unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Paul Nelson <ultrono@gmail.com>
Cc: 74140@debbugs.gnu.org
Subject: bug#74140: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package
Date: Mon, 04 Nov 2024 21:22:29 +0200	[thread overview]
Message-ID: <87ldxy953e.fsf@mail.linkov.net> (raw)
In-Reply-To: <CAOA-32N1jNHDemBX=tz0GFnUs4X_WB9msCptNE-eKV2ng4wi6A@mail.gmail.com> (Paul Nelson's message of "Fri, 1 Nov 2024 09:58:07 +0100")

>> > > With this patch, the available directives are:
>> > > :continue (default) - activates and continues
>> > > :exit - neither activates nor continues
>> > > :continue-only (new) - continues, but does not activate
>> >
>> > How does this map to the properties ':enter' and ':exit' of 'defvar-keymap'?
>>
>> :exit has the same meaning in both.
>>
>> In defvar-keymap, :enter means "activate, but do not continue".
>
> Another difference is that :enter from defvar-keymap does not actually
> bind a key in the keymap, thus:
>
>                   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.

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.

Then bind-keys could put such new properties
from the definition like 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)

Do you think such a symbol property would cover all possible uses?





  reply	other threads:[~2024-11-04 19:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 17:36 bug#74140: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package Paul Nelson
2024-11-01  7:54 ` Juri Linkov
2024-11-01  8:29   ` Paul Nelson
2024-11-01  8:58     ` Paul Nelson
2024-11-04 19:22       ` Juri Linkov [this message]
2024-11-04 20:45         ` Paul Nelson
2024-11-05 18:25           ` Juri Linkov
2024-11-05 20:51             ` Paul Nelson
2024-11-07 19:41               ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ldxy953e.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=74140@debbugs.gnu.org \
    --cc=ultrono@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).