1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(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.
This commit is contained in:
Richard M. Stallman 1995-04-09 05:32:47 +00:00
parent 434b875777
commit 144b263796

View file

@ -724,6 +724,8 @@ otherwise pop it")
(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 @@ otherwise pop it")
(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 @@ otherwise pop it")
)
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)