emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: programmatic jump to headline
Date: Fri, 25 Mar 2011 17:38:20 +0800	[thread overview]
Message-ID: <87vcz7o7zn.fsf@ericabrahamsen.net> (raw)

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	other threads:[~2011-03-25  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25  9:38 Eric Abrahamsen [this message]
2011-03-25 11:47 ` programmatic jump to headline Bernt Hansen
2011-03-26  7:07   ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vcz7o7zn.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).