emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Link to Top Most Heading


From: Thorsten Jolitz
Subject: Re: [O] Link to Top Most Heading
Date: Mon, 16 Jun 2014 10:31:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Esben Stien <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]