From 92dd9a7cb23d4ab14102e02a9f45f096fe8fff13 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 10 Apr 2002 00:31:47 +0000 Subject: handle display cloning --- chess-game.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'chess-game.el') 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." -- cgit v1.2.3