unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Fwd: idle exit hook
Date: Thu, 23 Jul 2020 00:00:24 +0200	[thread overview]
Message-ID: <20200722220024.qwwqfrueqql7t3wa@ergus> (raw)
In-Reply-To: <83o8o7fy6b.fsf@gnu.org>

On Wed, Jul 22, 2020 at 04:59:24PM +0300, Eli Zaretskii wrote:
>> Date: Wed, 22 Jul 2020 13:32:42 +0200
>> From: Ergus <spacibba@aol.com>
>>
>> Is there an idle-time-exit-hook? or, what's the canonical method to call
>> a function after breaking an idle? something like on-idle-exit?
>
>How do you define "breaking the idle"?  IOW, what events or activities
>will potentially be considered as "breaking the idle"?
>
Hi Eli:

When I say "breaking the idle" I mean any event that potentially could
be considered as not in idle anymore... or anything that resets the idle
counter.

>> The idea came to me when trying to implement my own version of
>> idle-highlight-mode to propose to add it to vanilla. I would like to
>> provide a different behaviour.
>
>Not sure why you need a new hook for implementing that behavior.
>maybe tell more details about what you intend to implement.
>
The idea is extremely simple (that's why I thing it could be in
vanilla). When in idle for some seconds a run-with-idle-timer calls a
function to set a highlight for thing-at-point. (useful when
programming for example)

https://github.com/nonsequitur/idle-highlight-mode/blob/master/idle-highlight-mode.el

The problem with the original implementation (apart from being abandon
and re-implemented by many packages and configuration) is that the
unhighlight function is called only when the idled function is executed
again.

A more common behavior (as in vs-code, atom and so on) is that when we
press any key o perform any action to exit the "highlighted thing"; the
highlight disappears immediately.

This could be performed using a different hook, (post-command-hook) but
it will require add and remove the hook constantly...

WDYT?
Best
Ergus



  reply	other threads:[~2020-07-22 22:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200722113242.577d4nfx4wbbbxxs.ref@ergus>
2020-07-22 11:32 ` Fwd: idle exit hook Ergus
2020-07-22 13:59   ` Eli Zaretskii
2020-07-22 22:00     ` Ergus [this message]
2020-07-22 22:31       ` Stefan Monnier

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=20200722220024.qwwqfrueqql7t3wa@ergus \
    --to=spacibba@aol.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).