Allow to show backlinks directly from Org agenda buffers

This is more convenient than to first switch to the item in the corrsponding Org
mode buffer and then querying for its backlinks.
This commit is contained in:
Daniel - 2021-03-27 10:39:53 +01:00
parent 732323edfc
commit 96638b09e4
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 13 additions and 6 deletions

View File

@ -704,14 +704,21 @@ linking to any item."
"Find links to current item. "Find links to current item.
Only links using the ID or CUSTOM_ID property are considered. Only links using the ID or CUSTOM_ID property are considered.
If ARG is given, or if not in an Org Mode buffer, interactively If ARG is given, or if neither in an Org Mode buffer nor on a
prompt for an item." headline in an Org Agenda buffer, interactively prompt for an
item."
(interactive "P") (interactive "P")
(apply #'db/org-find-items-linking-by-id (apply #'db/org-find-items-linking-by-id
(if (and (derived-mode-p 'org-mode) (not arg)) (cond ((and (not arg) (derived-mode-p 'org-mode))
(list (org-id-get) (org-entry-get nil "CUSTOM_ID")) (list (org-id-get) (org-entry-get nil "CUSTOM_ID")))
(org-with-point-at (db/org--get-location) ((and (not arg)
(list (org-id-get) (org-entry-get nil "CUSTOM_ID")))))) (derived-mode-p 'org-agenda-mode)
(org-get-at-bol 'org-hd-marker))
(org-with-point-at (org-get-at-bol 'org-hd-marker)
(list (org-id-get) (org-entry-get nil "CUSTOM_ID"))))
(t
(org-with-point-at (db/org--get-location)
(list (org-id-get) (org-entry-get nil "CUSTOM_ID")))))))
(defun db/org-add-link-to-other-item (arg) (defun db/org-add-link-to-other-item (arg)
"Interactively query for item and add link to it at point. "Interactively query for item and add link to it at point.