瀏覽代碼

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.
master
Daniel 2 月之前
父節點
當前提交
96638b09e4
沒有發現已知的金鑰在資料庫的簽署中
共有 1 個文件被更改,包括 13 次插入6 次删除
  1. 13
    6
      site-lisp/db-org.el

+ 13
- 6
site-lisp/db-org.el 查看文件

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

Loading…
取消
儲存