Allow adding links to other items without refile verification

We are only using the refile mechanism for convenience here, and not for actual
refiling.  The refile verification function is thus not relevant here.  To take
effect, we also have to ignore the cache, as it may hold precomputed targets
that have used the refile verification function in a previous run.
This commit is contained in:
Daniel - 2021-03-26 16:47:22 +01:00
parent d6584ef521
commit 22058b1568
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 20 additions and 17 deletions

View File

@ -667,23 +667,26 @@ variables `org-agenda-files',
`org-agenda-text-search-extra-files', and the current buffer, if `org-agenda-text-search-extra-files', and the current buffer, if
ARG is non-nil. Search is always conducted up to level 9. If ARG is non-nil. Search is always conducted up to level 9. If
the selected location does not have an associated mark, error the selected location does not have an associated mark, error
out." out. Disable refile cache and any active refile filter hooks to
(let* ((org-refile-targets (if arg allow linking to any item."
`((org-agenda-files :maxlevel . 9) (let ((org-refile-target-verify-function nil)
(,(cl-remove-if-not (org-refile-use-cache nil))
#'stringp org-agenda-text-search-extra-files) (let* ((org-refile-targets (if arg
:maxlevel . 9) `((org-agenda-files :maxlevel . 9)
(nil :maxlevel . 9)) (,(cl-remove-if-not
'((nil :maxlevel . 9)))) #'stringp org-agenda-text-search-extra-files)
(mrk (nth 3 (org-refile-get-location :maxlevel . 9)
nil (nil :maxlevel . 9))
;; if the current buffer is associated with a file, search '((nil :maxlevel . 9))))
;; through it; otherwise, use the default Org Mode file as (mrk (nth 3 (org-refile-get-location
;; default buffer nil
(if (buffer-file-name) ;; if the current buffer is associated with a file, search
nil ;; through it; otherwise, use the default Org Mode file as
(get-file-buffer db/org-default-org-file)))))) ;; default buffer
(if mrk mrk (user-error "Invalid location")))) (if (buffer-file-name)
nil
(get-file-buffer db/org-default-org-file))))))
(if mrk mrk (user-error "Invalid location")))))
(defun db/org-find-links-to-current-item (arg) (defun db/org-find-links-to-current-item (arg)
"Find links to current item. "Find links to current item.