ср, 5 февр. 2020 г. в 06:03, Stefan Monnier : > >> 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 > changed). > Not much impact actually. Here is the updated battery.el against the master this time. Also added "%b" format-spec, so 'M-x display-battery-mode RET' shows "+" in case AC is on-line Thanks -- lg