unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74140: [PATCH] Add :continue-only directive for repeat maps in bind-keys, use-package
@ 2024-10-31 17:36 Paul Nelson
  2024-11-01  7:54 ` Juri Linkov
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Nelson @ 2024-10-31 17:36 UTC (permalink / raw)
  To: 74140

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

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)))

[-- Attachment #2: 0001-Add-continue-only-directive-to-bind-keys-and-use-pac.patch --]
[-- Type: application/x-patch, Size: 5059 bytes --]

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

end of thread, other threads:[~2024-12-11 12:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
2024-11-23 18:44                 ` Paul Nelson
2024-11-27  7:46                   ` Juri Linkov
2024-11-27 15:19                     ` Paul Nelson
2024-11-28 19:12                       ` Juri Linkov
2024-12-03 18:12                         ` Juri Linkov
2024-12-03 18:18                           ` Paul Nelson
2024-12-04 12:08                           ` Eli Zaretskii
2024-12-04 17:29                             ` Juri Linkov
2024-12-11 12:27                               ` Paul Nelson

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).