* net/dbus.el (dbus-event-error-hooks): New variable.
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 26 Jan 2009 20:26:52 +0000 (20:26 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 26 Jan 2009 20:26:52 +0000 (20:26 +0000)
(dbus-handle-event): Use it.

lisp/ChangeLog
lisp/net/dbus.el

index 141ea0d..8dbaeba 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-26  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/dbus.el (dbus-event-error-hooks): New variable.
+       (dbus-handle-event): Use it.
+
 2009-01-26  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (ELCFILES): Update.
index ee20db9..39247b0 100644 (file)
@@ -97,6 +97,11 @@ Otherwise, return result of last form in BODY, or all other errors."
 (put 'dbus-ignore-errors 'edebug-form-spec '(form body))
 (font-lock-add-keywords 'emacs-lisp-mode '("\\<dbus-ignore-errors\\>"))
 
+(defvar dbus-event-error-hooks nil
+  "Functions to be called when a D-Bus error happens in the event handler.
+Every function must accept one argument, the error variable
+catched in `condition-case' by `dbus-error'.")
+
 \f
 ;;; Hash table of registered functions.
 
@@ -374,6 +379,7 @@ If the HANDLER returns an `dbus-error', it is propagated as return message."
         (dbus-method-error-internal
          (nth 1 event) (nth 3 event) (nth 4 event) (cadr err))))
      ;; Propagate D-Bus error messages.
+     (run-hook-with-args 'dbus-event-error-hooks err)
      (when (or dbus-debug (= dbus-message-type-error (nth 2 event)))
        (signal (car err) (cdr err))))))