GNU bug report logs - #55770
29.0.50; Feature Request: Hook When battery transitions to low or critical

Previous Next

Package: emacs;

Reported by: "T.V Raman" <raman <at> google.com>

Date: Thu, 2 Jun 2022 16:33:02 UTC

Severity: wishlist

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55770 in the body.
You can then email your comments to 55770 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Thu, 02 Jun 2022 16:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "T.V Raman" <raman <at> google.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 02 Jun 2022 16:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50;
 Feature Request: Hook When battery transitions to low or critical
Date: Thu, 02 Jun 2022 09:32:09 -0700
From: Eli Zaretskii <eliz <at> gnu.org>
To: "T.V Raman" <raman <at> google.com>
Subject: Re: battery.el: Add option to play a sound when battery hits
 critical?
Date: Thu, 02 Jun 2022 19:28:01 +0300
Cc: emacs-devel <at> gnu.org

> Date: Thu, 02 Jun 2022 08:42:48 -0700
> From: "T.V Raman" <raman <at> google.com>
> 
> Subject line almost says it all:
> 
> battery.el can change the face used to display battery status in the
> modeline. 
> 
> Could we also have a defcustom that makes an auditory alert that is
> configurable when it transitions from normal to low and low to
> critical?

Maybe we should have a hook that would be run by the battery.el's
timer function, then you could write a hook function to do whatever
you want, including playing a sound.

Suggest to file a feature request bug report about this.

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 03:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "T.V Raman" <raman <at> google.com>
Cc: 55770 <at> debbugs.gnu.org
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Fri, 03 Jun 2022 05:57:41 +0200
"T.V Raman" <raman <at> google.com> writes:

> Maybe we should have a hook that would be run by the battery.el's
> timer function, then you could write a hook function to do whatever
> you want, including playing a sound.

Good idea.  I've now added this to Emacs 29 as
`battery-update-functions'.  (The doc string has an example function
that plays an alarm.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 55770 <at> debbugs.gnu.org and "T.V Raman" <raman <at> google.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 03 Jun 2022 03:58:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 14:08:02 GMT) Full text and rfc822 format available.

Message #13 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: larsi <at> gnus.org
Cc: 55770 <at> debbugs.gnu.org, raman <at> google.com
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Fri, 3 Jun 2022 07:06:59 -0700
Awesome, thanks!
-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 16:40:02 GMT) Full text and rfc822 format available.

Message #16 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55770 <at> debbugs.gnu.org
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Fri, 03 Jun 2022 09:39:10 -0700
Lookeding at this more closely,
default value of battery-update-interval is 60s which might be okay for
updating modeline; will having other functions here prove to be an
efficiency hit?

For instance, if playing a sound on entering critical state,  one might
well end up implementing some more logic to decide how often to play a sound.
-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
74 Id: kg:/m/0285kf1  08




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 17:50:02 GMT) Full text and rfc822 format available.

Message #19 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "T.V Raman" <raman <at> google.com>
Cc: larsi <at> gnus.org, 55770 <at> debbugs.gnu.org
Subject: Re: bug#55770: 29.0.50;
 Feature Request: Hook When battery transitions to low or critical
Date: Fri, 03 Jun 2022 20:49:48 +0300
> Cc: 55770 <at> debbugs.gnu.org
> Date: Fri, 03 Jun 2022 09:39:10 -0700
> From:  "T.V Raman" via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> Lookeding at this more closely,
> default value of battery-update-interval is 60s which might be okay for
> updating modeline; will having other functions here prove to be an
> efficiency hit?
> 
> For instance, if playing a sound on entering critical state,  one might
> well end up implementing some more logic to decide how often to play a sound.

battery-update-interval is also a defcustom, so you can make it
smaller if you need.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 18:01:02 GMT) Full text and rfc822 format available.

Message #22 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: eliz <at> gnu.org
Cc: larsi <at> gnus.org, 55770 <at> debbugs.gnu.org, raman <at> google.com
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Fri, 3 Jun 2022 11:00:03 -0700
I understand and I can set mine appropriately --- I was just pointing
out that a low value for the update interval when combined with an
update function that does some computes could prove a bad combination.Eli Zaretskii writes:
 > > Cc: 55770 <at> debbugs.gnu.org
 > > Date: Fri, 03 Jun 2022 09:39:10 -0700
 > > From:  "T.V Raman" via "Bug reports for GNU Emacs,
 > >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
 > > 
 > > 
 > > Lookeding at this more closely,
 > > default value of battery-update-interval is 60s which might be okay for
 > > updating modeline; will having other functions here prove to be an
 > > efficiency hit?
 > > 
 > > For instance, if playing a sound on entering critical state,  one might
 > > well end up implementing some more logic to decide how often to play a sound.
 > 
 > battery-update-interval is also a defcustom, so you can make it
 > smaller if you need.

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 18:41:02 GMT) Full text and rfc822 format available.

Message #25 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "T.V Raman" <raman <at> google.com>
Cc: larsi <at> gnus.org, 55770 <at> debbugs.gnu.org, raman <at> google.com
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Fri, 03 Jun 2022 21:40:52 +0300
> From: "T.V Raman" <raman <at> google.com>
> Date: Fri, 3 Jun 2022 11:00:03 -0700
> Cc: raman <at> google.com,
>     larsi <at> gnus.org,
>     55770 <at> debbugs.gnu.org
> 
> I understand and I can set mine appropriately --- I was just pointing
> out that a low value for the update interval when combined with an
> update function that does some computes could prove a bad combination.

The default value is for when the status is just displayed.  I don't
think I see a reason to make the default shorter, because it will just
cause more drain on the battery for no good reason.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Fri, 03 Jun 2022 20:10:01 GMT) Full text and rfc822 format available.

Message #28 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: "T.V Raman" <raman <at> google.com>
To: eliz <at> gnu.org
Cc: larsi <at> gnus.org, 55770 <at> debbugs.gnu.org, raman <at> google.com
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Fri, 3 Jun 2022 13:09:11 -0700
we're not communicating.

I did not ask to  reduce the 60s -- rather I was saying that if we
allow the user to configure additional functions to run on each
update, and if that user doesn't realize that it will run every
minute, it might put too much load on the system.Eli Zaretskii writes:
 > > From: "T.V Raman" <raman <at> google.com>
 > > Date: Fri, 3 Jun 2022 11:00:03 -0700
 > > Cc: raman <at> google.com,
 > >     larsi <at> gnus.org,
 > >     55770 <at> debbugs.gnu.org
 > > 
 > > I understand and I can set mine appropriately --- I was just pointing
 > > out that a low value for the update interval when combined with an
 > > update function that does some computes could prove a bad combination.
 > 
 > The default value is for when the status is just displayed.  I don't
 > think I see a reason to make the default shorter, because it will just
 > cause more drain on the battery for no good reason.

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55770; Package emacs. (Sat, 04 Jun 2022 02:02:01 GMT) Full text and rfc822 format available.

Message #31 received at 55770 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: "T.V Raman" <raman <at> google.com>
Cc: eliz <at> gnu.org, 55770 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: bug#55770: 29.0.50; Feature Request: Hook When battery
 transitions to low or critical
Date: Sat, 04 Jun 2022 14:01:01 +1200
On 2022-06-04 08:09, T.V Raman" wrote:
> I did not ask to  reduce the 60s -- rather I was saying that if we
> allow the user to configure additional functions to run on each
> update, and if that user doesn't realize that it will run every
> minute

That could be emphasised like this?

(defcustom battery-update-functions nil
  "Functions run by `display-battery-mode' after updating the status.
+This normally happens every `battery-update-interval' seconds.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Jul 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 299 days ago.

Previous Next


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