changeset 11323:5f75d3e225c1

(byte-compile-log-file): New function. (displaying-byte-compile-warnings): Log the file name at start; display the log buffer only if something more gets output by BODY. (byte-compile-warnings-point-max): Initialize to nil.
author Richard M. Stallman <rms@gnu.org>
date Sun, 09 Apr 1995 05:32:47 +0000
parents 518a5db7f4f0
children 3190c85854b6
files lisp/emacs-lisp/bytecomp.el
diffstat 1 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Sun Apr 09 04:58:29 1995 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Sun Apr 09 05:32:47 1995 +0000
@@ -724,6 +724,8 @@
 
 (defconst byte-compile-last-warned-form nil)
 
+;; Log a message STRING in *Compile-Log*.
+;; Also log the current function and file if not already done.
 (defun byte-compile-log-1 (string &optional fill)
   (cond (noninteractive
 	 (if (or byte-compile-current-file
@@ -768,6 +770,19 @@
   (setq byte-compile-current-file nil
 	byte-compile-last-warned-form byte-compile-current-form))
 
+;; Log the start of a file in *Compile-Log*, and mark it as done.
+;; But do nothing in batch mode.
+(defun byte-compile-log-file ()
+  (and byte-compile-current-file (not noninteractive)
+       (save-excursion
+	 (set-buffer (get-buffer-create "*Compile-Log*"))
+	 (insert "\n\^L\nCompiling "
+		 (if (stringp byte-compile-current-file)
+		     (concat "file " byte-compile-current-file)
+		   (concat "buffer " (buffer-name byte-compile-current-file)))
+		 " at " (current-time-string) "\n")
+	 (setq byte-compile-current-file nil))))
+
 (defun byte-compile-warn (format &rest args)
   (setq format (apply 'format format args))
   (if byte-compile-error-on-warn
@@ -1059,15 +1074,19 @@
 		)
 	      body)))
 
-(defvar byte-compile-warnings-point-max)
+(defvar byte-compile-warnings-point-max nil)
 (defmacro displaying-byte-compile-warnings (&rest body)
   (list 'let
-	'((byte-compile-warnings-point-max
-	   (if (boundp 'byte-compile-warnings-point-max)
-	       byte-compile-warnings-point-max
-	     (save-excursion
-	       (set-buffer (get-buffer-create "*Compile-Log*"))
-	       (point-max)))))
+	'((byte-compile-warnings-point-max byte-compile-warnings-point-max))
+     ;; Log the file name.
+     '(byte-compile-log-file)
+     ;; Record how much is logged now.
+     ;; We will display the log buffer if anything more is logged
+     ;; before the end of BODY.
+     '(or byte-compile-warnings-point-max
+	  (save-excursion
+	    (set-buffer (get-buffer-create "*Compile-Log*"))
+	    (setq byte-compile-warnings-point-max (point-max))))
      (list 'unwind-protect
 	   (list 'condition-case 'error-info
 		 (cons 'progn body)