Commit 3858bfe7 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/emacs-lisp/bytecomp.el (byte-compile-root-dir): New var.

(byte-compile-warning-prefix, batch-byte-compile-file): Use it.
parent 9232a6d9
2012-05-19 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/bytecomp.el (byte-compile-root-dir): New var.
(byte-compile-warning-prefix, batch-byte-compile-file): Use it.
2012-05-19 Jay Belanger <jay.p.belanger@gmail.com> 2012-05-19 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc.el (calc-ensure-consistent-units): New variable. * calc/calc.el (calc-ensure-consistent-units): New variable.
......
...@@ -1002,12 +1002,14 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." ...@@ -1002,12 +1002,14 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(defvar byte-compile-last-warned-form nil) (defvar byte-compile-last-warned-form nil)
(defvar byte-compile-last-logged-file nil) (defvar byte-compile-last-logged-file nil)
(defvar byte-compile-root-dir nil
"Directory relative to which file names in error messages are written.")
;; This is used as warning-prefix for the compiler. ;; This is used as warning-prefix for the compiler.
;; It is always called with the warnings buffer current. ;; It is always called with the warnings buffer current.
(defun byte-compile-warning-prefix (level entry) (defun byte-compile-warning-prefix (level entry)
(let* ((inhibit-read-only t) (let* ((inhibit-read-only t)
(dir default-directory) (dir (or byte-compile-root-dir default-directory))
(file (cond ((stringp byte-compile-current-file) (file (cond ((stringp byte-compile-current-file)
(format "%s:" (file-relative-name (format "%s:" (file-relative-name
byte-compile-current-file dir))) byte-compile-current-file dir)))
...@@ -4515,29 +4517,30 @@ already up-to-date." ...@@ -4515,29 +4517,30 @@ already up-to-date."
(kill-emacs (if error 1 0)))) (kill-emacs (if error 1 0))))
(defun batch-byte-compile-file (file) (defun batch-byte-compile-file (file)
(if debug-on-error (let ((byte-compile-root-dir (or byte-compile-root-dir default-directory)))
(byte-compile-file file) (if debug-on-error
(condition-case err (byte-compile-file file)
(byte-compile-file file) (condition-case err
(file-error (byte-compile-file file)
(message (if (cdr err) (file-error
">>Error occurred processing %s: %s (%s)" (message (if (cdr err)
">>Error occurred processing %s: %s") ">>Error occurred processing %s: %s (%s)"
file ">>Error occurred processing %s: %s")
(get (car err) 'error-message) file
(prin1-to-string (cdr err))) (get (car err) 'error-message)
(let ((destfile (byte-compile-dest-file file))) (prin1-to-string (cdr err)))
(if (file-exists-p destfile) (let ((destfile (byte-compile-dest-file file)))
(delete-file destfile))) (if (file-exists-p destfile)
nil) (delete-file destfile)))
(error nil)
(message (if (cdr err) (error
">>Error occurred processing %s: %s (%s)" (message (if (cdr err)
">>Error occurred processing %s: %s") ">>Error occurred processing %s: %s (%s)"
file ">>Error occurred processing %s: %s")
(get (car err) 'error-message) file
(prin1-to-string (cdr err))) (get (car err) 'error-message)
nil)))) (prin1-to-string (cdr err)))
nil)))))
(defun byte-compile-refresh-preloaded () (defun byte-compile-refresh-preloaded ()
"Reload any Lisp file that was changed since Emacs was dumped. "Reload any Lisp file that was changed since Emacs was dumped.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment