aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/org-capture-config.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/org-capture-config.el b/modules/org-capture-config.el
index 14fb8e58..292e26a7 100644
--- a/modules/org-capture-config.el
+++ b/modules/org-capture-config.el
@@ -144,6 +144,23 @@ re-scanning large target files after the first successful lookup."
(advice-add 'org-capture-set-target-location
:around #'cj/org-capture--set-target-location-advice))
+;; --------------------------- Capture F-Key Guard -----------------------------
+;; The global popup keys (F1 dashboard sweep, F10 music, F11 dirvish-side,
+;; F12 terminal, M-SPC agent swap) fire even while a capture is in progress
+;; and pop their UI over the capture popup. org-capture-mode is a minor
+;; mode active exactly for the capture's duration and its keymap shadows
+;; the global map, so blocking the keys there scopes the guard precisely:
+;; the moment the capture finalizes or aborts, the keys work again.
+
+(defun cj/--org-capture-blocked-key ()
+ "Refuse a global popup key while a capture is in progress."
+ (interactive)
+ (user-error "Key disabled during capture -- finalize with C-c C-c or abort with C-c C-k"))
+
+(with-eval-after-load 'org-capture
+ (dolist (key '("<f1>" "<f10>" "<f11>" "<f12>" "M-SPC"))
+ (keymap-set org-capture-mode-map key #'cj/--org-capture-blocked-key)))
+
;; ----------------------- Project-Aware Capture Target ------------------------
;; C-c c t (Task) and C-c c b (Bug) file into the current projectile project's
;; todo.org under its "... Open Work" heading. Outside a project they fall back