summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1992-09-13 19:05:13 +0000
committerRichard M. Stallman <rms@gnu.org>1992-09-13 19:05:13 +0000
commitab94e6e7958295725884bcbe9097cb0eee9721b7 (patch)
tree5f7ec417cd0c69de09c60eb04789efe178b57591 /lisp/emacs-lisp/bytecomp.el
parent7b89707ca360cf6fa617a42ad209ca086177e8ad (diff)
downloademacs-ab94e6e7958295725884bcbe9097cb0eee9721b7.tar.gz
emacs-ab94e6e7958295725884bcbe9097cb0eee9721b7.tar.bz2
emacs-ab94e6e7958295725884bcbe9097cb0eee9721b7.zip
entered into RCS
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el41
1 files changed, 25 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 6e7886e70bc..a337c7d8d97 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -228,15 +228,15 @@ You may want to redefine `byte-compile-dest-file' if you change this.")
;; this way can never be run in Emacs 18, and may even cause it to crash.")
(defvar byte-optimize t
- "*If nil, no compile-optimizations will be done.
-Compilation will be faster, generated code will be slower and larger.
-This may be nil, t, 'byte, or 'source. If it is 'byte, then only byte-level
-optimizations will be done; if it is 'source, then only source-level
-optimizations will be done.")
+ "*Enables optimization in the byte compiler.
+nil means don't do any optimization.
+t means do all optimizations.
+`source' means do source-level optimizations only.
+`byte' means do code-level optimizations only.")
(defvar byte-compile-delete-errors t
- "*If non-nil, the optimizer may delete forms that may signal an error
-(variable references and side-effect-free functions such as CAR).")
+ "*If non-nil, the optimizer may delete forms that may signal an error.
+This includes variable references and calls to functions such as `car'.")
(defvar byte-optimize-log nil
"*If true, the byte-compiler will log its optimizations into *Compile-Log*.
@@ -244,8 +244,7 @@ If this is 'source, then only source-level optimizations will be logged.
If it is 'byte, then only byte-level optimizations will be logged.")
(defvar byte-compile-error-on-warn nil
- "*If true, the byte-compiler will report warnings with `error' instead
-of `message.'")
+ "*If true, the byte-compiler reports warnings with `error'.")
(defconst byte-compile-warning-types '(redefine callargs free-vars unresolved))
(defvar byte-compile-warnings t
@@ -258,7 +257,7 @@ Elements of the list may be be:
redefine function cell redefined from a macro to a lambda or vice
versa, or redefined to take a different number of arguments.
-See also the macro byte-compiler-options.")
+See also the macro `byte-compiler-options'.")
(defvar byte-compile-generate-call-tree nil
"*Non-nil means collect call-graph information when compiling.
@@ -307,6 +306,8 @@ lives partly on the stack.")
(defvar byte-compile-free-references)
(defvar byte-compile-free-assignments)
+(defvar byte-compiler-error-flag)
+
(defconst byte-compile-initial-macro-environment
'(
;; (byte-compiler-options . (lambda (&rest forms)
@@ -746,6 +747,7 @@ otherwise pop it")
;;; This function should be used to report errors that have halted
;;; compilation of the current file.
(defun byte-compile-report-error (error-info)
+ (setq byte-compiler-error-flag t)
(byte-compile-log-1
(concat "!! "
(format (if (cdr error-info) "%s (%s)" "%s")
@@ -1124,19 +1126,26 @@ With prefix arg (noninteractively: 2nd arg), load the file after compiling."
(if byte-compile-verbose
(message "Compiling %s..." filename))
(let ((byte-compile-current-file (file-name-nondirectory filename))
- target-file)
+ target-file input-buffer output-buffer)
(save-excursion
- (set-buffer (get-buffer-create " *Compiler Input*"))
+ (setq input-buffer (get-buffer-create " *Compiler Input*"))
+ (set-buffer input-buffer)
(erase-buffer)
(insert-file-contents filename)
;; Run hooks including the uncompression hook.
;; If they change the file name, then change it for the output also.
(let ((buffer-file-name filename))
(set-auto-mode)
- (setq filename buffer-file-name))
- (kill-buffer (prog1 (current-buffer)
- (set-buffer
- (byte-compile-from-buffer (current-buffer)))))
+ (setq filename buffer-file-name)))
+ (setq byte-compiler-error-flag nil)
+ ;; It is important that input-buffer not be current at this call,
+ ;; so that the value of point set in input-buffer
+ ;; within byte-compile-from-buffer lingers in that buffer.
+ (setq output-buffer (byte-compile-from-buffer input-buffer))
+ (or byte-compiler-error-flag
+ (kill-buffer input-buffer))
+ (save-excursion
+ (set-buffer output-buffer)
(goto-char (point-max))
(insert "\n") ; aaah, unix.
(let ((vms-stmlf-recfm t))