Skip to content

Commit cd2d812

Browse files
committed
Unbreak byte compilation
* lisp/emacs-lisp/bytecomp.el (byte-compile-fix-header): Update for recent header changes. (byte-compile-insert-header): Add more padding.
1 parent c4687d9 commit cd2d812

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

lisp/emacs-lisp/bytecomp.el

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,36 +2153,36 @@ With argument ARG, insert value in current buffer after the form."
21532153
(when (< (point-max) (position-bytes (point-max)))
21542154
(goto-char (point-min))
21552155
;; Find the comment that describes the version condition.
2156-
(search-forward "\n;;; This file uses")
2157-
(narrow-to-region (line-beginning-position) (point-max))
2158-
;; Find the first line of ballast semicolons.
2159-
(search-forward ";;;;;;;;;;")
2160-
(beginning-of-line)
2161-
(narrow-to-region (point-min) (point))
2162-
(let ((old-header-end (point))
2163-
(minimum-version "23")
2164-
delta)
2165-
(delete-region (point-min) (point-max))
2166-
(insert
2167-
";;; This file contains utf-8 non-ASCII characters,\n"
2168-
";;; and so cannot be loaded into Emacs 22 or earlier.\n"
2169-
;; Have to check if emacs-version is bound so that this works
2170-
;; in files loaded early in loadup.el.
2171-
"(and (boundp 'emacs-version)\n"
2172-
;; If there is a name at the end of emacs-version,
2173-
;; don't try to check the version number.
2174-
" (< (aref emacs-version (1- (length emacs-version))) ?A)\n"
2175-
(format " (string-lessp emacs-version \"%s\")\n" minimum-version)
2176-
;; Because the header must fit in a fixed width, we cannot
2177-
;; insert arbitrary-length file names (Bug#11585).
2178-
" (error \"`%s' was compiled for "
2179-
(format "Emacs %s or later\" #$))\n\n" minimum-version))
2180-
;; Now compensate for any change in size, to make sure all
2181-
;; positions in the file remain valid.
2182-
(setq delta (- (point-max) old-header-end))
2183-
(goto-char (point-max))
2184-
(widen)
2185-
(delete-char delta))))
2156+
(when (search-forward "\n;;; This file does not contain utf-8" nil t)
2157+
(narrow-to-region (line-beginning-position) (point-max))
2158+
;; Find the first line of ballast semicolons.
2159+
(search-forward ";;;;;;;;;;")
2160+
(beginning-of-line)
2161+
(narrow-to-region (point-min) (point))
2162+
(let ((old-header-end (point))
2163+
(minimum-version "23")
2164+
delta)
2165+
(delete-region (point-min) (point-max))
2166+
(insert
2167+
";;; This file contains utf-8 non-ASCII characters,\n"
2168+
";;; and so cannot be loaded into Emacs 22 or earlier.\n"
2169+
;; Have to check if emacs-version is bound so that this works
2170+
;; in files loaded early in loadup.el.
2171+
"(and (boundp 'emacs-version)\n"
2172+
;; If there is a name at the end of emacs-version,
2173+
;; don't try to check the version number.
2174+
" (< (aref emacs-version (1- (length emacs-version))) ?A)\n"
2175+
(format " (string-lessp emacs-version \"%s\")\n" minimum-version)
2176+
;; Because the header must fit in a fixed width, we cannot
2177+
;; insert arbitrary-length file names (Bug#11585).
2178+
" (error \"`%s' was compiled for "
2179+
(format "Emacs %s or later\" #$))\n\n" minimum-version))
2180+
;; Now compensate for any change in size, to make sure all
2181+
;; positions in the file remain valid.
2182+
(setq delta (- (point-max) old-header-end))
2183+
(goto-char (point-max))
2184+
(widen)
2185+
(delete-char delta)))))
21862186

21872187
(defun byte-compile-insert-header (_filename outbuffer)
21882188
"Insert a header at the start of OUTBUFFER.
@@ -2222,6 +2222,7 @@ Call from the source buffer."
22222222
;; can delete them so as to keep the buffer positions
22232223
;; constant for the actual compiled code.
22242224
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
2225+
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
22252226
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))))
22262227

22272228
(defun byte-compile-output-file-form (form)

0 commit comments

Comments
 (0)