emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99912: * net/zeroconf.el (zerocon


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99912: * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Date: Sat, 03 Jul 2010 12:52:17 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99912
committer: Michael Albinus <address@hidden>
branch nick: emacs-23
timestamp: Sat 2010-07-03 12:52:17 +0200
message:
  * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
modified:
  lisp/ChangeLog
  lisp/net/zeroconf.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-06-30 22:03:07 +0000
+++ b/lisp/ChangeLog    2010-07-03 10:52:17 +0000
@@ -1,3 +1,7 @@
+2010-07-03  Jan Moringen  <address@hidden>
+
+       * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
+
 2010-06-30  Dan Nicolaescu  <address@hidden>
 
        Avoid displaying files with a nil state in vc-dir.

=== modified file 'lisp/net/zeroconf.el'
--- a/lisp/net/zeroconf.el      2010-01-13 08:35:10 +0000
+++ b/lisp/net/zeroconf.el      2010-07-03 10:52:17 +0000
@@ -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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]