Mercurial > emacs
comparison lisp/emacs-lisp/bytecomp.el @ 55694:62803bbfc576
(byte-compile-log): Use backquotes.
(byte-compile-log-1): Don't call (byte-goto-log-buffer).
Use with-current-buffer.
(byte-goto-log-buffer): Delete.
(byte-compile-log-file): Call compilation-forget-errors.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 19 May 2004 18:53:13 +0000 |
parents | 6635869bd341 |
children | 36284d653673 14e5707213a6 |
comparison
equal
deleted
inserted
replaced
55693:1420f008c89b | 55694:62803bbfc576 |
---|---|
830 (defvar byte-compile-current-file nil) | 830 (defvar byte-compile-current-file nil) |
831 (defvar byte-compile-current-buffer nil) | 831 (defvar byte-compile-current-buffer nil) |
832 | 832 |
833 ;; Log something that isn't a warning. | 833 ;; Log something that isn't a warning. |
834 (defmacro byte-compile-log (format-string &rest args) | 834 (defmacro byte-compile-log (format-string &rest args) |
835 (list 'and | 835 `(and |
836 'byte-optimize | 836 byte-optimize |
837 '(memq byte-optimize-log '(t source)) | 837 (memq byte-optimize-log '(t source)) |
838 (list 'let '((print-escape-newlines t) | 838 (let ((print-escape-newlines t) |
839 (print-level 4) | 839 (print-level 4) |
840 (print-length 4)) | 840 (print-length 4)) |
841 (list 'byte-compile-log-1 | 841 (byte-compile-log-1 |
842 (cons 'format | 842 (format |
843 (cons format-string | 843 ,format-string |
844 (mapcar | 844 ,@(mapcar |
845 (lambda (x) | 845 (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x)) |
846 (if (symbolp x) (list 'prin1-to-string x) x)) | 846 args)))))) |
847 args))))))) | |
848 | 847 |
849 ;; Log something that isn't a warning. | 848 ;; Log something that isn't a warning. |
850 (defun byte-compile-log-1 (string) | 849 (defun byte-compile-log-1 (string) |
851 (save-excursion | 850 (with-current-buffer "*Compile-Log*" |
852 (byte-goto-log-buffer) | |
853 (goto-char (point-max)) | 851 (goto-char (point-max)) |
854 (byte-compile-warning-prefix nil nil) | 852 (byte-compile-warning-prefix nil nil) |
855 (cond (noninteractive | 853 (cond (noninteractive |
856 (message " %s" string)) | 854 (message " %s" string)) |
857 (t | 855 (t |
900 (or (and allow-previous (not (= last byte-compile-last-position))) | 898 (or (and allow-previous (not (= last byte-compile-last-position))) |
901 (> last byte-compile-last-position))))))) | 899 (> last byte-compile-last-position))))))) |
902 | 900 |
903 (defvar byte-compile-last-warned-form nil) | 901 (defvar byte-compile-last-warned-form nil) |
904 (defvar byte-compile-last-logged-file nil) | 902 (defvar byte-compile-last-logged-file nil) |
905 | |
906 (defun byte-goto-log-buffer () | |
907 (set-buffer (get-buffer-create "*Compile-Log*")) | |
908 (unless (eq major-mode 'compilation-mode) | |
909 (compilation-mode))) | |
910 | 903 |
911 ;; This is used as warning-prefix for the compiler. | 904 ;; This is used as warning-prefix for the compiler. |
912 ;; It is always called with the warnings buffer current. | 905 ;; It is always called with the warnings buffer current. |
913 (defun byte-compile-warning-prefix (level entry) | 906 (defun byte-compile-warning-prefix (level entry) |
914 (let* ((dir default-directory) | 907 (let* ((dir default-directory) |
981 (setq byte-compile-last-logged-file byte-compile-current-file | 974 (setq byte-compile-last-logged-file byte-compile-current-file |
982 byte-compile-last-warned-form nil) | 975 byte-compile-last-warned-form nil) |
983 ;; Do this after setting default-directory. | 976 ;; Do this after setting default-directory. |
984 (unless (eq major-mode 'compilation-mode) | 977 (unless (eq major-mode 'compilation-mode) |
985 (compilation-mode)) | 978 (compilation-mode)) |
979 (compilation-forget-errors) | |
986 pt)))) | 980 pt)))) |
987 | 981 |
988 ;; Log a message STRING in *Compile-Log*. | 982 ;; Log a message STRING in *Compile-Log*. |
989 ;; Also log the current function and file if not already done. | 983 ;; Also log the current function and file if not already done. |
990 (defun byte-compile-log-warning (string &optional fill level) | 984 (defun byte-compile-log-warning (string &optional fill level) |