diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-04-13 22:57:29 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-04-13 22:57:29 -0400 |
commit | 6aaa4a2193f3be9732b593c752ac21bfc0d9f03c (patch) | |
tree | 37b83cadeee5c9de4b14e88beea15c9d0759cfd4 /lisp | |
parent | c6a0f6e91241e877d5896e331fbe4c799015db36 (diff) | |
download | emacs.d-6aaa4a2193f3be9732b593c752ac21bfc0d9f03c.tar.gz |
Add function to set buffer for Org refiling
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-org.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el index 1e9ab6b..4785590 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -214,6 +214,20 @@ A numeric prefix can be given to set MAXLEVEL (defaults to 2)." (org-icompleting-read "Buffer: " (mapcar 'buffer-name (org-buffer-list 'files))))) +(defun km/org-set-refiling-buffer (maxlevel) + "Choose buffer to set as sole target in `org-refile-targets'. +If `org-refile-targets' is already a local variable, restore the +global value. A numeric prefix can be given to set +MAXLEVEL (defaults to 2)." + (interactive "P") + (if (local-variable-p 'org-refile-targets) + (kill-local-variable 'org-refile-targets) + (let* ((buffer-file (substring-no-properties + (buffer-file-name (km/get-org-file-buffer)))) + (maxlevel (prefix-numeric-value (or maxlevel 2)))) + (set (make-local-variable 'org-refile-targets) + `((,buffer-file :maxlevel . ,maxlevel)))))) + (eval-after-load 'org '(add-to-list 'org-mode-hook '(lambda () |