From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: Link to Top Most Heading Date: Mon, 16 Jun 2014 10:31:30 +0200 Message-ID: <877g4hfe71.fsf@gmail.com> References: <87ha3lzk53.fsf@quasar.esben-stien.name> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwSKj-00076B-KH for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 04:32:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwSKd-0003nf-C8 for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 04:32:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:39885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwSKd-0003nT-5C for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 04:31:59 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WwSKV-0008T2-Pl for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 10:31:51 +0200 Received: from e178191245.adsl.alicedsl.de ([85.178.191.245]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jun 2014 10:31:51 +0200 Received: from tjolitz by e178191245.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jun 2014 10:31:51 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Esben Stien 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