diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 11201d3..11f87c6 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -595,17 +595,21 @@ This is done only if the value of this variable is not null." ;;; Find items by link to current headline -;; TODO: expand: let the user choose the item that is to be linked to -;; interactively (defun db/org-find-items-linking-by-id (&optional id custom-id) "List all Org Mode items that link to ID. Uses `org-search-view' to conduct the actual search. ID must be a UUID as generated by, e.g., `org-id-get-create', and CUSTOM-ID -must consist of ASCII letters, numbers, and hyphens only. If ID -and CUSTOM-ID are not given, use the values of the current item -if in Org Mode." - (interactive (when (derived-mode-p 'org-mode) - (list (org-id-get) (org-entry-get nil "CUSTOM_ID")))) +must consist of ASCII letters, numbers, and hyphens only. When +called interactively in Org Mode, use the values ID and CUSTOM_ID +of the current item. When called interactively outside of Org +Mode, prompt the user for the user for a headline." + (interactive (if (derived-mode-p 'org-mode) + (list (org-id-get) (org-entry-get nil "CUSTOM_ID")) + (let ((pom (nth 3 (org-refile-get-location)))) + (if (not pom) + (user-error "Invalid location") + (org-with-point-at pom + (list (org-id-get) (org-entry-get nil "CUSTOM_ID"))))))) (unless (or (not id) (and (stringp id)