emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 154e1f1 2/5: lisp/org-capture.el: Add a new :refile


From: ELPA Syncer
Subject: [elpa] externals/org 154e1f1 2/5: lisp/org-capture.el: Add a new :refile-targets template option
Date: Sat, 1 May 2021 07:57:10 -0400 (EDT)

branch: externals/org
commit 154e1f19a9fa051443ad8e0b2be24caafff49525
Author: Richard Garner <richard.garner@mq.edu.au>
Commit: Bastien Guerry <bzg@gnu.org>

    lisp/org-capture.el: Add a new :refile-targets template option
    
    * lisp/org-capture.el (org-capture-templates): Add :refile-targets.
    (org-capture-refile): Honor :refile-targets.
    
    TINYCHANGE
---
 lisp/org-capture.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9fbd00c..e067751 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -246,6 +246,10 @@ properties are:
 
  :jump-to-captured   When set, jump to the captured entry when finished.
 
+ :refile-targets     When exiting capture mode via `org-capture-refile', the
+                     variable `org-refile-targets' will be temporarily bound
+                     to the value of this property.
+
  :empty-lines        Set this to the number of lines that should be inserted
                      before and after the new item.  Default 0, only common
                      other value is 1.
@@ -885,7 +889,8 @@ for `entry'-type templates"))
         (pos (make-marker))
         (org-capture-is-refiling t)
         (kill-buffer (org-capture-get :kill-buffer 'local))
-        (jump-to-captured (org-capture-get :jump-to-captured 'local)))
+        (jump-to-captured (org-capture-get :jump-to-captured 'local))
+        (refile-targets (org-capture-get :refile-targets 'local)))
     ;; Since `org-capture-finalize' may alter buffer contents (e.g.,
     ;; empty lines) around entry, use a marker to refer to the
     ;; headline to be refiled.  Place the marker in the base buffer,
@@ -895,11 +900,12 @@ for `entry'-type templates"))
     ;; early.  We want to wait for the refiling to be over, so we
     ;; control when the latter function is called.
     (org-capture-put :kill-buffer nil :jump-to-captured nil)
-    (org-capture-finalize)
-    (save-window-excursion
-      (with-current-buffer base
-       (org-with-point-at pos
-         (call-interactively 'org-refile))))
+    (let ((org-refile-targets (or refile-targets org-refile-targets)))
+      (org-capture-finalize)
+      (save-window-excursion
+        (with-current-buffer base
+         (org-with-point-at pos
+           (call-interactively 'org-refile)))))
     (when kill-buffer
       (with-current-buffer base (save-buffer))
       (kill-buffer base))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]