[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/battery.el [emacs-unicode-2]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/battery.el [emacs-unicode-2] |
Date: |
Mon, 28 Jun 2004 05:00:36 -0400 |
Index: emacs/lisp/battery.el
diff -c emacs/lisp/battery.el:1.15.10.1 emacs/lisp/battery.el:1.15.10.2
*** emacs/lisp/battery.el:1.15.10.1 Fri Apr 16 12:49:48 2004
--- emacs/lisp/battery.el Mon Jun 28 07:28:26 2004
***************
*** 61,67 ****
(cond ((eq battery-status-function 'battery-linux-proc-apm)
"Power %L, battery %B (%p%% load, remaining time %t)")
((eq battery-status-function 'battery-linux-proc-acpi)
! "Power %L, battery %B at %r mA (%p%% load, remaining time %t)"))
"*Control string formatting the string to display in the echo area.
Ordinary characters in the control string are printed as-is, while
conversion specifications introduced by a `%' character in the control
--- 61,67 ----
(cond ((eq battery-status-function 'battery-linux-proc-apm)
"Power %L, battery %B (%p%% load, remaining time %t)")
((eq battery-status-function 'battery-linux-proc-acpi)
! "Power %L, battery %B at %r (%p%% load, remaining time %t)"))
"*Control string formatting the string to display in the echo area.
Ordinary characters in the control string are printed as-is, while
conversion specifications introduced by a `%' character in the control
***************
*** 243,249 ****
%m Remaining time in minutes
%h Remaining time in hours
%t Remaining time in the form `h:min'"
! (let (capacity design-capacity rate charging-state warn low minutes hours)
(when (file-directory-p "/proc/acpi/battery/")
;; ACPI provides information about each battery present in the system in
;; a separate subdirectory. We are going to merge the available
--- 243,250 ----
%m Remaining time in minutes
%h Remaining time in hours
%t Remaining time in the form `h:min'"
! (let (capacity design-capacity rate rate-type charging-state warn low
! minutes hours)
(when (file-directory-p "/proc/acpi/battery/")
;; ACPI provides information about each battery present in the system in
;; a separate subdirectory. We are going to merge the available
***************
*** 261,292 ****
;; battery is "charging"/"discharging", the others are
;; "unknown".
(setq charging-state (match-string 1)))
! (when (re-search-forward "present rate: +\\([0-9]+\\) mA$" nil t)
! (setq rate (+ (or rate 0) (string-to-int (match-string 1)))))
! (when (re-search-forward "remaining capacity: +\\([0-9]+\\) mAh$"
nil t)
(setq capacity
(+ (or capacity 0) (string-to-int (match-string 1))))))
(goto-char (point-max))
(insert-file-contents (expand-file-name "info" dir))
(when (re-search-forward "present: +yes$" nil t)
! (when (re-search-forward "design capacity: +\\([0-9]+\\) mAh$"
nil t)
(setq design-capacity (+ (or design-capacity 0)
(string-to-int (match-string 1)))))
! (when (re-search-forward "design capacity warning: +\\([0-9]+\\)
mAh$"
nil t)
(setq warn (+ (or warn 0) (string-to-int (match-string 1)))))
! (when (re-search-forward "design capacity low: +\\([0-9]+\\) mAh$"
nil t)
(setq low (+ (or low 0)
(string-to-int (match-string 1))))))))
(directory-files "/proc/acpi/battery/" t "BAT")))
(and capacity rate
! (setq minutes (floor (* (/ (float (if (string= charging-state
! "charging")
! (- design-capacity capacity)
! capacity)) rate) 60))
hours (/ minutes 60)))
(list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
(cons ?L (or (when (file-exists-p "/proc/acpi/ac_adapter/AC/state")
--- 262,302 ----
;; battery is "charging"/"discharging", the others are
;; "unknown".
(setq charging-state (match-string 1)))
! (when (re-search-forward "present rate: +\\([0-9]+\\) \\(m[AW]\\)$"
! nil t)
! (setq rate (+ (or rate 0) (string-to-int (match-string 1)))
! rate-type (or (and rate-type
! (if (string= rate-type (match-string 2))
! rate-type
! (error
! "Inconsistent rate types (%s vs. %s)"
! rate-type (match-string 2))))
! (match-string 2))))
! (when (re-search-forward "remaining capacity: +\\([0-9]+\\)
m[AW]h$"
nil t)
(setq capacity
(+ (or capacity 0) (string-to-int (match-string 1))))))
(goto-char (point-max))
(insert-file-contents (expand-file-name "info" dir))
(when (re-search-forward "present: +yes$" nil t)
! (when (re-search-forward "design capacity: +\\([0-9]+\\) m[AW]h$"
nil t)
(setq design-capacity (+ (or design-capacity 0)
(string-to-int (match-string 1)))))
! (when (re-search-forward "design capacity warning: +\\([0-9]+\\)
m[AW]h$"
nil t)
(setq warn (+ (or warn 0) (string-to-int (match-string 1)))))
! (when (re-search-forward "design capacity low: +\\([0-9]+\\)
m[AW]h$"
nil t)
(setq low (+ (or low 0)
(string-to-int (match-string 1))))))))
(directory-files "/proc/acpi/battery/" t "BAT")))
(and capacity rate
! (setq minutes (if (zerop rate) 0
! (floor (* (/ (float (if (string= charging-state
! "charging")
! (- design-capacity capacity)
! capacity)) rate) 60)))
hours (/ minutes 60)))
(list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
(cons ?L (or (when (file-exists-p "/proc/acpi/ac_adapter/AC/state")
***************
*** 304,311 ****
(when (re-search-forward
"temperature: +\\([0-9]+\\) C$" nil t)
(match-string 1))))
"N/A"))
! (cons ?r (or (and rate (number-to-string rate)) "N/A"))
(cons ?B (or charging-state "N/A"))
(cons ?b (or (and (string= charging-state "charging") "+")
(and low (< capacity low) "!")
--- 314,330 ----
(when (re-search-forward
"temperature: +\\([0-9]+\\) C$" nil t)
(match-string 1))))
+ (when (file-exists-p
+ "/proc/acpi/thermal_zone/THM/temperature")
+ (with-temp-buffer
+ (insert-file-contents
+ "/proc/acpi/thermal_zone/THM/temperature")
+ (when (re-search-forward
+ "temperature: +\\([0-9]+\\) C$" nil t)
+ (match-string 1))))
"N/A"))
! (cons ?r (or (and rate (concat (number-to-string rate) " "
! rate-type)) "N/A"))
(cons ?B (or charging-state "N/A"))
(cons ?b (or (and (string= charging-state "charging") "+")
(and low (< capacity low) "!")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/battery.el [emacs-unicode-2],
Miles Bader <=