unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21634: 24.5; Suggested improvement
@ 2015-10-06 12:04 Eli Barzilay
  2015-10-06 14:58 ` Eli Zaretskii
  0 siblings, 1 reply; 29+ messages in thread
From: Eli Barzilay @ 2015-10-06 12:04 UTC (permalink / raw)
  To: 21634

Would it make sense to implement `text-scale-adjust' as follows?  One
minor change is using the `keep-pred' argument to avoid re-setting the
map repeatedly, but the important change is having it timeout after a
few seconds.  This avoids the kind of mode-ish interaction that feels
weird in Emacs.

In fact, I find this useful in other cases too (a command that allows
you to resize the current window with the arrow keys), so I think that
it's useful to either add an additional timeout argument -- or perhaps
an extension where `keep-pred' can be a number of seconds and will do
the timeout thing.

-------------------------------------------------------------------------------
(defun text-scale-adjust (inc)
  "..."
  (interactive "p")
  (let ((ev last-command-event)
	(echo-keystrokes nil))
    (let* ((base (event-basic-type ev))
           (step
            (pcase base
              ((or ?+ ?=) inc)
              (?- (- inc))
              (?0 0)
              (_ inc))))
      (text-scale-increase step)
      (message "Use +,-,0 for further adjustment")
      (run-with-idle-timer 2 nil
        (set-transient-map
         (let ((map (make-sparse-keymap)))
           (dolist (mods '(() (control)))
             (dolist (key '(?- ?+ ?= ?0)) ;; = is often unshifted +.
               (define-key map (vector (append mods (list key)))
                 (lambda () (interactive) (text-scale-adjust (abs inc))))))
           map)
         t (lambda () (message "done")))))))
-------------------------------------------------------------------------------

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





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

* bug#21634: 24.5; Suggested improvement
  2015-10-06 12:04 bug#21634: 24.5; Suggested improvement Eli Barzilay
@ 2015-10-06 14:58 ` Eli Zaretskii
  2015-10-22  6:06   ` Eli Barzilay
  0 siblings, 1 reply; 29+ messages in thread
From: Eli Zaretskii @ 2015-10-06 14:58 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 21634

> From: Eli Barzilay <eli@barzilay.org>
> Date: Tue, 6 Oct 2015 08:04:03 -0400
> 
> Would it make sense to implement `text-scale-adjust' as follows?  One
> minor change is using the `keep-pred' argument to avoid re-setting the
> map repeatedly, but the important change is having it timeout after a
> few seconds.  This avoids the kind of mode-ish interaction that feels
> weird in Emacs.

FWIW, such modus operandi always annoys me.  Why should I be under
pressure to do whatever is needed to prevent the setting from being
reset?

I don't really understand what's the problem with "mode-ish
operation", feel free to elaborate.

If there's demand for resetting the size, I guess we could have it as
optional behavior.

> In fact, I find this useful in other cases too (a command that allows
> you to resize the current window with the arrow keys), so I think that
> it's useful to either add an additional timeout argument -- or perhaps
> an extension where `keep-pred' can be a number of seconds and will do
> the timeout thing.

The user can always scale the size back when she wants, right?  Or am
I missing something?





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

* bug#21634: 24.5; Suggested improvement
  2015-10-06 14:58 ` Eli Zaretskii
@ 2015-10-22  6:06   ` Eli Barzilay
  2015-10-23  8:24     ` Eli Zaretskii
  2021-09-03 11:02     ` bug#21634: text-scale-adjust suggestion Lars Ingebrigtsen
  0 siblings, 2 replies; 29+ messages in thread
From: Eli Barzilay @ 2015-10-22  6:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 21634

On Tue, Oct 6, 2015 at 10:58 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Eli Barzilay <eli@barzilay.org>
>> Date: Tue, 6 Oct 2015 08:04:03 -0400
>>
>> Would it make sense to implement `text-scale-adjust' as follows?  One
>> minor change is using the `keep-pred' argument to avoid re-setting
>> the map repeatedly, but the important change is having it timeout
>> after a few seconds.  This avoids the kind of mode-ish interaction
>> that feels weird in Emacs.
>
> FWIW, such modus operandi always annoys me.  Why should I be under
> pressure to do whatever is needed to prevent the setting from being
> reset?
>
> I don't really understand what's the problem with "mode-ish
> operation", feel free to elaborate.

Well, I suspect that I'm annoyed at the other direction: whenever I go
into the text-scaling mode, I try to remember to explicitly break it at
the end, so that I won't leave emacs in that state by mistake and be
surpries when I come back to it hours later (which actually happened to
me once, possibly putting me on this side of that fence).  OTOH, if the
delay is long enough, there is never any time pressure that I run into,
and it's easy to see when the timer kicked in by the echo area message
disappearing.


> If there's demand for resetting the size, I guess we could have it as
> optional behavior.

That's why I suggested the below extension to the meaning of the
`keep-pred` argument: specifying a timeout if it's a number.  Then there
could be a new global variable that specifies a default for that
argument, so with nil you get a single resize only (so you need to do
the full C-x C-= to resize further), with t you get the current
behavior, and with a number I get my timeout.

(I'm also suggesting it because I have a similarly "moded" function that
uses `set-transient-map' -- it seems like a good idea to me to specify a
default behavior for all such transient maps, so my function behaves in
the same way as text scaling.)


>> In fact, I find this useful in other cases too (a command that allows
>> you to resize the current window with the arrow keys), so I think that
>> it's useful to either add an additional timeout argument -- or perhaps
>> an extension where `keep-pred' can be a number of seconds and will do
>> the timeout thing.
>
> The user can always scale the size back when she wants, right?  Or am
> I missing something?

(Hopefully the above clarified it.  I'm talking about the resulting
interaction and how convenient it is, unrelated to being able to scale
things back.)

-- 
                    ((x=>x(x))(x=>x(x)))                   Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





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

* bug#21634: 24.5; Suggested improvement
  2015-10-22  6:06   ` Eli Barzilay
@ 2015-10-23  8:24     ` Eli Zaretskii
  2021-09-03 11:02     ` bug#21634: text-scale-adjust suggestion Lars Ingebrigtsen
  1 sibling, 0 replies; 29+ messages in thread
From: Eli Zaretskii @ 2015-10-23  8:24 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 21634

> Date: Thu, 22 Oct 2015 02:06:57 -0400
> From: Eli Barzilay <eli@barzilay.org>
> Cc: 21634@debbugs.gnu.org
> 
> > If there's demand for resetting the size, I guess we could have it as
> > optional behavior.
> 
> That's why I suggested the below extension to the meaning of the
> `keep-pred` argument: specifying a timeout if it's a number.  Then there
> could be a new global variable that specifies a default for that
> argument, so with nil you get a single resize only (so you need to do
> the full C-x C-= to resize further), with t you get the current
> behavior, and with a number I get my timeout.

Would you like to send a patch along these lines?  If you decide to go
for it, please accompany the change with a suitable entry in
etc/NEWS.  Bonus points if you also provide a patch for the section in
the Emacs manual ("Text Scale") that describes this feature.

TIA





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

* bug#21634: text-scale-adjust suggestion
  2015-10-22  6:06   ` Eli Barzilay
  2015-10-23  8:24     ` Eli Zaretskii
@ 2021-09-03 11:02     ` Lars Ingebrigtsen
  2021-09-03 16:13       ` Juri Linkov
  1 sibling, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-03 11:02 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 21634, Juri Linkov

Eli Barzilay <eli@barzilay.org> writes:

> Well, I suspect that I'm annoyed at the other direction: whenever I go
> into the text-scaling mode, I try to remember to explicitly break it at
> the end, so that I won't leave emacs in that state by mistake and be
> surpries when I come back to it hours later (which actually happened to
> me once, possibly putting me on this side of that fence).  OTOH, if the
> delay is long enough, there is never any time pressure that I run into,
> and it's easy to see when the timer kicked in by the echo area message
> disappearing.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

We now have something similar in the form of `repeat-exit-timeout'
(which defaults to "no timeout").  Perhaps it would make sense to use
this in `text-scale-adjust'?  Any opinions?

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





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

* bug#21634: text-scale-adjust suggestion
  2021-09-03 11:02     ` bug#21634: text-scale-adjust suggestion Lars Ingebrigtsen
@ 2021-09-03 16:13       ` Juri Linkov
  2021-09-04  6:54         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-03 16:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, 21634

>> Well, I suspect that I'm annoyed at the other direction: whenever I go
>> into the text-scaling mode, I try to remember to explicitly break it at
>> the end, so that I won't leave emacs in that state by mistake and be
>> surpries when I come back to it hours later (which actually happened to
>> me once, possibly putting me on this side of that fence).  OTOH, if the
>> delay is long enough, there is never any time pressure that I run into,
>> and it's easy to see when the timer kicked in by the echo area message
>> disappearing.
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> We now have something similar in the form of `repeat-exit-timeout'
> (which defaults to "no timeout").  Perhaps it would make sense to use
> this in `text-scale-adjust'?  Any opinions?

Indeed, text-scale-adjust could be trivially modified to use
repeat-map that supports repeat-exit-timeout.  But the problem is
that this feature is available only when repeat-mode is enabled.
Maybe not a problem to enable it when the user wants repeatable keys.





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

* bug#21634: text-scale-adjust suggestion
  2021-09-03 16:13       ` Juri Linkov
@ 2021-09-04  6:54         ` Lars Ingebrigtsen
  2021-09-05 16:40           ` Juri Linkov
  2022-06-30 16:12           ` Juri Linkov
  0 siblings, 2 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-04  6:54 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, 21634

Juri Linkov <juri@linkov.net> writes:

> Indeed, text-scale-adjust could be trivially modified to use
> repeat-map that supports repeat-exit-timeout.  But the problem is
> that this feature is available only when repeat-mode is enabled.
> Maybe not a problem to enable it when the user wants repeatable keys.

I think implementing text-scale-adjust on top of repeat-mode would be
good -- and it could just enable repeat-mode for itself temporarily, I
think?

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





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

* bug#21634: text-scale-adjust suggestion
  2021-09-04  6:54         ` Lars Ingebrigtsen
@ 2021-09-05 16:40           ` Juri Linkov
  2021-09-06  8:28             ` Lars Ingebrigtsen
  2022-06-30 16:12           ` Juri Linkov
  1 sibling, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-05 16:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, 21634

>> Indeed, text-scale-adjust could be trivially modified to use
>> repeat-map that supports repeat-exit-timeout.  But the problem is
>> that this feature is available only when repeat-mode is enabled.
>> Maybe not a problem to enable it when the user wants repeatable keys.
>
> I think implementing text-scale-adjust on top of repeat-mode would be
> good -- and it could just enable repeat-mode for itself temporarily, I
> think?

Maybe a new mode transient-repeat-mode could be created.
Then text-scale-adjust could temporarily activate
this mode instead of using set-transient-map.





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

* bug#21634: text-scale-adjust suggestion
  2021-09-05 16:40           ` Juri Linkov
@ 2021-09-06  8:28             ` Lars Ingebrigtsen
  2021-09-06 15:34               ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-06  8:28 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, 21634

Juri Linkov <juri@linkov.net> writes:

> Maybe a new mode transient-repeat-mode could be created.
> Then text-scale-adjust could temporarily activate
> this mode instead of using set-transient-map.

Yeah, that's a good idea.

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





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

* bug#21634: text-scale-adjust suggestion
  2021-09-06  8:28             ` Lars Ingebrigtsen
@ 2021-09-06 15:34               ` Juri Linkov
  2021-09-06 22:15                 ` bug#21634: [External] : " Drew Adams
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2021-09-06 15:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, 21634

>> Maybe a new mode transient-repeat-mode could be created.
>> Then text-scale-adjust could temporarily activate
>> this mode instead of using set-transient-map.
>
> Yeah, that's a good idea.

Another command that could use it as well is 'indent-rigidly'.
Currently it's too inconvenient to type C-g to get out of it.
Exiting after a delay would be a better option.





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

* bug#21634: [External] : bug#21634: text-scale-adjust suggestion
  2021-09-06 15:34               ` Juri Linkov
@ 2021-09-06 22:15                 ` Drew Adams
  2021-09-06 22:31                   ` Eli Barzilay
  0 siblings, 1 reply; 29+ messages in thread
From: Drew Adams @ 2021-09-06 22:15 UTC (permalink / raw)
  To: Juri Linkov, Lars Ingebrigtsen; +Cc: Eli Barzilay, 21634@debbugs.gnu.org

> Another command that could use it as well is 'indent-rigidly'.
> Currently it's too inconvenient to type C-g to get out of it.
> Exiting after a delay would be a better option.

Not that I care much about this particular fiddling,
but IMHO, `C-g' to "get out of" what is essentially
a modal, or near-modal interaction, is emacsy and
makes perfect sense.  Having a time-out "get out of"
such contexts seems to me quite wrong & unfriendly.

(Again though, not much concern on my part, for
quitting this command's repeating behavior.)

Timers do things silently, at moments users are
often not aware of.  And users certainly don't want
to _wait_ for a timer as the way to initiate or
terminate some action.  At a minimum there should
be a way to quit on demand (i.e. do it now!).





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

* bug#21634: [External] : bug#21634: text-scale-adjust suggestion
  2021-09-06 22:15                 ` bug#21634: [External] : " Drew Adams
@ 2021-09-06 22:31                   ` Eli Barzilay
  2021-09-06 22:35                     ` Drew Adams
  2021-09-07  8:16                     ` martin rudalics
  0 siblings, 2 replies; 29+ messages in thread
From: Eli Barzilay @ 2021-09-06 22:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: Lars Ingebrigtsen, 21634@debbugs.gnu.org, Juri Linkov

IIUC, the discussion was about making it time out in addition to
C-g-ing out and not instead of it.

My original concern was leaving Emacs in the middle of such an
interaction, and when you get back to Emacs, you can easily forget
that you were in the middle of an interaction and be surprised when
keys don't work as expected.  With indent-rigidly this is even worse
since the echo-area message disappears leaving you with no indication
of it being active, which is essentially a mode which is extremely
un-emacsy.

On Mon, Sep 6, 2021 at 6:15 PM Drew Adams <drew.adams@oracle.com> wrote:
>
> > Another command that could use it as well is 'indent-rigidly'.
> > Currently it's too inconvenient to type C-g to get out of it.
> > Exiting after a delay would be a better option.
>
> Not that I care much about this particular fiddling,
> but IMHO, `C-g' to "get out of" what is essentially
> a modal, or near-modal interaction, is emacsy and
> makes perfect sense.  Having a time-out "get out of"
> such contexts seems to me quite wrong & unfriendly.
>
> (Again though, not much concern on my part, for
> quitting this command's repeating behavior.)
>
> Timers do things silently, at moments users are
> often not aware of.  And users certainly don't want
> to _wait_ for a timer as the way to initiate or
> terminate some action.  At a minimum there should
> be a way to quit on demand (i.e. do it now!).



-- 
                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!





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

* bug#21634: [External] : bug#21634: text-scale-adjust suggestion
  2021-09-06 22:31                   ` Eli Barzilay
@ 2021-09-06 22:35                     ` Drew Adams
  2021-09-07  8:16                     ` martin rudalics
  1 sibling, 0 replies; 29+ messages in thread
From: Drew Adams @ 2021-09-06 22:35 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: Lars Ingebrigtsen, 21634@debbugs.gnu.org, Juri Linkov

> IIUC, the discussion was about making it time out in addition to
> C-g-ing out and not instead of it.

I see.  Sorry I misunderstood, by reading out of context.

I'm still not a fan of having a time-out end an interaction,
in general.  But at least not having to _depend_ on only
that way of quitting is better than nothing.

> My original concern was leaving Emacs in the middle of such an
> interaction, and when you get back to Emacs, you can easily forget
> that you were in the middle of an interaction and be surprised when
> keys don't work as expected.  With indent-rigidly this is even worse
> since the echo-area message disappears leaving you with no indication
> of it being active, which is essentially a mode which is extremely
> un-emacsy.

I think I agree with you about that, FWIW.

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

* bug#21634: [External] : bug#21634: text-scale-adjust suggestion
  2021-09-06 22:31                   ` Eli Barzilay
  2021-09-06 22:35                     ` Drew Adams
@ 2021-09-07  8:16                     ` martin rudalics
  1 sibling, 0 replies; 29+ messages in thread
From: martin rudalics @ 2021-09-07  8:16 UTC (permalink / raw)
  To: Eli Barzilay, Drew Adams
  Cc: Lars Ingebrigtsen, 21634@debbugs.gnu.org, Juri Linkov

 > With indent-rigidly this is even worse
 > since the echo-area message disappears leaving you with no indication
 > of it being active, which is essentially a mode which is extremely
 > un-emacsy.

With `transient-mark-mode' the region stays highlighted until I'm done
with indenting.  I would never look anywhere else for obtaining feedback
about a transient mode like the one triggered by `indent-rigidly'.

martin





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

* bug#21634: text-scale-adjust suggestion
  2021-09-04  6:54         ` Lars Ingebrigtsen
  2021-09-05 16:40           ` Juri Linkov
@ 2022-06-30 16:12           ` Juri Linkov
  2022-07-01  9:17             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2022-06-30 16:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, Eli Zaretskii, 21634

> I think implementing text-scale-adjust on top of repeat-mode would be
> good -- and it could just enable repeat-mode for itself temporarily, I
> think?

repeat-mode = post-command-hook + set-transient-map

We don't need post-command-hook here - this leaves us with just
set-transient-map.  As was already suggested, we need either
to add a new optional arg TIMEOUT to set-transient-map,
or allow a number of seconds in the existing arg KEEP-PRED.

Then another question is how the users could customize the timeout.
One variable to customize timeout for all commands that use
set-transient-map?  Or separate variables for every command:
one for indent-rigidly, one for text-scale-adjust?





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

* bug#21634: text-scale-adjust suggestion
  2022-06-30 16:12           ` Juri Linkov
@ 2022-07-01  9:17             ` Lars Ingebrigtsen
  2022-07-01 15:40               ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-01  9:17 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, Eli Zaretskii, 21634

Juri Linkov <juri@linkov.net> writes:

> We don't need post-command-hook here - this leaves us with just
> set-transient-map.  As was already suggested, we need either
> to add a new optional arg TIMEOUT to set-transient-map,
> or allow a number of seconds in the existing arg KEEP-PRED.
>
> Then another question is how the users could customize the timeout.
> One variable to customize timeout for all commands that use
> set-transient-map?  Or separate variables for every command:
> one for indent-rigidly, one for text-scale-adjust?

I think one variable for the timeout would be sufficient, and a value of
(say) `timeout' for KEEP-PRED could instruct set-transient-map to use
that timeout, perhaps?

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-01  9:17             ` Lars Ingebrigtsen
@ 2022-07-01 15:40               ` Juri Linkov
  2022-07-02 11:59                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2022-07-01 15:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, Eli Zaretskii, 21634

>> We don't need post-command-hook here - this leaves us with just
>> set-transient-map.  As was already suggested, we need either
>> to add a new optional arg TIMEOUT to set-transient-map,
>> or allow a number of seconds in the existing arg KEEP-PRED.
>>
>> Then another question is how the users could customize the timeout.
>> One variable to customize timeout for all commands that use
>> set-transient-map?  Or separate variables for every command:
>> one for indent-rigidly, one for text-scale-adjust?
>
> I think one variable for the timeout would be sufficient, and a value of
> (say) `timeout' for KEEP-PRED could instruct set-transient-map to use
> that timeout, perhaps?

Actually, I can imagine when someone might want to keep a transient map
active with KEEP-PRED, but still deactivate it after a timeout.  So
a separate TIMEOUT looks cleaner.

Anyway, repeat-mode has separate options for repeat-exit-timeout
and constructs a message, so I could copy the same code from repeat-mode
to set-transient-map.





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

* bug#21634: text-scale-adjust suggestion
  2022-07-01 15:40               ` Juri Linkov
@ 2022-07-02 11:59                 ` Lars Ingebrigtsen
  2022-07-03 16:36                   ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-02 11:59 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, Eli Zaretskii, 21634

Juri Linkov <juri@linkov.net> writes:

> Actually, I can imagine when someone might want to keep a transient map
> active with KEEP-PRED, but still deactivate it after a timeout.  So
> a separate TIMEOUT looks cleaner.

Yup, makes sense.

> Anyway, repeat-mode has separate options for repeat-exit-timeout
> and constructs a message, so I could copy the same code from repeat-mode
> to set-transient-map.

Sounds good.

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-02 11:59                 ` Lars Ingebrigtsen
@ 2022-07-03 16:36                   ` Juri Linkov
  2022-07-04 10:51                     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2022-07-03 16:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, Eli Zaretskii, 21634

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

> Juri Linkov <juri@linkov.net> writes:
>
>> Actually, I can imagine when someone might want to keep a transient map
>> active with KEEP-PRED, but still deactivate it after a timeout.  So
>> a separate TIMEOUT looks cleaner.
>
> Yup, makes sense.
>
>> Anyway, repeat-mode has separate options for repeat-exit-timeout
>> and constructs a message, so I could copy the same code from repeat-mode
>> to set-transient-map.
>
> Sounds good.

Maybe something like this.  I'm still unsure about providing a prefix
message without keys, because when the message arg is a string
then better to display it as is.  Otherwise when it is `t', then
the message will be constructed to "Repeat with <keys...>".
I.e. the remaining question is that you already raised whether
typically all keys should be mentioned in the message.

OTOH, there are messages like "Use \\`+',\\`-',\\`0' for further adjustment"
have not only a prefix, but also a suffix.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: set-transient-map.patch --]
[-- Type: text/x-diff, Size: 6135 bytes --]

diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 7037bc58cb..951285fbf2 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -408,9 +408,6 @@ text-scale-adjust
               (?0 0)
               (_ inc))))
       (text-scale-increase step)
-      ;; (unless (zerop step)
-      (message (substitute-command-keys
-                "Use \\`+',\\`-',\\`0' for further adjustment"))
       (set-transient-map
        (let ((map (make-sparse-keymap)))
          (dolist (mods '(() (control)))
@@ -418,10 +415,9 @@ text-scale-adjust
              (define-key map (vector (append mods (list key)))
                (lambda () (interactive) (text-scale-adjust (abs inc))))))
          map)
-       nil
-       ;; Clear the prompt after exiting.
-       (lambda ()
-         (message ""))))))
+       nil nil
+       (substitute-command-keys
+        "Use \\`+',\\`-',\\`0' for further adjustment")))))
 
 (defvar-local text-scale--pinch-start-scale 0
   "The text scale at the start of a pinch sequence.")
@@ -515,15 +511,16 @@ global-text-scale-adjust
                (not global-text-scale-adjust-resizes-frames)))
           (set-face-attribute 'default nil :height new)))
       (when (characterp key)
-        (message (substitute-command-keys
-                  "Use \\`+',\\`-',\\`0' for further adjustment"))
         (set-transient-map
          (let ((map (make-sparse-keymap)))
            (dolist (mod '(() (control meta)))
              (dolist (key '(?+ ?= ?- ?0))
                (define-key map (vector (append mod (list key)))
                  'global-text-scale-adjust)))
-           map))))))
+           map)
+       nil nil
+       (substitute-command-keys
+        "Use \\`+',\\`-',\\`0' for further adjustment"))))))
 
 \f
 ;; ----------------------------------------------------------------
diff --git a/lisp/indent.el b/lisp/indent.el
index d6dee94016..6eaf9f04ae 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -270,11 +270,10 @@ indent-rigidly
 indentation by specifying a large negative ARG."
   (interactive "r\nP\np")
   (if (and (not arg) interactive)
-      (progn
-        (message
-	 (substitute-command-keys
-	  "Indent region with \\<indent-rigidly-map>\\[indent-rigidly-left], \\[indent-rigidly-right], \\[indent-rigidly-left-to-tab-stop], or \\[indent-rigidly-right-to-tab-stop]."))
-        (set-transient-map indent-rigidly-map t #'deactivate-mark))
+      (set-transient-map
+       indent-rigidly-map t #'deactivate-mark
+       (substitute-command-keys
+	"Indent region with \\<indent-rigidly-map>\\[indent-rigidly-left], \\[indent-rigidly-right], \\[indent-rigidly-left-to-tab-stop], or \\[indent-rigidly-right-to-tab-stop]."))
     (save-excursion
       (goto-char end)
       (setq end (point-marker))
diff --git a/lisp/subr.el b/lisp/subr.el
index 4e4eac32d9..338248bbae 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -6013,7 +6013,15 @@ internal-pop-keymap
 (define-obsolete-function-alias
   'set-temporary-overlay-map #'set-transient-map "24.4")
 
-(defun set-transient-map (map &optional keep-pred on-exit)
+(defvar set-transient-map-timeout 3
+  "Break the repetition chain of keys after specified timeout.
+When a number, exit the previous `set-transient-map' after idle time
+of the specified number of seconds.")
+
+(defvar set-transient-map-timer nil
+  "Timer to exit `set-transient-map' after `set-transient-map-timeout'.")
+
+(defun set-transient-map (map &optional keep-pred on-exit message timeout)
   "Set MAP as a temporary keymap taking precedence over other keymaps.
 Normally, MAP is used only once, to look up the very next key.
 However, if the optional argument KEEP-PRED is t, MAP stays
@@ -6030,18 +6038,33 @@ set-transient-map
 
 This returns an \"exit function\", which can be called with no argument
 to deactivate this transient map, regardless of KEEP-PRED."
-  (let* ((clearfun (make-symbol "clear-transient-map"))
+  (let* ((timeout (or set-transient-map-timeout timeout))
+         (message
+          (when message
+            (if (stringp message) message
+              (let (keys)
+                (map-keymap (lambda (key cmd) (and cmd (push key keys))) map)
+                (format-message "Repeat with %s"
+                                (mapconcat (lambda (key)
+                                             (substitute-command-keys
+                                              (format "\\`%s'"
+                                                      (key-description (vector key)))))
+                                           keys ", "))))))
+         (clearfun (make-symbol "clear-transient-map"))
          (exitfun
           (lambda ()
             (internal-pop-keymap map 'overriding-terminal-local-map)
             (remove-hook 'pre-command-hook clearfun)
+            ;; Clear the prompt after exiting.
+            (when message (message ""))
+            (when set-transient-map-timer (cancel-timer set-transient-map-timer))
             (when on-exit (funcall on-exit)))))
     ;; Don't use letrec, because equal (in add/remove-hook) could get trapped
     ;; in a cycle. (bug#46326)
     (fset clearfun
           (lambda ()
             (with-demoted-errors "set-transient-map PCH: %S"
-              (unless (cond
+              (if (cond
                        ((null keep-pred) nil)
                        ((and (not (eq map (cadr overriding-terminal-local-map)))
                              (memq map (cddr overriding-terminal-local-map)))
@@ -6066,9 +6089,14 @@ set-transient-map
                           ;; nil and so is `mc`.
                           (and mc (eq this-command mc))))
                        (t (funcall keep-pred)))
+                  (when message (message "%s" message))
                 (funcall exitfun)))))
     (add-hook 'pre-command-hook clearfun)
     (internal-push-keymap map 'overriding-terminal-local-map)
+    (when timeout
+      (when set-transient-map-timer (cancel-timer set-transient-map-timer))
+      (setq set-transient-map-timer (run-with-idle-timer timeout nil exitfun)))
+    (when message (message "%s" message))
     exitfun))
 
 ;;;; Progress reporters.

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

* bug#21634: text-scale-adjust suggestion
  2022-07-03 16:36                   ` Juri Linkov
@ 2022-07-04 10:51                     ` Lars Ingebrigtsen
  2022-07-04 17:45                       ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-04 10:51 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, Eli Zaretskii, 21634

Juri Linkov <juri@linkov.net> writes:

> Maybe something like this.  I'm still unsure about providing a prefix
> message without keys, because when the message arg is a string
> then better to display it as is.  Otherwise when it is `t', then
> the message will be constructed to "Repeat with <keys...>".
> I.e. the remaining question is that you already raised whether
> typically all keys should be mentioned in the message.
>
> OTOH, there are messages like "Use \\`+',\\`-',\\`0' for further adjustment"
> have not only a prefix, but also a suffix.

Perhaps the MESSAGE should be a format-spec string?  So the caller could
say "Use %k for further adjustment" and have the keymap description
inserted at the %k.  That should be plenty flexible.

Looks good otherwise.

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-04 10:51                     ` Lars Ingebrigtsen
@ 2022-07-04 17:45                       ` Juri Linkov
  2022-07-05 11:15                         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2022-07-04 17:45 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Barzilay, Eli Zaretskii, 21634

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

>> OTOH, there are messages like "Use \\`+',\\`-',\\`0' for further adjustment"
>> have not only a prefix, but also a suffix.
>
> Perhaps the MESSAGE should be a format-spec string?  So the caller could
> say "Use %k for further adjustment" and have the keymap description
> inserted at the %k.  That should be plenty flexible.

format-spec is a nice helper.  Here are the changes after
the value of %k is automatically generated from the keys:

  emoji-zoom-increase:
  OLD: Zoom with + and -
  NEW: Zoom with +, -

  indent-rigidly:
  OLD: Indent region with <left>, <right>, S-<left>, or S-<right>.
  NEW: Indent region with TAB, <left>, <right>, S-<left>, S-<right>

  text-scale-adjust:
  OLD: Use +,-,0 for further adjustment
  NEW: Use +, =, -, 0, C-+, C-=, C--, C-0 for further adjustment

  global-text-scale-adjust:
  OLD: Use +,-,0 for further adjustment
  NEW: Use +, =, -, 0, ESC for further adjustment

ESC is because map-keymap handles only top-level keys
but C-M-+ is [ESC C-+].


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: set-transient-map.patch --]
[-- Type: text/x-diff, Size: 6685 bytes --]

diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index 27b725b0aa..a129656d2b 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -709,10 +709,7 @@ emoji-zoom-increase
   "Increase the size of the character under point.
 FACTOR is the multiplication factor for the size."
   (interactive)
-  (message
-   (substitute-command-keys
-    "Zoom with \\<emoji-zoom-map>\\[emoji-zoom-increase] and \\[emoji-zoom-decrease]"))
-  (set-transient-map emoji-zoom-map t)
+  (set-transient-map emoji-zoom-map t nil "Zoom with %k")
   (let* ((factor (or factor 1.1))
          (old (get-text-property (point) 'face))
          (height (or (and (consp old)
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 467ccbc299..fd49c81ab3 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -408,20 +408,15 @@ text-scale-adjust
               (?0 0)
               (_ inc))))
       (text-scale-increase step)
-      ;; (unless (zerop step)
-      (message (substitute-command-keys
-                "Use \\`+',\\`-',\\`0' for further adjustment"))
       (set-transient-map
        (let ((map (make-sparse-keymap)))
          (dolist (mods '(() (control)))
-           (dolist (key '(?- ?+ ?= ?0)) ;; = is often unshifted +.
+           (dolist (key '(?+ ?= ?- ?0)) ;; = is often unshifted +.
              (define-key map (vector (append mods (list key)))
                (lambda () (interactive) (text-scale-adjust (abs inc))))))
          map)
-       nil
-       ;; Clear the prompt after exiting.
-       (lambda ()
-         (message ""))))))
+       nil nil
+       "Use %k for further adjustment"))))
 
 (defvar-local text-scale--pinch-start-scale 0
   "The text scale at the start of a pinch sequence.")
@@ -515,15 +510,15 @@ global-text-scale-adjust
                (not global-text-scale-adjust-resizes-frames)))
           (set-face-attribute 'default nil :height new)))
       (when (characterp key)
-        (message (substitute-command-keys
-                  "Use \\`+',\\`-',\\`0' for further adjustment"))
         (set-transient-map
          (let ((map (make-sparse-keymap)))
            (dolist (mod '(() (control meta)))
              (dolist (key '(?+ ?= ?- ?0))
                (define-key map (vector (append mod (list key)))
                  'global-text-scale-adjust)))
-           map))))))
+           map)
+       nil nil
+       "Use %k for further adjustment")))))
 
 \f
 ;; ----------------------------------------------------------------
diff --git a/lisp/indent.el b/lisp/indent.el
index d6dee94016..f52b729051 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -270,11 +270,8 @@ indent-rigidly
 indentation by specifying a large negative ARG."
   (interactive "r\nP\np")
   (if (and (not arg) interactive)
-      (progn
-        (message
-	 (substitute-command-keys
-	  "Indent region with \\<indent-rigidly-map>\\[indent-rigidly-left], \\[indent-rigidly-right], \\[indent-rigidly-left-to-tab-stop], or \\[indent-rigidly-right-to-tab-stop]."))
-        (set-transient-map indent-rigidly-map t #'deactivate-mark))
+      (set-transient-map indent-rigidly-map t #'deactivate-mark
+                         "Indent region with %k")
     (save-excursion
       (goto-char end)
       (setq end (point-marker))
diff --git a/lisp/subr.el b/lisp/subr.el
index 2f9d37ffd6..efb920ec5a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -6013,7 +6013,15 @@ internal-pop-keymap
 (define-obsolete-function-alias
   'set-temporary-overlay-map #'set-transient-map "24.4")
 
-(defun set-transient-map (map &optional keep-pred on-exit)
+(defvar set-transient-map-timeout 3
+  "Break the repetition chain of keys after specified timeout.
+When a number, exit the previous `set-transient-map' after idle time
+of the specified number of seconds.")
+
+(defvar set-transient-map-timer nil
+  "Timer to exit `set-transient-map' after `set-transient-map-timeout'.")
+
+(defun set-transient-map (map &optional keep-pred on-exit message timeout)
   "Set MAP as a temporary keymap taking precedence over other keymaps.
 Normally, MAP is used only once, to look up the very next key.
 However, if the optional argument KEEP-PRED is t, MAP stays
@@ -6030,18 +6038,34 @@ set-transient-map
 
 This returns an \"exit function\", which can be called with no argument
 to deactivate this transient map, regardless of KEEP-PRED."
-  (let* ((clearfun (make-symbol "clear-transient-map"))
+  (let* ((timeout (or set-transient-map-timeout timeout))
+         (message
+          (when message
+            (let (keys)
+              (map-keymap (lambda (key cmd) (and cmd (push key keys))) map)
+              (format-spec (if (stringp message) message
+                             "Repeat with %k")
+                           `((?k . ,(mapconcat
+                                     (lambda (key)
+                                       (substitute-command-keys
+                                        (format "\\`%s'"
+                                                (key-description (vector key)))))
+                                     keys ", ")))))))
+         (clearfun (make-symbol "clear-transient-map"))
          (exitfun
           (lambda ()
             (internal-pop-keymap map 'overriding-terminal-local-map)
             (remove-hook 'pre-command-hook clearfun)
+            ;; Clear the prompt after exiting.
+            (when message (message ""))
+            (when set-transient-map-timer (cancel-timer set-transient-map-timer))
             (when on-exit (funcall on-exit)))))
     ;; Don't use letrec, because equal (in add/remove-hook) could get trapped
     ;; in a cycle. (bug#46326)
     (fset clearfun
           (lambda ()
             (with-demoted-errors "set-transient-map PCH: %S"
-              (unless (cond
+              (if (cond
                        ((null keep-pred) nil)
                        ((and (not (eq map (cadr overriding-terminal-local-map)))
                              (memq map (cddr overriding-terminal-local-map)))
@@ -6066,9 +6090,14 @@ set-transient-map
                           ;; nil and so is `mc`.
                           (and mc (eq this-command mc))))
                        (t (funcall keep-pred)))
+                  (when message (message "%s" message))
                 (funcall exitfun)))))
     (add-hook 'pre-command-hook clearfun)
     (internal-push-keymap map 'overriding-terminal-local-map)
+    (when timeout
+      (when set-transient-map-timer (cancel-timer set-transient-map-timer))
+      (setq set-transient-map-timer (run-with-idle-timer timeout nil exitfun)))
+    (when message (message "%s" message))
     exitfun))
 
 ;;;; Progress reporters.

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

* bug#21634: text-scale-adjust suggestion
  2022-07-04 17:45                       ` Juri Linkov
@ 2022-07-05 11:15                         ` Lars Ingebrigtsen
  2022-07-05 13:21                           ` Robert Pluim
  0 siblings, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 11:15 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, Eli Zaretskii, 21634

Juri Linkov <juri@linkov.net> writes:

> format-spec is a nice helper.  Here are the changes after
> the value of %k is automatically generated from the keys:
>
>   emoji-zoom-increase:
>   OLD: Zoom with + and -
>   NEW: Zoom with +, -
>
>   indent-rigidly:
>   OLD: Indent region with <left>, <right>, S-<left>, or S-<right>.
>   NEW: Indent region with TAB, <left>, <right>, S-<left>, S-<right>

I think the final ", " in these lists should be an " or " instead -- I
think that reads better.

>   global-text-scale-adjust:
>   OLD: Use +,-,0 for further adjustment
>   NEW: Use +, =, -, 0, ESC for further adjustment
>
> ESC is because map-keymap handles only top-level keys
> but C-M-+ is [ESC C-+].

Hm.  We don't have any function that'll just spit out all the "real" key
binding in a keymap somewhere?  I.e., that results in a list with keys a
la what's displayed by `C-h b'?  I guess not, but that sounds like a
useful utility function to have, and could be used here.

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-05 11:15                         ` Lars Ingebrigtsen
@ 2022-07-05 13:21                           ` Robert Pluim
  2022-07-05 16:38                             ` Lars Ingebrigtsen
  2022-07-06 17:42                             ` Juri Linkov
  0 siblings, 2 replies; 29+ messages in thread
From: Robert Pluim @ 2022-07-05 13:21 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 21634, Eli Barzilay, Eli Zaretskii, Juri Linkov

>>>>> On Tue, 05 Jul 2022 13:15:42 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> Juri Linkov <juri@linkov.net> writes:
    >> format-spec is a nice helper.  Here are the changes after
    >> the value of %k is automatically generated from the keys:
    >> 
    >> emoji-zoom-increase:
    >> OLD: Zoom with + and -
    >> NEW: Zoom with +, -
    >> 
    >> indent-rigidly:
    >> OLD: Indent region with <left>, <right>, S-<left>, or S-<right>.
    >> NEW: Indent region with TAB, <left>, <right>, S-<left>, S-<right>

    Lars> I think the final ", " in these lists should be an " or " instead -- I
    Lars> think that reads better.

Yes

    >> global-text-scale-adjust:
    >> OLD: Use +,-,0 for further adjustment
    >> NEW: Use +, =, -, 0, ESC for further adjustment
    >> 
    >> ESC is because map-keymap handles only top-level keys
    >> but C-M-+ is [ESC C-+].

    Lars> Hm.  We don't have any function that'll just spit out all the "real" key
    Lars> binding in a keymap somewhere?  I.e., that results in a list with keys a
    Lars> la what's displayed by `C-h b'?  I guess not, but that sounds like a
    Lars> useful utility function to have, and could be used here.

I think the guts of `describe-repeat-mapsʼ does something like that.

Robert
-- 





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

* bug#21634: text-scale-adjust suggestion
  2022-07-05 13:21                           ` Robert Pluim
@ 2022-07-05 16:38                             ` Lars Ingebrigtsen
  2022-07-05 16:39                               ` Lars Ingebrigtsen
  2022-07-06 17:42                             ` Juri Linkov
  1 sibling, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 16:38 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 21634, Eli Barzilay, Eli Zaretskii, Juri Linkov

Robert Pluim <rpluim@gmail.com> writes:

> I think the guts of `describe-repeat-mapsʼ does something like that.

Hm...  it gets all the commands in the map, and then calls
`where-is-internal' on those commands?  Yes, that'll do the trick, even
if it's in slightly the opposite direction you'd expect.  But if a
command has two bindings, you only get one of them.

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-05 16:38                             ` Lars Ingebrigtsen
@ 2022-07-05 16:39                               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 16:39 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 21634, Eli Barzilay, Eli Zaretskii, Juri Linkov

Lars Ingebrigtsen <larsi@gnus.org> writes:

> But if a command has two bindings, you only get one of them.

Ignore that; I forgot that where-is-internal returns a list of bindings.

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-05 13:21                           ` Robert Pluim
  2022-07-05 16:38                             ` Lars Ingebrigtsen
@ 2022-07-06 17:42                             ` Juri Linkov
  2022-07-07  8:01                               ` Lars Ingebrigtsen
  1 sibling, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2022-07-06 17:42 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Lars Ingebrigtsen, Eli Zaretskii, Eli Barzilay, 21634

>     >> format-spec is a nice helper.  Here are the changes after
>     >> the value of %k is automatically generated from the keys:
>     >>
>     >> emoji-zoom-increase:
>     >> OLD: Zoom with + and -
>     >> NEW: Zoom with +, -
>     >>
>     >> indent-rigidly:
>     >> OLD: Indent region with <left>, <right>, S-<left>, or S-<right>.
>     >> NEW: Indent region with TAB, <left>, <right>, S-<left>, S-<right>
>
>     Lars> I think the final ", " in these lists should be an " or " instead -- I
>     Lars> think that reads better.
>
> Yes

Should then describe-repeat-maps do the same and replace this

 next-error (bound to n, M-n)
 previous-error (bound to p, M-p)

with

 next-error (bound to n or M-n)
 previous-error (bound to p or M-p)

Then also should repeat-echo-message-string use "or" and replace

 Repeat with n, M-n

with

 Repeat with n or M-n

But doing this is problematic since when repeat-exit-key is defined,
it will also replace

 Repeat with n, M-n or exit with RET

with incorrect

 Repeat with n or M-n or exit with RET

>     >> global-text-scale-adjust:
>     >> OLD: Use +,-,0 for further adjustment
>     >> NEW: Use +, =, -, 0, ESC for further adjustment
>     >>
>     >> ESC is because map-keymap handles only top-level keys
>     >> but C-M-+ is [ESC C-+].
>
>     Lars> Hm.  We don't have any function that'll just spit out all the "real" key
>     Lars> binding in a keymap somewhere?  I.e., that results in a list with keys a
>     Lars> la what's displayed by `C-h b'?  I guess not, but that sounds like a
>     Lars> useful utility function to have, and could be used here.
>
> I think the guts of `describe-repeat-mapsʼ does something like that.

I forgot that describe-repeat-maps uses where-is-internal.
But I don't see how repeat-echo-message-string and set-transient-map
could use where-is-internal without iterating a huge list of all commands
from obarray.  There is no function to get all commands from the given
keymap only?

BTW, now I fixed describe-repeat-maps to handle the case when the
keymap is not a symbol, e.g.

  (put 'next-line 'repeat-map (define-keymap
                                "C-M-a" #'next-line
                                "C-M-b" #'next-line))

Also pushed new args of set-transient-map, so the same improvements
are needed for both repeat-echo-message-string and set-transient-map,
maybe by sharing the same code.





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

* bug#21634: text-scale-adjust suggestion
  2022-07-06 17:42                             ` Juri Linkov
@ 2022-07-07  8:01                               ` Lars Ingebrigtsen
  2022-07-07 16:49                                 ` Juri Linkov
  0 siblings, 1 reply; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-07  8:01 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Robert Pluim, Eli Zaretskii, Eli Barzilay, 21634

Juri Linkov <juri@linkov.net> writes:

> But doing this is problematic since when repeat-exit-key is defined,
> it will also replace
>
>  Repeat with n, M-n or exit with RET
>
> with incorrect
>
>  Repeat with n or M-n or exit with RET

Well, you'd have to rephrase that to, for instance, "and exit with RET".

>> I think the guts of `describe-repeat-mapsʼ does something like that.
>
> I forgot that describe-repeat-maps uses where-is-internal.
> But I don't see how repeat-echo-message-string and set-transient-map
> could use where-is-internal without iterating a huge list of all commands
> from obarray.  There is no function to get all commands from the given
> keymap only?

No, I think we should add a function like that.  Shouldn't be too difficult.

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





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

* bug#21634: text-scale-adjust suggestion
  2022-07-07  8:01                               ` Lars Ingebrigtsen
@ 2022-07-07 16:49                                 ` Juri Linkov
  2022-07-07 18:04                                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 29+ messages in thread
From: Juri Linkov @ 2022-07-07 16:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Robert Pluim, Eli Zaretskii, Eli Barzilay, 21634

>>> I think the guts of `describe-repeat-mapsʼ does something like that.
>>
>> I forgot that describe-repeat-maps uses where-is-internal.
>> But I don't see how repeat-echo-message-string and set-transient-map
>> could use where-is-internal without iterating a huge list of all commands
>> from obarray.  There is no function to get all commands from the given
>> keymap only?
>
> No, I think we should add a function like that.  Shouldn't be too difficult.

Such a function could return a flat list of (key-sequence . binding).
Maybe loops from describe-map-tree/describe-map could be reused,
but with accumulating the result instead of printing.





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

* bug#21634: text-scale-adjust suggestion
  2022-07-07 16:49                                 ` Juri Linkov
@ 2022-07-07 18:04                                   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 29+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-07 18:04 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Robert Pluim, Eli Zaretskii, Eli Barzilay, 21634

Juri Linkov <juri@linkov.net> writes:

> Such a function could return a flat list of (key-sequence . binding).
> Maybe loops from describe-map-tree/describe-map could be reused,
> but with accumulating the result instead of printing.

Yup.

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





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

end of thread, other threads:[~2022-07-07 18:04 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 12:04 bug#21634: 24.5; Suggested improvement Eli Barzilay
2015-10-06 14:58 ` Eli Zaretskii
2015-10-22  6:06   ` Eli Barzilay
2015-10-23  8:24     ` Eli Zaretskii
2021-09-03 11:02     ` bug#21634: text-scale-adjust suggestion Lars Ingebrigtsen
2021-09-03 16:13       ` Juri Linkov
2021-09-04  6:54         ` Lars Ingebrigtsen
2021-09-05 16:40           ` Juri Linkov
2021-09-06  8:28             ` Lars Ingebrigtsen
2021-09-06 15:34               ` Juri Linkov
2021-09-06 22:15                 ` bug#21634: [External] : " Drew Adams
2021-09-06 22:31                   ` Eli Barzilay
2021-09-06 22:35                     ` Drew Adams
2021-09-07  8:16                     ` martin rudalics
2022-06-30 16:12           ` Juri Linkov
2022-07-01  9:17             ` Lars Ingebrigtsen
2022-07-01 15:40               ` Juri Linkov
2022-07-02 11:59                 ` Lars Ingebrigtsen
2022-07-03 16:36                   ` Juri Linkov
2022-07-04 10:51                     ` Lars Ingebrigtsen
2022-07-04 17:45                       ` Juri Linkov
2022-07-05 11:15                         ` Lars Ingebrigtsen
2022-07-05 13:21                           ` Robert Pluim
2022-07-05 16:38                             ` Lars Ingebrigtsen
2022-07-05 16:39                               ` Lars Ingebrigtsen
2022-07-06 17:42                             ` Juri Linkov
2022-07-07  8:01                               ` Lars Ingebrigtsen
2022-07-07 16:49                                 ` Juri Linkov
2022-07-07 18:04                                   ` Lars Ingebrigtsen

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