Subject: bug#32828: 27.0.50; Docstring of `dbus-init-bus' incorrect

From: Michael Albinus <[email-masked]>
Date: Tue, 25 Sep 2018 11:55:39 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> >> The function returns a number, which counts the connections this Emacs
>> >> session has established to the BUS under the same unique name
>> >
>> > However:
>> >
>> > (dbus-init-bus :system)
>> >
>> > ==> ((:signal :system "org.freedesktop.DBus.Local" "Disconnected") (nil "/org/freedesktop/DBus/Local" dbus-handle-bus-disconnect))
>> >
>> > Looking at the definition of `dbus-init-bus', it seems that only a
>> > `prog1' form is missing to make the docstring correct:
>> >
>> >   (prog1 (dbus--init-bus ...) (dbus-register-signal ...))
>>
>> Indeed. dbus--init-bus keeps the original implementation of dbus-init-bus.
>> It would be safe to apply this patch even to the emacs-26 branch, IMHO.
>>
>> Eli?
>
> ENOPATCH

My question was, whether we could apply the proposed change to the
emacs-26 branch. What else are you missing? The patch itself? It's
obvious from Philipp's message, but here it is:

diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index f63ab9a15a..5f44c36034 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -1791,10 +1791,11 @@ dbus-init-bus
 this connection to those buses."
   (or (featurep 'dbusbind)
       (signal 'dbus-error (list "Emacs not compiled with dbus support")))
-  (dbus--init-bus bus private)
-  (dbus-register-signal
-   bus nil dbus-path-local dbus-interface-local
-   "Disconnected" #'dbus-handle-bus-disconnect))
+  (prog1
+      (dbus--init-bus bus private)
+    (dbus-register-signal
+     bus nil dbus-path-local dbus-interface-local
+     "Disconnected" #'dbus-handle-bus-disconnect)))
 
  
 ;; Initialize `:system' and `:session' buses.  This adds their file

Best regards, Michael.