all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Start keybinding combination
       [not found] <20220130191539.mkbq77zpn7ugizfi.ref@Ergus>
@ 2022-01-30 19:15 ` Ergus
  2022-01-30 19:44   ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ergus @ 2022-01-30 19:15 UTC (permalink / raw)
  To: Help Gnu Emacs

Hi:

I have been wondering if there is a hook or advise I could use to give
some more explicit visual feedback when the user starts a long
keybinding.

I mean:

If a user wants to start a command like `C-x r b` I would like to change
the mode-line color after the `C-x`. I suppose that this may be a call
to a hook in the same place that updates the echo area inserting the
current prefix.

I saw that packages like which-key needs to do a pooling timer to
emulate that, so maybe this needs a feature request or is there a reason
to not implement this?

Best,
Ergus



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

* Re: Start keybinding combination
  2022-01-30 19:15 ` Start keybinding combination Ergus
@ 2022-01-30 19:44   ` Eli Zaretskii
  2022-01-30 20:54     ` Ergus
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-01-30 19:44 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 30 Jan 2022 20:15:39 +0100
> From: Ergus <spacibba@aol.com>
> 
> If a user wants to start a command like `C-x r b` I would like to change
> the mode-line color after the `C-x`. I suppose that this may be a call
> to a hook in the same place that updates the echo area inserting the
> current prefix.

What would such a hook do to produce the effect that you want?  The
mode-line color change will not be visible unless you force redisplay
of the mode line.



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

* Re: Start keybinding combination
  2022-01-30 19:44   ` Eli Zaretskii
@ 2022-01-30 20:54     ` Ergus
  2022-01-31 12:23       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ergus @ 2022-01-30 20:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Sun, Jan 30, 2022 at 09:44:58PM +0200, Eli Zaretskii wrote:
>> Date: Sun, 30 Jan 2022 20:15:39 +0100
>> From: Ergus <spacibba@aol.com>
>>
>> If a user wants to start a command like `C-x r b` I would like to change
>> the mode-line color after the `C-x`. I suppose that this may be a call
>> to a hook in the same place that updates the echo area inserting the
>> current prefix.
>
>What would such a hook do to produce the effect that you want?  The
>mode-line color change will not be visible unless you force redisplay
>of the mode line.
>
Hi Eli:

My question comes from the fact that I see the prefix in the echo area
and it looks inconspicuous. So, some redisplay is actually done
right?. I thought that a hook and let the user implement something could
work.

Something like:

(add-hook the-new-hook (lambda ()
           (face-remap-add-relative 'mode-line :background some-color)))

And then call `face-remap-remove-relative` in the opposed|symmetric exit
hook... similar to what minibuffer-setup-hook/minibuffer-exit-hook do.

But I could be wrong.

Does it makes sense?




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

* Re: Start keybinding combination
  2022-01-30 20:54     ` Ergus
@ 2022-01-31 12:23       ` Eli Zaretskii
  2022-01-31 15:42         ` Ergus
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-01-31 12:23 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 30 Jan 2022 21:54:47 +0100
> From: Ergus <spacibba@aol.com>
> Cc: help-gnu-emacs@gnu.org
> 
> >What would such a hook do to produce the effect that you want?  The
> >mode-line color change will not be visible unless you force redisplay
> >of the mode line.
> >
> Hi Eli:
> 
> My question comes from the fact that I see the prefix in the echo area
> and it looks inconspicuous. So, some redisplay is actually done
> right?

A very limited variant of redisplay, which only updates the echo-area.

> Something like:
> 
> (add-hook the-new-hook (lambda ()
>            (face-remap-add-relative 'mode-line :background some-color)))
> 
> And then call `face-remap-remove-relative` in the opposed|symmetric exit
> hook... similar to what minibuffer-setup-hook/minibuffer-exit-hook do.
> 
> But I could be wrong.
> 
> Does it makes sense?

It would make the prompt much slower, because updating the mode line
requires a very thorough redisplay, the way it is implemented.  And if
you on top of that change the mode-line face, Emacs will need to
recompute all the faces (twice) as well.  I wonder if it's worth it.



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

* Re: Start keybinding combination
  2022-01-31 12:23       ` Eli Zaretskii
@ 2022-01-31 15:42         ` Ergus
  0 siblings, 0 replies; 5+ messages in thread
From: Ergus @ 2022-01-31 15:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Mon, Jan 31, 2022 at 02:23:34PM +0200, Eli Zaretskii wrote:
>> Date: Sun, 30 Jan 2022 21:54:47 +0100
>> From: Ergus <spacibba@aol.com>
>> Cc: help-gnu-emacs@gnu.org
>>
>> >What would such a hook do to produce the effect that you want?  The
>> >mode-line color change will not be visible unless you force redisplay
>> >of the mode line.
>> >
>> Hi Eli:
>>
>> My question comes from the fact that I see the prefix in the echo area
>> and it looks inconspicuous. So, some redisplay is actually done
>> right?
>
>A very limited variant of redisplay, which only updates the echo-area.
>
Oh, I see.

>> Something like:
>>
>> (add-hook the-new-hook (lambda ()
>>            (face-remap-add-relative 'mode-line :background some-color)))
>>
>> And then call `face-remap-remove-relative` in the opposed|symmetric exit
>> hook... similar to what minibuffer-setup-hook/minibuffer-exit-hook do.
>>
>> But I could be wrong.
>>
>> Does it makes sense?
>
>It would make the prompt much slower, because updating the mode line
>requires a very thorough redisplay, the way it is implemented.  And if
>you on top of that change the mode-line face, Emacs will need to
>recompute all the faces (twice) as well.  I wonder if it's worth it.
>
I understand. I don't think that in practice that slowness may be even
noticeable in our days, but considering I am always concerned about
performance, then probably you are right.

Very thanks,
Ergus



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

end of thread, other threads:[~2022-01-31 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220130191539.mkbq77zpn7ugizfi.ref@Ergus>
2022-01-30 19:15 ` Start keybinding combination Ergus
2022-01-30 19:44   ` Eli Zaretskii
2022-01-30 20:54     ` Ergus
2022-01-31 12:23       ` Eli Zaretskii
2022-01-31 15:42         ` Ergus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.