emacs-orgmode
[Top][All Lists]
Advanced

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

[O] programmatic jump to headline


From: Eric Abrahamsen
Subject: [O] programmatic jump to headline
Date: Fri, 25 Mar 2011 17:38:20 +0800
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux)

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




reply via email to

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