From 091da4191417e8f1d2cb8debe0233fb317ef5729 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 25 Oct 2021 21:55:44 +0100 Subject: missing elisp spicy helper --- init.org | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'init.org') 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) -- cgit v1.2.3