aboutsummaryrefslogtreecommitdiff
path: root/modules/keyboard-macros.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-11 21:07:00 -0500
committerCraig Jennings <c@cjennings.net>2026-07-11 21:07:00 -0500
commit5d8262e7854e43c3a5013d60b8d32fa869bbb924 (patch)
treedc4d4e25aa1a5974aed4a2823502c0ac492a7485 /modules/keyboard-macros.el
parent2f01863f724837759465f2f2bf44d8ccc2e04a6f (diff)
downloaddotemacs-5d8262e7854e43c3a5013d60b8d32fa869bbb924.tar.gz
dotemacs-5d8262e7854e43c3a5013d60b8d32fa869bbb924.zip
fix(keyboard-macros): require user-constants at runtime, drop exit prompt
user-constants was required only at eval-when-compile, but macros-file lives there and every macro-load path reads it at runtime. The byte-compiled module never pulled user-constants, so it worked only because init.el happens to load user-constants first. An isolated load of the .elc left macros-file unbound. Made it a plain require. Dropped cj/save-last-kbd-macro-on-exit and its kill-emacs-hook. On a daemon or systemd shutdown the y-or-n-p and name prompt have no one to answer, and M-<f3> already persists named macros, so unnamed throwaways don't need a shutdown gate.
Diffstat (limited to 'modules/keyboard-macros.el')
-rw-r--r--modules/keyboard-macros.el12
1 files changed, 2 insertions, 10 deletions
diff --git a/modules/keyboard-macros.el b/modules/keyboard-macros.el
index 4e801096..bca36eed 100644
--- a/modules/keyboard-macros.el
+++ b/modules/keyboard-macros.el
@@ -43,7 +43,7 @@
;;; Code:
(require 'subr-x) ;; for string-trim
-(eval-when-compile (require 'user-constants))
+(require 'user-constants) ;; for macros-file, read at runtime
(defvar cj/macros-loaded nil
"Whether saved keyboard macros have been loaded from file.")
@@ -130,15 +130,7 @@ With prefix arg, open the macros file for editing after saving."
(keymap-global-set "C-<f3>" #'cj/kbd-macro-start-or-end)
(keymap-global-set "<f3>" #'call-last-kbd-macro)
(keymap-global-set "M-<f3>" #'cj/save-maybe-edit-macro)
- (keymap-global-set "s-<f3>" #'cj/open-macros-file)
- (add-hook 'kill-emacs-hook #'cj/save-last-kbd-macro-on-exit))
-
-;; Add hook to save any unnamed macros on exit if desired
-(defun cj/save-last-kbd-macro-on-exit ()
- "Save the last keyboard macro before exiting Emacs if it's not saved."
- (when last-kbd-macro
- (when (y-or-n-p "Save last keyboard macro before exiting? ")
- (call-interactively #'cj/save-maybe-edit-macro))))
+ (keymap-global-set "s-<f3>" #'cj/open-macros-file))
;; Auto-call setup after init
(if after-init-time