diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2012-09-26 05:39:22 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2012-09-26 05:44:27 +0200 |
commit | 97956792999e3c58e4216355d5c9a7ac1cf40b7e (patch) | |
tree | f9f3301b9d8d1115c5adb10f2784a3ed2895e6ce | |
parent | ea7baa82c2acf31a236d2eef7e32184721429d6b (diff) | |
download | org-mode-97956792999e3c58e4216355d5c9a7ac1cf40b7e.tar.gz |
Allow to specify the separator used in an outline path.
* lisp/org.el (org-format-outline-path): New argument SEPARATOR to
specify a string that is inserted between parts of the outline path.
(org-display-outline-path): New argument SEPARATOR, to specify a
string that is inserted between parts of the outline path.
-rw-r--r-- | lisp/org.el | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/org.el b/lisp/org.el index 5ee7213..7bfc18c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10836,11 +10836,13 @@ avoiding backtracing. Refile target collection makes use of that." (push (org-match-string-no-properties 4) rtn))) rtn))))) -(defun org-format-outline-path (path &optional width prefix) +(defun org-format-outline-path (path &optional width prefix separator) "Format the outline path PATH for display. -Width is the maximum number of characters that is available. -Prefix is a prefix to be included in the returned string, -such as the file name." +WIDTH is the maximum number of characters that is available. +PREFIX is a prefix to be included in the returned string, +such as the file name. +SEPARATOR is inserted between the different parts of the path, the default +is \"/\"." (setq width (or width 79)) (if prefix (setq width (- width (length prefix)))) (if (not path) @@ -10872,16 +10874,17 @@ such as the file name." (nth (% (1- n) org-n-level-faces) org-level-faces)) h) - path "/"))))) + path (or separator "/")))))) -(defun org-display-outline-path (&optional file current as-string) +(defun org-display-outline-path (&optional file current separator + just-return-string) "Display the current outline path in the echo area. If FILE is non-nil, prepend the output with the file name. If CURRENT is non-nil, append the current heading to the output. -If AS-STRING is non-nil, return a string, don't display a message. -AS-STRING can also be a string which will then replace the \"/\" -separator in the output." +SEPARATOR is passed through to `org-format-outline-path'. It separates +the different parts of the path and defaults to \"/\". +If JUST-RETURN-STRING is non-nil, return a string, don't display a message." (interactive "P") (let* ((bfn (buffer-file-name (buffer-base-buffer))) (case-fold-search nil) @@ -10896,10 +10899,11 @@ separator in the output." (org-format-outline-path path (1- (frame-width)) - (and file bfn (concat (file-name-nondirectory bfn) "/")))) - (when (stringp as-string) - (setq res (replace-regexp-in-string "/" as-string res))) - (if as-string (org-no-properties res) (message "%s" res)))) + separator + (and file bfn (concat (file-name-nondirectory bfn) separator)))) + (if just-return-string + (org-no-properties res) + (message "%s" res)))) (defvar org-refile-history nil "History for refiling operations.") |