1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

byte-compile-file: Make optional LOAD argument obsolete

* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Declare optional
LOAD argument obsolete.  Adjust callers.  (Bug#38072)
(byte-recompile-file): Declare optional LOAD argument obsolete.
* doc/lispref/compile.texi (Compilation Functions): Update
documentation to reflect above obsoletion.
* etc/NEWS: Announce above obsoletion.
This commit is contained in:
Stefan Kangas 2020-09-22 00:16:22 +02:00
parent 1841b13282
commit 4a575eb18c
7 changed files with 24 additions and 16 deletions

View file

@ -164,7 +164,7 @@ echo area, but if @var{arg} is non-@code{nil}, it inserts the result
in the current buffer after the form it has compiled. in the current buffer after the form it has compiled.
@end deffn @end deffn
@deffn Command byte-compile-file filename &optional load @deffn Command byte-compile-file filename
This function compiles a file of Lisp code named @var{filename} into a This function compiles a file of Lisp code named @var{filename} into a
file of byte-code. The output file's name is made by changing the file of byte-code. The output file's name is made by changing the
@samp{.el} suffix into @samp{.elc}; if @var{filename} does not end in @samp{.el} suffix into @samp{.elc}; if @var{filename} does not end in
@ -180,9 +180,6 @@ input file is read.
This command returns @code{t} if there were no errors and @code{nil} This command returns @code{t} if there were no errors and @code{nil}
otherwise. When called interactively, it prompts for the file name. otherwise. When called interactively, it prompts for the file name.
If @var{load} is non-@code{nil}, this command loads the compiled file
after compiling it. Interactively, @var{load} is the prefix argument.
@example @example
@group @group
$ ls -l push* $ ls -l push*

View file

@ -1500,6 +1500,11 @@ This is no longer supported, and setting this variable has no effect.
** The macro 'with-displayed-buffer-window' is now obsolete. ** The macro 'with-displayed-buffer-window' is now obsolete.
Use macro 'with-current-buffer-window' with action alist entry 'body-function'. Use macro 'with-current-buffer-window' with action alist entry 'body-function'.
+++
** `byte-compile-file' optional argument LOAD is now obsolete.
To load the file after byte-compiling, add a call to 'load' from Lisp
or use 'M-x emacs-lisp-byte-compile-and-load' interactively.
** The metamail.el library is now marked obsolete. ** The metamail.el library is now marked obsolete.
--- ---

View file

@ -1845,10 +1845,9 @@ compile FILENAME. If optional argument ARG is 0, it compiles
the input file even if the `.elc' file does not exist. the input file even if the `.elc' file does not exist.
Any other non-nil value of ARG means to ask the user. Any other non-nil value of ARG means to ask the user.
If optional argument LOAD is non-nil, loads the file after compiling.
If compilation is needed, this functions returns the result of If compilation is needed, this functions returns the result of
`byte-compile-file'; otherwise it returns `no-byte-compile'." `byte-compile-file'; otherwise it returns `no-byte-compile'."
(declare (advertised-calling-convention (filename &optional force arg) "28.1"))
(interactive (interactive
(let ((file buffer-file-name) (let ((file buffer-file-name)
(file-name nil) (file-name nil)
@ -1877,7 +1876,9 @@ If compilation is needed, this functions returns the result of
(progn (progn
(if (and noninteractive (not byte-compile-verbose)) (if (and noninteractive (not byte-compile-verbose))
(message "Compiling %s..." filename)) (message "Compiling %s..." filename))
(byte-compile-file filename load)) (byte-compile-file filename)
(when load
(load (if (file-exists-p dest) dest filename))))
(when load (when load
(load (if (file-exists-p dest) dest filename))) (load (if (file-exists-p dest) dest filename)))
'no-byte-compile))) 'no-byte-compile)))
@ -1901,8 +1902,10 @@ If compilation is needed, this functions returns the result of
"Compile a file of Lisp code named FILENAME into a file of byte code. "Compile a file of Lisp code named FILENAME into a file of byte code.
The output file's name is generated by passing FILENAME to the The output file's name is generated by passing FILENAME to the
function `byte-compile-dest-file' (which see). function `byte-compile-dest-file' (which see).
With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling. The value is non-nil if there were no errors, nil if errors.
The value is non-nil if there were no errors, nil if errors."
See also `emacs-lisp-byte-compile-and-load'."
(declare (advertised-calling-convention (filename) "28.1"))
;; (interactive "fByte compile file: \nP") ;; (interactive "fByte compile file: \nP")
(interactive (interactive
(let ((file buffer-file-name) (let ((file buffer-file-name)
@ -2068,7 +2071,7 @@ The value is non-nil if there were no errors, nil if errors."
(insert (format "%S\n" (cons var filename)))) (insert (format "%S\n" (cons var filename))))
(write-region (point-min) (point-max) dynvar-file))))) (write-region (point-min) (point-max) dynvar-file)))))
(if load (if load
(load target-file)) (load target-file))
t)))) t))))
;;; compiling a single function ;;; compiling a single function

View file

@ -223,7 +223,8 @@ byte-compiled before it is loaded."
(org-babel-tangle-file file tangled-file "emacs-lisp")) (org-babel-tangle-file file tangled-file "emacs-lisp"))
(if compile (if compile
(progn (progn
(byte-compile-file tangled-file 'load) (byte-compile-file tangled-file)
(load tangled-file)
(message "Compiled and loaded %s" tangled-file)) (message "Compiled and loaded %s" tangled-file))
(load-file tangled-file) (load-file tangled-file)
(message "Loaded %s" tangled-file)))) (message "Loaded %s" tangled-file))))

View file

@ -196,7 +196,8 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
(if (and (buffer-modified-p) (if (and (buffer-modified-p)
(y-or-n-p (format "Save buffer %s first? " (buffer-name)))) (y-or-n-p (format "Save buffer %s first? " (buffer-name))))
(save-buffer)) (save-buffer))
(byte-recompile-file buffer-file-name nil 0 t)) (byte-recompile-file buffer-file-name nil 0)
(load buffer-file-name))
(defun emacs-lisp-macroexpand () (defun emacs-lisp-macroexpand ()
"Macroexpand the form after point. "Macroexpand the form after point.

View file

@ -1392,7 +1392,7 @@ Argument ARG represents to force a refresh past any caches that may exist."
(if (and (file-exists-p f) (string-match "\\.el\\'" f)) (if (and (file-exists-p f) (string-match "\\.el\\'" f))
(progn (progn
(dframe-select-attached-frame speedbar-frame) (dframe-select-attached-frame speedbar-frame)
(byte-compile-file f nil) (byte-compile-file f)
(select-frame sf) (select-frame sf)
(speedbar-reset-scanners))) (speedbar-reset-scanners)))
)) ))

View file

@ -444,8 +444,8 @@ Subtests signal errors if something goes wrong."
(if compile (if compile
(let ((byte-compile-dest-file-function (let ((byte-compile-dest-file-function
(lambda (e) elcfile))) (lambda (e) elcfile)))
(byte-compile-file elfile t)) (byte-compile-file elfile)))
(load elfile nil 'nomessage))) (load elfile nil 'nomessage))
(when elfile (delete-file elfile)) (when elfile (delete-file elfile))
(when elcfile (delete-file elcfile))))) (when elcfile (delete-file elcfile)))))
(put 'test-byte-comp-compile-and-load 'lisp-indent-function 1) (put 'test-byte-comp-compile-and-load 'lisp-indent-function 1)
@ -646,7 +646,8 @@ literals (Bug#20852)."
(setq bytecomp-tests--foobar (bytecomp-tests--foobar)))) (setq bytecomp-tests--foobar (bytecomp-tests--foobar))))
(print form (current-buffer))) (print form (current-buffer)))
(write-region (point-min) (point-max) source nil 'silent) (write-region (point-min) (point-max) source nil 'silent)
(byte-compile-file source t) (byte-compile-file source)
(load source)
(should (equal bytecomp-tests--foobar (cons 1 2))))) (should (equal bytecomp-tests--foobar (cons 1 2)))))
(ert-deftest bytecomp-tests--test-no-warnings-with-advice () (ert-deftest bytecomp-tests--test-no-warnings-with-advice ()