summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Reuße <seb@wirrsal.net>2017-05-06 08:38:45 +0200
committerKyle Meyer <kyle@kyleam.com>2017-05-06 12:01:20 -0400
commit1188beaa3bd66cca094628be680ac109e3fe91e8 (patch)
tree2d62aa055c827aadb4e7d4af81c7309ea86ee605
parent53bcf91a967f8fb3ef5ee68b95318cdab235694e (diff)
downloadorg-mode-1188beaa3bd66cca094628be680ac109e3fe91e8.tar.gz
org-refile: Optionally prefix refile targets with buffer name
* org.el (org-refile-get-targets): Add case to optionally prefix refile targets with the buffer name. (org-refile-use-outline-path): Add new option setting and document. Having an option to use the buffer name as a prefix is convenient, since this will work hand in hand with uniquify to only show those parts of the filesystem path needed to disambiguate buffers of identically named files, as opposed to prefixing refile targets with the full filesystem path.
-rw-r--r--lisp/org.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 5d8166c..0e41edb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2553,13 +2553,16 @@ When the value is `file', also include the file name (without directory)
into the path. In this case, you can also stop the completion after
the file name, to get entries inserted as top level in the file.
-When `full-file-path', include the full file path."
+When `full-file-path', include the full file path.
+
+When `buffer-name', use the buffer name."
:group 'org-refile
:type '(choice
(const :tag "Not" nil)
(const :tag "Yes" t)
(const :tag "Start with file name" file)
- (const :tag "Start with full file path" full-file-path)))
+ (const :tag "Start with full file path" full-file-path)
+ (const :tag "Start with buffer name" buffer-name)))
(defcustom org-outline-path-complete-in-steps t
"Non-nil means complete the outline path in hierarchical steps.
@@ -11557,6 +11560,8 @@ order.")
(setq f (and f (expand-file-name f)))
(when (eq org-refile-use-outline-path 'file)
(push (list (file-name-nondirectory f) f nil nil) tgs))
+ (when (eq org-refile-use-outline-path 'buffer-name)
+ (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
(org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -11585,6 +11590,9 @@ order.")
(`full-file-path
(list (buffer-file-name
(buffer-base-buffer))))
+ (`buffer-name
+ (list (buffer-name
+ (buffer-base-buffer))))
(_ nil))
(mapcar #'org-protect-slash
(org-get-outline-path t t)))