summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-03-04 04:03:46 +0000
committerRichard M. Stallman <rms@gnu.org>1994-03-04 04:03:46 +0000
commit8a5dd0860056db963930ace1ffffc343dabac74a (patch)
tree32a3362affc8e5973cd62f74ee8c79fe10d1ba73 /lisp/emacs-lisp/bytecomp.el
parent17b85a9b30e38659f1703ef16a84a106d2f345df (diff)
downloademacs-8a5dd0860056db963930ace1ffffc343dabac74a.tar.gz
emacs-8a5dd0860056db963930ace1ffffc343dabac74a.tar.bz2
emacs-8a5dd0860056db963930ace1ffffc343dabac74a.zip
(byte-compile-insert-header): Take a filename argument.
(byte-compile-from-buffer): Change second argument to filename. Always return outbuffer; never eval from it or kill it. (byte-compile-file): Pass filename to byte-compile-from-buffer.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el35
1 files changed, 18 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e991ddbdd66..146fb204b02 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1161,7 +1161,7 @@ With prefix arg (noninteractively: 2nd arg), load the file after compiling."
;; 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))
+ (setq output-buffer (byte-compile-from-buffer input-buffer filename))
(if byte-compiler-error-flag
nil
(kill-buffer input-buffer)
@@ -1221,7 +1221,7 @@ With prefix arg (noninteractively: 2nd arg), load the file after compiling."
;; (let* ((filename (or (buffer-file-name buffer)
;; (concat "#<buffer " (buffer-name buffer) ">")))
;; (byte-compile-current-file buffer))
-;; (byte-compile-from-buffer buffer t))
+;; (byte-compile-from-buffer buffer nil))
;; (message "Compiling %s...done" (buffer-name buffer))
;; t)
@@ -1275,8 +1275,8 @@ With argument, insert value in current buffer after the form."
(if defmacro-active-p
(ad-activate 'defmacro))))))
-(defun byte-compile-from-buffer (inbuffer &optional eval)
- ;; buffer --> output-buffer, or buffer --> eval form, return nil
+(defun byte-compile-from-buffer (inbuffer &optional filename)
+ ;; Filename is used for the loading-into-Emacs-18 error message.
(byte-compile-protect-from-advice
(let (outbuffer)
(let (;; Prevent truncation of flonums and lists as we read and print them
@@ -1322,7 +1322,7 @@ With argument, insert value in current buffer after the form."
(byte-compile-file-form (read inbuffer)))
;; Compile pending forms at end of file.
(byte-compile-flush-pending)
- (and (not eval) (byte-compile-insert-header))
+ (and filename (byte-compile-insert-header filename))
(byte-compile-warn-about-unresolved-functions)
;; always do this? When calling multiple files, it
;; would be useful to delay this warning until all have
@@ -1331,17 +1331,18 @@ With argument, insert value in current buffer after the form."
(save-excursion
(set-buffer outbuffer)
(goto-char (point-min)))))
- (if (not eval)
- outbuffer
- (while (condition-case nil
- (progn (setq form (read outbuffer))
- t)
- (end-of-file nil))
- (eval form))
- (kill-buffer outbuffer)
- nil))))
-
-(defun byte-compile-insert-header ()
+ outbuffer)))
+;;; (if (not eval)
+;;; outbuffer
+;;; (while (condition-case nil
+;;; (progn (setq form (read outbuffer))
+;;; t)
+;;; (end-of-file nil))
+;;; (eval form))
+;;; (kill-buffer outbuffer)
+;;; nil))))
+
+(defun byte-compile-insert-header (filename)
(save-excursion
(set-buffer outbuffer)
(goto-char 1)
@@ -1380,7 +1381,7 @@ With argument, insert value in current buffer after the form."
"\n(if (and (boundp 'emacs-version)\n"
"\t (or (and (boundp 'epoch::version) epoch::version)\n"
"\t (string-lessp emacs-version \"19\")))\n"
- " (error \"This file was compiled for Emacs 19\"))\n"
+ " (error \"`" filename "' was compiled for Emacs 19\"))\n"
))
))