comparison lisp/emacs-lisp/bytecomp.el @ 83221:0fc4928cc48e

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-616 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-617 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-618 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-619 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-620 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-621 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-622 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-623 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-624 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-625 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-51 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-52 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-53 Merge from emacs--cvs-trunk--0 git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-261
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 19 Oct 2004 17:00:02 +0000
parents 42acc7fa8a4f 25bf13fe1c10
children 7a0245dd1848
comparison
equal deleted inserted replaced
83220:fe1db7935e1a 83221:0fc4928cc48e
790 ;; and mark all the functions defined therein. 790 ;; and mark all the functions defined therein.
791 (while (and hist-new (not (eq hist-new hist-orig))) 791 (while (and hist-new (not (eq hist-new hist-orig)))
792 (let ((xs (pop hist-new)) 792 (let ((xs (pop hist-new))
793 old-autoloads) 793 old-autoloads)
794 ;; Make sure the file was not already loaded before. 794 ;; Make sure the file was not already loaded before.
795 (unless (assoc (car xs) hist-orig) 795 (unless (or (assoc (car xs) hist-orig)
796 (equal (car xs) "cl"))
796 (dolist (s xs) 797 (dolist (s xs)
797 (cond 798 (cond
798 ((symbolp s) 799 ((symbolp s)
799 (unless (memq s old-autoloads) 800 (unless (memq s old-autoloads)
800 (push s byte-compile-noruntime-functions))) 801 (push s byte-compile-noruntime-functions)))
807 (while (and hist-nil-new (not (eq hist-nil-new hist-nil-orig))) 808 (while (and hist-nil-new (not (eq hist-nil-new hist-nil-orig)))
808 (let ((s (pop hist-nil-new))) 809 (let ((s (pop hist-nil-new)))
809 (when (and (symbolp s) (not (memq s old-autoloads))) 810 (when (and (symbolp s) (not (memq s old-autoloads)))
810 (push s byte-compile-noruntime-functions)) 811 (push s byte-compile-noruntime-functions))
811 (when (and (consp s) (eq t (car s))) 812 (when (and (consp s) (eq t (car s)))
812 (push (cdr s) old-autoloads)))))))))) 813 (push (cdr s) old-autoloads)))))))
814 (when (memq 'cl-functions byte-compile-warnings)
815 (let ((hist-new load-history)
816 (hist-nil-new current-load-list))
817 ;; Go through load-history, look for newly loaded files
818 ;; and mark all the functions defined therein.
819 (while (and hist-new (not (eq hist-new hist-orig)))
820 (let ((xs (pop hist-new))
821 old-autoloads)
822 ;; Make sure the file was not already loaded before.
823 (when (and (equal (car xs) "cl") (not (assoc (car xs) hist-orig)))
824 (byte-compile-find-cl-functions)))))))))
813 825
814 (defun byte-compile-eval-before-compile (form) 826 (defun byte-compile-eval-before-compile (form)
815 "Evaluate FORM for `eval-and-compile'." 827 "Evaluate FORM for `eval-and-compile'."
816 (let ((hist-nil-orig current-load-list)) 828 (let ((hist-nil-orig current-load-list))
817 (prog1 (eval form) 829 (prog1 (eval form)
846 args)))))) 858 args))))))
847 859
848 ;; Log something that isn't a warning. 860 ;; Log something that isn't a warning.
849 (defun byte-compile-log-1 (string) 861 (defun byte-compile-log-1 (string)
850 (with-current-buffer "*Compile-Log*" 862 (with-current-buffer "*Compile-Log*"
851 (goto-char (point-max)) 863 (let ((inhibit-read-only t))
852 (byte-compile-warning-prefix nil nil) 864 (goto-char (point-max))
853 (cond (noninteractive 865 (byte-compile-warning-prefix nil nil)
854 (message " %s" string)) 866 (cond (noninteractive
855 (t 867 (message " %s" string))
856 (insert (format "%s\n" string)))))) 868 (t
869 (insert (format "%s\n" string)))))))
857 870
858 (defvar byte-compile-read-position nil 871 (defvar byte-compile-read-position nil
859 "Character position we began the last `read' from.") 872 "Character position we began the last `read' from.")
860 (defvar byte-compile-last-position nil 873 (defvar byte-compile-last-position nil
861 "Last known character position in the input.") 874 "Last known character position in the input.")
902 (defvar byte-compile-last-logged-file nil) 915 (defvar byte-compile-last-logged-file nil)
903 916
904 ;; This is used as warning-prefix for the compiler. 917 ;; This is used as warning-prefix for the compiler.
905 ;; It is always called with the warnings buffer current. 918 ;; It is always called with the warnings buffer current.
906 (defun byte-compile-warning-prefix (level entry) 919 (defun byte-compile-warning-prefix (level entry)
907 (let* ((dir default-directory) 920 (let* ((inhibit-read-only t)
921 (dir default-directory)
908 (file (cond ((stringp byte-compile-current-file) 922 (file (cond ((stringp byte-compile-current-file)
909 (format "%s:" (file-relative-name byte-compile-current-file dir))) 923 (format "%s:" (file-relative-name byte-compile-current-file dir)))
910 ((bufferp byte-compile-current-file) 924 ((bufferp byte-compile-current-file)
911 (format "Buffer %s:" 925 (format "Buffer %s:"
912 (buffer-name byte-compile-current-file))) 926 (buffer-name byte-compile-current-file)))
948 (and (not (equal byte-compile-current-file byte-compile-last-logged-file)) 962 (and (not (equal byte-compile-current-file byte-compile-last-logged-file))
949 (not noninteractive) 963 (not noninteractive)
950 (save-excursion 964 (save-excursion
951 (set-buffer (get-buffer-create "*Compile-Log*")) 965 (set-buffer (get-buffer-create "*Compile-Log*"))
952 (goto-char (point-max)) 966 (goto-char (point-max))
953 (let* ((dir (and byte-compile-current-file 967 (let* ((inhibit-read-only t)
968 (dir (and byte-compile-current-file
954 (file-name-directory byte-compile-current-file))) 969 (file-name-directory byte-compile-current-file)))
955 (was-same (equal default-directory dir)) 970 (was-same (equal default-directory dir))
956 pt) 971 pt)
957 (when dir 972 (when dir
958 (unless was-same 973 (unless was-same
982 ;; Log a message STRING in *Compile-Log*. 997 ;; Log a message STRING in *Compile-Log*.
983 ;; Also log the current function and file if not already done. 998 ;; Also log the current function and file if not already done.
984 (defun byte-compile-log-warning (string &optional fill level) 999 (defun byte-compile-log-warning (string &optional fill level)
985 (let ((warning-prefix-function 'byte-compile-warning-prefix) 1000 (let ((warning-prefix-function 'byte-compile-warning-prefix)
986 (warning-type-format "") 1001 (warning-type-format "")
987 (warning-fill-prefix (if fill " "))) 1002 (warning-fill-prefix (if fill " "))
1003 (inhibit-read-only t))
988 (display-warning 'bytecomp string level "*Compile-Log*"))) 1004 (display-warning 'bytecomp string level "*Compile-Log*")))
989 1005
990 (defun byte-compile-warn (format &rest args) 1006 (defun byte-compile-warn (format &rest args)
991 "Issue a byte compiler warning; use (format FORMAT ARGS...) for message." 1007 "Issue a byte compiler warning; use (format FORMAT ARGS...) for message."
992 (setq format (apply 'format format args)) 1008 (setq format (apply 'format format args))
2138 (eq (car (car tail)) 'lambda)) 2154 (eq (car (car tail)) 'lambda))
2139 (setcar tail (byte-compile-lambda (car tail))))) 2155 (setcar tail (byte-compile-lambda (car tail)))))
2140 (setq tail (cdr tail)))) 2156 (setq tail (cdr tail))))
2141 form) 2157 form)
2142 2158
2143 (put 'require 'byte-hunk-handler 'byte-compile-file-form-eval-boundary) 2159 (put 'require 'byte-hunk-handler 'byte-compile-file-form-require)
2144 (defun byte-compile-file-form-eval-boundary (form) 2160 (defun byte-compile-file-form-require (form)
2145 (let ((old-load-list current-load-list)) 2161 (let ((old-load-list current-load-list)
2146 (eval form) 2162 (args (mapcar 'eval (cdr form))))
2147 ;; (require 'cl) turns off warnings for cl functions. 2163 (apply 'require args)
2148 (let ((tem current-load-list)) 2164 ;; Detech (require 'cl) in a way that works even if cl is already loaded.
2149 (while (not (eq tem old-load-list)) 2165 (if (member (car args) '("cl" cl))
2150 (when (equal (car tem) '(require . cl)) 2166 (setq byte-compile-warnings
2151 (setq byte-compile-warnings 2167 (remq 'cl-functions byte-compile-warnings))))
2152 (remq 'cl-functions byte-compile-warnings)))
2153 (setq tem (cdr tem)))))
2154 (byte-compile-keep-pending form 'byte-compile-normal-call)) 2168 (byte-compile-keep-pending form 'byte-compile-normal-call))
2155 2169
2156 (put 'progn 'byte-hunk-handler 'byte-compile-file-form-progn) 2170 (put 'progn 'byte-hunk-handler 'byte-compile-file-form-progn)
2157 (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn) 2171 (put 'prog1 'byte-hunk-handler 'byte-compile-file-form-progn)
2158 (put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn) 2172 (put 'prog2 'byte-hunk-handler 'byte-compile-file-form-progn)