Function: elisp-byte-compile-buffer
elisp-byte-compile-buffer is an interactive and byte-compiled function
defined in elisp-mode.el.gz.
Signature
(elisp-byte-compile-buffer &optional LOAD)
Documentation
Byte compile the current buffer, but don't write a file.
If LOAD is non-nil, load byte-compiled data. When called interactively, this is the prefix argument.
Probably introduced at or before Emacs version 29.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/elisp-mode.el.gz
(defun elisp-byte-compile-buffer (&optional load)
"Byte compile the current buffer, but don't write a file.
If LOAD is non-nil, load byte-compiled data. When called
interactively, this is the prefix argument."
(interactive "P")
(let ((bfn buffer-file-name)
file elc)
(require 'bytecomp)
(unwind-protect
(progn
(setq file (make-temp-file "compile" nil ".el")
elc (funcall byte-compile-dest-file-function file))
(write-region (point-min) (point-max) file nil 'silent)
(let ((set-message-function
(lambda (message)
(when (string-match-p "\\`Wrote " message)
'ignore)))
(byte-compile-log-warning-function
(lambda (string position &optional fill level)
(if bfn
;; Massage the warnings to that they point to
;; this file, not the one in /tmp.
(let ((byte-compile-current-file bfn)
(byte-compile-root-dir (file-name-directory bfn)))
(byte-compile--log-warning-for-byte-compile
string position fill level))
;; We don't have a file name, so the warnings
;; will point to a file that doesn't exist. This
;; should be fixed in some way.
(byte-compile--log-warning-for-byte-compile
string position fill level)))))
(byte-compile-file file))
(when (and bfn (get-buffer "*Compile-Log*"))
(with-current-buffer "*Compile-Log*"
(setq default-directory (file-name-directory bfn))))
(if load
(load elc)
(message "Byte-compiled the current buffer")))
(when file
(when (file-exists-p file)
(delete-file file))
(when (file-exists-p elc)
(delete-file elc))))))