0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-22 13:10:42 +00:00

org.el (org-display-outline-path): Allow a string value for the `as-string' parameter

* org.el (org-display-outline-path): Allow a string value for
the `as-string' parameter.  Such a value will replace the "/"
separator in the output.

Thanks to Sébastien Vauban for triggering this.
This commit is contained in:
Bastien Guerry 2012-09-25 14:47:58 +02:00
parent 9ebf9c169e
commit 4512f88c3c

View file

@ -10871,7 +10871,13 @@ such as the file name."
path "/"))))) path "/")))))
(defun org-display-outline-path (&optional file current as-string) (defun org-display-outline-path (&optional file current as-string)
"Display the current outline path in the echo area." "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."
(interactive "P") (interactive "P")
(let* ((bfn (buffer-file-name (buffer-base-buffer))) (let* ((bfn (buffer-file-name (buffer-base-buffer)))
(case-fold-search nil) (case-fold-search nil)
@ -10887,6 +10893,8 @@ such as the file name."
path path
(1- (frame-width)) (1- (frame-width))
(and file bfn (concat (file-name-nondirectory bfn) "/")))) (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)))) (if as-string (org-no-properties res) (message "%s" res))))
(defvar org-refile-history nil (defvar org-refile-history nil