(declare-function native-compile "comp")
(declare-function comp-write-bytecode-file "comp")
+(defun emacs-lisp-native-compile ()
+ "Native-compile synchronously the current file (if it has changed)."
+ (interactive nil emacs-lisp-mode)
+ (emacs-lisp--before-compile-buffer)
+ (let* ((byte+native-compile t)
+ (byte-to-native-output-buffer-file nil)
+ (eln (native-compile buffer-file-name)))
+ (when eln
+ (comp-write-bytecode-file eln))))
+
(defun emacs-lisp-native-compile-and-load ()
"Native-compile synchronously the current file (if it has changed).
Load the compiled code when finished.
`native-comp-jit-compilation' set to t to achieve asynchronous
native compilation."
(interactive nil emacs-lisp-mode)
- (emacs-lisp--before-compile-buffer)
- (let ((byte+native-compile t)
- (byte-to-native-output-buffer-file nil))
- (when-let ((eln (native-compile buffer-file-name)))
- (load (file-name-sans-extension (comp-write-bytecode-file eln))))))
+ (when-let ((byte-file (emacs-lisp-native-compile)))
+ (load (file-name-sans-extension byte-file))))
(defun emacs-lisp-macroexpand ()
"Macroexpand the form after point.