unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
@ 2022-06-02 16:32 T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-03  3:57 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-02 16:32 UTC (permalink / raw)
  To: 55770

From: Eli Zaretskii <eliz@gnu.org>
To: "T.V Raman" <raman@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@gnu.org

> Date: Thu, 02 Jun 2022 08:42:48 -0700
> From: "T.V Raman" <raman@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  🦮





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-02 16:32 bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-03  3:57 ` Lars Ingebrigtsen
  2022-06-03 14:06   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-03 16:39   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 9+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-03  3:57 UTC (permalink / raw)
  To: T.V Raman; +Cc: 55770

"T.V Raman" <raman@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





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03  3:57 ` Lars Ingebrigtsen
@ 2022-06-03 14:06   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-03 16:39   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 9+ messages in thread
From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-03 14:06 UTC (permalink / raw)
  To: larsi; +Cc: 55770, raman

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  🦮





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03  3:57 ` Lars Ingebrigtsen
  2022-06-03 14:06   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-03 16:39   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-03 17:49     ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-03 16:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 55770

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 454 bytes --]


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)
7©4 Id: kg:/m/0285kf1  •0Ü8





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03 16:39   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-03 17:49     ` Eli Zaretskii
  2022-06-03 18:00       ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2022-06-03 17:49 UTC (permalink / raw)
  To: T.V Raman; +Cc: larsi, 55770

> Cc: 55770@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@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.





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03 17:49     ` Eli Zaretskii
@ 2022-06-03 18:00       ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-03 18:40         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-03 18:00 UTC (permalink / raw)
  To: eliz; +Cc: larsi, 55770, raman

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@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@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  🦮





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03 18:00       ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-03 18:40         ` Eli Zaretskii
  2022-06-03 20:09           ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2022-06-03 18:40 UTC (permalink / raw)
  To: T.V Raman; +Cc: larsi, 55770, raman

> From: "T.V Raman" <raman@google.com>
> Date: Fri, 3 Jun 2022 11:00:03 -0700
> Cc: raman@google.com,
>     larsi@gnus.org,
>     55770@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.





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03 18:40         ` Eli Zaretskii
@ 2022-06-03 20:09           ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-04  2:01             ` Phil Sainty
  0 siblings, 1 reply; 9+ messages in thread
From: T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-03 20:09 UTC (permalink / raw)
  To: eliz; +Cc: larsi, 55770, raman

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@google.com>
 > > Date: Fri, 3 Jun 2022 11:00:03 -0700
 > > Cc: raman@google.com,
 > >     larsi@gnus.org,
 > >     55770@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  🦮





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

* bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical
  2022-06-03 20:09           ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-04  2:01             ` Phil Sainty
  0 siblings, 0 replies; 9+ messages in thread
From: Phil Sainty @ 2022-06-04  2:01 UTC (permalink / raw)
  To: T.V Raman; +Cc: eliz, 55770, larsi

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.






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

end of thread, other threads:[~2022-06-04  2:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 16:32 bug#55770: 29.0.50; Feature Request: Hook When battery transitions to low or critical T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-03  3:57 ` Lars Ingebrigtsen
2022-06-03 14:06   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-03 16:39   ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-03 17:49     ` Eli Zaretskii
2022-06-03 18:00       ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-03 18:40         ` Eli Zaretskii
2022-06-03 20:09           ` T.V Raman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-04  2:01             ` Phil Sainty

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