emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: POLL: make C-x o transient


From: Drew Adams
Subject: RE: [External] : Re: POLL: make C-x o transient
Date: Sat, 30 Jan 2021 20:47:31 +0000

> >>> It is to bind C-= to the existing "repeat" command,
> >>
> >> FWIW, I agree that `repeat` deserves a single-key bindings.
> >> But I don't think `C-=` can be it, and I don't have a counter-offer.
> >
> > 1. Why is it important to save one keystroke, just
> >    to initiate repetition?
> >
> > What's important is to be able to repeat using a simple,
> > single keystroke.  But to initiate repetition it's not
> > important to use a single keystroke (IMO).
> 
> As I already said twice, it is important because otherwise you cannot
> change the prefix argument between two repetitions, which is a very
> useful (i[f] not necessary) feature for a repeat command.

Indeed, as you admit, that's _not_ a necessary feature
for a repeatable command.  And that use case is certainly
(IMO) no justification for dedicating a new default key
binding.  I don't consider it an "important" reason for
sacrificing a repeatable key by default.

Anyone, or any library, that _really_ needs, in some
particular case, to be able to optionally use a prefix
arg on _only some_ particular repetitions can do what's
needed for that.

This (for me) is about _not wasting keys_: not having
Emacs needlessly appropriate more keys for default
bindings.

If you dedicate a repeatable key such as `C-=' for a
NON-repeatable action such as this -- and INITIATING
repetition of the last command is a NON-repeatable
action -- you're wasting the chance for that key to
be used for a repeatable action.

The _much_ more common use case for a repeatable
command is to be able to use the same prefix arg
for each repetition - i.e., pass the prefix arg
at the beginning.

And that use case is satisfied, I assume, by your
definition using transient.  At least it should be.

It's satisfied currently by `C-x z':
`C-2 M-f C-x z z z...' moves forward two words at
each repetition.

If your definition of repeatable commands using
transient doesn't do that yet (I haven't checked)
it should.

And if for some reason it can't, that functionality
is easily provided for any non-repeatable command
by a repeatable-command-defining function such as this:

(defun my-repeat-command (command)
  "Repeat COMMAND."
  (require 'repeat)
  (let ((repeat-previous-repeated-command  command)
        (repeat-message-function           #'ignore)
        (last-repeatable-command           'repeat))
    (repeat nil)))

(defun foo (arg)
  (interactive "P")
  <whatever>
  ...)

;; Repeat `foo', passing it prefix-arg ARG.
(defun foo-repeatable (arg)
  (interactive "P")
  (my-repeat-command 'foo))

[The msg that started this thread used `set-transient-map'
to do the same kind of thing.  The original proposal, which
I applauded, was just to bind `C-x o' to a repeatable
version of `other-window', so `C-x o o o...'.]

> Another reason (mentioned by Sean Whitton) is that repeating with the
> last key of a keystroke leads to commands being called when what you want to
> do is to type the character.... [Y]ou have to remind that you need to
> quit the transient keymap with C-g before typing '{'.

Nah.
That's just pilot error - not being used to it yet.

That's no different from ending Isearch.  You type
{ thinking you'll insert { in the buffer.  But since
you're still isearching it's instead added to the
search string.

That's a minor gotcha that's easily, unconsciously,
learned and overcome.

> > 2. That said, for _specific commands_, which are
> >    already bound to keys, I think it's very helpful
> >    for some such commands to themselves be repeatable.
> 
> That requires a lot more changes: it is necessary to adapt each
> individual command, including user-defined commands, to make it repeatable.

I think I was clear that it's NOT either/or:

 * EITHER (1) provide a general key to repeat any action
   (which we already have with `C-x z', and which you
   want to put on a new single keystroke, e.g. `C-=')

 * OR (2) replace some non-repeatable commands currently
   bound to keys by repeatable versions of them.

You're trying to change my statement that, (1) when
useful for some particular commands, they can be made
repeatable and kept on their existing keys, into (2)
a supposed need to do that for all commands.

I'm not in favor of needlessly sacrificing more keys,
by default.  Not even one - for this.  `C-x z' is fine.
It's superior to `C-=' because it's not a repeatable
key (and `C-=' is).  And any particular repeatable
command that needs/merits a single keystroke can be
bound by anyone.

My point there was about non-repeatable commands
_already_ bound to repeatable keys.  It's a waste for
a key such as `C-e' to be bound to a non-repeatable
command - it could just as easily be bound to a
repeatable version of the same action.  That's all.

I'd much sooner just hold down Control and repeat `e'
(i.e., `C-e C-e...'), or even use `C-e C-x z z...',
than use either `C-e C-= C-= C-=...' (which I think
you proposed?) or `C-e C-= e e...'.

Replacing `C-x z' by `C-=' -- or by any other single
key -- gains nothing (AFAICS).  The act of initiating
repetition of the preceding action is NOT itself
a repeatable action.  That just wastes a repeatable
key, `C-=', for a non-repeatable action.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]