unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24537: 25.1; battery.el on macOS Sierra 10.12
@ 2016-09-25  5:41 Kevin Lin
  2016-09-28 21:36 ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Lin @ 2016-09-25  5:41 UTC (permalink / raw)
  To: 24537

display-battery-mode stopped working when I upgraded
from macOS 10.11 to 10.12.  It appears the output of
`pmset -g ps` has changed, breaking pattern matching
in battery-pmset.  Changing the line

  (looking-at "\\([0-9]\\{1,3\\}\\)%")

in battery-pmset to

  (re-search-forward "\\([0-9]\\{1,3\\}\\)%")

fixes the problem, at least on my machine.

Cheers,
Kevin


In GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1911))
 of 2016-09-17 built on builder10-9.porkrind.org
Windowing system distributor 'Apple', version 10.3.1504
Configured using:
 'configure --with-ns
 '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp''

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org-Agenda 28 days Ddl Grid

Minor modes in effect:
  shell-dirtrack-mode: t
  display-battery-mode: t
  display-time-mode: t
  iswitchb-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Warning: symbolic link to Git-controlled source file
Word wrapping enabled
Warning: symbolic link to Git-controlled source file
Word wrapping enabled
Warning: symbolic link to Git-controlled source file
Word wrapping enabled [2 times]
‘working-revision’ not found: using the old ‘workfile-version’ instead
Word wrapping enabled
‘working-revision’ not found: using the old ‘workfile-version’ instead
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-view
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-view
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-util
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-util
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-tools
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-tools
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-sync
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-sync
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-outline
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-outline
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-occur
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-occur
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-misc
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-misc
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-links
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-links
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-isearch
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-isearch
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-info
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-info
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-history
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-history
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-dev
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-dev
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-cache
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-cache
/Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.60/elpa/pdf-annot
hides /Applications/Emacs.app/Contents/Resources/site-lisp/pdf-tools/0.70/share/emacs/site-lisp/pdf-tools/pdf-annot
~/elisp/vc-git hides /Applications/Emacs.app/Contents/Resources/lisp/vc/vc-git
~/elisp/iswitchb hides
/Applications/Emacs.app/Contents/Resources/lisp/obsolete/iswitchb

Features:
(shadow sort mail-extr emacsbug message rfc822 mml
mml-sec epg mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mail-utils diary-lib
diary-loaddefs cal-iso org-indent vc-git org-element
org-rmail org-mhe org-irc org-info org-gnus
org-docview doc-view subr-x dired org-bibtex bibtex
org-bbdb org-w3m org-agenda pdf-tools cus-edit
cus-start cus-load wid-edit pdf-view jka-compr
pdf-cache pdf-info tq pdf-util image-mode julia-mode
derived ert pp ewoc debug rx ido ess-toolbar ess-mouse
mouseme thingatpt browse-url ess-menu ess-swv
ess-noweb ess-noweb-font-lock-mode ess-bugs-l essd-els
ess-sas-d ess-sas-l ess-sas-a ess-sta-d ess-sta-l
cc-vars cc-defs make-regexp ess-sp6-d ess-sp3-d
ess-julia ess-r-d ess-r-completion ess-tracebug
compile tramp tramp-compat auth-source cl-seq eieio
eieio-core gnus-util mm-util help-fns mail-prsvr
password-cache tramp-loaddefs trampver shell ess-roxy
advice hideshow ess-help info reporter ess-developer
ess-s-l speedbar sb-image ezimage dframe ess ess-inf
cl-macs ess-mode ess-noweb-mode edmacro kmacro
ess-utils cl ess-custom executable ess-compat ess-site
battery time iswitchb org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs format-spec find-func
cal-menu calendar cal-loaddefs cmuscheme comint
ansi-color ring scheme server finder-inf package
epg-config seq byte-opt gv bytecomp byte-compile
cl-extra help-mode easymenu cconv cl-loaddefs pcase
cl-lib time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win ucs-normalize term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list
newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese
eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1
md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 505649 23267)
 (symbols 48 38900 0)
 (miscs 40 6194 3745)
 (strings 32 79704 13110)
 (string-bytes 1 2519115)
 (vectors 16 49906)
 (vector-slots 8 854589 2388)
 (floats 8 399 18)
 (intervals 56 3640 0)
 (buffers 976 75))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: 25.1; battery.el on macOS Sierra 10.12
  2016-09-25  5:41 bug#24537: 25.1; battery.el on macOS Sierra 10.12 Kevin Lin
@ 2016-09-28 21:36 ` Alan Third
  2016-09-29  6:49   ` Kevin Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2016-09-28 21:36 UTC (permalink / raw)
  To: Kevin Lin; +Cc: 24537

Kevin Lin <lin.kevin.k@gmail.com> writes:

> display-battery-mode stopped working when I upgraded
> from macOS 10.11 to 10.12.  It appears the output of
> `pmset -g ps` has changed, breaking pattern matching
> in battery-pmset.

Hi, could you perhaps provide an example of the output of that command
in 10.12? I'm still on 10.11 and would like to compare it.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: 25.1; battery.el on macOS Sierra 10.12
  2016-09-28 21:36 ` Alan Third
@ 2016-09-29  6:49   ` Kevin Lin
  2016-09-29 19:31     ` bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537) Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Lin @ 2016-09-29  6:49 UTC (permalink / raw)
  To: Alan Third; +Cc: 24537@debbugs.gnu.org

Hi Alan,

Of course!  Here it is from my machine running 10.12:

% pmset -g ps
Now drawing from 'Battery Power'
 -InternalBattery-0 (id=3997795) 54%; discharging; 1:27 remaining present: true

And from another machine still on 10.11:

Now drawing from 'Battery Power'
 -InternalBattery-0 36%; discharging; 1:00 remaining present: true

Cheers,
Kevin

On Wed, Sep 28, 2016 at 2:36 PM, Alan Third <alan@idiocy.org> wrote:
> Kevin Lin <lin.kevin.k@gmail.com> writes:
>
>> display-battery-mode stopped working when I upgraded
>> from macOS 10.11 to 10.12.  It appears the output of
>> `pmset -g ps` has changed, breaking pattern matching
>> in battery-pmset.
>
> Hi, could you perhaps provide an example of the output of that command
> in 10.12? I'm still on 10.11 and would like to compare it.
> --
> Alan Third





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
  2016-09-29  6:49   ` Kevin Lin
@ 2016-09-29 19:31     ` Alan Third
  2016-09-29 22:02       ` Noam Postavsky
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2016-09-29 19:31 UTC (permalink / raw)
  To: Kevin Lin; +Cc: 24537

* 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
  2016-09-29 19:31     ` bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537) Alan Third
@ 2016-09-29 22:02       ` Noam Postavsky
  2016-09-29 22:09         ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2016-09-29 22:02 UTC (permalink / raw)
  To: Alan Third; +Cc: Kevin Lin, 24537

On Thu, Sep 29, 2016 at 3:31 PM, Alan Third <alan@idiocy.org> wrote:
> +       (when (re-search-forward "^ -InternalBattery-0\\([ \t]+\(id\=[0-9]+\)\\)*[ \t]+" nil t)

Using "\(id\=[0-9]+\)" instead of the equivalent "(id=[0-9]+)" is a
bit confusing.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
  2016-09-29 22:02       ` Noam Postavsky
@ 2016-09-29 22:09         ` Alan Third
  2016-09-29 22:17           ` Noam Postavsky
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2016-09-29 22:09 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Kevin Lin, 24537

On Thu, Sep 29, 2016 at 06:02:36PM -0400, Noam Postavsky wrote:
> On Thu, Sep 29, 2016 at 3:31 PM, Alan Third <alan@idiocy.org> wrote:
> > +       (when (re-search-forward "^ -InternalBattery-0\\([ \t]+\(id\=[0-9]+\)\\)*[ \t]+" nil t)
> 
> Using "\(id\=[0-9]+\)" instead of the equivalent "(id=[0-9]+)" is a
> bit confusing.

Ah, I thought they had to be escaped because they’re special
characters. It seems I was wrong. Thanks. :)

I’ve removed the three extra slashes, do you want me to repost the
patch?
-- 
Alan Third





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
  2016-09-29 22:09         ` Alan Third
@ 2016-09-29 22:17           ` Noam Postavsky
  2016-09-30  3:30             ` Kevin Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Noam Postavsky @ 2016-09-29 22:17 UTC (permalink / raw)
  To: Alan Third; +Cc: Kevin Lin, 24537

On Thu, Sep 29, 2016 at 6:09 PM, Alan Third <alan@idiocy.org> wrote:
> I’ve removed the three extra slashes, do you want me to repost the
> patch?

I don't have any more comments for you. Apart from the slashes, it
looks okay (I don't run OSX, so I can't confirm if it works).





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
  2016-09-29 22:17           ` Noam Postavsky
@ 2016-09-30  3:30             ` Kevin Lin
  2016-09-30 21:42               ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Lin @ 2016-09-30  3:30 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Alan Third, 24537@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

Yup it works.  Thank you both!
-Kevin

On Thursday, September 29, 2016, Noam Postavsky <
npostavs@users.sourceforge.net> wrote:

> On Thu, Sep 29, 2016 at 6:09 PM, Alan Third <alan@idiocy.org
> <javascript:;>> wrote:
> > I’ve removed the three extra slashes, do you want me to repost the
> > patch?
>
> I don't have any more comments for you. Apart from the slashes, it
> looks okay (I don't run OSX, so I can't confirm if it works).
>

[-- Attachment #2: Type: text/html, Size: 745 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537)
  2016-09-30  3:30             ` Kevin Lin
@ 2016-09-30 21:42               ` Alan Third
  0 siblings, 0 replies; 9+ messages in thread
From: Alan Third @ 2016-09-30 21:42 UTC (permalink / raw)
  To: Kevin Lin; +Cc: 24537@debbugs.gnu.org, Noam Postavsky

On Thu, Sep 29, 2016 at 08:30:02PM -0700, Kevin Lin wrote:
> Yup it works.  Thank you both!
> -Kevin
> 
> On Thursday, September 29, 2016, Noam Postavsky <
> npostavs@users.sourceforge.net> wrote:
> 
> > On Thu, Sep 29, 2016 at 6:09 PM, Alan Third <alan@idiocy.org
> > <javascript:;>> wrote:
> > > I’ve removed the three extra slashes, do you want me to repost the
> > > patch?
> >
> > I don't have any more comments for you. Apart from the slashes, it
> > looks okay (I don't run OSX, so I can't confirm if it works).
> >

Pushed to master.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-30 21:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-25  5:41 bug#24537: 25.1; battery.el on macOS Sierra 10.12 Kevin Lin
2016-09-28 21:36 ` Alan Third
2016-09-29  6:49   ` Kevin Lin
2016-09-29 19:31     ` bug#24537: [PATCH] Fix compatibility with macOS 10.12 pmset (bug#24537) Alan Third
2016-09-29 22:02       ` Noam Postavsky
2016-09-29 22:09         ` Alan Third
2016-09-29 22:17           ` Noam Postavsky
2016-09-30  3:30             ` Kevin Lin
2016-09-30 21:42               ` Alan Third

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).