mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
(add-hook): Implement `permanent-local-hook' property.
This commit is contained in:
parent
8f696e6558
commit
3531046188
1 changed files with 11 additions and 1 deletions
12
lisp/subr.el
12
lisp/subr.el
|
|
@ -1103,7 +1103,17 @@ function, it is changed to a list of functions."
|
|||
(append hook-value (list function))
|
||||
(cons function hook-value))))
|
||||
;; Set the actual variable
|
||||
(if local (set hook hook-value) (set-default hook hook-value))))
|
||||
(if local
|
||||
(progn
|
||||
;; If HOOK isn't a permanent local,
|
||||
;; but FUNCTION wants to survive a change of modes,
|
||||
;; mark HOOK as partially permanent.
|
||||
(and (symbolp function)
|
||||
(get function 'permanent-local-hook)
|
||||
(not (get hook 'permanent-local))
|
||||
(put hook 'permanent-local 'permanent-local-hook))
|
||||
(set hook hook-value))
|
||||
(set-default hook hook-value))))
|
||||
|
||||
(defun remove-hook (hook function &optional local)
|
||||
"Remove from the value of HOOK the function FUNCTION.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue