From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dirk-Jan C. Binnema Newsgroups: gmane.emacs.help Subject: Re: What do 'hooks' do and how do they do it? Date: Sat, 01 Aug 2009 21:00:33 +0300 Organization: DJCBSoftware Message-ID: <86iqh7ct32.wl%djcb@djcbsoftware.nl> References: <1249147043.2246.18.camel@CASE> Reply-To: djcb@djcbsoftware.nl NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1249149682 28513 80.91.229.12 (1 Aug 2009 18:01:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2009 18:01:22 +0000 (UTC) Cc: Emacs Help List To: William Case Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 01 20:01:15 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MXItO-0003tX-2s for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Aug 2009 20:01:14 +0200 Original-Received: from localhost ([127.0.0.1]:45358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXItN-0003sI-LS for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Aug 2009 14:01:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXIsy-0003pz-9M for help-gnu-emacs@gnu.org; Sat, 01 Aug 2009 14:00:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXIst-0003kB-ML for help-gnu-emacs@gnu.org; Sat, 01 Aug 2009 14:00:47 -0400 Original-Received: from [199.232.76.173] (port=56194 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXIst-0003jx-HV for help-gnu-emacs@gnu.org; Sat, 01 Aug 2009 14:00:43 -0400 Original-Received: from emh03.mail.saunalahti.fi ([62.142.5.109]:54664) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MXIss-0005nV-Pr for help-gnu-emacs@gnu.org; Sat, 01 Aug 2009 14:00:43 -0400 Original-Received: from saunalahti-vams (vs3-12.mail.saunalahti.fi [62.142.5.96]) by emh03-2.mail.saunalahti.fi (Postfix) with SMTP id E323AEBB92; Sat, 1 Aug 2009 21:00:34 +0300 (EEST) Original-Received: from emh03.mail.saunalahti.fi ([62.142.5.109]) by vs3-12.mail.saunalahti.fi ([62.142.5.96]) with SMTP (gateway) id A04B66D84AB; Sat, 01 Aug 2009 21:00:34 +0300 Original-Received: from mail.djcbsoftware.nl (a88-113-10-89.elisa-laajakaista.fi [88.113.10.89]) by emh03.mail.saunalahti.fi (Postfix) with ESMTP id E2852158A6A; Sat, 1 Aug 2009 21:00:31 +0300 (EEST) Original-Received: from mindcrime.mindcrime.djcbsoftware.nl (localhost [127.0.0.1]) by mail.djcbsoftware.nl (Postfix) with ESMTP id 95B0959DE2; Sat, 1 Aug 2009 21:00:33 +0300 (EEST) In-Reply-To: <1249147043.2246.18.camel@CASE> User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0 (HANACHIRUSATO) X-Antivirus: VAMS X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66628 Archived-At: Hi Bill, >>>>> "Bill" == William Case writes: Bill> Hi; Bill> This is not an urgent question, it is more in the way of a request for Bill> an explanation by anyone who has the time and inclination to do a little Bill> teaching. Bill> I know at a high level what a 'hook' is and how to use it an elisp Bill> statement. And, I have seen hooks used in other programs like SELinux. Bill> But I am curious about what is going on at the kernel level with a Bill> 'hook'. If someone can give me a brief overview in relatively plain Bill> language, I would appreciate it. Bill> e.g. some of the kind of questions that spring to mind. Bill> Is it a process that is added to the task structure waiting to be Bill> called? Bill> How is it woken up? And what kind of events might wake it? etc. I think Drew Adams gave a very clear answer about the Emacs implementation, but let me add that the concept of a 'hook' is simply a programming technique: the ability to set some function to be run whenever a particular event happens. The concept is in use in many places (such as SE-Linux), but how it's implemented is quite different. In Emacs-Lisp, the hooks are simply Lisp functions to be called -- no kernel involved (well...). See: http://en.wikipedia.org/wiki/Hooking Best wishes, Dirk. -- Dirk-Jan C. Binnema Helsinki, Finland e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C