From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Hook Function Examples Date: Mon, 25 Jan 2010 00:24:35 -0500 Message-ID: <2417.1264397075@gamaville.dokosmarshall.org> References: <4B5CE87B.6060603@comcast.net> Reply-To: nicholas.dokos@hp.com Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZHSr-0006Md-4L for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 00:26:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZHSm-0006Jg-FH for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 00:26:16 -0500 Received: from [199.232.76.173] (port=45737 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZHSm-0006JT-91 for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 00:26:12 -0500 Received: from vms173005pub.verizon.net ([206.46.173.5]:54095) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZHSl-0006CR-W7 for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 00:26:12 -0500 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0KWS00EPGF0ZWLIA@vms173005.mailsrvcs.net> for emacs-orgmode@gnu.org; Sun, 24 Jan 2010 23:24:41 -0600 (CST) In-reply-to: Message from Mark Elston of "Sun, 24 Jan 2010 16:40:27 PST." <4B5CE87B.6060603@comcast.net> 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: Mark Elston Cc: org-mode emacs-orgmode Mark Elston 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 -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 gives me: (org-export-blocks-preprocess) so we have here an example of a hook function! C-h f org-export-blocks-preprocess 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