emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117020: * lisp/battery.el (battery-update): Hand


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-24 r117020: * lisp/battery.el (battery-update): Handle the case where battery
Date: Fri, 25 Apr 2014 18:01:27 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117020
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17319
author: Nicolas Richard <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Fri 2014-04-25 14:01:18 -0400
message:
  * lisp/battery.el (battery-update): Handle the case where battery
  status is "N/A".
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/battery.el                battery.el-20091113204419-o5vbwnq5f7feedwu-1189
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-04-24 15:02:56 +0000
+++ b/lisp/ChangeLog    2014-04-25 18:01:18 +0000
@@ -1,7 +1,12 @@
+2014-04-25  Nicolas Richard  <address@hidden>
+
+       * battery.el (battery-update): Handle the case where battery
+       status is "N/A" (bug#17319).
+
 2014-04-24  Eli Zaretskii  <address@hidden>
 
-       * tooltip.el (tooltip-show-help-non-mode, tooltip-show-help): Use
-       equal-including-properties to compare help-echo strings.  (Bug#17331)
+       * tooltip.el (tooltip-show-help-non-mode, tooltip-show-help):
+       Use equal-including-properties to compare help-echo strings (bug#17331).
 
 2014-04-24  Leo Liu  <address@hidden>
 

=== modified file 'lisp/battery.el'
--- a/lisp/battery.el   2014-03-23 00:08:47 +0000
+++ b/lisp/battery.el   2014-04-25 18:01:18 +0000
@@ -201,19 +201,18 @@
 
 (defun battery-update ()
   "Update battery status information in the mode line."
-  (let ((data (and battery-status-function (funcall battery-status-function))))
+  (let* ((data (and battery-status-function (funcall battery-status-function)))
+         (percentage (car (read-from-string (cdr (assq ?p data))))))
     (setq battery-mode-line-string
          (propertize (if (and battery-mode-line-format
-                              (<= (car (read-from-string (cdr (assq ?p data))))
-                                  battery-mode-line-limit))
-                         (battery-format
-                          battery-mode-line-format
-                          data)
+                              (numberp percentage)
+                               (<= percentage battery-mode-line-limit))
+                         (battery-format battery-mode-line-format data)
                        "")
                      'face
-                     (and (<= (car (read-from-string (cdr (assq ?p data))))
-                                  battery-load-critical)
-                          'error)
+                      (and (numberp percentage)
+                           (<= percentage battery-load-critical)
+                           'error)
                      'help-echo "Battery status information")))
   (force-mode-line-update))
 


reply via email to

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