Allow nil as shortcut character in frequently used features
This results in no entry being defined in the corresponding hydra.
This commit is contained in:
parent
0aa8140e22
commit
a511e9e73a
|
@ -153,9 +153,11 @@ them. Can be used in application shortcuts such as
|
||||||
`db/helm-shortcuts’. Each entry is a list of three items: a
|
`db/helm-shortcuts’. Each entry is a list of three items: a
|
||||||
short description, a shortcut character, and the function to
|
short description, a shortcut character, and the function to
|
||||||
call. Customizing this variable redefines the global
|
call. Customizing this variable redefines the global
|
||||||
`hydra-shortcuts' mapping."
|
`hydra-feature-shortcuts'. Instead of a shortcut character, nil
|
||||||
|
can be chosen, in which case no entry in the
|
||||||
|
`hydra-feature-shortcuts' will be generated."
|
||||||
:group 'personal-settings
|
:group 'personal-settings
|
||||||
:type '(repeat (list string character function))
|
:type '(repeat (list string (choice character (const nil)) function))
|
||||||
:set #'(lambda (symbol value)
|
:set #'(lambda (symbol value)
|
||||||
(set-default symbol value)
|
(set-default symbol value)
|
||||||
;; Update hydra when already possible available
|
;; Update hydra when already possible available
|
||||||
|
|
|
@ -60,14 +60,19 @@ _h_ _l_ _o_k _y_ank
|
||||||
;; `db/frequently-used-features'.
|
;; `db/frequently-used-features'.
|
||||||
|
|
||||||
(defun db/define-feature-shortcuts-hydra ()
|
(defun db/define-feature-shortcuts-hydra ()
|
||||||
"Globally define `hydra-feature-shortcuts' for feature shortcuts."
|
"Globally define `hydra-feature-shortcuts' for feature shortcuts.
|
||||||
|
If instead of a shortcut character nil is provided, no entry in
|
||||||
|
the hydra will be generated. See documentation of
|
||||||
|
`db/frequently-used-features' for details."
|
||||||
(eval
|
(eval
|
||||||
`(defhydra hydra-feature-shortcuts (:color blue)
|
`(defhydra hydra-feature-shortcuts (:color blue)
|
||||||
""
|
""
|
||||||
,@(mapcar (lambda (entry)
|
,@(mapcar (lambda (entry)
|
||||||
(pcase-let ((`(,description ,shortcut ,function) entry))
|
(pcase-let ((`(,description ,shortcut ,function) entry))
|
||||||
(list (string shortcut) function description)))
|
(list (string shortcut) function description)))
|
||||||
db/frequently-used-features))))
|
(cl-remove-if #'(lambda (entry)
|
||||||
|
(null (cl-second entry)))
|
||||||
|
db/frequently-used-features)))))
|
||||||
|
|
||||||
(db/define-feature-shortcuts-hydra)
|
(db/define-feature-shortcuts-hydra)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue