summaryrefslogtreecommitdiff
path: root/chess-game.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-10 00:31:47 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-10 00:31:47 +0000
commit92dd9a7cb23d4ab14102e02a9f45f096fe8fff13 (patch)
treee90d654ba627ed6c2f9da694520193cf8cc6dc32 /chess-game.el
parent3b72d987a9dfb01d9226b88d86dedf10fea67fed (diff)
handle display cloning
Diffstat (limited to 'chess-game.el')
-rw-r--r--chess-game.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/chess-game.el b/chess-game.el
index 500df8d..60a9ddf 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -40,10 +40,22 @@
(chess-game-set-hooks game (cons (cons function data) hooks))
(nconc hooks (list (cons function data)))))))
-(defsubst chess-game-remove-hook (game function)
- "Return the tags alist associated with GAME."
- (chess-game-set-hooks game (assq-delete-all function
- (chess-game-hooks game))))
+(defun chess-game-remove-hook (game function &optional data)
+ "Remove from GAME all event hooks that match FUNCTION.
+If DATA is specified, only remove those hooks whose associated data
+matches."
+ (let* ((hooks (chess-game-hooks game))
+ (h hooks) last-hook)
+ (while h
+ (if (and (eq (caar h) function)
+ (or (null data)
+ (eq data (cdar h))))
+ (if last-hook
+ (setcdr last-hook (cdr h))
+ (setq hooks (cdr h)))
+ (setq last-hook h))
+ (setq h (cdr h)))
+ (chess-game-set-hooks game hooks)))
(defsubst chess-game-run-hooks (game &rest args)
"Return the tags alist associated with GAME."