emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Link to Top Most Heading
@ 2014-06-16  2:02 Esben Stien
  2014-06-16  8:31 ` Thorsten Jolitz
  2014-06-25  9:32 ` Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: Esben Stien @ 2014-06-16  2:02 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to figure out how I can get a link to the top most heading
without actually moving point up there and doing C-c C-l.

Is there some function to do that?

If I try using the function outline-previous-heading, how can I know
when I've reached the top as it seems to just bang its head in the roof
of the file when it reaches the top. It also finds stuff above the
topmost heading, like lines beginning with "#". 

Any pointers as to what I can try?

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
           sip:b0ef@   e     e 
           jid:b0ef@    n     n

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

* Re: Link to Top Most Heading
  2014-06-16  2:02 Link to Top Most Heading Esben Stien
@ 2014-06-16  8:31 ` Thorsten Jolitz
  2014-06-25  9:32 ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2014-06-16  8:31 UTC (permalink / raw)
  To: emacs-orgmode

Esben Stien <b0ef@esben-stien.name> writes:

> I'm trying to figure out how I can get a link to the top most heading
> without actually moving point up there and doing C-c C-l.
>
> Is there some function to do that?
>
> If I try using the function outline-previous-heading, how can I know
> when I've reached the top as it seems to just bang its head in the roof
> of the file when it reaches the top. It also finds stuff above the
> topmost heading, like lines beginning with "#". 
>
> Any pointers as to what I can try?

I don't know if `org-goto-first-headline' is implemented, but e.g. this
function shows how to do it, since it needs to find first headline too:

(defun org-first-headline-recenter ()
  "Move cursor to the first headline and recenter the headline."
  (goto-char (point-min))
  (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
    (set-window-start (selected-window) (point-at-bol))))

-- 
cheers,
Thorsten

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

* Re: Link to Top Most Heading
  2014-06-16  2:02 Link to Top Most Heading Esben Stien
  2014-06-16  8:31 ` Thorsten Jolitz
@ 2014-06-25  9:32 ` Bastien
  2014-06-25 10:06   ` Esben Stien
  1 sibling, 1 reply; 4+ messages in thread
From: Bastien @ 2014-06-25  9:32 UTC (permalink / raw)
  To: Esben Stien; +Cc: emacs-orgmode

Hi Esben

Esben Stien <b0ef@esben-stien.name> writes:

> I'm trying to figure out how I can get a link to the top most heading
> without actually moving point up there and doing C-c C-l.

(defun my-org-store-link-to-top-level-heading ()
  (interactive)
  (save-excursion
    (org-up-heading-all 10)
    (call-interactively 'org-store-link)))

HTH,

-- 
 Bastien

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

* Re: Link to Top Most Heading
  2014-06-25  9:32 ` Bastien
@ 2014-06-25 10:06   ` Esben Stien
  0 siblings, 0 replies; 4+ messages in thread
From: Esben Stien @ 2014-06-25 10:06 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@gnu.org> writes:

> (defun my-org-store-link-to-top-level-heading ()
>   (interactive)
>   (save-excursion
>     (org-up-heading-all 10)
>     (call-interactively 'org-store-link)))

Perfect. So simple with org-up-heading-all. Didn't find that. Thanks a
lot. Saves me so much time;)

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
           sip:b0ef@   e     e 
           jid:b0ef@    n     n

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

end of thread, other threads:[~2014-06-25 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16  2:02 Link to Top Most Heading Esben Stien
2014-06-16  8:31 ` Thorsten Jolitz
2014-06-25  9:32 ` Bastien
2014-06-25 10:06   ` Esben Stien

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).