summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--init.org14
1 files changed, 14 insertions, 0 deletions
diff --git a/init.org b/init.org
index 2043a56..5b250fa 100644
--- a/init.org
+++ b/init.org
@@ -2269,6 +2269,20 @@
(message "Symbol not bound: %S" symbol)))))
(t (message "No symbol at point"))))
+
+ (defun elisp-bytecompile-and-load ()
+ (interactive)
+ (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.
+ (when (and (buffer-modified-p)
+ (y-or-n-p (format "save buffer %s first? " (buffer-name))))
+ (save-buffer))
+ (let ((filename (expand-file-name buffer-file-name)))
+ (with-temp-buffer
+ (byte-compile-file filename t))))
+
(use-package elisp-mode
:bind (:map emacs-lisp-mode-map
(("C-c C-m" . elisp-macroexpand)