From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Issue connecting Emacs --daemon to D-BUS Date: Mon, 08 Oct 2012 14:28:58 +0200 Message-ID: <87zk3xkv05.fsf@gmx.de> References: <87ipat1lj6.wl%andres.ramirez@kipuamutay.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1349699353 17857 80.91.229.3 (8 Oct 2012 12:29:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2012 12:29:13 +0000 (UTC) Cc: "andres.ramirez" , emacs-devel@gnu.org To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 08 14:29:19 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TLCSV-0001Eo-Gf for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2012 14:29:19 +0200 Original-Received: from localhost ([::1]:59178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLCSP-0008Ui-9x for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2012 08:29:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLCSJ-0008U2-IX for emacs-devel@gnu.org; Mon, 08 Oct 2012 08:29:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLCSF-00074p-9P for emacs-devel@gnu.org; Mon, 08 Oct 2012 08:29:07 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:42955) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TLCSE-00074g-Uz for emacs-devel@gnu.org; Mon, 08 Oct 2012 08:29:03 -0400 Original-Received: (qmail invoked by alias); 08 Oct 2012 12:29:00 -0000 Original-Received: from p57BB95D8.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.149.216] by mail.gmx.net (mp035) with SMTP; 08 Oct 2012 14:29:00 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18zE8EMW7MzAykSpXyvMtXeVfWmxdLRDRN90u4Nwa cqxyjEsaioqvNd In-Reply-To: <87ipat1lj6.wl%andres.ramirez@kipuamutay.com> (andres ramirez's message of "Tue, 02 Oct 2012 00:38:05 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.23 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154228 Archived-At: [Sorry for the late answer, I was offline last weeks due to vacation] andres.ramirez writes: Hi Joakim. > From a Discussion with Michael Albinus. > > This is what works for me. Using the emacs trunk: > > - You start the daemon as usual via crontab: > > @reboot /usr/local/src/emacs/src/emacs --quick --eval \(progn\ \(setq\ server-name\ \"test\"\)\ \) --daemon > > - In your emacsclient call, you hand over $DBUS_SESSION_BUS_ADDRESS via > the variable `my-dbus-address': > > emacsclient -s test -c -e \(setq\ my-dbus-address\ \"$DBUS_SESSION_BUS_ADDRESS\"\) > > Instead of expanding $DBUS_SESSION_BUS_ADDRESS you could use any > address string, once you know it. > > - In your Emacs daemon, you can now apply the following code: > > (progn > (require 'notifications) > (dbus-init-bus my-dbus-address) > (notifications-notify > :bus my-dbus-address > :title "nick" > :body "message" > :app-icon "/usr/share/notify-osd/icons/gnome/scalable/status/notification-message-im.svg" > :urgency 'low)) Does this recipe work for you? It is a limited use case, because you have to manage your own session bus address, instead of using `:session'. If you need a more general solution, because you use libraries which depend on the `:session' bus, you might try to postpone the load of dbus.el to the emacsclient call, after setting $DBUS_SESSION_BUS_ADDRESS properly. Best regards, Michael.