Introduce hydra for managing links between Org mode items

It's easier to use and easier to keep track of what is available.  It also saves
key precious bindings!
This commit is contained in:
Daniel - 2021-03-20 15:45:49 +01:00
parent 77920dd9a2
commit 78b202aed7
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
2 changed files with 13 additions and 3 deletions

View File

@ -175,14 +175,13 @@
(bind-key "<XF86Back>" #'winner-undo) (bind-key "<XF86Back>" #'winner-undo)
(bind-key "<XF86Forward>" #'winner-redo) (bind-key "<XF86Forward>" #'winner-redo)
(bind-key "<f10>" #'magit-status) (bind-key "<f10>" #'magit-status)
(bind-key "<f11>" #'db/org-find-links-to-current-item)
(bind-key "<f1>" #'db/run-or-hide-eshell) (bind-key "<f1>" #'db/run-or-hide-eshell)
(bind-key "<f2>" #'hydra-feature-shortcuts/body) (bind-key "<f2>" #'hydra-feature-shortcuts/body)
(bind-key "<f5>" (if (executable-find "ag") #'counsel-ag #'rgrep)) (bind-key "<f5>" (if (executable-find "ag") #'counsel-ag #'rgrep))
(bind-key "<f6>" #'hydra-zoom/body) (bind-key "<f6>" #'hydra-zoom/body)
(bind-key "<f7>" #'dictcc) (bind-key "<f7>" #'dictcc)
(bind-key "<f8>" #'bm-toggle) (bind-key "<f8>" #'bm-toggle)
(bind-key "<f9>" #'db/org-add-link-to-other-item) (bind-key "<f9>" #'hydra-org-linking/body)
(bind-key "<C-f8>" #'bm-next) (bind-key "<C-f8>" #'bm-next)
(bind-key "<C-S-f8>" #'bm-previous) (bind-key "<C-S-f8>" #'bm-previous)
(bind-key "C-," #'mc/skip-to-previous-like-this) (bind-key "C-," #'mc/skip-to-previous-like-this)
@ -732,7 +731,8 @@
db/org-copy-template-for-periodic-task db/org-copy-template-for-periodic-task
db/org-find-links-to-current-item db/org-find-links-to-current-item
db/org-add-link-to-other-item db/org-add-link-to-other-item
db/org-add-link-to-current-clock)) db/org-add-link-to-current-clock
hydra-org-linking/body))
(use-package org (use-package org
:pin "gnu" :pin "gnu"

View File

@ -733,6 +733,16 @@ in an Org Mode buffer or when the clock is not active."
(pcase-let ((`(,location ,description) (cl-first org-stored-links))) (pcase-let ((`(,location ,description) (cl-first org-stored-links)))
(org-insert-link nil location description))) (org-insert-link nil location description)))
(defhydra hydra-org-linking (:color blue :hint none)
"\nLinking between Org mode items.
_c_urrent clock _o_ther item (current buffer or default Org file)
_b_acklinks to current item _O_ther item (all text files)
"
("c" (db/org-add-link-to-current-clock))
("o" (db/org-add-link-to-other-item nil))
("O" (db/org-add-link-to-other-item t))
("b" db/org-find-links-to-current-item))
;;; End ;;; End