diff options
author | Andrea Corallo <akrl@sdf.org> | 2023-06-06 11:27:13 +0200 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2023-06-06 12:21:43 +0200 |
commit | bcc222251e1a750a11e365f2faa641cc56c1169d (patch) | |
tree | 9155784871490afc9855808c50115555d199c28b /lisp/emacs-lisp/comp.el | |
parent | 07c8211ca3075d57dc669946fc4670bb94b79983 (diff) | |
download | emacs-bcc222251e1a750a11e365f2faa641cc56c1169d.tar.gz emacs-bcc222251e1a750a11e365f2faa641cc56c1169d.tar.bz2 emacs-bcc222251e1a750a11e365f2faa641cc56c1169d.zip |
Fix `emacs-lisp-native-compile-and-load' for C-h f (bug#58314)
* lisp/emacs-lisp/comp.el (comp-write-bytecode-file): New function
spilling code from `batch-byte+native-compile'.
(batch-byte+native-compile): Make use of.
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load): Produce the elc file and ask
to have it loaded.
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r-- | lisp/emacs-lisp/comp.el | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 8f40f2f40a0..469f921a38e 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4318,6 +4318,26 @@ last directory in `native-comp-eln-load-path')." else collect (byte-compile-file file)))) +(defun comp-write-bytecode-file (eln-file) + "After native compilation write the bytecode file for ELN-FILE. +Make sure that eln file is younger than byte-compiled one and +return the filename of this last. + +This function can be used only in conjuntion with +`byte+native-compile' `byte-to-native-output-buffer-file' (see +`batch-byte+native-compile')." + (pcase byte-to-native-output-buffer-file + (`(,temp-buffer . ,target-file) + (unwind-protect + (progn + (byte-write-target-file temp-buffer target-file) + ;; Touch the .eln in order to have it older than the + ;; corresponding .elc. + (when (stringp eln-file) + (set-file-times eln-file))) + (kill-buffer temp-buffer)) + target-file))) + ;;;###autoload (defun batch-byte+native-compile () "Like `batch-native-compile', but used for bootstrap. @@ -4333,16 +4353,7 @@ variable \"NATIVE_DISABLED\" is set, only byte compile." (let* ((byte+native-compile t) (byte-to-native-output-buffer-file nil) (eln-file (car (batch-native-compile)))) - (pcase byte-to-native-output-buffer-file - (`(,temp-buffer . ,target-file) - (unwind-protect - (progn - (byte-write-target-file temp-buffer target-file) - ;; Touch the .eln in order to have it older than the - ;; corresponding .elc. - (when (stringp eln-file) - (set-file-times eln-file))) - (kill-buffer temp-buffer)))) + (comp-write-bytecode-file eln-file) (setq command-line-args-left (cdr command-line-args-left))))) ;;;###autoload |