[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp a214882 5/8: * Add to elisp-mode `emacs-lisp-native-
From: |
Andrea Corallo |
Subject: |
feature/native-comp a214882 5/8: * Add to elisp-mode `emacs-lisp-native-compile-and-load' |
Date: |
Wed, 11 Nov 2020 19:03:07 -0500 (EST) |
branch: feature/native-comp
commit a214882354c7b0f4842698b5a1a65db6806853a2
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Add to elisp-mode `emacs-lisp-native-compile-and-load'
* lisp/progmodes/elisp-mode.el
(emacs-lisp--before-compile-buffer): New function.
(emacs-lisp-byte-compile-and-load): Use the previous.
(emacs-lisp-native-compile-and-load): New function.
---
lisp/progmodes/elisp-mode.el | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 12788ea..dac3aaf 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -186,19 +186,34 @@ All commands in `lisp-mode-shared-map' are inherited by
this map.")
(byte-compile-file buffer-file-name)
(error "The buffer must be saved in a file first")))
-(defun emacs-lisp-byte-compile-and-load ()
- "Byte-compile the current file (if it has changed), then load compiled code."
- (interactive)
+(defun emacs-lisp--before-compile-buffer ()
+ "Make sure the buffer is saved before compiling."
(or buffer-file-name
(error "The buffer must be saved in a file first"))
- (require 'bytecomp)
;; Recompile if file or buffer has changed since last compilation.
(if (and (buffer-modified-p)
(y-or-n-p (format "Save buffer %s first? " (buffer-name))))
- (save-buffer))
+ (save-buffer)))
+
+(defun emacs-lisp-byte-compile-and-load ()
+ "Byte-compile the current file (if it has changed), then load compiled code."
+ (interactive)
+ (emacs-lisp--before-compile-buffer)
+ (require 'bytecomp)
(byte-recompile-file buffer-file-name nil 0)
(load buffer-file-name))
+(defun emacs-lisp-native-compile-and-load ()
+ "Native-compile synchronously the current file (if it has changed).
+Load the compiled code when finished.
+
+Use `emacs-lisp-byte-compile-and-load' in combination with
+`comp-deferred-compilation' set to `t' to achieve asynchronous
+native compilation."
+ (interactive)
+ (emacs-lisp--before-compile-buffer)
+ (load (native-compile buffer-file-name)))
+
(defun emacs-lisp-macroexpand ()
"Macroexpand the form after point.
Comments in the form will be lost."
- feature/native-comp updated (e20cdf9 -> 2435c10), Andrea Corallo, 2020/11/11
- feature/native-comp e96cd4e 2/8: Add initial nativecomp typeset and range propagation support, Andrea Corallo, 2020/11/11
- feature/native-comp 00b4e0a 4/8: * Fix limple-mode for new type and range limple semantic, Andrea Corallo, 2020/11/11
- feature/native-comp c3d0e2a 1/8: * Rename two nativecomp functions, Andrea Corallo, 2020/11/11
- feature/native-comp a214882 5/8: * Add to elisp-mode `emacs-lisp-native-compile-and-load',
Andrea Corallo <=
- feature/native-comp 6b7c257 6/8: * Unline some functions to optimize bootstrap time, Andrea Corallo, 2020/11/11
- feature/native-comp 2435c10 8/8: * Nativecomp testsuite rework for derived return type specifiers, Andrea Corallo, 2020/11/11
- feature/native-comp 175efec 3/8: Add a nativecomp testcase, Andrea Corallo, 2020/11/11
- feature/native-comp 93a80a4 7/8: * Add nativecomp derived return type specifier computation support, Andrea Corallo, 2020/11/11