From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: andres.ramirez Newsgroups: gmane.emacs.devel Subject: Re: Issue connecting Emacs --daemon to D-BUS Date: Tue, 02 Oct 2012 00:38:05 -0500 Message-ID: <87ipat1lj6.wl%andres.ramirez@kipuamutay.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1349156316 22424 80.91.229.3 (2 Oct 2012 05:38:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Oct 2012 05:38:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 02 07:38:42 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 1TIvBn-0000qD-DE for ged-emacs-devel@m.gmane.org; Tue, 02 Oct 2012 07:38:39 +0200 Original-Received: from localhost ([::1]:36155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIvBh-00048Y-VC for ged-emacs-devel@m.gmane.org; Tue, 02 Oct 2012 01:38:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIvBd-00044i-Rf for emacs-devel@gnu.org; Tue, 02 Oct 2012 01:38:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIvBc-0002JZ-D8 for emacs-devel@gnu.org; Tue, 02 Oct 2012 01:38:29 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:61191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIvBc-0002JS-7Q for emacs-devel@gnu.org; Tue, 02 Oct 2012 01:38:28 -0400 Original-Received: by yenq11 with SMTP id q11so1675552yen.0 for ; Mon, 01 Oct 2012 22:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:message-id:from:to:cc:newsgroups:subject:in-reply-to :references:x-mailer:user-agent:mime-version:content-type :content-transfer-encoding; bh=BLEuxcizadw+naxdKbwmS+q8Iy31XkrPHR4OE5eBfQc=; b=yanelnCMb3lidU9lEILk6mMR5cIxbS+c17Cwc+SwOUGkd8Qesb4ogWeSWpasZCPjC3 15KcbRNYMiHo17SVcR0+BLhZwxU3WFLAzPyDh/NX9wdA83P8AlhCLvmROtnh2OzQC9AD KoRRSLMDNjNulFNyowCmIzugIVMR471GxRGRX+aABO9rYj/LtbNJkEJO3ViheteAzjdp G6y0CUtbIVhlNlO8kUxztwxQ3xzuzkhahOn+uzQZ8LLA+O6pWgTHcF0QI+NtyxGzQqU4 RjuSzxGQtkBnH5erEDMg5n3alJSYeff2UvidufzyDKQCipi4ujhcKXN6RtpPUV3DJpsB xefw== Original-Received: by 10.236.76.132 with SMTP id b4mr17350408yhe.106.1349156307264; Mon, 01 Oct 2012 22:38:27 -0700 (PDT) Original-Received: from paracas.ryu.edu ([190.232.166.93]) by mx.google.com with ESMTPS id r43sm325122yhc.0.2012.10.01.22.38.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Oct 2012 22:38:26 -0700 (PDT) Original-Newsgroups: gmane.emacs.devel In-Reply-To: X-Mailer: Wanderlust/2.15.9 User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.2 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.169 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:153890 Archived-At: Hi Joakim. =46rom 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\ se= rver-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_AD= DRESS\"\) 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/notificat= ion-message-im.svg" :urgency 'low)) The crucial point is calling `dbus-init-bus' and using the bus address as argument of `notifications-notify'. `dbus-init-bus' must be called only once for a new address, but it doesn't hurt when you call it always. Btw, there was a subtle bug in `dbus-init-bus', which took me so long to test ... Now your notifications shall be visible, wherever you call emacsclient from. Even if you stop your session, and restart it, it shall work, because the new D-Bus session bus will be found. At Thu, 27 Sep 2012 11:42:13 +0200, joakim@verona.se wrote: >=20 > This will be a rather vague problem description, sorry. >=20 > I'm trying to start using Emacs in its daemonic form: > emacs --daemon >=20 > The idea is that since the Gnome 3 gnome-shell sometimes crashes several = times a > day for me, my emacs will survive and I can simply reconnect with > emacsclient once gnome-shell is up again. >=20 > Since I want my emacs to start as a service daemon when the machine > boots, there is no dbus or gnome session to connect to yet. I want to > attach to dbus and gnome once the gui session is started. >=20 >=20 >=20 > for the gnome keyring I can do this: > m-x setenv SSH_AUTH_SOCK RET /run/user/joakim/keyring-hzCXZo/ssh RET >=20 > where the value is fetched from a shell started within the login > session. I can thus unlock the keyring in gnome and use it in emacs. >=20 > I expect to be able to do the same for dbus, but it doesnt quite work: >=20 > m-x setevn DBUS_SESSION_BUS_ADDRESS RET > unix:abstract=3D/tmp/dbus-XpKHIj1IpU,guid=3D5a7b419d5e50e78fe35e6ccf00057= 87a > RET >=20 > I still get: >=20 > ELISP> (dbus-init-bus :session) > *** Eval error *** D-Bus error: "No connection to bus", :session >=20 > And here somewhere is my actuall issue: "No connection to bus" can be > returned in several places in dbusbind.c, so I cant really debug which > of the checks are triggered.=20 >=20 >=20 > (dbus-init-bus :system) seems to work and return 2. > --=20 > Joakim Verona >=20 >=20