changeset 6193:74fcc9007c39

(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.
author Richard M. Stallman <rms@gnu.org>
date Fri, 04 Mar 1994 04:03:46 +0000
parents b7fa2446073e
children b094b321b4a6
files lisp/emacs-lisp/bytecomp.el
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Fri Mar 04 01:33:43 1994 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Mar 04 04:03:46 1994 +0000
@@ -1161,7 +1161,7 @@
     ;; 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 @@
 ;;  (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 @@
 	 (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 @@
 	     (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 @@
 	(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))))
+     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 ()
+(defun byte-compile-insert-header (filename)
   (save-excursion
     (set-buffer outbuffer)
     (goto-char 1)
@@ -1380,7 +1381,7 @@
 	       "\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"
 	       ))
    ))