comp.el: Cosmetic changes
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Tweak code. (comp-run-async-workers): Don't set `buffer-read-only` directly. (native--compile-async): Fix misuse of "path".
This commit is contained in:
parent
cc878319f9
commit
42076e6986
1 changed files with 39 additions and 23 deletions
|
@ -3926,22 +3926,36 @@ display a message."
|
|||
(file-newer-than-file-p
|
||||
source-file (comp-el-to-eln-filename source-file)))
|
||||
do (let* ((expr `((require 'comp)
|
||||
,(when (boundp 'backtrace-line-length)
|
||||
`(setf backtrace-line-length ,backtrace-line-length))
|
||||
(setf comp-file-preloaded-p ,comp-file-preloaded-p
|
||||
native-compile-target-directory ,native-compile-target-directory
|
||||
native-comp-speed ,native-comp-speed
|
||||
native-comp-debug ,native-comp-debug
|
||||
native-comp-verbose ,native-comp-verbose
|
||||
comp-libgccjit-reproducer ,comp-libgccjit-reproducer
|
||||
comp-async-compilation t
|
||||
native-comp-eln-load-path ',native-comp-eln-load-path
|
||||
native-comp-compiler-options
|
||||
',native-comp-compiler-options
|
||||
native-comp-driver-options
|
||||
',native-comp-driver-options
|
||||
load-path ',load-path
|
||||
warning-fill-column most-positive-fixnum)
|
||||
(setq comp-async-compilation t)
|
||||
(setq warning-fill-column most-positive-fixnum)
|
||||
,(let ((set (list 'setq)))
|
||||
(dolist (var '(comp-file-preloaded-p
|
||||
native-compile-target-directory
|
||||
native-comp-speed
|
||||
native-comp-debug
|
||||
native-comp-verbose
|
||||
comp-libgccjit-reproducer
|
||||
native-comp-eln-load-path
|
||||
native-comp-compiler-options
|
||||
native-comp-driver-options
|
||||
load-path
|
||||
backtrace-line-length
|
||||
;; package-load-list
|
||||
;; package-user-dir
|
||||
;; package-directory-list
|
||||
))
|
||||
(when (boundp var)
|
||||
(push var set)
|
||||
(push `',(symbol-value var) set)))
|
||||
(nreverse set))
|
||||
;; FIXME: Activating all packages would align the
|
||||
;; functionality offered with what is usually done
|
||||
;; for ELPA packages (and thus fix some compilation
|
||||
;; issues with some ELPA packages), but it's too
|
||||
;; blunt an instrument (e.g. we don't even know if
|
||||
;; we're compiling such an ELPA package at
|
||||
;; this point).
|
||||
;;(package-activate-all)
|
||||
,native-comp-async-env-modifier-form
|
||||
(message "Compiling %s..." ,source-file)
|
||||
(comp--native-compile ,source-file ,(and load t))))
|
||||
|
@ -3994,7 +4008,7 @@ display a message."
|
|||
(run-hooks 'native-comp-async-all-done-hook)
|
||||
(with-current-buffer (get-buffer-create comp-async-buffer-name)
|
||||
(save-excursion
|
||||
(let ((buffer-read-only nil))
|
||||
(let ((inhibit-read-only t))
|
||||
(goto-char (point-max))
|
||||
(insert "Compilation finished.\n"))))
|
||||
;; `comp-deferred-pending-h' should be empty at this stage.
|
||||
|
@ -4088,6 +4102,7 @@ LOAD and SELECTOR work as described in `native--compile-async'."
|
|||
native-comp-deferred-compilation-deny-list))))
|
||||
|
||||
(defun native--compile-async (files &optional recursively load selector)
|
||||
;; BEWARE, this function is also called directly from C.
|
||||
"Compile FILES asynchronously.
|
||||
FILES is one filename or a list of filenames or directories.
|
||||
|
||||
|
@ -4121,16 +4136,17 @@ bytecode definition was not changed in the meantime)."
|
|||
(unless (listp files)
|
||||
(setf files (list files)))
|
||||
(let (file-list)
|
||||
(dolist (path files)
|
||||
(cond ((file-directory-p path)
|
||||
(dolist (file-or-dir files)
|
||||
(cond ((file-directory-p file-or-dir)
|
||||
(dolist (file (if recursively
|
||||
(directory-files-recursively
|
||||
path comp-valid-source-re)
|
||||
(directory-files path t comp-valid-source-re)))
|
||||
file-or-dir comp-valid-source-re)
|
||||
(directory-files file-or-dir
|
||||
t comp-valid-source-re)))
|
||||
(push file file-list)))
|
||||
((file-exists-p path) (push path file-list))
|
||||
((file-exists-p file-or-dir) (push file-or-dir file-list))
|
||||
(t (signal 'native-compiler-error
|
||||
(list "Path not a file nor directory" path)))))
|
||||
(list "Not a file nor directory" file-or-dir)))))
|
||||
(dolist (file file-list)
|
||||
(if-let ((entry (cl-find file comp-files-queue :key #'car :test #'string=)))
|
||||
;; Most likely the byte-compiler has requested a deferred
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue