summaryrefslogtreecommitdiff
path: root/lisp/battery.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1998-02-25 22:44:24 +0000
committerKarl Heuer <kwzh@gnu.org>1998-02-25 22:44:24 +0000
commitd5323ba0c25159b7e73de1cfbc096d848230a03b (patch)
tree886b0c6503d72551a38aacabff9b58d060dfc983 /lisp/battery.el
parent2154db49c887727459be775026a59daf132dce10 (diff)
downloademacs-d5323ba0c25159b7e73de1cfbc096d848230a03b.tar.gz
(battery-linux-proc-apm-regexp): Load percentage
and remaining time have to match negative values. (battery-linux-proc-apm): Initialize void %-sequences.
Diffstat (limited to 'lisp/battery.el')
-rw-r--r--lisp/battery.el30
1 files changed, 15 insertions, 15 deletions
diff --git a/lisp/battery.el b/lisp/battery.el
index f3bbb89b15b..702ef75f810 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -1,9 +1,9 @@
;;; battery.el --- display battery status information.
-;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998 Free Software Foundation, Inc.
;; Author: Ralph Schleicher <rs@purple.UL.BaWue.DE>
-;; Keywords: local hardware
+;; Keywords: hardware
;; This file is part of GNU Emacs.
@@ -126,8 +126,8 @@ seconds."
" 0x\\([0-9a-f]+\\)" ; AC line status.
" 0x\\([0-9a-f]+\\)" ; Battery status.
" 0x\\([0-9a-f]+\\)" ; Battery flags.
- " \\([0-9]+\\)%" ; Load percentage.
- " \\([0-9]+\\)" ; Remaining time.
+ " \\(-?[0-9]+\\)%" ; Load percentage.
+ " \\(-?[0-9]+\\)" ; Remaining time.
" \\(.*\\)" ; Time unit.
"$")
"Regular expression matching contents of `/proc/apm'.")
@@ -193,17 +193,17 @@ The following %-sequences are provided:
(setq remaining-time
(format "%d:%02d" hours (- minutes (* 60 hours)))))))
(and buffer (kill-buffer buffer)))
- (list (cons ?v driver-version)
- (cons ?V bios-version)
- (cons ?I bios-interface)
- (cons ?L line-status)
- (cons ?B battery-status)
- (cons ?b battery-status-symbol)
- (cons ?p load-percentage)
- (cons ?s (and seconds (number-to-string seconds)))
- (cons ?m (and minutes (number-to-string minutes)))
- (cons ?h (and hours (number-to-string hours)))
- (cons ?t remaining-time))))
+ (list (cons ?v (or driver-version "N/A"))
+ (cons ?V (or bios-version "N/A"))
+ (cons ?I (or bios-interface "N/A"))
+ (cons ?L (or line-status "N/A"))
+ (cons ?B (or battery-status "N/A"))
+ (cons ?b (or battery-status-symbol ""))
+ (cons ?p (or load-percentage "N/A"))
+ (cons ?s (or (and seconds (number-to-string seconds)) "N/A"))
+ (cons ?m (or (and minutes (number-to-string minutes)) "N/A"))
+ (cons ?h (or (and hours (number-to-string hours)) "N/A"))
+ (cons ?t (or remaining-time "N/A")))))
;;; Private functions.