diff options
-rw-r--r-- | init.org | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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) |