From: Ralph Schleicher <rs@nunatak.allgaeu.org>
Cc: Luigi Panzeri <matley@member.fsf.org>
Subject: battery.el patch
Date: 07 Jan 2007 11:01:29 +0100 [thread overview]
Message-ID: <87lkkfb1fq.fsf@bravo.nunatak.allgaeu.org> (raw)
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
next reply other threads:[~2007-01-07 10:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-07 10:01 Ralph Schleicher [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-09-14 20:33 battery.el patch Ralph Schleicher
[not found] ` <E1C7bwj-0001T6-HR@fencepost.gnu.org>
2004-09-15 21:59 ` Ralph Schleicher
2004-08-09 20:25 Ralph Schleicher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lkkfb1fq.fsf@bravo.nunatak.allgaeu.org \
--to=rs@nunatak.allgaeu.org \
--cc=matley@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).