# HG changeset patch # User Michael Albinus # Date 1278154337 -7200 # Node ID 1cedbb610cc1d91a439f2435a2e67335bfa35d05 # Parent 69cc7cbe898bb134c84af79e32343e770ecf4223 * net/zeroconf.el (zeroconf-service-remove-hook): New defun. diff -r 69cc7cbe898b -r 1cedbb610cc1 lisp/ChangeLog --- a/lisp/ChangeLog Sat Jul 03 11:43:45 2010 +0200 +++ b/lisp/ChangeLog Sat Jul 03 12:52:17 2010 +0200 @@ -1,3 +1,7 @@ +2010-07-03 Jan Moringen + + * net/zeroconf.el (zeroconf-service-remove-hook): New defun. + 2010-06-30 Dan Nicolaescu Avoid displaying files with a nil state in vc-dir. diff -r 69cc7cbe898b -r 1cedbb610cc1 lisp/net/zeroconf.el --- a/lisp/net/zeroconf.el Sat Jul 03 11:43:45 2010 +0200 +++ b/lisp/net/zeroconf.el Sat Jul 03 12:52:17 2010 +0200 @@ -336,6 +336,23 @@ (puthash type l-hook zeroconf-service-removed-hooks-hash))) (t (error "EVENT must be either `:new' or `:removed'")))) +(defun zeroconf-service-remove-hook (type event function) + "Remove FUNCTION from the hook of service type TYPE. + +EVENT must be either :new or :removed and has to match the event +type used when registering FUNCTION." + (let* ((table (cond + ((equal event :new) + zeroconf-service-added-hooks-hash) + ((equal event :removed) + zeroconf-service-removed-hooks-hash) + (t (error "EVENT must be either `:new' or `:removed'")))) + (l-hook (gethash type table nil))) + (remove-hook 'l-hook function) + (if l-hook + (puthash type l-hook table) + (remhash type table)))) + (defun zeroconf-get-host () "Returns the local host name as string." (dbus-call-method