emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Breadcrumbs?
@ 2012-09-24 21:36 Ken Williams
  2012-09-25  0:44 ` Breadcrumbs? Anthony Lander
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Ken Williams @ 2012-09-24 21:36 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 946 bytes --]

Has anyone ever tried implementing a "breadcrumbs"-type feature in org-mode?  By that I mean something that would quickly tell you the headings up the whole path to the root, to quickly orient yourself when you're deep within a document.  I was originally thinking of something always-present shown at the top of the frame, but maybe it would be better as something shown on demand in the minibuffer, possibly making it taller while shown.

--
Ken Williams, Senior Research Scientist
WindLogics
http://windlogics.com


________________________________
CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please contact the sender via reply e-mail and destroy all copies of the original message. Thank you.

[-- Attachment #2: Type: text/html, Size: 2998 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-24 21:36 Breadcrumbs? Ken Williams
@ 2012-09-25  0:44 ` Anthony Lander
  2012-09-25  9:27   ` Breadcrumbs? Sebastien Vauban
  2012-09-25 17:44   ` Breadcrumbs? Ken Williams
  2012-09-25  0:59 ` Breadcrumbs? Bastien
  2012-09-25  1:20 ` Breadcrumbs? Eric Abrahamsen
  2 siblings, 2 replies; 18+ messages in thread
From: Anthony Lander @ 2012-09-25  0:44 UTC (permalink / raw)
  To: Ken Williams; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

Hi Ken,

On 12-Sep-24, at 5:36 PM, Ken Williams wrote:

> Has anyone ever tried implementing a “breadcrumbs”-type feature in org-mode?  By that I mean something that would quickly tell you the headings up the whole path to the root, to quickly orient yourself when you’re deep within a document.  I was originally thinking of something always-present shown at the top of the frame, but maybe it would be better as something shown on demand in the minibuffer, possibly making it taller while shown.

You can bind this to a speed command. It will show you the path to the current headline (less the first heading) in the echo area, and will also copy it to the kill ring. This is the functionality I need, but it would be easy to modify to do what you want.

(defun org-copy-outline-path-less-root-to-kill-ring (&optional a b)
  "Copy the current outline path, less the first node, to the
kill ring, and echo to the echo area."
  (interactive "P")
  (let* ((bfn (buffer-file-name (buffer-base-buffer)))
     (case-fold-search nil)
         (path (rest (org-get-outline-path))))
    (setq path (append path
                       (save-excursion
                         (org-back-to-heading t)
                         (if (looking-at org-complex-heading-regexp)
                             (list (match-string 4))))))
    (let ((formatted-path (org-format-outline-path
                           path
                           (1- (frame-width)))))
      (kill-new formatted-path)
      (message "%s" formatted-path))))

Hope this helps,

 -Anthony


[-- Attachment #2: Type: text/html, Size: 3400 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-24 21:36 Breadcrumbs? Ken Williams
  2012-09-25  0:44 ` Breadcrumbs? Anthony Lander
@ 2012-09-25  0:59 ` Bastien
  2012-09-25  1:16   ` Breadcrumbs? Bastien
  2012-09-25  1:20 ` Breadcrumbs? Eric Abrahamsen
  2 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2012-09-25  0:59 UTC (permalink / raw)
  To: Ken Williams; +Cc: emacs-orgmode@gnu.org

Hi Ken,

Ken Williams <Ken.Williams@windlogics.com> writes:

> Has anyone ever tried implementing a “breadcrumbs”-type feature in
> org-mode?  

What about this?

(defun org-show-olpath ()
  "Show the outline path."
  (interactive)
  (let (p h)
    (save-excursion
      (while (and (setq h (ignore-errors (org-get-heading t t)))
		  (org-up-heading-safe))
	(setq p (concat h "/" p)))
      (setq p (concat (org-get-heading t t) "/" p)))
    p))

(add-hook 'org-mode-hook
          (lambda() (add-to-list 'mode-line-format
                                 '(:eval (org-show-olpath)) t)))

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  0:59 ` Breadcrumbs? Bastien
@ 2012-09-25  1:16   ` Bastien
  0 siblings, 0 replies; 18+ messages in thread
From: Bastien @ 2012-09-25  1:16 UTC (permalink / raw)
  To: Ken Williams; +Cc: emacs-orgmode@gnu.org

Bastien <bzg@altern.org> writes:

> What about this?

Or, inspired by Anthony's use of `org-get-outline-path':

(defun org-show-olpath ()
  "Show the outline path."
  (org-no-properties
   (mapconcat 'identity
	      (append (ignore-errors (org-get-outline-path))
		      (ignore-errors (list (org-get-heading t t))))
	      "/")))

(add-hook 'org-mode-hook
          (lambda() (add-to-list 'mode-line-format
                                 '(:eval (org-show-olpath)) t)))

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-24 21:36 Breadcrumbs? Ken Williams
  2012-09-25  0:44 ` Breadcrumbs? Anthony Lander
  2012-09-25  0:59 ` Breadcrumbs? Bastien
@ 2012-09-25  1:20 ` Eric Abrahamsen
  2012-09-25  1:46   ` Breadcrumbs? Bastien
  2 siblings, 1 reply; 18+ messages in thread
From: Eric Abrahamsen @ 2012-09-25  1:20 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Sep 25 2012, Ken Williams wrote:

> Has anyone ever tried implementing a “breadcrumbs”-type feature in
> org-mode?  By that I mean something that would quickly tell you the
> headings up the whole path to the root, to quickly orient yourself
> when you’re deep within a document.  I was originally thinking of
> something always-present shown at the top of the frame, but maybe it
> would be better as something shown on demand in the minibuffer,
> possibly making it taller while shown.

The command `org-display-outline-path' will do this -- you could just
bind it to a key in org-mode-map.

Yours,
Eric

-- 
GNU Emacs 24.2.50.1 (i686-pc-linux-gnu, GTK+ Version 3.4.4)
 of 2012-09-16 on pellet
7.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  1:20 ` Breadcrumbs? Eric Abrahamsen
@ 2012-09-25  1:46   ` Bastien
  2012-09-25 15:04     ` Breadcrumbs? Memnon Anon
  0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2012-09-25  1:46 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> The command `org-display-outline-path' will do this -- you could just
> bind it to a key in org-mode-map.

Indeed!  I've updated `org-display-outline-path' so that it can return a
string:

  (org-display-outline-path nil t t)

So you can now hook it like this:

(add-hook 'org-mode-hook
          (lambda() (add-to-list 'mode-line-format
                                 '(:eval (org-display-outline-path nil t t)) t)))

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  0:44 ` Breadcrumbs? Anthony Lander
@ 2012-09-25  9:27   ` Sebastien Vauban
  2012-09-25  9:35     ` Breadcrumbs? Bastien
                       ` (2 more replies)
  2012-09-25 17:44   ` Breadcrumbs? Ken Williams
  1 sibling, 3 replies; 18+ messages in thread
From: Sebastien Vauban @ 2012-09-25  9:27 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi,

Anthony Lander wrote:
> On 12-Sep-24, at 5:36 PM, Ken Williams wrote:
>
>> Has anyone ever tried implementing a “breadcrumbs”-type feature in org-mode?
>> By that I mean something that would quickly tell you the headings up the
>> whole path to the root, to quickly orient yourself when you’re deep within a
>> document. I was originally thinking of something always-present shown at the
>> top of the frame, but maybe it would be better as something shown on demand
>> in the minibuffer, possibly making it taller while shown.
>
> You can bind this to a speed command.

SPC in column 0 does already do that, doesn't it?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  9:27   ` Breadcrumbs? Sebastien Vauban
@ 2012-09-25  9:35     ` Bastien
  2012-09-25 11:25       ` Breadcrumbs? Sebastien Vauban
       [not found]       ` <13349.1348583253@alphaville>
  2012-09-25 14:18     ` Breadcrumbs? Nick Dokos
  2012-09-25 20:31     ` Breadcrumbs? François Pinard
  2 siblings, 2 replies; 18+ messages in thread
From: Bastien @ 2012-09-25  9:35 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

>> You can bind this to a speed command.
>
> SPC in column 0 does already do that, doesn't it?

Yes.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  9:35     ` Breadcrumbs? Bastien
@ 2012-09-25 11:25       ` Sebastien Vauban
  2012-09-25 12:48         ` Breadcrumbs? Bastien
       [not found]       ` <13349.1348583253@alphaville>
  1 sibling, 1 reply; 18+ messages in thread
From: Sebastien Vauban @ 2012-09-25 11:25 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Bastien,

Bastien wrote:
> "Sebastien Vauban" writes:
>>> You can bind this to a speed command.
>>
>> SPC in column 0 does already do that, doesn't it?
>
> Yes.

And here a small extension to your function, in order to add a more visible
color to the displayed path:

#+begin_src emacs-lisp
(add-hook 'org-mode-hook
          (lambda() (add-to-list 'mode-line-format
                                 '(:eval (org-propertize
                                          (org-display-outline-path nil t t)
                                         'face 'mode-line-emphasis
                                         'help-echo "Outline path")) t)))
#+end_src

Could we imagine the displayed outline path to be separated by " / " instead
of by "/", that is:

    "Tasks / Add color to modeline / Check function org-propertize"

instead of:

    "Tasks/Add color to modeline/Check function org-propertize"?

That way, it would as well be equivalent to what's displayed by helm-imenu.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25 11:25       ` Breadcrumbs? Sebastien Vauban
@ 2012-09-25 12:48         ` Bastien
  2012-09-26  3:49           ` Breadcrumbs? Carsten Dominik
  0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2012-09-25 12:48 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Could we imagine the displayed outline path to be separated by " / " instead
> of by "/", that is:

From current master, try this out:

(org-display-outline-path nil t " - ")

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  9:27   ` Breadcrumbs? Sebastien Vauban
  2012-09-25  9:35     ` Breadcrumbs? Bastien
@ 2012-09-25 14:18     ` Nick Dokos
  2012-09-25 20:31     ` Breadcrumbs? François Pinard
  2 siblings, 0 replies; 18+ messages in thread
From: Nick Dokos @ 2012-09-25 14:18 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

Sebastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:

> Hi,
> 
> Anthony Lander wrote:
> > On 12-Sep-24, at 5:36 PM, Ken Williams wrote:
> >
> >> Has anyone ever tried implementing a “breadcrumbs”-type feature in org-mode?
> >> By that I mean something that would quickly tell you the headings up the
> >> whole path to the root, to quickly orient yourself when you’re deep within a
> >> document. I was originally thinking of something always-present shown at the
> >> top of the frame, but maybe it would be better as something shown on demand
> >> in the minibuffer, possibly making it taller while shown.
> >
> > You can bind this to a speed command.
> 
> SPC in column 0 does already do that, doesn't it?
> 

Not here, I'm afraid: SPC in column 0 (both on headlines and not on headlines)
is bound to org-self-insert-command and just inserts a space.

Nick

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  1:46   ` Breadcrumbs? Bastien
@ 2012-09-25 15:04     ` Memnon Anon
  0 siblings, 0 replies; 18+ messages in thread
From: Memnon Anon @ 2012-09-25 15:04 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Indeed!  I've updated `org-display-outline-path' so that it can return a
> string:
>
>   (org-display-outline-path nil t t)
>
> So you can now hook it like this:
>
> (add-hook 'org-mode-hook
>           (lambda() (add-to-list 'mode-line-format
>                                  '(:eval (org-display-outline-path nil t t)) t)))

Interesting.

But my modeline is already fairly crowded and headlines can be rather long.

I am currently trying this:

--8<---------------cut here---------------start------------->8---

(add-hook 'org-mode-hook
          (lambda() (setq header-line-format
                                 '(:eval (org-display-outline-path nil t t)))))

--8<---------------cut here---------------end--------------->8---

Memnon

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
       [not found]       ` <13349.1348583253@alphaville>
@ 2012-09-25 15:31         ` Bastien
  0 siblings, 0 replies; 18+ messages in thread
From: Bastien @ 2012-09-25 15:31 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: public-emacs-orgmode-mXXj517/zsQ, Sebastien Vauban



Hi Nick,

Nick Dokos <nicholas.dokos@hp.com> writes:

> I must have missed some context: where does SPC in column 0 run
> org-display-outline-path?

If you have (setq org-use-speed-commands t)

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  0:44 ` Breadcrumbs? Anthony Lander
  2012-09-25  9:27   ` Breadcrumbs? Sebastien Vauban
@ 2012-09-25 17:44   ` Ken Williams
  1 sibling, 0 replies; 18+ messages in thread
From: Ken Williams @ 2012-09-25 17:44 UTC (permalink / raw)
  To: Anthony Lander; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]

Very nice, thanks.  I like to see the top-level heading too, so I removed the (rest ...) call near the beginning.

  -Ken

From: Anthony Lander [mailto:anthony@landerfamily.ca]
Sent: Monday, September 24, 2012 7:45 PM
To: Ken Williams
Cc: emacs-orgmode@gnu.org
Subject: Re: [O] Breadcrumbs?

Hi Ken,

You can bind this to a speed command. It will show you the path to the current headline (less the first heading) in the echo area, and will also copy it to the kill ring. This is the functionality I need, but it would be easy to modify to do what you want.

(defun org-copy-outline-path-less-root-to-kill-ring (&optional a b)
  "Copy the current outline path, less the first node, to the
kill ring, and echo to the echo area."
  (interactive "P")
  (let* ((bfn (buffer-file-name (buffer-base-buffer)))
     (case-fold-search nil)
         (path (rest (org-get-outline-path))))
    (setq path (append path
                       (save-excursion
                         (org-back-to-heading t)
                         (if (looking-at org-complex-heading-regexp)
                             (list (match-string 4))))))
    (let ((formatted-path (org-format-outline-path
                           path
                           (1- (frame-width)))))
      (kill-new formatted-path)
      (message "%s" formatted-path))))

Hope this helps,

 -Anthony


________________________________
CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please contact the sender via reply e-mail and destroy all copies of the original message. Thank you.

[-- Attachment #2: Type: text/html, Size: 6593 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25  9:27   ` Breadcrumbs? Sebastien Vauban
  2012-09-25  9:35     ` Breadcrumbs? Bastien
  2012-09-25 14:18     ` Breadcrumbs? Nick Dokos
@ 2012-09-25 20:31     ` François Pinard
  2 siblings, 0 replies; 18+ messages in thread
From: François Pinard @ 2012-09-25 20:31 UTC (permalink / raw)
  To: emacs-orgmode

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> SPC in column 0 does already do that, doesn't it?

Wow!  I did not know that!  Thanks! :-)

François

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-25 12:48         ` Breadcrumbs? Bastien
@ 2012-09-26  3:49           ` Carsten Dominik
  2012-09-26  6:32             ` Breadcrumbs? Bastien
       [not found]             ` <80d3198a49.fsf@somewhere.org>
  0 siblings, 2 replies; 18+ messages in thread
From: Carsten Dominik @ 2012-09-26  3:49 UTC (permalink / raw)
  To: Bastien; +Cc: public-emacs-orgmode-mXXj517/zsQ, Sebastien Vauban




On 25.9.2012, at 14:48, Bastien wrote:

> 
> 
> "Sebastien Vauban"
> <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
> 
>> Could we imagine the displayed outline path to be separated by " / " instead
>> of by "/", that is:
> 
> From current master, try this out:
> 
> (org-display-outline-path nil t " - ")

Hi everyone,

I just changed the definitions of org-display-outline-path
and org-format-outline-path, so the call above would have to
be modified to

         (org-display-outline-path nil t " / " t)

Cheers

- Carsten

> 
> HTH,
> 
> -- 
> Bastien
> 
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Breadcrumbs?
  2012-09-26  3:49           ` Breadcrumbs? Carsten Dominik
@ 2012-09-26  6:32             ` Bastien
       [not found]             ` <80d3198a49.fsf@somewhere.org>
  1 sibling, 0 replies; 18+ messages in thread
From: Bastien @ 2012-09-26  6:32 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: public-emacs-orgmode-mXXj517/zsQ, Sebastien Vauban



Carsten Dominik <carsten.dominik@gmail.com> writes:

> I just changed the definitions of org-display-outline-path
> and org-format-outline-path, so the call above would have to
> be modified to
>
>          (org-display-outline-path nil t " / " t)

Great, thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: **: Re:  Breadcrumbs?
       [not found]             ` <80d3198a49.fsf@somewhere.org>
@ 2012-09-26  9:07               ` Bastien
  0 siblings, 0 replies; 18+ messages in thread
From: Bastien @ 2012-09-26  9:07 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: re.A20CLP7YTWP8G, public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Now, it does not work anymore as it did. I now have things such as:
>
>  "/ Headline 1/Longer headline 2/Very long headline 3"
>
> in my mode line, instead of:
>
>  "Headline 1 / Longer headline 2 / Very long headline 3"

Fixed, thanks.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-09-26  9:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-24 21:36 Breadcrumbs? Ken Williams
2012-09-25  0:44 ` Breadcrumbs? Anthony Lander
2012-09-25  9:27   ` Breadcrumbs? Sebastien Vauban
2012-09-25  9:35     ` Breadcrumbs? Bastien
2012-09-25 11:25       ` Breadcrumbs? Sebastien Vauban
2012-09-25 12:48         ` Breadcrumbs? Bastien
2012-09-26  3:49           ` Breadcrumbs? Carsten Dominik
2012-09-26  6:32             ` Breadcrumbs? Bastien
     [not found]             ` <80d3198a49.fsf@somewhere.org>
2012-09-26  9:07               ` **: Breadcrumbs? Bastien
     [not found]       ` <13349.1348583253@alphaville>
2012-09-25 15:31         ` Breadcrumbs? Bastien
2012-09-25 14:18     ` Breadcrumbs? Nick Dokos
2012-09-25 20:31     ` Breadcrumbs? François Pinard
2012-09-25 17:44   ` Breadcrumbs? Ken Williams
2012-09-25  0:59 ` Breadcrumbs? Bastien
2012-09-25  1:16   ` Breadcrumbs? Bastien
2012-09-25  1:20 ` Breadcrumbs? Eric Abrahamsen
2012-09-25  1:46   ` Breadcrumbs? Bastien
2012-09-25 15:04     ` Breadcrumbs? Memnon Anon

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).