Commit 35310461 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(add-hook): Implement `permanent-local-hook' property.

parent 8f696e65
...@@ -1103,7 +1103,17 @@ function, it is changed to a list of functions." ...@@ -1103,7 +1103,17 @@ function, it is changed to a list of functions."
(append hook-value (list function)) (append hook-value (list function))
(cons function hook-value)))) (cons function hook-value))))
;; Set the actual variable ;; 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) (defun remove-hook (hook function &optional local)
"Remove from the value of HOOK the function FUNCTION. "Remove from the value of HOOK the function FUNCTION.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment