aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2008-01-04 05:35:12 +0000
committerRichard M. Stallman2008-01-04 05:35:12 +0000
commita5832373fdb7016415239fadf524dc45c953acc5 (patch)
tree1cd81ec01f63f84a3c1a6cb9554678db4bafb2aa
parent8df5b06d165df703f7ef9a00c64323b72f31d393 (diff)
downloademacs-a5832373fdb7016415239fadf524dc45c953acc5.tar.gz
emacs-a5832373fdb7016415239fadf524dc45c953acc5.zip
(byte-compile-from-buffer): Call byte-compile-warn-about-unresolved-functions
outside the with-current-buffer. (byte-compile-insert-header): Use with-current-buffer.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emacs-lisp/bytecomp.el166
2 files changed, 90 insertions, 83 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fdeb887d21d..560fa9e4b77 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-01-04 Richard Stallman <rms@gnu.org>
2
3 * emacs-lisp/bytecomp.el (byte-compile-from-buffer):
4 Call byte-compile-warn-about-unresolved-functions outside
5 the with-current-buffer.
6 (byte-compile-insert-header): Use with-current-buffer.
7
12008-01-04 Glenn Morris <rgm@gnu.org> 82008-01-04 Glenn Morris <rgm@gnu.org>
2 9
3 * startup.el (fancy-about-screen): Remove reference to deleted 10 * startup.el (fancy-about-screen): Remove reference to deleted
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index eaff1ad72f5..9d392c2fc28 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1920,8 +1920,8 @@ and will be removed soon. See (elisp)Backquote in the manual."))
1920 (byte-compile-flush-pending) 1920 (byte-compile-flush-pending)
1921 ;; Make warnings about unresolved functions 1921 ;; Make warnings about unresolved functions
1922 ;; give the end of the file as their position. 1922 ;; give the end of the file as their position.
1923 (setq byte-compile-last-position (point-max)) 1923 (setq byte-compile-last-position (point-max)))
1924 (byte-compile-warn-about-unresolved-functions)) 1924 (byte-compile-warn-about-unresolved-functions)
1925 ;; Fix up the header at the front of the output 1925 ;; Fix up the header at the front of the output
1926 ;; if the buffer contains multibyte characters. 1926 ;; if the buffer contains multibyte characters.
1927 (and filename (byte-compile-fix-header filename inbuffer outbuffer)))) 1927 (and filename (byte-compile-fix-header filename inbuffer outbuffer))))
@@ -1964,88 +1964,88 @@ and will be removed soon. See (elisp)Backquote in the manual."))
1964 (delete-char delta))))) 1964 (delete-char delta)))))
1965 1965
1966(defun byte-compile-insert-header (filename inbuffer outbuffer) 1966(defun byte-compile-insert-header (filename inbuffer outbuffer)
1967 (set-buffer inbuffer) 1967 (with-current-buffer inbuffer
1968 (let ((dynamic-docstrings byte-compile-dynamic-docstrings) 1968 (let ((dynamic-docstrings byte-compile-dynamic-docstrings)
1969 (dynamic byte-compile-dynamic)) 1969 (dynamic byte-compile-dynamic))
1970 (set-buffer outbuffer) 1970 (set-buffer outbuffer)
1971 (goto-char (point-min)) 1971 (goto-char (point-min))
1972 ;; The magic number of .elc files is ";ELC", or 0x3B454C43. After 1972 ;; The magic number of .elc files is ";ELC", or 0x3B454C43. After
1973 ;; that is the file-format version number (18, 19 or 20) as a 1973 ;; that is the file-format version number (18, 19 or 20) as a
1974 ;; byte, followed by some nulls. The primary motivation for doing 1974 ;; byte, followed by some nulls. The primary motivation for doing
1975 ;; this is to get some binary characters up in the first line of 1975 ;; this is to get some binary characters up in the first line of
1976 ;; the file so that `diff' will simply say "Binary files differ" 1976 ;; the file so that `diff' will simply say "Binary files differ"
1977 ;; instead of actually doing a diff of two .elc files. An extra 1977 ;; instead of actually doing a diff of two .elc files. An extra
1978 ;; benefit is that you can add this to /etc/magic: 1978 ;; benefit is that you can add this to /etc/magic:
1979 1979
1980 ;; 0 string ;ELC GNU Emacs Lisp compiled file, 1980 ;; 0 string ;ELC GNU Emacs Lisp compiled file,
1981 ;; >4 byte x version %d 1981 ;; >4 byte x version %d
1982 1982
1983 (insert 1983 (insert
1984 ";ELC" 1984 ";ELC"
1985 (if (byte-compile-version-cond byte-compile-compatibility) 18 20) 1985 (if (byte-compile-version-cond byte-compile-compatibility) 18 20)
1986 "\000\000\000\n" 1986 "\000\000\000\n"
1987 ) 1987 )
1988 (insert ";;; Compiled by " 1988 (insert ";;; Compiled by "
1989 (or (and (boundp 'user-mail-address) user-mail-address) 1989 (or (and (boundp 'user-mail-address) user-mail-address)
1990 (concat (user-login-name) "@" (system-name))) 1990 (concat (user-login-name) "@" (system-name)))
1991 " on " 1991 " on "
1992 (current-time-string) "\n;;; from file " filename "\n") 1992 (current-time-string) "\n;;; from file " filename "\n")
1993 (insert ";;; in Emacs version " emacs-version "\n") 1993 (insert ";;; in Emacs version " emacs-version "\n")
1994 (insert ";;; " 1994 (insert ";;; "
1995 (cond 1995 (cond
1996 ((eq byte-optimize 'source) "with source-level optimization only") 1996 ((eq byte-optimize 'source) "with source-level optimization only")
1997 ((eq byte-optimize 'byte) "with byte-level optimization only") 1997 ((eq byte-optimize 'byte) "with byte-level optimization only")
1998 (byte-optimize "with all optimizations") 1998 (byte-optimize "with all optimizations")
1999 (t "without optimization")) 1999 (t "without optimization"))
2000 (if (byte-compile-version-cond byte-compile-compatibility) 2000 (if (byte-compile-version-cond byte-compile-compatibility)
2001 "; compiled with Emacs 18 compatibility.\n" 2001 "; compiled with Emacs 18 compatibility.\n"
2002 ".\n")) 2002 ".\n"))
2003 (if dynamic 2003 (if dynamic
2004 (insert ";;; Function definitions are lazy-loaded.\n")) 2004 (insert ";;; Function definitions are lazy-loaded.\n"))
2005 (if (not (byte-compile-version-cond byte-compile-compatibility)) 2005 (if (not (byte-compile-version-cond byte-compile-compatibility))
2006 (let (intro-string minimum-version) 2006 (let (intro-string minimum-version)
2007 ;; Figure out which Emacs version to require, 2007 ;; Figure out which Emacs version to require,
2008 ;; and what comment to use to explain why. 2008 ;; and what comment to use to explain why.
2009 ;; Note that this fails to take account of whether 2009 ;; Note that this fails to take account of whether
2010 ;; the buffer contains multibyte characters. We may have to 2010 ;; the buffer contains multibyte characters. We may have to
2011 ;; compensate at the end in byte-compile-fix-header. 2011 ;; compensate at the end in byte-compile-fix-header.
2012 (if dynamic-docstrings 2012 (if dynamic-docstrings
2013 (setq intro-string
2014 ";;; This file uses dynamic docstrings, first added in Emacs 19.29.\n"
2015 minimum-version "19.29")
2013 (setq intro-string 2016 (setq intro-string
2014 ";;; This file uses dynamic docstrings, first added in Emacs 19.29.\n" 2017 ";;; This file uses opcodes which do not exist in Emacs 18.\n"
2015 minimum-version "19.29") 2018 minimum-version "19"))
2016 (setq intro-string 2019 ;; Now insert the comment and the error check.
2017 ";;; This file uses opcodes which do not exist in Emacs 18.\n" 2020 (insert
2018 minimum-version "19")) 2021 "\n"
2019 ;; Now insert the comment and the error check. 2022 intro-string
2020 (insert 2023 ;; Have to check if emacs-version is bound so that this works
2021 "\n" 2024 ;; in files loaded early in loadup.el.
2022 intro-string 2025 "(if (and (boundp 'emacs-version)\n"
2023 ;; Have to check if emacs-version is bound so that this works 2026 ;; If there is a name at the end of emacs-version,
2024 ;; in files loaded early in loadup.el. 2027 ;; don't try to check the version number.
2025 "(if (and (boundp 'emacs-version)\n" 2028 "\t (< (aref emacs-version (1- (length emacs-version))) ?A)\n"
2026 ;; If there is a name at the end of emacs-version, 2029 "\t (or (and (boundp 'epoch::version) epoch::version)\n"
2027 ;; don't try to check the version number. 2030 (format "\t (string-lessp emacs-version \"%s\")))\n"
2028 "\t (< (aref emacs-version (1- (length emacs-version))) ?A)\n" 2031 minimum-version)
2029 "\t (or (and (boundp 'epoch::version) epoch::version)\n" 2032 " (error \"`"
2030 (format "\t (string-lessp emacs-version \"%s\")))\n" 2033 ;; prin1-to-string is used to quote backslashes.
2031 minimum-version) 2034 (substring (prin1-to-string (file-name-nondirectory filename))
2032 " (error \"`" 2035 1 -1)
2033 ;; prin1-to-string is used to quote backslashes. 2036 (format "' was compiled for Emacs %s or later\"))\n\n"
2034 (substring (prin1-to-string (file-name-nondirectory filename)) 2037 minimum-version)
2035 1 -1) 2038 ;; Insert semicolons as ballast, so that byte-compile-fix-header
2036 (format "' was compiled for Emacs %s or later\"))\n\n" 2039 ;; can delete them so as to keep the buffer positions
2037 minimum-version) 2040 ;; constant for the actual compiled code.
2038 ;; Insert semicolons as ballast, so that byte-compile-fix-header 2041 ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))
2039 ;; can delete them so as to keep the buffer positions 2042 ;; Here if we want Emacs 18 compatibility.
2040 ;; constant for the actual compiled code. 2043 (when dynamic-docstrings
2041 ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")) 2044 (error "Version-18 compatibility doesn't support dynamic doc strings"))
2042 ;; Here if we want Emacs 18 compatibility. 2045 (when byte-compile-dynamic
2043 (when dynamic-docstrings 2046 (error "Version-18 compatibility doesn't support dynamic byte code"))
2044 (error "Version-18 compatibility doesn't support dynamic doc strings")) 2047 (insert "(or (boundp 'current-load-list) (setq current-load-list nil))\n"
2045 (when byte-compile-dynamic 2048 "\n")))))
2046 (error "Version-18 compatibility doesn't support dynamic byte code"))
2047 (insert "(or (boundp 'current-load-list) (setq current-load-list nil))\n"
2048 "\n"))))
2049 2049
2050(defun byte-compile-output-file-form (form) 2050(defun byte-compile-output-file-form (form)
2051 ;; writes the given form to the output buffer, being careful of docstrings 2051 ;; writes the given form to the output buffer, being careful of docstrings