Mercurial > emacs
comparison lisp/emacs-lisp/lucid.el @ 4997:96c0a97da147
(remove-hook): Function deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 13 Nov 1993 08:21:16 +0000 |
parents | b9ce445fb406 |
children | 8c2f150f2880 |
comparison
equal
deleted
inserted
replaced
4996:4414ceac33dc | 4997:96c0a97da147 |
---|---|
49 (let ((tail (cdr keymap))) | 49 (let ((tail (cdr keymap))) |
50 (while (and tail (cdr tail) (not (eq (car (cdr tail)) 'keymap))) | 50 (while (and tail (cdr tail) (not (eq (car (cdr tail)) 'keymap))) |
51 (setq tail (cdr tail))) | 51 (setq tail (cdr tail))) |
52 (if tail | 52 (if tail |
53 (setcdr tail new-parent)))) | 53 (setcdr tail new-parent)))) |
54 | |
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')." | |
59 (if (boundp '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)))))) | |
66 | 54 |
67 (defun remprop (symbol prop) | 55 (defun remprop (symbol prop) |
68 (let ((plist (symbol-plist symbol))) | 56 (let ((plist (symbol-plist symbol))) |
69 (while (eq (car plist) prop) | 57 (while (eq (car plist) prop) |
70 (setplist symbol (setq plist (cdr (cdr plist))))) | 58 (setplist symbol (setq plist (cdr (cdr plist))))) |