(remove-hook): Doc string added.
Change a single function into a list.
This commit is contained in:
parent
322959764a
commit
23f87cce43
1 changed files with 9 additions and 1 deletions
|
@ -53,8 +53,16 @@
|
||||||
(setcdr tail new-parent))))
|
(setcdr tail new-parent))))
|
||||||
|
|
||||||
(defun remove-hook (hook-var function)
|
(defun remove-hook (hook-var function)
|
||||||
|
"Remove a function from a hook, if it is present.
|
||||||
|
First argument HOOK-VAR (a symbol) is the name of a hook, second
|
||||||
|
argument FUNCTION is the function to remove (compared with `eq')."
|
||||||
(if (boundp 'hook-var)
|
(if (boundp 'hook-var)
|
||||||
(set hook-var (delq function (symbol-value hook-var)))))
|
(let ((old (symbol-value hook-var)))
|
||||||
|
;; If the hook value is a single function, turn it into a list.
|
||||||
|
(if (or (not (listp old)) (eq (car old) 'lambda))
|
||||||
|
(set hook-var (list old)))
|
||||||
|
;; Now delete FUNCTION.
|
||||||
|
(set hook-var (delq function (symbol-value hook-var))))))
|
||||||
|
|
||||||
(defun remprop (symbol prop)
|
(defun remprop (symbol prop)
|
||||||
(let ((plist (symbol-plist symbol)))
|
(let ((plist (symbol-plist symbol)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue