all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#11269: battery.el does not display remaining time when using sysfs
@ 2012-04-18  6:37 Dan Nicolaescu
  2012-04-20  7:32 ` Chong Yidong
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2012-04-18  6:37 UTC (permalink / raw
  To: 11269


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)







^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#11269: battery.el does not display remaining time when using sysfs
  2012-04-18  6:37 bug#11269: battery.el does not display remaining time when using sysfs Dan Nicolaescu
@ 2012-04-20  7:32 ` Chong Yidong
  0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2012-04-20  7:32 UTC (permalink / raw
  To: Dan Nicolaescu; +Cc: 11269

Dan Nicolaescu <dann@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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-20  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-18  6:37 bug#11269: battery.el does not display remaining time when using sysfs Dan Nicolaescu
2012-04-20  7:32 ` Chong Yidong

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.