[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
battery.el patch
From: |
Ralph Schleicher |
Subject: |
battery.el patch |
Date: |
07 Jan 2007 11:01:29 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Hi,
below is a patch for battery.el (CVS revision 1.38) together with the
associated ChangeLog entry. Please commit it into Emacs CVS.
2007-01-07 Ralph Schleicher <rs@nunatak.allgaeu.org>
* battery.el (battery-linux-proc-acpi): Ignore errors when
evaluating optional subdirectories. Bug report and initial
patch by Luigi Panzeri <matley@member.fsf.org>.
(battery-search-for-one-match-in-files): Leave error handling
to the caller.
--- battery.el-1.38 2007-01-05 20:27:53.000000000 +0100
+++ battery.el 2007-01-07 08:54:36.000000000 +0100
@@ -355,19 +355,19 @@
60)))
hours (/ minutes 60)))
(list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
- (cons ?L (or (battery-search-for-one-match-in-files
- (mapcar (lambda (e) (concat e "/state"))
- (directory-files "/proc/acpi/ac_adapter/"
- t "\\`[^.]"))
- "state: +\\(.*\\)$" 1)
-
+ (cons ?L (or (ignore-errors
+ (battery-search-for-one-match-in-files
+ (mapcar (lambda (e) (concat e "/state"))
+ (directory-files "/proc/acpi/ac_adapter/"
+ t "\\`[^.]"))
+ "state: +\\(.*\\)$" 1))
"N/A"))
- (cons ?d (or (battery-search-for-one-match-in-files
- (mapcar (lambda (e) (concat e "/temperature"))
- (directory-files "/proc/acpi/thermal_zone/"
- t "\\`[^.]"))
- "temperature: +\\([0-9]+\\) C$" 1)
-
+ (cons ?d (or (ignore-errors
+ (battery-search-for-one-match-in-files
+ (mapcar (lambda (e) (concat e "/temperature"))
+ (directory-files "/proc/acpi/thermal_zone/"
+ t "\\`[^.]"))
+ "temperature: +\\([0-9]+\\) C$" 1))
"N/A"))
(cons ?r (or (and rate (concat (number-to-string rate) " "
rate-type)) "N/A"))
@@ -460,7 +460,7 @@
(with-temp-buffer
(catch 'found
(dolist (file files)
- (and (ignore-errors (insert-file-contents file nil nil nil 'replace))
+ (and (insert-file-contents file nil nil nil 'replace)
(re-search-forward regexp nil t)
(throw 'found (match-string match-num)))))))
--
Ralph
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- battery.el patch,
Ralph Schleicher <=