summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-09-25 03:43:41 +0200
committerBastien Guerry <bzg@altern.org>2012-09-25 03:43:41 +0200
commit044dbf680e4262b6e9ad154f448fa63018c2ef88 (patch)
treeb423110867f90cded838e6f3effb306c1fef2010
parentbf072bd647f7a83d84800487e9e60b981b4ceb83 (diff)
downloadorg-mode-044dbf680e4262b6e9ad154f448fa63018c2ef88.tar.gz
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)))
-rw-r--r--lisp/org.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 3a7cab0..6b782b2 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.")