GNU bug report logs -
#74140
[PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package
Previous Next
Reported by: Paul Nelson <ultrono <at> gmail.com>
Date: Thu, 31 Oct 2024 17:37:02 UTC
Severity: wishlist
Tags: patch
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> Keys will help to avoid aliases. In your example:
>>
>> :continue-only
>> ;; These commands will be available during paragraph manipulation
>> ;; but won't activate paragraph-repeat-map themselves
>> ("y" . yank)
>> ("C-/" . undo))
>>
>> to be able to not activate repeat-map on executing the command 'yank'
>> with the global keybinding such as 'C-y', we can check
>> that last-command-event is 'y'.
>
> My point was that the "C-/" here is the same in the repeat map and the
> global map, so we can't use it to distinguish the two.
Thanks for pointing out the case when the command is bound to the same key
globally and in the repeat map. So checking for a key can't help here.
Therefore, I implemented another solution in repeat.el. There is now
a new symbol property 'repeat-continue-only'. And a command with this
symbol property will not activate the repeat map, but will only continue
the already activated repeating sequence. This is implemented by
a simple change:
(when (and (repeat-check-map map)
(or (null (repeat--command-property 'repeat-continue-only))
was-in-progress))
Also I improved the existing tests to use more mnemonic keys:
a - Activate (enter),
c - Continue,
o - continue-Only (not activate),
q - Quit (exit)
Currently the test uses (put 'repeat-tests-call-o 'repeat-continue-only t)
but a new keyword ':continue-only' will be added to 'defvar-keymap'.
The same way you could try to use the new symbol property for 'bind-keys'.
I wrote a new test for 'bind-keys' in test/lisp/repeat-tests.el.
But the part for :continue-only is currently commented out.
BTW, while writing the 'bind-keys' test, I noticed there is no way
to specify a command that only activates, but not continues
(the same as :entry in 'defvar-keymap'). Is it true that 'bind-keys'
has no such keyword, so there is a need to do this explicitly with:
(put 'repeat-tests-bind-call-a 'repeat-map 'repeat-tests-bind-keys-repeat-map)
This bug report was last modified 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.