Remove unused `hydra-shortcuts'
The idea of having a hydra to access frequently used features is certainly nice, but quite hard to achive when one wants to redefine the hydra every time `db/frequently-used-features' changes. Regrettably, there are not „ephemeral hydras“ that are created every time one would like to access it. Therefore, the shortcuts hydra is removed for now, but may come back again when we have found a better way to handle its dynamic nature.
This commit is contained in:
parent
c96083c871
commit
6183e008d7
26
init.el
26
init.el
|
@ -162,7 +162,6 @@
|
|||
(bind-key "<XF86Back>" #'winner-undo)
|
||||
(bind-key "<XF86Forward>" #'winner-redo)
|
||||
(bind-key "<f1>" #'db/run-or-hide-eshell)
|
||||
(bind-key "<f2>" #'hydra-shortcuts/body)
|
||||
(bind-key "<f5>" #'rgrep)
|
||||
(bind-key "<f6>" #'hydra-zoom/body)
|
||||
(bind-key "<f7>" #'dictcc)
|
||||
|
@ -579,9 +578,7 @@
|
|||
(use-package db-hydras
|
||||
:commands (hydra-toggle/body
|
||||
hydra-zoom/body
|
||||
hydra-rectangle/body
|
||||
hydra-shortcuts/body
|
||||
db/define-hydra-from-frequently-used-features))
|
||||
hydra-rectangle/body))
|
||||
|
||||
(use-package git-commit
|
||||
:commands (global-git-commit-mode))
|
||||
|
@ -630,27 +627,6 @@
|
|||
|
||||
;; * Start Menu via Helm
|
||||
|
||||
(defcustom db/frequently-used-features
|
||||
'(("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’. Each entry is a list of three items: a
|
||||
short description, a shortcut character, and the function to
|
||||
call."
|
||||
:group 'personal-settings
|
||||
:type '(repeat (list string character function))
|
||||
:set #'(lambda (symbol value)
|
||||
(set symbol value)
|
||||
(db/define-hydra-from-frequently-used-features)))
|
||||
|
||||
(defun db/helm-shortcuts (arg)
|
||||
"Open helm completion on common locations.
|
||||
With given ARG, display files in `db/important-document-path’."
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
(require 'gnutls)
|
||||
|
||||
|
||||
|
||||
(defgroup personal-settings nil
|
||||
"A bunch of functions and variables for personalizing emacs."
|
||||
:prefix "db/"
|
||||
|
@ -128,6 +130,25 @@ in the main agenda view."
|
|||
:group 'personal-settings
|
||||
:type '(choice (const nil) file))
|
||||
|
||||
(defcustom db/frequently-used-features
|
||||
'(("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’. Each entry is a list of three items: a
|
||||
short description, a shortcut character, and the function to
|
||||
call. Customizing this variable redefines the global
|
||||
`hydra-shortcuts' mapping."
|
||||
:group 'personal-settings
|
||||
:type '(repeat (list string character function)))
|
||||
|
||||
|
||||
|
||||
(provide 'db-customize)
|
||||
|
|
|
@ -52,24 +52,5 @@ _h_ _l_ _o_k _y_ank
|
|||
("e" rectangle-exchange-point-and-mark nil)
|
||||
("o" nil nil))
|
||||
|
||||
(defun hydra-shortcuts/body ()
|
||||
"Dummy default value for shortcuts hydra. Will simply barf."
|
||||
(interactive)
|
||||
(user-error "Shortcuts Hydra not defined yet."))
|
||||
|
||||
(defun db/define-hydra-from-frequently-used-features ()
|
||||
"Defines `hydra-shortcuts/body' based on the current value of
|
||||
`db/frequently-used-features'. Raises an error if the latter is
|
||||
not bound."
|
||||
(if (not (boundp 'db/frequently-used-features))
|
||||
(user-error "Variable `db/frequently-used-features' is not defined, please set that variable first.")
|
||||
(eval
|
||||
`(defhydra hydra-shortcuts (:color blue)
|
||||
""
|
||||
,@(mapcar (lambda (entry)
|
||||
(pcase-let ((`(,description ,shortcut ,function) entry))
|
||||
(list (string shortcut) function description)))
|
||||
db/frequently-used-features)))))
|
||||
|
||||
(provide 'db-hydras)
|
||||
;; db-hydras.el ends here
|
||||
|
|
Loading…
Reference in New Issue