From 044dbf680e4262b6e9ad154f448fa63018c2ef88 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 25 Sep 2012 03:43:41 +0200 Subject: [PATCH] org.el (org-display-outline-path): New argument `as-string' * org.el (org-display-outline-path): New argument `as-string'. This useful if you want to display the outline path in the minibuffer like this: (add-hook 'org-mode-hook (lambda() (add-to-list 'mode-line-format '(:eval (org-display-outline-path nil t t)) t))) --- lisp/org.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 3a7cab0b0..6b782b2b0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10870,22 +10870,24 @@ such as the file name." h) path "/"))))) -(defun org-display-outline-path (&optional file current) +(defun org-display-outline-path (&optional file current as-string) "Display the current outline path in the echo area." (interactive "P") (let* ((bfn (buffer-file-name (buffer-base-buffer))) (case-fold-search nil) - (path (and (derived-mode-p 'org-mode) (org-get-outline-path)))) + (path (and (derived-mode-p 'org-mode) (org-get-outline-path))) + res) (if current (setq path (append path (save-excursion (org-back-to-heading t) (if (looking-at org-complex-heading-regexp) (list (match-string 4))))))) - (message "%s" - (org-format-outline-path - path - (1- (frame-width)) - (and file bfn (concat (file-name-nondirectory bfn) "/")))))) + (setq res + (org-format-outline-path + path + (1- (frame-width)) + (and file bfn (concat (file-name-nondirectory bfn) "/")))) + (if as-string (org-no-properties res) (message "%s" res)))) (defvar org-refile-history nil "History for refiling operations.")