ソースを参照

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 3ヶ月前
コミット
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.

読み込み中…
キャンセル
保存