Subject: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package

From: Paul Nelson <[email-masked]>
Date: Thu, 31 Oct 2024 18:36:41 +0100

For a command and its key in a repeat map:
- "activate" means the command makes the repeat map active
- "continue" means pressing the key keeps the repeat map active

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

A similar feature has been available for many years in the package
https://tildegit.org/acdw/define-repeat-map.el.  The inclusion here
was motivated by the discussions at
https://github.com/jwiegley/use-package/issues/964 and
https://github.com/jwiegley/use-package/pull/974.

A basic example indicating why this might be useful:

(bind-keys
 :repeat-map paragraph-repeat-map
 :continue
 ("]" . forward-paragraph)
 ("}" . forward-paragraph)
 ("[" . backward-paragraph)
 ("{" . backward-paragraph)
 ("k" . kill-paragraph)
 :continue-only
 ;; These commands will be available during paragraph manipulation
 ;; but won't activate paragraph-repeat-map themselves
 ("y" . yank)
 ("C-/" . undo))

Or equivalently, with use-package:

(use-package emacs
  :ensure nil
  :bind
  (:repeat-map
   paragraph-repeat-map
   ("]" . forward-paragraph)
   ("}" . forward-paragraph)
   ("[" . backward-paragraph)
   ("{" . backward-paragraph)
   ("k" . kill-paragraph)
   :continue-only
   ;; These commands will be available during paragraph manipulation
   ;; but won't activate paragraph-repeat-map themselves
   ("y" . yank)
   ("C-/" . undo)))