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

(remove-hook): Doc string added.

Change a single function into a list.
parent 32295976
......@@ -53,8 +53,16 @@
(setcdr tail new-parent))))
(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)
(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)
(let ((plist (symbol-plist symbol)))
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