GNU bug report logs - #24537
25.1; battery.el on macOS Sierra 10.12

Previous Next

Package: emacs;

Reported by: Kevin Lin <lin.kevin.k <at> gmail.com>

Date: Sun, 25 Sep 2016 06:31:02 UTC

Severity: normal

Tags: patch

Found in version 25.1

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Third <alan <at> idiocy.org>
To: Kevin Lin <lin.kevin.k <at> gmail.com>
Cc: 24537 <at> debbugs.gnu.org
Subject: bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
Date: Thu, 29 Sep 2016 20:31:02 +0100
* lisp/battery.el (battery-pmset): Recognise and ignore battery id if
present in output.
---
 lisp/battery.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/battery.el b/lisp/battery.el
index 1b58489..90e4f5a 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -625,7 +625,7 @@ battery-pmset
       (goto-char (point-min))
       (when (re-search-forward "\\(?:Currentl?y\\|Now\\) drawing from '\\(AC\\|Battery\\) Power'" nil t)
 	(setq power-source (match-string 1))
-	(when (re-search-forward "^ -InternalBattery-0[ \t]+" nil t)
+	(when (re-search-forward "^ -InternalBattery-0\\([ \t]+\(id\=[0-9]+\)\\)*[ \t]+" nil t)
 	  (when (looking-at "\\([0-9]\\{1,3\\}\\)%")
 	    (setq load-percentage (match-string 1))
 	    (goto-char (match-end 0))
-- 

Hi Kevin,

Can you give this patch a go?
-- 
Alan Third




This bug report was last modified 8 years and 291 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.