From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: programmatic jump to headline Date: Fri, 25 Mar 2011 17:38:20 +0800 Message-ID: <87vcz7o7zn.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=35988 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q33Tm-0008VI-87 for emacs-orgmode@gnu.org; Fri, 25 Mar 2011 05:38:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q33Tk-0001vE-Kj for emacs-orgmode@gnu.org; Fri, 25 Mar 2011 05:38:50 -0400 Received: from lo.gmane.org ([80.91.229.12]:38268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q33Tk-0001uf-EG for emacs-orgmode@gnu.org; Fri, 25 Mar 2011 05:38:48 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q33Tf-0006JF-3C for emacs-orgmode@gnu.org; Fri, 25 Mar 2011 10:38:43 +0100 Received: from 123.121.239.58 ([123.121.239.58]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Mar 2011 10:38:43 +0100 Received: from eric by 123.121.239.58 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 25 Mar 2011 10:38:43 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I'm writing a little helper function for use when I'm starting work on a particular long-term writing project. Basically I found myself doing the same little ritual of commands two or three times a day, and I got tired of it. Here's what I've got so far, it's pretty self-explanatory. The "my-" variables are set elsewhere. #+BEGIN_SRC emacs-lisp (defun my-project-start () (interactive) (delete-other-windows) (find-file my-project-file) ;; here's where I go to the most recent Chapter heading (org-narrow-to-subtree) (split-window-horizontally) (other-window 1) (goto-char (point-max)) (read-abbrev-file my-project-abbrev-file) ) #+END_SRC The bit I'm missing is in the comment above. The file is full of different headings, most (but not all) of which look like * Chapter XXX I've looked at the code for org-goto, but it's a wee bit complicated, and I don't need to do things like pushing to the mark ring. My question is, what's the simplest way to either: 1. Jump to the "Chapter" heading with the largest number 2. Jump to the bottom-most "Chapter" heading (the bottom-most heading is not a Chapter) Additionally, in this case is there any practical difference between using narrowing or using an indirect buffer? I'm not doing anything but writing… Thanks! Eric