diff options
| author | Glenn Morris | 2009-11-05 03:25:41 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-11-05 03:25:41 +0000 |
| commit | 775adc51434983e7c1e397bb3a6cfa9308e66bae (patch) | |
| tree | af30d21ad042b139a033936e05e45336cb2f5bc0 /lisp | |
| parent | 881e4184a3d83b939559ba684a227eea67e17dd2 (diff) | |
| download | emacs-775adc51434983e7c1e397bb3a6cfa9308e66bae.tar.gz emacs-775adc51434983e7c1e397bb3a6cfa9308e66bae.zip | |
(byte-compile-insert-header): Drop test for Emacs 19. (Bug#1531)
(byte-compile-fix-header): Update for the above change.
Drop test for epoch::version.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 176 |
2 files changed, 83 insertions, 98 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a36bbbbc508..7b2de46fe4c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2009-11-05 Glenn Morris <rgm@gnu.org> | 1 | 2009-11-05 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-insert-header): Drop test for | ||
| 4 | Emacs 19. (Bug#1531) | ||
| 5 | (byte-compile-fix-header): Update for the above change. | ||
| 6 | Drop test for epoch::version. | ||
| 7 | |||
| 3 | * emacs-lisp/autoload.el (autoload-rubric): Add optional feature arg. | 8 | * emacs-lisp/autoload.el (autoload-rubric): Add optional feature arg. |
| 4 | * cus-dep.el (custom-make-dependencies): | 9 | * cus-dep.el (custom-make-dependencies): |
| 5 | * finder.el (finder-compile-keywords): | 10 | * finder.el (finder-compile-keywords): |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e527d07029a..606d1b9e84a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1922,10 +1922,9 @@ With argument ARG, insert value in current buffer after the form." | |||
| 1922 | ;; need to be written carefully. | 1922 | ;; need to be written carefully. |
| 1923 | (setq overwrite-mode 'overwrite-mode-binary)) | 1923 | (setq overwrite-mode 'overwrite-mode-binary)) |
| 1924 | (displaying-byte-compile-warnings | 1924 | (displaying-byte-compile-warnings |
| 1925 | (and bytecomp-filename | ||
| 1926 | (byte-compile-insert-header bytecomp-filename bytecomp-inbuffer | ||
| 1927 | bytecomp-outbuffer)) | ||
| 1928 | (with-current-buffer bytecomp-inbuffer | 1925 | (with-current-buffer bytecomp-inbuffer |
| 1926 | (and bytecomp-filename | ||
| 1927 | (byte-compile-insert-header bytecomp-filename bytecomp-outbuffer)) | ||
| 1929 | (goto-char (point-min)) | 1928 | (goto-char (point-min)) |
| 1930 | ;; Should we always do this? When calling multiple files, it | 1929 | ;; Should we always do this? When calling multiple files, it |
| 1931 | ;; would be useful to delay this warning until all have been | 1930 | ;; would be useful to delay this warning until all have been |
| @@ -1958,49 +1957,55 @@ and will be removed soon. See (elisp)Backquote in the manual.")) | |||
| 1958 | ;; Fix up the header at the front of the output | 1957 | ;; Fix up the header at the front of the output |
| 1959 | ;; if the buffer contains multibyte characters. | 1958 | ;; if the buffer contains multibyte characters. |
| 1960 | (and bytecomp-filename | 1959 | (and bytecomp-filename |
| 1961 | (byte-compile-fix-header bytecomp-filename bytecomp-inbuffer | 1960 | (with-current-buffer bytecomp-outbuffer |
| 1962 | bytecomp-outbuffer)))) | 1961 | (byte-compile-fix-header bytecomp-filename))))) |
| 1963 | bytecomp-outbuffer)) | 1962 | bytecomp-outbuffer)) |
| 1964 | 1963 | ||
| 1965 | (defun byte-compile-fix-header (filename inbuffer outbuffer) | 1964 | (defun byte-compile-fix-header (filename) |
| 1966 | (with-current-buffer outbuffer | 1965 | "If the current buffer has any multibyte characters, insert a version test." |
| 1967 | ;; See if the buffer has any multibyte characters. | 1966 | (when (< (point-max) (position-bytes (point-max))) |
| 1968 | (when (< (point-max) (position-bytes (point-max))) | 1967 | (goto-char (point-min)) |
| 1969 | (goto-char (point-min)) | 1968 | ;; Find the comment that describes the version condition. |
| 1970 | ;; Find the comment that describes the version test. | 1969 | (search-forward "\n;;; This file uses") |
| 1971 | (search-forward "\n;;; This file") | 1970 | (narrow-to-region (line-beginning-position) (point-max)) |
| 1972 | (beginning-of-line) | 1971 | ;; Find the first line of ballast semicolons. |
| 1973 | (narrow-to-region (point) (point-max)) | 1972 | (search-forward ";;;;;;;;;;") |
| 1974 | ;; Find the line of ballast semicolons. | 1973 | (beginning-of-line) |
| 1975 | (search-forward ";;;;;;;;;;") | 1974 | (narrow-to-region (point-min) (point)) |
| 1976 | (beginning-of-line) | 1975 | (let ((old-header-end (point)) |
| 1977 | 1976 | (minimum-version "23") | |
| 1978 | (narrow-to-region (point-min) (point)) | 1977 | delta) |
| 1979 | (let ((old-header-end (point)) | 1978 | (delete-region (point-min) (point-max)) |
| 1980 | delta) | 1979 | (insert |
| 1981 | (goto-char (point-min)) | 1980 | ";;; This file contains utf-8 non-ASCII characters,\n" |
| 1982 | (delete-region (point) (progn (re-search-forward "^(") | 1981 | ";;; and so cannot be loaded into Emacs 22 or earlier.\n" |
| 1983 | (beginning-of-line) | 1982 | ;; Have to check if emacs-version is bound so that this works |
| 1984 | (point))) | 1983 | ;; in files loaded early in loadup.el. |
| 1985 | (insert ";;; This file contains utf-8 non-ASCII characters\n" | 1984 | "(and (boundp 'emacs-version)\n" |
| 1986 | ";;; and therefore cannot be loaded into Emacs 22 or earlier.\n") | 1985 | ;; If there is a name at the end of emacs-version, |
| 1987 | ;; Replace "19" or "19.29" with "23", twice. | 1986 | ;; don't try to check the version number. |
| 1988 | (re-search-forward "19\\(\\.[0-9]+\\)") | 1987 | " (< (aref emacs-version (1- (length emacs-version))) ?A)\n" |
| 1989 | (replace-match "23") | 1988 | (format " (string-lessp emacs-version \"%s\")\n" minimum-version) |
| 1990 | (re-search-forward "19\\(\\.[0-9]+\\)") | 1989 | " (error \"`" |
| 1991 | (replace-match "23") | 1990 | ;; prin1-to-string is used to quote backslashes. |
| 1992 | ;; Now compensate for the change in size, | 1991 | (substring (prin1-to-string (file-name-nondirectory filename)) |
| 1993 | ;; to make sure all positions in the file remain valid. | 1992 | 1 -1) |
| 1994 | (setq delta (- (point-max) old-header-end)) | 1993 | (format "' was compiled for Emacs %s or later\"))\n\n" |
| 1995 | (goto-char (point-max)) | 1994 | minimum-version)) |
| 1996 | (widen) | 1995 | ;; Now compensate for any change in size, to make sure all |
| 1997 | (delete-char delta))))) | 1996 | ;; positions in the file remain valid. |
| 1998 | 1997 | (setq delta (- (point-max) old-header-end)) | |
| 1999 | (defun byte-compile-insert-header (filename inbuffer outbuffer) | 1998 | (goto-char (point-max)) |
| 2000 | (with-current-buffer inbuffer | 1999 | (widen) |
| 2001 | (let ((dynamic-docstrings byte-compile-dynamic-docstrings) | 2000 | (delete-char delta)))) |
| 2002 | (dynamic byte-compile-dynamic)) | 2001 | |
| 2003 | (set-buffer outbuffer) | 2002 | (defun byte-compile-insert-header (filename outbuffer) |
| 2003 | "Insert a header at the start of OUTBUFFER. | ||
| 2004 | Call from the source buffer." | ||
| 2005 | (let ((dynamic-docstrings byte-compile-dynamic-docstrings) | ||
| 2006 | (dynamic byte-compile-dynamic) | ||
| 2007 | (optimize byte-optimize)) | ||
| 2008 | (with-current-buffer outbuffer | ||
| 2004 | (goto-char (point-min)) | 2009 | (goto-char (point-min)) |
| 2005 | ;; The magic number of .elc files is ";ELC", or 0x3B454C43. After | 2010 | ;; The magic number of .elc files is ";ELC", or 0x3B454C43. After |
| 2006 | ;; that is the file-format version number (18, 19, 20, or 23) as a | 2011 | ;; that is the file-format version number (18, 19, 20, or 23) as a |
| @@ -2009,62 +2014,37 @@ and will be removed soon. See (elisp)Backquote in the manual.")) | |||
| 2009 | ;; the file so that `diff' will simply say "Binary files differ" | 2014 | ;; the file so that `diff' will simply say "Binary files differ" |
| 2010 | ;; instead of actually doing a diff of two .elc files. An extra | 2015 | ;; instead of actually doing a diff of two .elc files. An extra |
| 2011 | ;; benefit is that you can add this to /etc/magic: | 2016 | ;; benefit is that you can add this to /etc/magic: |
| 2012 | |||
| 2013 | ;; 0 string ;ELC GNU Emacs Lisp compiled file, | 2017 | ;; 0 string ;ELC GNU Emacs Lisp compiled file, |
| 2014 | ;; >4 byte x version %d | 2018 | ;; >4 byte x version %d |
| 2015 | 2019 | (insert | |
| 2016 | (insert ";ELC" 23 "\000\000\000\n") | 2020 | ";ELC" 23 "\000\000\000\n" |
| 2017 | (insert ";;; Compiled by " | 2021 | ";;; Compiled by " |
| 2018 | (or (and (boundp 'user-mail-address) user-mail-address) | 2022 | (or (and (boundp 'user-mail-address) user-mail-address) |
| 2019 | (concat (user-login-name) "@" (system-name))) | 2023 | (concat (user-login-name) "@" (system-name))) |
| 2020 | " on " | 2024 | " on " (current-time-string) "\n" |
| 2021 | (current-time-string) "\n;;; from file " filename "\n") | 2025 | ";;; from file " filename "\n" |
| 2022 | (insert ";;; in Emacs version " emacs-version "\n") | 2026 | ";;; in Emacs version " emacs-version ", with" |
| 2023 | (insert ";;; " | 2027 | (cond |
| 2024 | (cond | 2028 | ((eq optimize 'source) " source-level optimization only") |
| 2025 | ((eq byte-optimize 'source) "with source-level optimization only") | 2029 | ((eq optimize 'byte) " byte-level optimization only") |
| 2026 | ((eq byte-optimize 'byte) "with byte-level optimization only") | 2030 | (optimize " all optimizations") |
| 2027 | (byte-optimize "with all optimizations") | 2031 | (t "out optimization")) |
| 2028 | (t "without optimization")) | 2032 | ".\n" |
| 2029 | ".\n") | 2033 | (if dynamic ";;; Function definitions are lazy-loaded.\n" |
| 2030 | (if dynamic | 2034 | "") |
| 2031 | (insert ";;; Function definitions are lazy-loaded.\n")) | 2035 | "\n;;; This file uses " |
| 2032 | (let (intro-string minimum-version) | 2036 | (if dynamic-docstrings |
| 2033 | ;; Figure out which Emacs version to require, | 2037 | "dynamic docstrings, first added in Emacs 19.29" |
| 2034 | ;; and what comment to use to explain why. | 2038 | "opcodes that do not exist in Emacs 18") |
| 2035 | ;; Note that this fails to take account of whether | 2039 | ".\n\n" |
| 2036 | ;; the buffer contains multibyte characters. We may have to | 2040 | ;; Note that byte-compile-fix-header may change this. |
| 2037 | ;; compensate at the end in byte-compile-fix-header. | 2041 | ";;; This file does not contain utf-8 non-ASCII characters,\n" |
| 2038 | (if dynamic-docstrings | 2042 | ";;; and so can be loaded in Emacs versions earlier than 23.\n\n" |
| 2039 | (setq intro-string | 2043 | ;; Insert semicolons as ballast, so that byte-compile-fix-header |
| 2040 | ";;; This file uses dynamic docstrings, first added in Emacs 19.29.\n" | 2044 | ;; can delete them so as to keep the buffer positions |
| 2041 | minimum-version "19.29") | 2045 | ;; constant for the actual compiled code. |
| 2042 | (setq intro-string | 2046 | ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" |
| 2043 | ";;; This file uses opcodes which do not exist in Emacs 18.\n" | 2047 | ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")))) |
| 2044 | minimum-version "19")) | ||
| 2045 | ;; Now insert the comment and the error check. | ||
| 2046 | (insert | ||
| 2047 | "\n" | ||
| 2048 | intro-string | ||
| 2049 | ;; Have to check if emacs-version is bound so that this works | ||
| 2050 | ;; in files loaded early in loadup.el. | ||
| 2051 | "(if (and (boundp 'emacs-version)\n" | ||
| 2052 | ;; If there is a name at the end of emacs-version, | ||
| 2053 | ;; don't try to check the version number. | ||
| 2054 | "\t (< (aref emacs-version (1- (length emacs-version))) ?A)\n" | ||
| 2055 | "\t (or (and (boundp 'epoch::version) epoch::version)\n" | ||
| 2056 | (format "\t (string-lessp emacs-version \"%s\")))\n" | ||
| 2057 | minimum-version) | ||
| 2058 | " (error \"`" | ||
| 2059 | ;; prin1-to-string is used to quote backslashes. | ||
| 2060 | (substring (prin1-to-string (file-name-nondirectory filename)) | ||
| 2061 | 1 -1) | ||
| 2062 | (format "' was compiled for Emacs %s or later\"))\n\n" | ||
| 2063 | minimum-version) | ||
| 2064 | ;; Insert semicolons as ballast, so that byte-compile-fix-header | ||
| 2065 | ;; can delete them so as to keep the buffer positions | ||
| 2066 | ;; constant for the actual compiled code. | ||
| 2067 | ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))))) | ||
| 2068 | 2048 | ||
| 2069 | ;; Dynamically bound in byte-compile-from-buffer. | 2049 | ;; Dynamically bound in byte-compile-from-buffer. |
| 2070 | ;; NB also used in cl.el and cl-macs.el. | 2050 | ;; NB also used in cl.el and cl-macs.el. |