From a9695b9d1ac8ac20395602f48eebe165d65c660d Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Fri, 20 Dec 2019 15:14:29 +0100 Subject: [PATCH] Generalize `db/frequently-used-features' to also include shortcuts --- init.el | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/init.el b/init.el index 4da63ae..10a82dd 100644 --- a/init.el +++ b/init.el @@ -643,20 +643,22 @@ ;; * Start Menu via Helm (defcustom db/frequently-used-features - '(("Mail" . db/gnus) - ("Agenda" . db/org-agenda) - ("Init File" . db/find-user-init-file) - ("EMMS" . emms) - ("Shell" . shell) - ("EShell" . eshell) - ("scratch" . db/scratch) - ("Info Lookup" . counsel-info-lookup-symbol) - ("Unicode Lookup" . counsel-unicode-char)) + '(("Mail" ?m db/gnus) + ("Agenda" ?a db/org-agenda) + ("Init File" ?i db/find-user-init-file) + ("EMMS" ?M emms) + ("Shell" ?s db/run-or-hide-shell) + ("EShell" ?e db/run-or-hide-eshell) + ("scratch" ?r db/scratch) + ("Info Lookup" ?I counsel-info-lookup-symbol) + ("Unicode Lookup" ?U counsel-unicode-char)) "Mapping of frequently used features to functions implementing them. Can be used in application shortcuts such as -`db/helm-shortcuts’." +`db/helm-shortcuts’. Each entry is a list of three items: a +short description, a shortcut character, and the function to +call." :group 'personal-settings - :type '(alist :key-type string :value-type sexp)) + :type '(repeat (list string character function))) (defcustom db/important-documents-path "~/Documents/library/" "Path to look for documents that can be listed in extended @@ -671,8 +673,11 @@ With given ARG, display files in `db/important-document-path’." (require 'helm-bookmark) (helm :sources (list (helm-make-source "Frequently Used" 'helm-source-sync - :candidates #'db/frequently-used-features - :action '(("Open" . funcall)) + :candidates (mapcar #'(lambda (entry) + (cons (car entry) + (caddr entry))) + db/frequently-used-features) + :action '(("Open" . call-interactively)) :filtered-candidate-transformer #'helm-adaptive-sort) ;; if prefix arg is given, extrac files from