refactor bytecomp
This commit is contained in:
parent
370798262e
commit
9eb11bb7a2
|
@ -44,15 +44,14 @@ File paths are relative to the `spacemacs-start-directory'.")
|
|||
(format "%s.elc")
|
||||
(delete-file))))
|
||||
|
||||
(defun spacemacs//remove-byte-compiled-if-stale (files)
|
||||
"Remove all .elc files corresponding to the source FILES if any is stale."
|
||||
(when (cl-dolist (file files)
|
||||
(let* ((file-el (file-truename file))
|
||||
(file-elc (thread-last file-el
|
||||
(file-name-sans-extension)
|
||||
(format "%s.elc"))))
|
||||
(when (file-newer-than-file-p file-el file-elc)
|
||||
(cl-return t))))
|
||||
(spacemacs//remove-byte-compiled-files files)))
|
||||
(defun spacemacs//contains-newer-than-byte-compiled-p (files)
|
||||
"Return true if any file in FILES is newer than its byte-compiled version."
|
||||
(cl-dolist (file files)
|
||||
(let* ((file-el (file-truename file))
|
||||
(file-elc (thread-last file-el
|
||||
(file-name-sans-extension)
|
||||
(format "%s.elc"))))
|
||||
(when (file-newer-than-file-p file-el file-elc)
|
||||
(cl-return t)))))
|
||||
|
||||
(provide 'core-compilation)
|
||||
|
|
4
init.el
4
init.el
|
@ -28,7 +28,9 @@
|
|||
(load (concat spacemacs-core-directory "core-compilation.el")
|
||||
nil (not init-file-debug))
|
||||
(let ((default-directory spacemacs-start-directory))
|
||||
(spacemacs//remove-byte-compiled-if-stale spacemacs--compiled-files))
|
||||
(when (spacemacs//contains-newer-than-byte-compiled-p
|
||||
spacemacs--compiled-files)
|
||||
(spacemacs//remove-byte-compiled-files spacemacs--compiled-files)))
|
||||
|
||||
(if (not (version<= spacemacs-emacs-min-version emacs-version))
|
||||
(error (concat "Your version of Emacs (%s) is too old. "
|
||||
|
|
Loading…
Reference in New Issue