From 7b760f0a0fc25f31365bdcaf0165b600d2b9002c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 5 Dec 2007 21:59:12 +0000 Subject: [PATCH] * net/dbus.el (dbus-hash-table=): Allow nil as wildcard in the interface and member fields. --- lisp/ChangeLog | 5 +++++ lisp/net/dbus.el | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c6b9997ea77..c334edd6001 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-12-05 Michael Albinus + + * net/dbus.el (dbus-hash-table=): Allow nil as wildcard in the + interface and member fields. + 2007-12-05 Glenn Morris * eshell/em-alias.el (pcomplete-stub): Define for compiler. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 8dd17bfea4c..9221c52a082 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -55,15 +55,24 @@ See `dbus-registered-functions-table' for a description of the hash table." (and (listp x) (listp y) ;; Bus symbol, either :system or :session. - (symbolp (car x)) (symbolp (car y)) (equal (car x) (car y)) + (symbolp (car x)) (symbolp (car y)) (equal (car x) (car y)) ;; Interface. - (stringp (cadr x)) (stringp (cadr y)) (string-equal (cadr x) (cadr y)) + (or + (null (cadr x)) (null (cadr y)) ; wildcard + (and + (stringp (cadr x)) (stringp (cadr y)) (string-equal (cadr x) (cadr y)))) ;; Member. - (stringp (caddr x)) (stringp (caddr y)) (string-equal (caddr x) (caddr y)))) + (or + (null (caddr x)) (null (caddr y)) ; wildcard + (and + (stringp (caddr x)) (stringp (caddr y)) + (string-equal (caddr x) (caddr y)))))) -(define-hash-table-test 'dbus-hash-table-test - 'dbus-hash-table= 'sxhash) +(define-hash-table-test 'dbus-hash-table-test 'dbus-hash-table= 'sxhash) +;; When we assume that interface and and member are always strings in +;; the key, we could use `equal' as test function. But we want to +;; have also `nil' there, being a wildcard. (setq dbus-registered-functions-table (make-hash-table :test 'dbus-hash-table-test)) -- 2.39.2