GNU bug report logs - #74140
[PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package

Previous Next

Package: emacs;

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 74140 <at> debbugs.gnu.org
Subject: bug#74140: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package
Date: Mon, 4 Nov 2024 21:45:15 +0100
> >                   activate    continue     bind
> > :continue         yes         yes          yes
> > :continue-only    no          yes          yes
> > :exit             no          no           yes
> > :enter            yes         no           no
>
> Thanks, this table provides a clear overview.
>
> So bind-keys doesn't need :enter?  Ok.

I understand the purpose of bind-keys to be "bind keys to commands in
a keymap".  Since :enter doesn't bind a key, it doesn't fit in
bind-keys.

There is a missing fourth case ("yes, no, yes") describing a key bound
to a command in a repeat map which the command activates but the key
exits.  I haven't been imaginative enough to think of a good use case.
"Why does this command start a repeat sequence, but then terminate it
when I try to use it in that sequence?"

>
> Since defvar-keymap uses :continue by default,
> what is missing in defvar-keymap is :continue-only.
> For adding :continue-only to defvar-keymap
> I looked how you implemented it for bind-keys,
> and it seems making an alias doesn't look
> like a clean solution.
>
> I know that 'define-repeat-map' makes an alias as well.
> So some time ago I had one idea how such aliases
> could be avoided.  The solution would be to put
> a new property like this:
>
>   (put 'yank 'repeat-continue-keys '("y"))
>   (put 'undo 'repeat-continue-keys '("C-/"))
>
> Its semantics is that when such a property exists
> then repeat-mode will check if the last typed keys
> don't exist in this list, only then the repeat map
> should be activated.
>

I didn't quite follow.  If the repeat map is active and the user
presses "C-/", then repeat-mode will see that the key in question
exists in the repeat-continue-keys list, and so will not activate the
repeat map.  This is the opposite of the intended behavior.  Perhaps
I've misunderstood?


I think that in an ideal world, "repeat-map" would be a property of a
keybinding inside a keymap, rather than a command.  The alias-based
approach gives one approximation to that.

I guess one alias-free approach would be to introduce a
repeat-continue property describing keymaps that a command should
perpetuate, e.g.,

  (put 'yank 'repeat-continue '(paragraph-repeat-map))
  (put 'undo 'repeat-continue '(paragraph-repeat-map))

Anyway, is the idea that you'd like to see equivalent functionality in
defvar-keymap and/or to have both implementations avoid aliases?




This bug report was last modified 141 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.