[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposed changes to gnus-notifications.el

From: Michael Albinus
Subject: Re: Proposed changes to gnus-notifications.el
Date: Sun, 21 Jul 2019 12:40:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

"Basil L. Contovounesios" <address@hidden> writes:

Hi Basil,

> Michael Albinus <address@hidden> writes:
>> The patch seems to assume that notifications-notify works
>> everywhere. That's not the case, since it depends on D-Bus it runs only
>> for GNU/Linux systems.
> Thank you for pointing this out.  I had wondered about it while
> preparing the patch but could not find a description of what happens
> when notifications are not supported, other than the usual
> "notifications-notify returns an integer ID".
> Does notifications-notify return nil in this case?  If so, I would like
> to document this.  If not, wouldn't this make sense?

Likely yes. It uses with-demoted-errors, which should return nil indeed.

> What is the best way to determine whether notifications are supported by
> the current Emacs instance?  I skimmed through (info "(dbus) Top") and
> (info "(elisp) Desktop Notifications"), as well as through the syms of
> dbusbind.c, dbus.el, and notifications.el, but did not find any clear
> answers.

(featurep 'dbusbind)

checks, whether Emacs is configured to use D-Bus. This does not
necessarily tells you that notifications are supported, but it gives you
a strong indication for this.

You could also wrap the call of notifications-notify by dbus-ignore-errors.

A better check would be to ping notifications-service, but this should
be done inside notifications.el, if needed.

> Currently, gnus-notifications.el checks a) directly whether
> notifications-notify is fboundp, and b) indirectly whether
> notifications-notify returns nil.  Even without notification support,
> (a) should always be true after loading the library, right?  So the
> question is whether (b) is a sufficient condition.
> PS Should gnus-notifications.el be extended to support
> w32-notification-notify?
> PPS Would it be possible/welcome to provide a common interface for both
> notifications-notify and w32-notification-notify?  At the moment it
> sounds like programmers need to choose between the two depending on
> system-type.

In ELPA, there are several notification libraries. alert.el seems to be
the most advanced one, although it doesn't support w32-notification-notify.

> Thanks,

Best regards, Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]