summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-09-21 23:51:11 -0400
committerKyle Meyer <kyle@kyleam.com>2016-09-21 23:51:11 -0400
commit07a3c384b42b2e9ab8bdbd9bf7bdf67c0f8d293c (patch)
treec88ef273f843081b5650047bd07510babf03d01b /lisp
parenta8ba6e87e3712c264c4687b26bccdfd66d8c9ccb (diff)
downloademacs.d-07a3c384b42b2e9ab8bdbd9bf7bdf67c0f8d293c.tar.gz
Add org-agenda-refile-dwim command
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))