summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-org.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/km-org.el b/lisp/km-org.el
index b1cd833..29df941 100644
--- a/lisp/km-org.el
+++ b/lisp/km-org.el
@@ -514,6 +514,19 @@ A target is determined by `km/org-refile-dwim-target-file'."
org-refile-targets)))
(call-interactively #'org-refile)))
+(defun km/org-agenda-refile-dwim ()
+ "Rebind `org-agenda-refile-targets' if next window is an Org buffer.
+A target is determined by `km/org-refile-dwim-target-file'."
+ (interactive)
+ (let* ((dwim-target (km/org-refile-dwim-target-file))
+ (org-refile-targets (if dwim-target
+ `((nil
+ :maxlevel . ,km/org-refile-dwim-maxlevel)
+ (dwim-target
+ :maxlevel . ,km/org-refile-dwim-maxlevel))
+ org-refile-targets)))
+ (call-interactively #'org-agenda-refile)))
+
(defun km/org-refile-dwim-target-file ()
"Return next window that is an Org buffer."
(let* ((from-buffer (current-buffer))