diff options
| author | Stefan Monnier | 2012-05-19 14:28:32 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-05-19 14:28:32 -0400 |
| commit | 3858bfe7c9f11d482715879fe40f06ce3dd6c009 (patch) | |
| tree | c018d7a4608691142e5482316c28a984c56b3a14 /lisp | |
| parent | 9232a6d9a7ca8ef3e725899552cfd568463ddcfe (diff) | |
| download | emacs-3858bfe7c9f11d482715879fe40f06ce3dd6c009.tar.gz emacs-3858bfe7c9f11d482715879fe40f06ce3dd6c009.zip | |
* lisp/emacs-lisp/bytecomp.el (byte-compile-root-dir): New var.
(byte-compile-warning-prefix, batch-byte-compile-file): Use it.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 51 |
2 files changed, 32 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 91778032966..b311fc4fcaa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-05-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-root-dir): New var. | ||
| 4 | (byte-compile-warning-prefix, batch-byte-compile-file): Use it. | ||
| 5 | |||
| 1 | 2012-05-19 Jay Belanger <jay.p.belanger@gmail.com> | 6 | 2012-05-19 Jay Belanger <jay.p.belanger@gmail.com> |
| 2 | 7 | ||
| 3 | * calc/calc.el (calc-ensure-consistent-units): New variable. | 8 | * calc/calc.el (calc-ensure-consistent-units): New variable. |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9cb0a376e36..91db288feef 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1002,12 +1002,14 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." | |||
| 1002 | 1002 | ||
| 1003 | (defvar byte-compile-last-warned-form nil) | 1003 | (defvar byte-compile-last-warned-form nil) |
| 1004 | (defvar byte-compile-last-logged-file nil) | 1004 | (defvar byte-compile-last-logged-file nil) |
| 1005 | (defvar byte-compile-root-dir nil | ||
| 1006 | "Directory relative to which file names in error messages are written.") | ||
| 1005 | 1007 | ||
| 1006 | ;; This is used as warning-prefix for the compiler. | 1008 | ;; This is used as warning-prefix for the compiler. |
| 1007 | ;; It is always called with the warnings buffer current. | 1009 | ;; It is always called with the warnings buffer current. |
| 1008 | (defun byte-compile-warning-prefix (level entry) | 1010 | (defun byte-compile-warning-prefix (level entry) |
| 1009 | (let* ((inhibit-read-only t) | 1011 | (let* ((inhibit-read-only t) |
| 1010 | (dir default-directory) | 1012 | (dir (or byte-compile-root-dir default-directory)) |
| 1011 | (file (cond ((stringp byte-compile-current-file) | 1013 | (file (cond ((stringp byte-compile-current-file) |
| 1012 | (format "%s:" (file-relative-name | 1014 | (format "%s:" (file-relative-name |
| 1013 | byte-compile-current-file dir))) | 1015 | byte-compile-current-file dir))) |
| @@ -4515,29 +4517,30 @@ already up-to-date." | |||
| 4515 | (kill-emacs (if error 1 0)))) | 4517 | (kill-emacs (if error 1 0)))) |
| 4516 | 4518 | ||
| 4517 | (defun batch-byte-compile-file (file) | 4519 | (defun batch-byte-compile-file (file) |
| 4518 | (if debug-on-error | 4520 | (let ((byte-compile-root-dir (or byte-compile-root-dir default-directory))) |
| 4519 | (byte-compile-file file) | 4521 | (if debug-on-error |
| 4520 | (condition-case err | 4522 | (byte-compile-file file) |
| 4521 | (byte-compile-file file) | 4523 | (condition-case err |
| 4522 | (file-error | 4524 | (byte-compile-file file) |
| 4523 | (message (if (cdr err) | 4525 | (file-error |
| 4524 | ">>Error occurred processing %s: %s (%s)" | 4526 | (message (if (cdr err) |
| 4525 | ">>Error occurred processing %s: %s") | 4527 | ">>Error occurred processing %s: %s (%s)" |
| 4526 | file | 4528 | ">>Error occurred processing %s: %s") |
| 4527 | (get (car err) 'error-message) | 4529 | file |
| 4528 | (prin1-to-string (cdr err))) | 4530 | (get (car err) 'error-message) |
| 4529 | (let ((destfile (byte-compile-dest-file file))) | 4531 | (prin1-to-string (cdr err))) |
| 4530 | (if (file-exists-p destfile) | 4532 | (let ((destfile (byte-compile-dest-file file))) |
| 4531 | (delete-file destfile))) | 4533 | (if (file-exists-p destfile) |
| 4532 | nil) | 4534 | (delete-file destfile))) |
| 4533 | (error | 4535 | nil) |
| 4534 | (message (if (cdr err) | 4536 | (error |
| 4535 | ">>Error occurred processing %s: %s (%s)" | 4537 | (message (if (cdr err) |
| 4536 | ">>Error occurred processing %s: %s") | 4538 | ">>Error occurred processing %s: %s (%s)" |
| 4537 | file | 4539 | ">>Error occurred processing %s: %s") |
| 4538 | (get (car err) 'error-message) | 4540 | file |
| 4539 | (prin1-to-string (cdr err))) | 4541 | (get (car err) 'error-message) |
| 4540 | nil)))) | 4542 | (prin1-to-string (cdr err))) |
| 4543 | nil))))) | ||
| 4541 | 4544 | ||
| 4542 | (defun byte-compile-refresh-preloaded () | 4545 | (defun byte-compile-refresh-preloaded () |
| 4543 | "Reload any Lisp file that was changed since Emacs was dumped. | 4546 | "Reload any Lisp file that was changed since Emacs was dumped. |