Fix el-get-byte-compile in recent Emacs snapshot.

byte-compile-file behaviour changed yet again, so stop trying to guess if we
can rely on it and just define our own behaviour.
This commit is contained in:
Dimitri Fontaine 2011-10-11 20:40:57 +02:00
parent 06e4016669
commit ce8a7e3899
2 changed files with 26 additions and 21 deletions

View File

@ -15,27 +15,32 @@
(require 'cl) ; yes I like loop
(require 'bytecomp)
;; Emacs < 24
(eval-and-compile
(if (fboundp 'byte-recompile-file)
(defsubst el-get-byte-compile-file (el)
;; Byte-compile runs emacs-lisp-mode-hook; disable it
(let (emacs-lisp-mode-hook)
(byte-recompile-file el)))
(defun el-get-byte-compile-file (el)
"Same as `byte-compile-file', but skips unnecessary compilation.
;; byte-recompile-file:
;;
;; - in Emacs23 will not recompile a file when the source is newer than the
;; bytecode (.elc)
;;
;; - in Emacs24 has another different and unhelpful behavior:
;;
;; If the `.elc' file does not exist, normally this function *does not*
;; compile FILENAME. If ARG is 0, that means compile the file even if it
;; has never been compiled before.
;;
;; so we just define our own
(defun el-get-byte-compile-file (el)
"Byte compile the EL file, and skips unnecessary compilation.
Specifically, if the compiled elc file already exists and is
newer, then compilation will be skipped."
newer, then compilation is skipped."
(let ((elc (concat (file-name-sans-extension el) ".elc"))
;; Byte-compile runs emacs-lisp-mode-hook; disable it
emacs-lisp-mode-hook)
emacs-lisp-mode-hook byte-compile-warnings)
(when (or (not (file-exists-p elc))
(file-newer-than-file-p el elc))
(condition-case err
(byte-compile-file el)
((debug error) ;; catch-all, allow for debugging
(message "%S" (error-message-string err)))))))))
(message "%S" (error-message-string err)))))))
(defun el-get-byte-compile-file-or-directory (file)
"Byte-compile FILE or all files within it if it is a directory."

View File

@ -6,9 +6,9 @@
(let ((debug-on-error t)
(debug-ignored-errors '())
(el-get-default-process-sync t)
(el-get-verbose t))
(el-get-verbose t)
(el-get-byte-compile-at-init t))
(require 'el-get)
(message "%S" (el-get-dependencies 'cperl-mode))
(el-get-install "mode-compile")
(el-get-install "cperl-mode"))