[Top][All Lists]

[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 22:03:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> No: `M-x battery` will emit the warning.
> So `battery-upower` should check the correctness of the
> `battery-upower-device` on every call?  It would make it heavier, but of
> course more reliable, because user might change the value of the
> `batter-upower-device` in runtime
> We might have `nil` values for the `battery-upower-device` and
> `battery-upower-line-power-device` meaning "autodetect".  This will require
> additional call to D-Bus (battery-upower-device-list) on every call to
> `battery-upower`, probably this is OK.  If user want extra speed he just
> set right values for that vars.  Sounds good?

Right, we have to decouple the custom vars `battery-upower-device` and
`battery-upower-line-power-device` from the actual list of devices.
We can do this by recomputing the actual list (and checking its
validity) every time time.

Or if the performance impact matters, we can do this computation on the
first call and then check every time that the custom vars haven't
changed (and ask for D-Bus to calls us back when the list needs to be

> Having `nil` values for those defcustom vars, also won't require putting
> them after all the functions



reply via email to

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