From 465c5fc88d4d7f0cbeba1a12852a4be70d6ed28b Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Wed, 13 Jul 2011 23:38:56 +0200 Subject: [PATCH] Clarify manual and `add-hook' doc string about buffer-local hooks --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/custom.texi | 6 ++++++ lisp/ChangeLog | 3 +++ lisp/subr.el | 8 ++++---- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 0102e028d49..e21a02f700f 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2011-07-13 Lars Magne Ingebrigtsen + + * custom.texi (Hooks): Mention buffer-local hooks (bug#6218). + 2011-07-13 Glenn Morris * dired.texi (Dired Enter): Mention --dired. (Bug#9039) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 8465dd93519..6a6d465438d 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -820,6 +820,12 @@ the versions you added will remain in the hook variable together. You can clear out individual functions by calling @code{remove-hook}, or do @code{(setq @var{hook-variable} nil)} to remove everything. +@cindex buffer-local hooks + If the hook variable is buffer-local, the buffer-local variable will +be used instead of the global variable. However, if the buffer-local +variable contains the element @code{t}, the global hook variable will +be run as well. + @node Locals @subsection Local Variables diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 41a7f0b1d2e..be42c4b8b2a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2011-07-13 Lars Magne Ingebrigtsen + * subr.el (add-hook): Clarify section about buffer-local hooks + (bug#6218). + * dired.el (dired-flagged): Clarify doc string (bug#6117). 2011-07-13 Juanma Barranquero diff --git a/lisp/subr.el b/lisp/subr.el index 5c9d6c8d724..a2f560461eb 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1262,10 +1262,10 @@ unless the optional argument APPEND is non-nil, in which case FUNCTION is added at the end. The optional fourth argument, LOCAL, if non-nil, says to modify -the hook's buffer-local value rather than its default value. -This makes the hook buffer-local if needed, and it makes t a member -of the buffer-local value. That acts as a flag to run the hook -functions in the default value as well as in the local value. +the hook's buffer-local value rather than its global value. +This makes the hook buffer-local, and it makes t a member of the +buffer-local value. That acts as a flag to run the hook +functions of the global value as well as in the local value. HOOK should be a symbol, and FUNCTION may be any valid function. If HOOK is void, it is first set to nil. If HOOK's value is a single -- 2.39.5