diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-org.el | 9 |
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) |