GNU bug report logs -
#18157
24.4.50; battery-pmset fails to report critical battery state
Previous Next
Reported by: Sebastian Wiesner <swiesner <at> lunaryorn.com>
Date: Thu, 31 Jul 2014 13:18:02 UTC
Severity: normal
Tags: fixed
Found in version 24.4.50
Fixed in version 25.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18157 in the body.
You can then email your comments to 18157 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Thu, 31 Jul 2014 13:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sebastian Wiesner <swiesner <at> lunaryorn.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 31 Jul 2014 13:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
`battery-pmset' fails to correctly report critical battery state: Even
if the battery charge level is below `battery-load-critical', it reports
"low" battery state only.
The culprit is the `cond' expression in the body of `battery-pmset'
which compares the reported `load-percentage' against `battery-load-low'
first, and then against `battery-load-critical'.
Since the latter is typically lower, it will never be reached, because
`cond' already returns after the former succeeded.
To fix this issue, `batter-pmset' needs to check `battery-load-critical'
*first*, and then `battery-load-low'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Tue, 16 Feb 2016 14:58:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 18157 <at> debbugs.gnu.org (full text, mbox):
On 2014-07-31, at 16:16, Sebastian Wiesner <swiesner <at> lunaryorn.com> wrote:
> `battery-pmset' fails to correctly report critical battery state: Even
> if the battery charge level is below `battery-load-critical', it reports
> "low" battery state only.
>
> The culprit is the `cond' expression in the body of `battery-pmset'
> which compares the reported `load-percentage' against `battery-load-low'
> first, and then against `battery-load-critical'.
>
> Since the latter is typically lower, it will never be reached, because
> `cond' already returns after the former succeeded.
>
> To fix this issue, `batter-pmset' needs to check `battery-load-critical'
> *first*, and then `battery-load-low'.
Does this patch help?
--8<---------------cut here---------------start------------->8---
diff -u --label /usr/local/share/emacs/25.1.50/lisp/battery.el.gz --label \#\<buffer\ battery.el.gz\> /tmp/jka-com1889YvM /tmp/buffer-content-1889yDZ
--- /usr/local/share/emacs/25.1.50/lisp/battery.el.gz
+++ #<buffer battery.el.gz>
@@ -628,12 +628,12 @@
(cond ((looking-at "; charging")
(setq battery-status "charging"
battery-status-symbol "+"))
- ((< (string-to-number load-percentage) battery-load-low)
- (setq battery-status "low"
- battery-status-symbol "-"))
((< (string-to-number load-percentage) battery-load-critical)
(setq battery-status "critical"
battery-status-symbol "!"))
+ ((< (string-to-number load-percentage) battery-load-low)
+ (setq battery-status "low"
+ battery-status-symbol "-"))
(t
(setq battery-status "high"
battery-status-symbol "")))
Diff finished. Tue Feb 16 15:56:03 2016
--8<---------------cut here---------------end--------------->8---
Best,
--
mb
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Tue, 16 Feb 2016 18:42:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 18157 <at> debbugs.gnu.org (full text, mbox):
> Am 16.02.2016 um 15:56 schrieb Marcin Borkowski <mbork <at> mbork.pl>:
>
> On 2014-07-31, at 16:16, Sebastian Wiesner <swiesner <at> lunaryorn.com> wrote:
>
>> `battery-pmset' fails to correctly report critical battery state: Even
>> if the battery charge level is below `battery-load-critical', it reports
>> "low" battery state only.
>>
>> The culprit is the `cond' expression in the body of `battery-pmset'
>> which compares the reported `load-percentage' against `battery-load-low'
>> first, and then against `battery-load-critical'.
>>
>> Since the latter is typically lower, it will never be reached, because
>> `cond' already returns after the former succeeded.
>>
>> To fix this issue, `batter-pmset' needs to check `battery-load-critical'
>> *first*, and then `battery-load-low'.
>
> Does this patch help?
I'm sorry, are you asking me? It would be bold to believe that I still cared for this issue now, almost *two years* after I reported it.
At a cursory look the fix surely looks correct, but I hope you understand that Emacs taking two years for what seems to be a trivial issue to fix does not particularly contribute to my enthusiasm, nor does it motivate me to test this patch.
> --8<---------------cut here---------------start------------->8---
> diff -u --label /usr/local/share/emacs/25.1.50/lisp/battery.el.gz --label \#\<buffer\ battery.el.gz\> /tmp/jka-com1889YvM /tmp/buffer-content-1889yDZ
> --- /usr/local/share/emacs/25.1.50/lisp/battery.el.gz
> +++ #<buffer battery.el.gz>
> @@ -628,12 +628,12 @@
> (cond ((looking-at "; charging")
> (setq battery-status "charging"
> battery-status-symbol "+"))
> - ((< (string-to-number load-percentage) battery-load-low)
> - (setq battery-status "low"
> - battery-status-symbol "-"))
> ((< (string-to-number load-percentage) battery-load-critical)
> (setq battery-status "critical"
> battery-status-symbol "!"))
> + ((< (string-to-number load-percentage) battery-load-low)
> + (setq battery-status "low"
> + battery-status-symbol "-"))
> (t
> (setq battery-status "high"
> battery-status-symbol "")))
>
> Diff finished. Tue Feb 16 15:56:03 2016
> --8<---------------cut here---------------end--------------->8---
>
> Best,
>
> --
> mb
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Tue, 16 Feb 2016 19:05:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 18157 <at> debbugs.gnu.org (full text, mbox):
> From: Sebastian Wiesner <swiesner <at> lunaryorn.com>
> Date: Tue, 16 Feb 2016 19:41:25 +0100
> Cc: 18157 <at> debbugs.gnu.org
>
> I hope you understand that Emacs taking two years for what seems to be a trivial issue to fix does not particularly contribute to my enthusiasm, nor does it motivate me to test this patch.
FWIW, I'm very grateful to Marcin and a few people like him for
investing their time into working on this and other bug reports, and
hope that more contributors like them will come on board and help in
this effort.
Thanks a lot, guys!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Tue, 16 Feb 2016 23:45:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 18157 <at> debbugs.gnu.org (full text, mbox):
On 2016-02-16, at 19:41, Sebastian Wiesner <swiesner <at> lunaryorn.com> wrote:
>> Does this patch help?
>
> I'm sorry, are you asking me? It would be bold to believe that I still cared for this issue now, almost *two years* after I reported it.
>
> At a cursory look the fix surely looks correct, but I hope you understand that Emacs taking two years for what seems to be a trivial issue to fix does not particularly contribute to my enthusiasm, nor does it motivate me to test this patch.
I am also sorry if I sounded rude. The question was directed to people
reading the bug-gnu-emacs mailing list as well as to you. I am also
sorry that this was not fixed earlier, but I am bold enough to believe
that it is better to try to investigate it now than to leave it forever.
I am also sorry that I didn't test this myself. However, I do not own
a Mac, so I could only transcribe your report into a (trivial,
admittedly) patch for others to test. I do not consider my input here
too valuable (everyone could write this patch, even without any deeper
knowledge about Elisp, thanks to your detailed report and suggestion as
to were the correct fix was - thank you for that!), but I hoped that
what I may have /really/ fixed was the problem of your report not
gaining enough attention when it was sent.
Also, even if you don't care for this issue anymore, there may be other
people who do. And you were the author of the report, so it was
a natural thing to send this message to you. (In fact, this is what the
debbugs tool did, as it does by default when responding to bug reports.)
Also, if I should have behaved differently, please tell me what I could
have done better (apart from the not-so-optimal wording of my message).
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Sat, 20 Feb 2016 05:57:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 18157 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
> FWIW, I'm very grateful to Marcin and a few people like him for investing
> their time into working on this and other bug reports, and hope that more
> contributors like them will come on board and help in this effort.
>
> Thanks a lot, guys!
I would like to second that thanks. We move at the speed of our volunteers.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Sat, 20 Feb 2016 07:36:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 18157 <at> debbugs.gnu.org (full text, mbox):
Marcin Borkowski <mbork <at> mbork.pl> writes:
> Does this patch help?
>
> diff -u --label /usr/local/share/emacs/25.1.50/lisp/battery.el.gz --label \#\<buffer\ battery.el.gz\> /tmp/jka-com1889YvM /tmp/buffer-content-1889yDZ
> --- /usr/local/share/emacs/25.1.50/lisp/battery.el.gz
> +++ #<buffer battery.el.gz>
> @@ -628,12 +628,12 @@
> (cond ((looking-at "; charging")
> (setq battery-status "charging"
> battery-status-symbol "+"))
> - ((< (string-to-number load-percentage) battery-load-low)
> - (setq battery-status "low"
> - battery-status-symbol "-"))
> ((< (string-to-number load-percentage) battery-load-critical)
> (setq battery-status "critical"
> battery-status-symbol "!"))
> + ((< (string-to-number load-percentage) battery-load-low)
> + (setq battery-status "low"
> + battery-status-symbol "-"))
> (t
> (setq battery-status "high"
> battery-status-symbol "")))
Looks logical to me. I've applied it to emacs-25.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18157
; Package
emacs
.
(Sat, 20 Feb 2016 07:38:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 18157 <at> debbugs.gnu.org (full text, mbox):
Marcin Borkowski <mbork <at> mbork.pl> writes:
> Also, if I should have behaved differently, please tell me what I could
> have done better (apart from the not-so-optimal wording of my message).
No, you've done exactly what we hope people would do. Thank you for
investigating the problem and providing a patch.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 20 Feb 2016 07:40:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 25.1, send any further explanations to
18157 <at> debbugs.gnu.org and Sebastian Wiesner <swiesner <at> lunaryorn.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 20 Feb 2016 07:40:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 19 Mar 2016 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 88 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.