aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-03-04 04:03:46 +0000
committerRichard M. Stallman1994-03-04 04:03:46 +0000
commit8a5dd0860056db963930ace1ffffc343dabac74a (patch)
tree32a3362affc8e5973cd62f74ee8c79fe10d1ba73
parent17b85a9b30e38659f1703ef16a84a106d2f345df (diff)
downloademacs-8a5dd0860056db963930ace1ffffc343dabac74a.tar.gz
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.
-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."
1161 ;; It is important that input-buffer not be current at this call, 1161 ;; It is important that input-buffer not be current at this call,
1162 ;; so that the value of point set in input-buffer 1162 ;; so that the value of point set in input-buffer
1163 ;; within byte-compile-from-buffer lingers in that buffer. 1163 ;; within byte-compile-from-buffer lingers in that buffer.
1164 (setq output-buffer (byte-compile-from-buffer input-buffer)) 1164 (setq output-buffer (byte-compile-from-buffer input-buffer filename))
1165 (if byte-compiler-error-flag 1165 (if byte-compiler-error-flag
1166 nil 1166 nil
1167 (kill-buffer input-buffer) 1167 (kill-buffer input-buffer)
@@ -1221,7 +1221,7 @@ With prefix arg (noninteractively: 2nd arg), load the file after compiling."
1221;; (let* ((filename (or (buffer-file-name buffer) 1221;; (let* ((filename (or (buffer-file-name buffer)
1222;; (concat "#<buffer " (buffer-name buffer) ">"))) 1222;; (concat "#<buffer " (buffer-name buffer) ">")))
1223;; (byte-compile-current-file buffer)) 1223;; (byte-compile-current-file buffer))
1224;; (byte-compile-from-buffer buffer t)) 1224;; (byte-compile-from-buffer buffer nil))
1225;; (message "Compiling %s...done" (buffer-name buffer)) 1225;; (message "Compiling %s...done" (buffer-name buffer))
1226;; t) 1226;; t)
1227 1227
@@ -1275,8 +1275,8 @@ With argument, insert value in current buffer after the form."
1275 (if defmacro-active-p 1275 (if defmacro-active-p
1276 (ad-activate 'defmacro)))))) 1276 (ad-activate 'defmacro))))))
1277 1277
1278(defun byte-compile-from-buffer (inbuffer &optional eval) 1278(defun byte-compile-from-buffer (inbuffer &optional filename)
1279 ;; buffer --> output-buffer, or buffer --> eval form, return nil 1279 ;; Filename is used for the loading-into-Emacs-18 error message.
1280 (byte-compile-protect-from-advice 1280 (byte-compile-protect-from-advice
1281 (let (outbuffer) 1281 (let (outbuffer)
1282 (let (;; Prevent truncation of flonums and lists as we read and print them 1282 (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."
1322 (byte-compile-file-form (read inbuffer))) 1322 (byte-compile-file-form (read inbuffer)))
1323 ;; Compile pending forms at end of file. 1323 ;; Compile pending forms at end of file.
1324 (byte-compile-flush-pending) 1324 (byte-compile-flush-pending)
1325 (and (not eval) (byte-compile-insert-header)) 1325 (and filename (byte-compile-insert-header filename))
1326 (byte-compile-warn-about-unresolved-functions) 1326 (byte-compile-warn-about-unresolved-functions)
1327 ;; always do this? When calling multiple files, it 1327 ;; always do this? When calling multiple files, it
1328 ;; would be useful to delay this warning until all have 1328 ;; would be useful to delay this warning until all have
@@ -1331,17 +1331,18 @@ With argument, insert value in current buffer after the form."
1331 (save-excursion 1331 (save-excursion
1332 (set-buffer outbuffer) 1332 (set-buffer outbuffer)
1333 (goto-char (point-min))))) 1333 (goto-char (point-min)))))
1334 (if (not eval) 1334 outbuffer)))
1335 outbuffer 1335;;; (if (not eval)
1336 (while (condition-case nil 1336;;; outbuffer
1337 (progn (setq form (read outbuffer)) 1337;;; (while (condition-case nil
1338 t) 1338;;; (progn (setq form (read outbuffer))
1339 (end-of-file nil)) 1339;;; t)
1340 (eval form)) 1340;;; (end-of-file nil))
1341 (kill-buffer outbuffer) 1341;;; (eval form))
1342 nil)))) 1342;;; (kill-buffer outbuffer)
1343 1343;;; nil))))
1344(defun byte-compile-insert-header () 1344
1345(defun byte-compile-insert-header (filename)
1345 (save-excursion 1346 (save-excursion
1346 (set-buffer outbuffer) 1347 (set-buffer outbuffer)
1347 (goto-char 1) 1348 (goto-char 1)
@@ -1380,7 +1381,7 @@ With argument, insert value in current buffer after the form."
1380 "\n(if (and (boundp 'emacs-version)\n" 1381 "\n(if (and (boundp 'emacs-version)\n"
1381 "\t (or (and (boundp 'epoch::version) epoch::version)\n" 1382 "\t (or (and (boundp 'epoch::version) epoch::version)\n"
1382 "\t (string-lessp emacs-version \"19\")))\n" 1383 "\t (string-lessp emacs-version \"19\")))\n"
1383 " (error \"This file was compiled for Emacs 19\"))\n" 1384 " (error \"`" filename "' was compiled for Emacs 19\"))\n"
1384 )) 1385 ))
1385 )) 1386 ))
1386 1387