aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2023-06-12 12:45:38 +0200
committerMichael Albinus2023-06-12 12:45:38 +0200
commit1383efe01d0ee8ba3ea8da5ab41b07f5672191bf (patch)
tree7145ae70b17fe202d11357608845783e96b1d5b0
parentbdb0bc2b4e44a7d40369e10e3de825d58fe46825 (diff)
downloademacs-1383efe01d0ee8ba3ea8da5ab41b07f5672191bf.tar.gz
emacs-1383efe01d0ee8ba3ea8da5ab41b07f5672191bf.zip
Fix setting $DBUS_SESSION_BUS_ADDRESS after Emacs has started
* doc/misc/dbus.texi (Alternative Buses): Explain using $DBUS_SESSION_BUS_ADDRESS after Emacs has started. * src/dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Use egetenv.
-rw-r--r--doc/misc/dbus.texi20
-rw-r--r--src/dbusbind.c2
2 files changed, 19 insertions, 3 deletions
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 97a0f39ea13..2bd6b9556c8 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -1847,8 +1847,24 @@ This function establishes the connection to D-Bus @var{bus}.
1847corresponding bus. For the system and session buses, this function is 1847corresponding bus. For the system and session buses, this function is
1848called when loading @file{dbus.el}, there is no need to call it again. 1848called when loading @file{dbus.el}, there is no need to call it again.
1849 1849
1850The function returns the number of connections this Emacs session has 1850If Emacs was invoked when there was no D-Bus session bus available
1851established to the @var{bus} under the same unique name 1851yet, you can set the environment variable
1852@env{DBUS_SESSION_BUS_ADDRESS} once the session bus daemon is running
1853and offering the address. Calling @code{dbus-init-bus} initializes
1854the connection to the session bus.
1855
1856@lisp
1857(setenv "DBUS_SESSION_BUS_ADDRESS" "unix:path=/run/user/1000/bus")
1858
1859@result{} "unix:path=/run/user/1000/bus"
1860
1861(dbus-init-bus :session)
1862
1863@result{} 2
1864@end lisp
1865
1866@code{dbus-init-bus} returns the number of connections this Emacs
1867session has established to the @var{bus} under the same unique name
1852(@pxref{dbus-get-unique-name}). It depends on the libraries Emacs is 1868(@pxref{dbus-get-unique-name}). It depends on the libraries Emacs is
1853linked with, and on the environment Emacs is running. For example, if 1869linked with, and on the environment Emacs is running. For example, if
1854Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware 1870Emacs is linked with the GTK+ toolkit, and it runs in a GTK+-aware
diff --git a/src/dbusbind.c b/src/dbusbind.c
index d96b735c79a..97094e407d7 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -276,7 +276,7 @@ XD_OBJECT_TO_STRING (Lisp_Object object)
276 276
277#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ 277#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \
278 do { \ 278 do { \
279 char const *session_bus_address = getenv ("DBUS_SESSION_BUS_ADDRESS"); \ 279 char const *session_bus_address = egetenv ("DBUS_SESSION_BUS_ADDRESS"); \
280 if (STRINGP (bus)) \ 280 if (STRINGP (bus)) \
281 { \ 281 { \
282 DBusAddressEntry **entries; \ 282 DBusAddressEntry **entries; \