diff options
| author | Richard M. Stallman | 1993-08-02 07:23:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-02 07:23:24 +0000 |
| commit | 23f87cce43f42f8e623da0fe8abeabd0af76022a (patch) | |
| tree | 1bc642616a2f5839a4f4d189b75924f44fee4eac | |
| parent | 322959764a2b05f0210adc474fab6876b45cb53f (diff) | |
| download | emacs-23f87cce43f42f8e623da0fe8abeabd0af76022a.tar.gz emacs-23f87cce43f42f8e623da0fe8abeabd0af76022a.zip | |
(remove-hook): Doc string added.
Change a single function into a list.
| -rw-r--r-- | lisp/emacs-lisp/lucid.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/lucid.el b/lisp/emacs-lisp/lucid.el index 144aaf35b22..eaa405afd33 100644 --- a/lisp/emacs-lisp/lucid.el +++ b/lisp/emacs-lisp/lucid.el | |||
| @@ -53,8 +53,16 @@ | |||
| 53 | (setcdr tail new-parent)))) | 53 | (setcdr tail new-parent)))) |
| 54 | 54 | ||
| 55 | (defun remove-hook (hook-var function) | 55 | (defun remove-hook (hook-var function) |
| 56 | "Remove a function from a hook, if it is present. | ||
| 57 | First argument HOOK-VAR (a symbol) is the name of a hook, second | ||
| 58 | argument FUNCTION is the function to remove (compared with `eq')." | ||
| 56 | (if (boundp 'hook-var) | 59 | (if (boundp 'hook-var) |
| 57 | (set hook-var (delq function (symbol-value hook-var))))) | 60 | (let ((old (symbol-value hook-var))) |
| 61 | ;; If the hook value is a single function, turn it into a list. | ||
| 62 | (if (or (not (listp old)) (eq (car old) 'lambda)) | ||
| 63 | (set hook-var (list old))) | ||
| 64 | ;; Now delete FUNCTION. | ||
| 65 | (set hook-var (delq function (symbol-value hook-var)))))) | ||
| 58 | 66 | ||
| 59 | (defun remprop (symbol prop) | 67 | (defun remprop (symbol prop) |
| 60 | (let ((plist (symbol-plist symbol))) | 68 | (let ((plist (symbol-plist symbol))) |