Compare commits

..

No commits in common. "0946628681fb054911fb3e74c38df3ccb4e4cb5b" and "42d25198d9c4b72e65e521e9b36bf2339d930c80" have entirely different histories.

2 changed files with 14 additions and 24 deletions

1
.gitignore vendored
View File

@ -57,4 +57,3 @@
/dired-history
/sandbox/.emacs.d
/flycheck_init.el
/projects

View File

@ -661,20 +661,17 @@ not."
(t (user-error "Neither ID nor CUSTOM_ID given")))))
(org-search-view nil query)))
(defun db/org--get-location (&optional arg)
(defun db/org--get-location ()
"Interactively query for location and return mark.
Searches through the current file, and through all of
`org-agenda-files', `org-agenda-text-search-extra-files', and the
current buffer, if ARG is non-nil. Search is always conducted up
to level 9. If the selected location does not have an associated
mark, error out."
(let* ((org-refile-targets (if arg
`((org-agenda-files :maxlevel . 9)
(,(cl-remove-if-not
#'stringp org-agenda-text-search-extra-files)
:maxlevel . 9)
(nil :maxlevel . 9))
'((nil :maxlevel . 9))))
Searches through `org-agenda-files',
`org-agenda-text-search-extra-files', and the current buffer, up
to level 9. If location does not have an associated mark, error
out."
(let* ((org-refile-targets `((org-agenda-files :maxlevel . 9)
(,(cl-remove-if-not
#'stringp org-agenda-text-search-extra-files)
:maxlevel . 9)
(nil :maxlevel . 9)))
(mrk (nth 3 (org-refile-get-location
nil
;; if the current buffer is associated with a file, search
@ -698,20 +695,14 @@ prompt for an item."
(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 ()
"Interactively query for item and add link to it at point.
Search through all items of the current buffer, or
`db/org-default-org-file' if the current buffer is not associated
with a file. If ARG is non-nil, include all files in
`org-agenda-files' and `org-agenda-text-search-extra-files' in
this search.
Use `org-store-link' to save link to `org-stored-links'."
(interactive "P")
(interactive)
(unless (derived-mode-p 'org-mode)
(user-error "Not in Org Mode"))
(let ((pom (db/org--get-location arg)))
(let ((pom (db/org--get-location))
id item)
(save-mark-and-excursion
(org-with-point-at pom
(org-store-link nil t))