comparison lisp/battery.el @ 52470:b4d15685afef

2003-09-10 Mario Lang <mlang@delysid.org> Update Commentary and Copyright. (battery-linux-proc-acpi): Fix a bug in %b which made "!" never appear due to wrong ordering of the expressions in `or'.
author Alex Schroeder <alex@gnu.org>
date Wed, 10 Sep 2003 19:51:01 +0000
parents d096f00804db
children f3be7c4dc1e6
comparison
equal deleted inserted replaced
52469:88758cad1012 52470:b4d15685afef
1 ;;; battery.el --- display battery status information 1 ;;; battery.el --- display battery status information
2 2
3 ;; Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
4 4
5 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org> 5 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org>
6 ;; Keywords: hardware 6 ;; Keywords: hardware
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA. 23 ;; Boston, MA 02111-1307, USA.
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;; There is at present only a function interpreting the new `/proc/apm' 27 ;; There is at present support for interpreting the new `/proc/apm'
28 ;; file format of Linux version 1.3.58 or newer. That is, what a lucky 28 ;; file format of Linux version 1.3.58 or newer and for the `/proc/acpi/'
29 ;; coincidence, exactly the interface provided by the author's laptop. 29 ;; directory structure of Linux 2.4.20 and 2.6.
30 30
31 ;;; Code: 31 ;;; Code:
32 32
33 (require 'timer) 33 (require 'timer)
34 34
306 (match-string 1)))) 306 (match-string 1))))
307 "N/A")) 307 "N/A"))
308 (cons ?r (or (and rate (number-to-string rate)) "N/A")) 308 (cons ?r (or (and rate (number-to-string rate)) "N/A"))
309 (cons ?B (or charging-state "N/A")) 309 (cons ?B (or charging-state "N/A"))
310 (cons ?b (or (and (string= charging-state "charging") "+") 310 (cons ?b (or (and (string= charging-state "charging") "+")
311 (and low (< capacity low) "!")
311 (and warn (< capacity warn) "-") 312 (and warn (< capacity warn) "-")
312 (and low (< capacity low) "!")
313 "")) 313 ""))
314 (cons ?h (or (and hours (number-to-string hours)) "N/A")) 314 (cons ?h (or (and hours (number-to-string hours)) "N/A"))
315 (cons ?m (or (and minutes (number-to-string minutes)) "N/A")) 315 (cons ?m (or (and minutes (number-to-string minutes)) "N/A"))
316 (cons ?t (or (and minutes 316 (cons ?t (or (and minutes
317 (format "%d:%02d" hours (- minutes (* 60 hours)))) 317 (format "%d:%02d" hours (- minutes (* 60 hours))))