From 66d32f0ff8661350d4e1ba497a50b50957bb7a4b Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Mon, 16 Jun 2025 12:23:31 +0200 Subject: [PATCH] Make redefinition of frequently used features keymap work Replaced keymap with prefix funtion for this. Not completely understood yet what I am doing here. --- init.el | 5 +++-- site-lisp/db-customize.el | 13 +++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/init.el b/init.el index 7a06592..39e4b81 100644 --- a/init.el +++ b/init.el @@ -92,7 +92,8 @@ db/org-default-home-file db/org-default-notes-file db/org-default-refile-file - db/after-init-load-files)) + db/after-init-load-files + db/frequently-used-features-prefix)) ;; * Core Configuration @@ -3111,7 +3112,7 @@ eventuelly be set to nil, however)." (bind-key "" #'winner-redo) (bind-key "" 'scroll-lock-mode) (bind-key "" #'db/run-or-hide-eshell) - (bind-key "" db/frequently-used-features-map) ; TODO: this does not update when the keymap is changed + (bind-key "" #'db/frequently-used-features-prefix) (bind-key "" #'project-find-regexp) (bind-key "" #'text-scale-adjust) (bind-key "" #'dictcc) diff --git a/site-lisp/db-customize.el b/site-lisp/db-customize.el index e8441b6..7b4fbd8 100644 --- a/site-lisp/db-customize.el +++ b/site-lisp/db-customize.el @@ -148,9 +148,6 @@ in the main agenda view." :group 'personal-settings :type '(choice (const nil) file)) -(defvar db/frequently-used-features-map (make-sparse-keymap) - "Functions from `db/frequently-used-features' bound to shortcuts.") - (defcustom db/frequently-used-features '(("Mail" ?m db/gnus) ("Agenda" ?a db/org-agenda) @@ -177,11 +174,11 @@ character, nil can be chosen, in which case no entry in the :type '(repeat (list string (choice character (const nil)) function)) :set #'(lambda (symbol value) (set-default symbol value) - (setq db/frequently-used-features-map (make-sparse-keymap)) - (mapc #'(lambda (entry) - (pcase-let ((`(_ ,shortcut ,function) entry)) - (keymap-set db/frequently-used-features-map (string shortcut) function))) - db/frequently-used-features))) + (let ((map (make-sparse-keymap))) + (mapc (pcase-lambda (`(_ ,shortcut ,function)) + (keymap-set map (string shortcut) function)) + value) + (fset 'db/frequently-used-features-prefix map))))