unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Symbol’s function definition is void: dbus-call-method-asynchronously
@ 2025-01-10 17:14 Jeremy Korwin-Zmijowski
  2025-01-11 16:19 ` tpeplt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeremy Korwin-Zmijowski @ 2025-01-10 17:14 UTC (permalink / raw)
  To: help-gnu-emacs

Dear Emacs community,

I am confused while facing this error when launching Emacs :

    Error (use-package): emacs/:config: Symbol’s function definition is
    void: dbus-call-method-asynchronously

As I thought the procedure should be available.

I am using GNU Emacs 29.4.

Here is my relative configuration bloc where I want to set the theme 
according to my system (Ubuntu) theme style (dark/light) :

    #+BEGIN_SRC emacs-lisp
    (use-package emacs
       :hook (after-init . jk/watch-system-theme-change)
       :config
       (require-theme 'modus-themes)

       (setq modus-themes-italic-constructs t
             modus-themes-bold-constructs t
         modus-themes-common-palette-overrides
    'modus-themes-preset-overrides-intense)

       (defun jk/set-theme-from-dbus-value (value)
         "Set the appropiate theme according to the system's
    color-scheme setting value."
         (interactive)
         (message "value is %s" value)
         (if (equal value '1)
             (progn (message "Auto switch to dark theme")
                    (modus-themes-load-vivendi))
           (progn (message "Auto switch to light theme")
                  (modus-themes-load-operandi))))

       (defun jk/color-scheme-changed (namespace key value)
         "DBus handler to detect when the system's color-scheme has
    changed."
         (interactive)
         (message "SettingChanged signal : %s %s %s" namespace key value)
         (when (and (string-equal namespace "org.freedesktop.appearance")
                    (string-equal key "color-scheme"))
           (jk/set-theme-from-dbus-value (car value))))

       (defun jk/watch-system-theme-change ()
         "Register to DBus Signal to listen futur system's color-sheme
    changes."
         (interactive)
         (dbus-register-signal
          :session "org.freedesktop.portal.Desktop"
          "/org/freedesktop/portal/desktop"
    "org.freedesktop.portal.Settings"
          "SettingChanged"
          #'jk/color-scheme-changed))

       (defun jk/request-current-system-theme ()
         "Request the current color-scheme."
         (interactive)
         (dbus-call-method-asynchronously
          :session "org.freedesktop.portal.Desktop"
          "/org/freedesktop/portal/desktop"
    "org.freedesktop.portal.Settings"
          "Read"
          (lambda (value) (jk/set-theme-from-dbus-value (caar value)))
          "org.freedesktop.appearance"
          "color-scheme"))

       (jk/request-current-system-theme)
       :bind ("<f5>" . modus-themes-toggle))
    #+END_SRC

Thank you for you for reading and maybe help.

Jeremy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Symbol’s function definition is void: dbus-call-method-asynchronously
  2025-01-10 17:14 Symbol’s function definition is void: dbus-call-method-asynchronously Jeremy Korwin-Zmijowski
@ 2025-01-11 16:19 ` tpeplt
  2025-01-11 17:53 ` Michael Albinus
  2025-01-12  0:31 ` Michael Heerdegen
  2 siblings, 0 replies; 4+ messages in thread
From: tpeplt @ 2025-01-11 16:19 UTC (permalink / raw)
  To: Jeremy Korwin-Zmijowski; +Cc: help-gnu-emacs

Jeremy Korwin-Zmijowski <jeremy@korwin-zmijowski.fr> writes:

> Dear Emacs community,
>
> I am confused while facing this error when launching Emacs :
>
>     Error (use-package): emacs/:config: Symbol’s function definition is
>     void: dbus-call-method-asynchronously
>
> As I thought the procedure should be available.
>
> I am using GNU Emacs 29.4.
>

If I start Emacs with ‘emacs -Q’, the function
‘dbus-call-method-asynchronously’ is defined via the file ‘dbus.el’,
which is included in Emacs’s set of Lisp files.  (Moreover, your code
calls ‘dbus-register-signal’, which is also defined in ‘dbus.el’.)

Possibly, you have code that has modified ‘load-path’ so that Emacs can
no longer find ‘dbus.el’.

You might try starting Emacs with ‘emacs -Q’, and then verifying that
you can look up the dbus functions using C-h f (that is, Emacs can find
the dbus functions).  ‘dbus.el’ is found in
<path-to-Emacs>/29.4/lisp/net.  You can then check for that in your
Emacs’s ‘load-path’ and possibly track down what might have caused it to
be lost.

> Here is my relative configuration bloc where I want to set the theme 
> according to my system (Ubuntu) theme style (dark/light) :
>

-- 
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Symbol’s function definition is void: dbus-call-method-asynchronously
  2025-01-10 17:14 Symbol’s function definition is void: dbus-call-method-asynchronously Jeremy Korwin-Zmijowski
  2025-01-11 16:19 ` tpeplt
@ 2025-01-11 17:53 ` Michael Albinus
  2025-01-12  0:31 ` Michael Heerdegen
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2025-01-11 17:53 UTC (permalink / raw)
  To: Jeremy Korwin-Zmijowski; +Cc: help-gnu-emacs

Jeremy Korwin-Zmijowski <jeremy@korwin-zmijowski.fr> writes:

> Dear Emacs community,

Hi Jeremy,

> I am confused while facing this error when launching Emacs :
>
>     Error (use-package): emacs/:config: Symbol’s function definition is
>     void: dbus-call-method-asynchronously

Is your Emacs build with D-Bus support? Check (featurep 'dbus) returning t.

> As I thought the procedure should be available.

This function is not autoloaded. You must load dbus.el, for example

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(use-package emacs
 :requires dbus      
--8<---------------cut here---------------end--------------->8---

or similar; I don't use use-package myself.

> Thank you for you for reading and maybe help.
>
> Jeremy

Best regars, Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Symbol’s function definition is void: dbus-call-method-asynchronously
  2025-01-10 17:14 Symbol’s function definition is void: dbus-call-method-asynchronously Jeremy Korwin-Zmijowski
  2025-01-11 16:19 ` tpeplt
  2025-01-11 17:53 ` Michael Albinus
@ 2025-01-12  0:31 ` Michael Heerdegen
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2025-01-12  0:31 UTC (permalink / raw)
  To: Jeremy Korwin-Zmijowski; +Cc: help-gnu-emacs

Jeremy Korwin-Zmijowski <jeremy@korwin-zmijowski.fr> writes:

> I am confused while facing this error when launching Emacs :
>
>     Error (use-package): emacs/:config: Symbol’s function definition is
>     void: dbus-call-method-asynchronously

You are using functions that are not autoloaded.  dbus is not preloaded.
Is not maybe just a (require 'dbus) missing in your config?


Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-12  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10 17:14 Symbol’s function definition is void: dbus-call-method-asynchronously Jeremy Korwin-Zmijowski
2025-01-11 16:19 ` tpeplt
2025-01-11 17:53 ` Michael Albinus
2025-01-12  0:31 ` Michael Heerdegen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).