summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-18 01:59:58 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-18 01:59:58 -0500
commit547d77fbd47b320122e35008aa700bd4a45a5bb0 (patch)
tree886d81a50fb705a819704bb5e29a08ff1d5d11ec /lisp
parentff65eff6f70058d06057e5d796460eeeb9b0234d (diff)
downloademacs.d-547d77fbd47b320122e35008aa700bd4a45a5bb0.tar.gz
Use separate function for org-refile-dwim
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-org.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el
index 85cd684..1fe0c65 100644
--- a/lisp/init-org.el
+++ b/lisp/init-org.el
@@ -453,9 +453,10 @@ displayed in the agenda."
"Exclude DONE state from refile targets."
(not (member (nth 2 (org-heading-components)) org-done-keywords)))
-(defadvice org-refile (around km/org-refile-dwim activate)
+(defun km/org-refile-dwim ()
"Rebind `org-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
@@ -463,7 +464,7 @@ A target is determined by `km/org-refile-dwim-target-file'."
(dwim-target
:maxlevel . ,km/org-refile-dwim-maxlevel))
org-refile-targets)))
- ad-do-it))
+ (call-interactively #'org-refile)))
(defun km/org-refile-dwim-target-file ()
"Return next window that is an Org buffer."
@@ -514,6 +515,10 @@ global value. A numeric prefix sets MAXLEVEL (defaults to 2)."
(define-key km/global-org-map "w" 'org-refile-goto-last-stored)
(define-key km/org-prefix-map "w" 'km/org-refile-to-other-org-buffer)
+(after 'org
+ (define-key org-mode-map [remap org-refile] 'km/org-refile-dwim)
+ (add-to-list 'org-speed-commands-user '("w" . km/org-refile-dwim)))
+
(after 'org-agenda
;; Free up 'j' for `ace-jump-mode'.
(define-key org-agenda-mode-map (kbd "C-j") 'org-agenda-goto-date)