Browse Source

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.
master
Daniel 1 month ago
parent
commit
22058b1568
No known key found for this signature in database
1 changed files with 20 additions and 17 deletions
  1. 20
    17
      site-lisp/db-org.el

+ 20
- 17
site-lisp/db-org.el View File

@@ -667,23 +667,26 @@ variables `org-agenda-files',
667 667
 `org-agenda-text-search-extra-files', and the current buffer, if
668 668
 ARG is non-nil.  Search is always conducted up to level 9.  If
669 669
 the selected location does not have an associated mark, error
670
-out."
671
-  (let* ((org-refile-targets (if arg
672
-                                 `((org-agenda-files :maxlevel . 9)
673
-                                   (,(cl-remove-if-not
674
-                                      #'stringp org-agenda-text-search-extra-files)
675
-                                    :maxlevel . 9)
676
-                                   (nil :maxlevel . 9))
677
-                                 '((nil :maxlevel . 9))))
678
-         (mrk (nth 3 (org-refile-get-location
679
-                      nil
680
-                      ;; if the current buffer is associated with a file, search
681
-                      ;; through it; otherwise, use the default Org Mode file as
682
-                      ;; default buffer
683
-                      (if (buffer-file-name)
684
-                          nil
685
-                        (get-file-buffer db/org-default-org-file))))))
686
-    (if mrk mrk (user-error "Invalid location"))))
670
+out.  Disable refile cache and any active refile filter hooks to
671
+allow linking to any item."
672
+  (let ((org-refile-target-verify-function nil)
673
+        (org-refile-use-cache nil))
674
+   (let* ((org-refile-targets (if arg
675
+                                  `((org-agenda-files :maxlevel . 9)
676
+                                    (,(cl-remove-if-not
677
+                                       #'stringp org-agenda-text-search-extra-files)
678
+                                     :maxlevel . 9)
679
+                                    (nil :maxlevel . 9))
680
+                                '((nil :maxlevel . 9))))
681
+          (mrk (nth 3 (org-refile-get-location
682
+                       nil
683
+                       ;; if the current buffer is associated with a file, search
684
+                       ;; through it; otherwise, use the default Org Mode file as
685
+                       ;; default buffer
686
+                       (if (buffer-file-name)
687
+                           nil
688
+                         (get-file-buffer db/org-default-org-file))))))
689
+     (if mrk mrk (user-error "Invalid location")))))
687 690
 
688 691
 (defun db/org-find-links-to-current-item (arg)
689 692
   "Find links to current item.

Loading…
Cancel
Save