/[emacs]/emacs/lispref/modes.texi
ViewVC logotype

Diff of /emacs/lispref/modes.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by rms, Sun Jan 20 23:17:16 2002 UTC revision 1.46 by monnier, Tue Feb 12 19:33:15 2002 UTC
# Line 2206  then the value is a list of functions, b Line 2206  then the value is a list of functions, b
2206  these functions are called with arguments or their values are used in  these functions are called with arguments or their values are used in
2207  some way.  You can use @code{add-hook} to add a function to the list,  some way.  You can use @code{add-hook} to add a function to the list,
2208  but you must take care in writing the function.  (A few of these  but you must take care in writing the function.  (A few of these
2209  variables are actually normal hooks which were named before we  variables, notably those ending in @samp{-hooks}, are actually
2210  established the convention of using @samp{-hook} for them.)  normal hooks which were named before we established the convention of
2211    using @samp{-hook} for them.)
2212    
2213    If the variable's name ends in @samp{-function}, then its value    If the variable's name ends in @samp{-function}, then its value
2214  is just a single function, not a list of functions.  is just a single function, not a list of functions.
# Line 2290  executed first (barring another @code{ad Line 2291  executed first (barring another @code{ad
2291  argument @var{append} is non-@code{nil}, the new hook function goes at  argument @var{append} is non-@code{nil}, the new hook function goes at
2292  the end of the hook list and will be executed last.  the end of the hook list and will be executed last.
2293    
2294  If @var{local} is non-@code{nil}, that says to make the new hook  If @var{local} is non-@code{nil}, that says to add @var{function}
2295  function buffer-local in the current buffer and automatically calls  to the buffer-local hook list instead of to the global hook list.
 @code{make-local-hook} to make the hook itself buffer-local.  
2296  @end defun  @end defun
2297    
2298  @defun remove-hook hook function &optional local  @defun remove-hook hook function &optional local
# Line 2300  This function removes @var{function} fro Line 2300  This function removes @var{function} fro
2300    
2301  If @var{local} is non-@code{nil}, that says to remove @var{function}  If @var{local} is non-@code{nil}, that says to remove @var{function}
2302  from the buffer-local hook list instead of from the global hook list.  from the buffer-local hook list instead of from the global hook list.
 If the hook variable itself is not buffer-local, then the value of  
 @var{local} makes no difference.  
 @end defun  
   
 @defun make-local-hook hook  
 This function makes the hook variable @code{hook} buffer-local in the  
 current buffer.  When a hook variable is buffer-local, it can have  
 buffer-local and global hook functions, and @code{run-hooks} runs all of  
 them.  
   
 This function works by adding @code{t} as an element of the buffer-local  
 value.  That serves as a flag to use the hook functions listed in the default  
 value of the hook variable, as well as those listed in the buffer-local value.  
 Since @code{run-hooks} understands this flag, @code{make-local-hook}  
 works with all normal hooks.  It works for only some non-normal  
 hooks---those whose callers have been updated to understand this meaning  
 of @code{t}.  
   
 Do not use @code{make-local-variable} directly for hook variables; it is  
 not sufficient.  
2303  @end defun  @end defun

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26