From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralph Schleicher Newsgroups: gmane.emacs.bugs Subject: battery.el patch Date: 07 Jan 2007 11:01:29 +0100 Organization: Development Proletcult Cadre #23 Message-ID: <87lkkfb1fq.fsf@bravo.nunatak.allgaeu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1168185703 9466 80.91.229.12 (7 Jan 2007 16:01:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 7 Jan 2007 16:01:43 +0000 (UTC) Cc: Luigi Panzeri Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 07 17:01:36 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H3aSe-0006qs-VJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jan 2007 17:01:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3aSe-0005BE-I4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Jan 2007 11:01:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H3W23-0000ux-CV for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2007 06:17:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H3W22-0000u4-0x for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2007 06:17:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H3W21-0000tr-UM for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2007 06:17:41 -0500 Original-Received: from [213.182.8.6] (helo=mail.allgaeu.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1H3W21-00017S-Ep for bug-gnu-emacs@gnu.org; Sun, 07 Jan 2007 06:17:41 -0500 Original-Received: from kim.allgaeu.org (localhost [127.0.0.1]) by mail.allgaeu.org with ESMTP id l07BHX5c018073 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sun, 7 Jan 2007 12:17:33 +0100 Original-X-Complaints-To: abuse@allgaeu.org Original-Received: (from uucp@localhost) by kim.allgaeu.org with UUCP id l07BHXdu018072 for bug-gnu-emacs@gnu.org; Sun, 7 Jan 2007 12:17:33 +0100 Original-To: bug-gnu-emacs@gnu.org Original-Lines: 61 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-RCPT-Domain: gnu.org X-Virus-Check: Yes X-Spam-Check: Yes X-Spam-Tests: X-Mailman-Approved-At: Sun, 07 Jan 2007 11:01:27 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15513 Archived-At: 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 * battery.el (battery-linux-proc-acpi): Ignore errors when evaluating optional subdirectories. Bug report and initial patch by Luigi Panzeri . (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