emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Mark Elston <m_elston@comcast.net>
Cc: org-mode emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Hook Function Examples
Date: Mon, 25 Jan 2010 00:24:35 -0500	[thread overview]
Message-ID: <2417.1264397075@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Mark Elston <m_elston@comcast.net> of "Sun, 24 Jan 2010 16:40:27 PST." <4B5CE87B.6060603@comcast.net>

Mark Elston <m_elston@comcast.net> wrote:

> I am trying to make use of some of the hooks for exporting and haven't
> found any docs about what they take or how to make use of them (elisp
> is *not* my native language).
> 

The Emacs Lisp Reference manual has a section (23.1: Hooks) on hooks,
but I'm not sure how helpful it will be to you. The most important note
is that "normal" hook variables are, by convention, named
<foo>-hook. "normal" means that the functions that are added to the hook
take no arguments and return no useful values.

> In particular, I am trying to figure out how to use the following
> to see if any of them are going to help me:
> 
>  org-export-preprocess-hook
>  org-export-preprocess-after-tree-selection-hook
>  org-export-preprocess-final-hook
> 
> Any examples of a hook function for these would help a lot.  In
> particular, what are the parameters, is the point "looking at"
> anything in particular, etc.
> 

Use the source, Luke! (erm... Mark!)

 C-h v org-export-preprocess-hook <RET>

gives me:

 (org-export-blocks-preprocess)

so we have here an example of a hook function!

 C-h f org-export-blocks-preprocess <RET>

gives you the function's doc string, including a link to where it is
defined, and clicking on the link will take you to the function: no
params (it is a "normal" hook after all), and I think you can make no
assumptions about the context. In particular, the above function wraps
everything in a save-excursion, goes to the beginning of the buffer and
searches for interesting things, doing something on each interesting
thing it finds.

The other two hooks are nil in my case, but I think similar things
would apply there too.

HTH,
Nick

  reply	other threads:[~2010-01-25  5:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25  0:40 Hook Function Examples Mark Elston
2010-01-25  5:24 ` Nick Dokos [this message]
2010-01-25  6:21   ` Mark Elston
2010-01-25 15:48     ` Nick Dokos
2010-01-28 18:22     ` Carsten Dominik

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=2417.1264397075@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=m_elston@comcast.net \
    /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).