unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Campbell Barton <ideasman42@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Support for explicitly resetting the idle timer?
Date: Sat, 27 Nov 2021 20:14:44 +1100	[thread overview]
Message-ID: <CAEcf3NwBeRsvKpS-kpOUNxa3fCwN6LbpCy0Eb-y2C09Y4ymj+w@mail.gmail.com> (raw)
In-Reply-To: <835yse0y70.fsf@gnu.org>

On Sat, Nov 27, 2021 at 8:01 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Campbell Barton <ideasman42@gmail.com>
> > Date: Sat, 27 Nov 2021 19:42:15 +1100
> > Cc: Emacs developers <emacs-devel@gnu.org>
> >
> > > The cleanest solution in this case would be to call timer_stop_idle if
> > > Emacs is executing a command, no matter how it was invoked.  In fact,
> > > I'm surprised that we don't stop idle timers when track-mouse invokes
> > > commands: it sounds like a bug we should fix.
> >
> > Not sure if this would solve my case (is there some formal definition
> > of what is meant by a command?).
> > I'm changing the scroll position using `set-window-vscroll` - so I'm
> > not sure if that counts as a command.
>
> Which code invokes set-window-vscroll, and what triggers that code?

There is a while loop that uses  (read-event) inside a `(track-mouse
...)` block that changes the scroll location and redraws.

(any solution shouldn't be so specific to my use-case of course,
AFAICS it's just a case that is reasonable to support with whatever
fix/feature is used).

> > As a workaround it may be possible to define a dummy command that does
> > nothing but reset the idle timer.
>
> Btw, what do you mean by "reset" here?  timer_stop_idle has a
> counterpart, timer_resume_idle.

I've probably misunderstood the purpose of this function, I only meant
to reset the idle timer (as already happens when a key has been
pressed).

> Would the resumption work under your proposal, and if so, how?

Yes, resuming is would be fine,
I considered some alternative solution too, e.g. a
`(without-idle-timers ...)` macro - which would be useful in my case -
but doesn't seem necessary if the idle timer can be reset either
explicitly or automatically in more cases than it is currently being
done.
-- 
- Campbell



  reply	other threads:[~2021-11-27  9:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27  7:54 Support for explicitly resetting the idle timer? Campbell Barton
2021-11-27  8:02 ` Eli Zaretskii
2021-11-27  8:42   ` Campbell Barton
2021-11-27  9:01     ` Eli Zaretskii
2021-11-27  9:14       ` Campbell Barton [this message]
2021-11-27 10:11         ` Eli Zaretskii
2021-11-27 10:21           ` Campbell Barton
2021-11-27 10:54             ` Eli Zaretskii
2021-11-27 11:16               ` Campbell Barton
2021-11-27 11:33                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEcf3NwBeRsvKpS-kpOUNxa3fCwN6LbpCy0Eb-y2C09Y4ymj+w@mail.gmail.com \
    --to=ideasman42@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).