Function: byte-compile-insert-header
byte-compile-insert-header is a byte-compiled function defined in
bytecomp.el.gz.
Signature
(byte-compile-insert-header FILENAME OUTBUFFER)
Documentation
Insert a header at the start of OUTBUFFER.
Call from the source buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-insert-header (_filename outbuffer)
"Insert a header at the start of OUTBUFFER.
Call from the source buffer."
(let ((dynamic byte-compile-dynamic)
(optimize byte-optimize))
(with-current-buffer outbuffer
(goto-char (point-min))
;; The magic number of .elc files is ";ELC", or 0x3B454C43. After
;; that is the file-format version number (18, 19, 20, or 23) as a
;; byte, followed by some nulls. The primary motivation for doing
;; this is to get some binary characters up in the first line of
;; the file so that `diff' will simply say "Binary files differ"
;; instead of actually doing a diff of two .elc files. An extra
;; benefit is that you can add this to /etc/magic:
;; 0 string ;ELC GNU Emacs Lisp compiled file,
;; >4 byte x version %d
(insert
";ELC"
(let ((version
(if (zerop emacs-minor-version)
;; Let's allow silently loading into Emacs-27
;; files compiled with Emacs-28.0.NN since the two can
;; be almost identical (e.g. right after cutting the
;; release branch) and people running the development
;; branch can be presumed to know that it's risky anyway.
(1- emacs-major-version) emacs-major-version)))
;; Make sure the version is a plain byte that doesn't end the comment!
(cl-assert (and (> version 13) (< version 128)))
version)
"\000\000\000\n"
";;; Compiled\n"
";;; in Emacs version " emacs-version "\n"
";;; with"
(cond
((eq optimize 'source) " source-level optimization only")
((eq optimize 'byte) " byte-level optimization only")
(optimize " all optimizations")
(t "out optimization"))
".\n"
(if dynamic ";;; Function definitions are lazy-loaded.\n"
"")
"\n\n"))))