From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: Re: programmatic jump to headline
Date: Sat, 26 Mar 2011 15:07:52 +0800 [thread overview]
Message-ID: <87oc4y2wc7.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 87ipv7o20h.fsf@norang.ca
Bernt Hansen <bernt@norang.ca> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> 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.
[...]
> Hi Eric,
>
> If your chapters are always level 1 headings you can do something like
> this:
>
> (defun bh/jump-to-last-level-1-heading ()
> (interactive)
> (goto-char (point-max))
> (while (org-up-heading-safe)))
Thanks for the pointers! A =while= form with no body wasn't
something that had occured to me, that's pretty useful. The final
command, which does just what I want, is below.
Eric
#+begin_src emacs-lisp
(defun my-project-start ()
(interactive)
(delete-other-windows)
(find-file my-project-file)
(goto-char (point-max))
(while (org-up-heading-safe))
(while (not (looking-at "\\* Chapter"))
(org-backward-same-level 1))
(org-narrow-to-subtree)
(split-window-horizontally)
(other-window 1)
(show-subtree)
(goto-char (point-max))
(abbrev-mode 1)
(read-abbrev-file my-project-abbrev-file)
)
#+end_src
prev parent reply other threads:[~2011-03-26 7:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 9:38 programmatic jump to headline Eric Abrahamsen
2011-03-25 11:47 ` Bernt Hansen
2011-03-26 7:07 ` Eric Abrahamsen [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oc4y2wc7.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.