emacs data-provider should handle dbus errors

Bug #779831 reported by MartinDengler
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zeitgeist Data-Sources
Fix Committed
Low
Siegfried Gevatter

Bug Description

My screen-based emacs's DBUS_SESSION_BUS_ADDRESS environment variable got superceded, and though emacs was fine and could open frames in the new session, it was very naughty about opening, saving, and closing files/buffers because the dbus-call-method in zeitgeist.el was failing.

This patch reduces the annoyance a bit:

--- emacs/zeitgeist.el 2011-05-04 18:57:00 +0000
+++ emacs/zeitgeist.el 2011-05-09 09:59:08 +0000
@@ -26,12 +26,14 @@

 (defun zeitgeist-call (method &rest args)
   "Call the zeitgeist method METHOD with ARGS over dbus"
- (apply 'dbus-call-method
- :session ; use the session (not system) bus
- "org.gnome.zeitgeist.Engine" ; service name
- "/org/gnome/zeitgeist/log/activity" ; path name
- "org.gnome.zeitgeist.Log" ; interface name
- method args))
+ (condition-case err
+ (apply 'dbus-call-method
+ :session ; use the session (not system) bus
+ "org.gnome.zeitgeist.Engine" ; service name
+ "/org/gnome/zeitgeist/log/activity" ; path name
+ "org.gnome.zeitgeist.Log" ; interface name
+ method args))
+ (dbus-error (message (format "zeitgeist-call %s failed due to D-Bus error %s" method err))))

 (defun zeitgeist-event-timestamp ()
   "Get the timestamp in zeitgeist format."

Related branches

Revision history for this message
MartinDengler (mtd) wrote :

Sorry, flubbed one set of parens in condition-case when rebasing to latest zeitgeist.el; Here's the right diff:

=== modified file 'emacs/zeitgeist.el'
--- emacs/zeitgeist.el 2011-05-04 18:57:00 +0000
+++ emacs/zeitgeist.el 2011-05-09 14:36:21 +0000
@@ -26,12 +26,14 @@

 (defun zeitgeist-call (method &rest args)
   "Call the zeitgeist method METHOD with ARGS over dbus"
- (apply 'dbus-call-method
- :session ; use the session (not system) bus
- "org.gnome.zeitgeist.Engine" ; service name
- "/org/gnome/zeitgeist/log/activity" ; path name
- "org.gnome.zeitgeist.Log" ; interface name
- method args))
+ (condition-case err
+ (apply 'dbus-call-method
+ :session ; use the session (not system) bus
+ "org.gnome.zeitgeist.Engine" ; service name
+ "/org/gnome/zeitgeist/log/activity" ; path name
+ "org.gnome.zeitgeist.Log" ; interface name
+ method args)
+ (dbus-error (message (format "zeitgeist-call %s failed due to D-Bus error %s" method err)))))

 (defun zeitgeist-event-timestamp ()
   "Get the timestamp in zeitgeist format."

Changed in zeitgeist-dataproviders:
assignee: nobody → Siegfried Gevatter (rainct)
importance: Undecided → Low
milestone: none → 0.8.0
status: New → Confirmed
Revision history for this message
Siegfried Gevatter (rainct) wrote :

Thanks, I've committed your fix.

Can you please check if it's working right (since I applied the chnges by hand):
http://bazaar.launchpad.net/~zeitgeist-dataproviders/zeitgeist-dataproviders/trunk/view/head:/emacs/zeitgeist.el

Changed in zeitgeist-dataproviders:
status: Confirmed → Fix Committed
Revision history for this message
MartinDengler (mtd) wrote : Re: [Bug 779831] Re: emacs data-provider should handle dbus errors

On Wed, May 11, 2011 at 04:04:01PM -0000, Siegfried Gevatter wrote:
> Thanks, I've committed your fix.
>
> Can you please check if it's working right (since I applied the chnges by hand):
> http://bazaar.launchpad.net/~zeitgeist-dataproviders/zeitgeist-dataproviders/trunk/view/head:/emacs/zeitgeist.el

Thanks - looks good to me.

Martin

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.