emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] battery.el, upower fixes


From: Stefan Monnier
Subject: Re: [PATCH] battery.el, upower fixes
Date: Tue, 04 Feb 2020 20:27:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Hmm, maybe no reason actually.  My thought was about providing some way for
> user to autodetect :battery and :line-power device in his init.el and
> explicitly write something like:
>
>   (setq battery-upower-device (battery-upower-device-autodetect :battery))
>
> So he states in the config, that he has upower and want error to be rised
> if upower service is not available.

But

    (setq battery-status-function #'battery-upower)

already does that in a more direct and reliable way, no?

> If `battery.el` is loaded unintentionally, then all the custom vars will
> have suitable values to have no warnings.  However if user explicitly set
> `battery-upower-device` to invalid value, then warning will arise on
> battery.el load.

Exactly, and even if the user did not intend to use battery in this
session (Elisp files can be loaded "spuriously").

> Otherwise (no warning on invalid `battery-upower-device`), if upower
> service is available - `battery-status-function` will be set to
> upower, and `M-x battery RET` will produce N/A values, and there is no
> clue for the user that he just have invalid value for the
> `battery-upower-device`.

No: `M-x battery` will emit the warning.


        Stefan




reply via email to

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