all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Repeat undo-only is not working
       [not found] <20210823131240.rxfepbz4q2buo733.ref@Ergus>
@ 2021-08-23 13:12 ` Ergus
  2021-08-23 13:52   ` Fu Yuan
  2021-08-23 16:06   ` Juri Linkov
  0 siblings, 2 replies; 7+ messages in thread
From: Ergus @ 2021-08-23 13:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

Hi Juri:

I have this config:

```
(global-set-key (kbd "C-/") #'undo-only)
(global-set-key (kbd "C-M-/") #'undo-redo)

(with-eval-after-load 'repeat
   (defvar undo-redo-repeat-map
     (let ((map (make-sparse-keymap)))
       (define-key map "/" #'undo-only)
       (define-key map "M-/" #'undo-redo)
       (define-key map "U" #'undo)
       map)
     "Keymap to repeat undo-redo key sequences.  Used in `repeat-mode'.")
   (put 'undo-only 'repeat-map 'undo-redo-repeat-map)
   (put 'undo-redo 'repeat-map 'undo-redo-repeat-map)
   (put 'undo 'repeat-map 'undo-redo-repeat-map))
```

And for some reason the repeat map does not activates with "undo-only"
(it doesn't even shows the message in the minibuffer) but with "undo"
and "undo-redo" it works as expected. Is there anything special in
"undo-only" that disables repeat-mode?



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

* Re: Repeat undo-only is not working
  2021-08-23 13:12 ` Repeat undo-only is not working Ergus
@ 2021-08-23 13:52   ` Fu Yuan
  2021-08-23 16:06   ` Juri Linkov
  1 sibling, 0 replies; 7+ messages in thread
From: Fu Yuan @ 2021-08-23 13:52 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel, Juri Linkov


> 在 2021年8月23日,上午6:17,Ergus <spacibba@aol.com> 写道:
> 
> Hi Juri:
> 
> I have this config:
> 
> ```
> (global-set-key (kbd "C-/") #'undo-only)
> (global-set-key (kbd "C-M-/") #'undo-redo)
> 
> (with-eval-after-load 'repeat
>  (defvar undo-redo-repeat-map
>    (let ((map (make-sparse-keymap)))
>      (define-key map "/" #'undo-only)
>      (define-key map "M-/" #'undo-redo)
>      (define-key map "U" #'undo)
>      map)
>    "Keymap to repeat undo-redo key sequences.  Used in `repeat-mode'.")
>  (put 'undo-only 'repeat-map 'undo-redo-repeat-map)
>  (put 'undo-redo 'repeat-map 'undo-redo-repeat-map)
>  (put 'undo 'repeat-map 'undo-redo-repeat-map))
> ```
> 
> And for some reason the repeat map does not activates with "undo-only"
> (it doesn't even shows the message in the minibuffer) but with "undo"
> and "undo-redo" it works as expected. Is there anything special in
> "undo-only" that disables repeat-mode?
> 

Maybe because undo-only sets this-command to undo?

Yuan


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

* Re: Repeat undo-only is not working
  2021-08-23 13:12 ` Repeat undo-only is not working Ergus
  2021-08-23 13:52   ` Fu Yuan
@ 2021-08-23 16:06   ` Juri Linkov
  2021-08-23 20:30     ` Ergus
  2021-08-23 20:50     ` Jim Porter
  1 sibling, 2 replies; 7+ messages in thread
From: Juri Linkov @ 2021-08-23 16:06 UTC (permalink / raw)
  To: Ergus; +Cc: emacs-devel

> ```
> (global-set-key (kbd "C-/") #'undo-only)
> (global-set-key (kbd "C-M-/") #'undo-redo)
>
> (with-eval-after-load 'repeat
>   (defvar undo-redo-repeat-map
>     (let ((map (make-sparse-keymap)))
>       (define-key map "/" #'undo-only)
>       (define-key map "M-/" #'undo-redo)

BTW, a typo here: (kbd "M-/") is missing.

>       (define-key map "U" #'undo)
>       map)
>     "Keymap to repeat undo-redo key sequences.  Used in `repeat-mode'.")
>   (put 'undo-only 'repeat-map 'undo-redo-repeat-map)
>   (put 'undo-redo 'repeat-map 'undo-redo-repeat-map)
>   (put 'undo 'repeat-map 'undo-redo-repeat-map))
> ```
>
> And for some reason the repeat map does not activates with "undo-only"
> (it doesn't even shows the message in the minibuffer) but with "undo"
> and "undo-redo" it works as expected. Is there anything special in
> "undo-only" that disables repeat-mode?

Sorry, this part of the feature is still unpolished.
The intention was to disallow repeating of undo with
the key sequence `C-/ u', but allow only with `C-x u u'.
Maybe this was a wrong idea?  Do you think it should be
possible to type `C-/' to initiate the repeating sequence
`C-/ u u u'?



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

* Re: Repeat undo-only is not working
  2021-08-23 16:06   ` Juri Linkov
@ 2021-08-23 20:30     ` Ergus
  2021-08-23 20:50     ` Jim Porter
  1 sibling, 0 replies; 7+ messages in thread
From: Ergus @ 2021-08-23 20:30 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

On Mon, Aug 23, 2021 at 07:06:01PM +0300, Juri Linkov wrote:
>
>Sorry, this part of the feature is still unpolished.
>The intention was to disallow repeating of undo with
>the key sequence `C-/ u', but allow only with `C-x u u'.
>Maybe this was a wrong idea?  Do you think it should be
>possible to type `C-/' to initiate the repeating sequence
>`C-/ u u u'?
>
The point is that in this case it is useful for doing things like:

C-/ u u u r r

So not only to start the sequence, but to call other commands in the map
that maybe don't need a binding in the global map (undo-redo,
winner-redo, avy-prev and some other tricks)




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

* Re: Repeat undo-only is not working
  2021-08-23 16:06   ` Juri Linkov
  2021-08-23 20:30     ` Ergus
@ 2021-08-23 20:50     ` Jim Porter
  2021-08-24  6:40       ` Juri Linkov
  1 sibling, 1 reply; 7+ messages in thread
From: Jim Porter @ 2021-08-23 20:50 UTC (permalink / raw)
  To: Juri Linkov, Ergus; +Cc: emacs-devel

On 8/23/2021 9:06 AM, Juri Linkov wrote:
> Sorry, this part of the feature is still unpolished.
> The intention was to disallow repeating of undo with
> the key sequence `C-/ u', but allow only with `C-x u u'.
> Maybe this was a wrong idea?  Do you think it should be
> possible to type `C-/' to initiate the repeating sequence
> `C-/ u u u'?

For what it's worth, the intention matches my personal expectation. I'd 
be pretty surprised if a key sequence with a single input event (e.g. 
`C-/') activated a repeat-mode map. My mental model is that repeat-mode 
"saves" all but the last input event of a key sequence and then uses it 
as a prefix to the subsequently-pressed keys.

Perhaps it should be possible to support the behavior in the original 
post, but I'm happy with how things are now.

- Jim



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

* Re: Repeat undo-only is not working
  2021-08-23 20:50     ` Jim Porter
@ 2021-08-24  6:40       ` Juri Linkov
  2021-08-24 16:36         ` Jim Porter
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2021-08-24  6:40 UTC (permalink / raw)
  To: Jim Porter; +Cc: Ergus, emacs-devel

>> Sorry, this part of the feature is still unpolished.
>> The intention was to disallow repeating of undo with
>> the key sequence `C-/ u', but allow only with `C-x u u'.
>> Maybe this was a wrong idea?  Do you think it should be
>> possible to type `C-/' to initiate the repeating sequence
>> `C-/ u u u'?
>
> For what it's worth, the intention matches my personal expectation. I'd be
> pretty surprised if a key sequence with a single input event (e.g. `C-/')
> activated a repeat-mode map. My mental model is that repeat-mode "saves"
> all but the last input event of a key sequence and then uses it as a prefix
> to the subsequently-pressed keys.
>
> Perhaps it should be possible to support the behavior in the original post,
> but I'm happy with how things are now.

So there is a need to distinguish between these cases

  C-/ --- u u u
  C-x u --- u u

("---" visually separates the initial and repeating sequence)
and allow their customization.  Maybe a new variable is sufficient
that will inhibit checking that the last character exists in repeat-map.

But what to do if the user wants to disable C-/ --- u u u,
but still wants to use for gdb-step such sequence
C-x C-a C-n --- n n n n where repeat-map has no C-n?



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

* Re: Repeat undo-only is not working
  2021-08-24  6:40       ` Juri Linkov
@ 2021-08-24 16:36         ` Jim Porter
  0 siblings, 0 replies; 7+ messages in thread
From: Jim Porter @ 2021-08-24 16:36 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Ergus, emacs-devel

On 8/23/2021 11:40 PM, Juri Linkov wrote:
>>> Sorry, this part of the feature is still unpolished.
>>> The intention was to disallow repeating of undo with
>>> the key sequence `C-/ u', but allow only with `C-x u u'.
>>> Maybe this was a wrong idea?  Do you think it should be
>>> possible to type `C-/' to initiate the repeating sequence
>>> `C-/ u u u'?
>>
>> For what it's worth, the intention matches my personal expectation. [snip]
>>
>> Perhaps it should be possible to support the behavior in the original post,
>> but I'm happy with how things are now.
> 
> So there is a need to distinguish between these cases
> 
>    C-/ --- u u u
>    C-x u --- u u
> 
> ("---" visually separates the initial and repeating sequence)
> and allow their customization.  Maybe a new variable is sufficient
> that will inhibit checking that the last character exists in repeat-map.
> 
> But what to do if the user wants to disable C-/ --- u u u,
> but still wants to use for gdb-step such sequence
> C-x C-a C-n --- n n n n where repeat-map has no C-n?

If there were a flag like `repeat-enable-aggressively' to enable things 
like C-/ --- u u u, then would it be possible to let a user who doesn't 
want C-/ --- u u u but *does* want C-x C-a C-n --- n n n to set that 
flag to nil and then call some function in their .emacs for each "extra" 
sequence in the repeat-map they want to enable? Another option would be 
to set `repeat-enable-aggressively' to t and then *remove* any repeat 
mappings the user doesn't like.

I haven't looked at the implementation, so I'm not sure if either of 
those options are feasible, but they'd give users plenty of flexibility 
if they really wanted it.

That said, I'd probably be happy with setting 
`repeat-enable-aggressively' to nil in my config and not worrying about 
overriding any specific cases.

- Jim



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

end of thread, other threads:[~2021-08-24 16:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20210823131240.rxfepbz4q2buo733.ref@Ergus>
2021-08-23 13:12 ` Repeat undo-only is not working Ergus
2021-08-23 13:52   ` Fu Yuan
2021-08-23 16:06   ` Juri Linkov
2021-08-23 20:30     ` Ergus
2021-08-23 20:50     ` Jim Porter
2021-08-24  6:40       ` Juri Linkov
2021-08-24 16:36         ` Jim Porter

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.