On this page:
install-found-emacs-lisp-files
9.2

10 Enigma API: Install Subcommand🔗

 (require enigma/subcommands/install) package: enigma-app

procedure

(install-found-emacs-lisp-files start-path 
  extra-emacs-flags) 
  
exact-integer? (listof hash?)
  start-path : path-string?
  extra-emacs-flags : (listof string?)
Install Emacs Lisp packages found under start-path. Pass extra-emacs-flags as extra install flags.

Returns the values that indicate: exact-integer? total installation success and a list of objects that describe properties of installed files.

The source code of this module:

#lang racket/base
 
(require racket/contract/base)
(require racket/match)
 
(require "../compiler/stamp/stamp.rkt")
(require "../emacs/file/context.rkt")
(require "../emacs/path/load-path.rkt")
(require "../emacs/system/run-emacs.rkt")
 
(provide
 (contract-out
  [compile-found-emacs-lisp-files
   (-> path-string? (listof string?)
       (values exact-integer? (listof hash?)))]))
 
(define (compile-emacs-lisp-file file-path load-path extra-emacs-flags)
  (define cmdline-args
    (append (make-emacs-cmdline-args load-path extra-emacs-flags)
            `("-batch" "-f" "batch-byte-compile" ,(path->string file-path))))
  (eprintf " Compiling: ~a\n" file-path)
  (define exit-code (run-emacs cmdline-args))
  (match exit-code
    [0 (create-stamp file-path "compiled")]
    [_ (void)])
  exit-code)
 
(define (compile-found-emacs-lisp-files start-path extra-emacs-flags)
  (define result-code (make-parameter 0))
  (define-values (emacs-lisp-files load-path)
    (find-emacs-lisp-context start-path))
  (define result-hash
    (for/list ([emacs-lisp-file emacs-lisp-files])
      (define exit-code
        (compile-emacs-lisp-file emacs-lisp-file load-path extra-emacs-flags))
      (define successful? (= 0 exit-code))
      (define compiled-file
        (match successful?
          [#true
           (match (path-replace-extension emacs-lisp-file #".elc")
             [(? file-exists? f) (path->string f)]
             [_ #false])]
          [_ #false]))
      (define h
        (hash 'compiled-file compiled-file
              'exit-code exit-code
              'file-path (path->string emacs-lisp-file)
              'successful? successful?))
      (when (not successful?)
        (result-code exit-code))
      h))
  (values (result-code) result-hash))