GNU bug report logs - #11269
battery.el does not display remaining time when using sysfs

Previous Next

Package: emacs;

Reported by: Dan Nicolaescu <dann <at> gnu.org>

Date: Wed, 18 Apr 2012 06:38:11 UTC

Severity: normal

Tags: patch

Done: Chong Yidong <cyd <at> gnu.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 11269 in the body.
You can then email your comments to 11269 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11269; Package emacs. (Wed, 18 Apr 2012 06:38:14 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Nicolaescu <dann <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 18 Apr 2012 06:38:14 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: battery.el does not display remaining time when using sysfs
Date: Wed, 18 Apr 2012 02:37:21 -0400
After a kernel upgrade battery.el on a machine started using the sysfs
backend instead of the acpi backend.

That info displayed by default now is not very useful because it does
not include "remaining time" like all the other backends do. 
I think this might be considered a regression, the display was more
useful in the previous version than it is now.

Here's a fix for that, and fix for the charge in a system with 2
batteries, when one of them is not in use.
Please check this in the appropriate place.


       * battery.el (battery-echo-area-format): Display remaining time
       for the sysfs backend too.
       (battery-linux-sysfs): Fix conditional for the charge.



=== modified file 'lisp/battery.el'
--- lisp/battery.el	2012-04-12 02:04:29 +0000
+++ lisp/battery.el	2012-04-16 16:29:43 +0000
@@ -78,7 +78,7 @@ introduced by a `%' character in a contr
   (cond ((eq battery-status-function 'battery-linux-proc-acpi)
 	 "Power %L, battery %B at %r (%p%% load, remaining time %t)")
 	((eq battery-status-function 'battery-linux-sysfs)
-	 "Power %L, battery %B (%p%% load)")
+	 "Power %L, battery %B (%p%% load, remaining time %t)")
 	((eq battery-status-function 'battery-pmset)
 	 "%L power, battery %B (%p%% load, remaining time %t)")
 	(battery-status-function
@@ -509,7 +509,7 @@ The following %-sequences are provided:
 		     "N/A"))
 	  (cons ?d (or temperature "N/A"))
 	  (cons ?B (or charging-state "N/A"))
-	  (cons ?p (cond ((> charge-full 0)
+	  (cons ?p (cond ((and (> charge-full 0) (> charge-now 0))
 			  (format "%.1f"
 				  (/ (* 100 charge-now) charge-full)))
 			 ((> energy-full 0)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11269; Package emacs. (Fri, 20 Apr 2012 07:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 11269 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Dan Nicolaescu <dann <at> gnu.org>
Cc: 11269 <at> debbugs.gnu.org
Subject: Re: bug#11269: battery.el does not display remaining time when using
	sysfs
Date: Fri, 20 Apr 2012 15:32:39 +0800
Dan Nicolaescu <dann <at> gnu.org> writes:

> That info displayed by default now is not very useful because it does
> not include "remaining time" like all the other backends do. 
> I think this might be considered a regression, the display was more
> useful in the previous version than it is now.
>
> Here's a fix for that, and fix for the charge in a system with 2
> batteries, when one of them is not in use.
> Please check this in the appropriate place.

Thanks, committed to emacs-24.




bug closed, send any further explanations to 11269 <at> debbugs.gnu.org and Dan Nicolaescu <dann <at> gnu.org> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 20 Apr 2012 07:34:03 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. (Fri, 18 May 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.