[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient a2222d294c 038/366: transient-base-map: New p
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient a2222d294c 038/366: transient-base-map: New parent of other shared keymaps |
Date: |
Tue, 25 Jan 2022 18:54:24 -0500 (EST) |
branch: externals/transient
commit a2222d294c24ef587ff5538b7e6251ec67c9fab4
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient-base-map: New parent of other shared keymaps
---
docs/CHANGELOG | 5 +++++
lisp/transient.el | 56 +++++++++++++++++++++++++++----------------------------
2 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 55ef46891b..611ab24b1c 100644
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -18,6 +18,11 @@
it necessary to find a new binding for ~transient-show~, which ~C-t~ is
bound to now. #17
+- A new keymap, ~transient-base-map~ was added to make it easier to
+ change key bindings that are shared between all transients. This
+ new keymap is used as the parent of all the other keymaps that are
+ shared between all transients.
+
- The window that was selected before the transient window was shown
is no longer re-selected before calling a suffix that exits the
transient. If a suffix changes the selected window unintentionally,
diff --git a/lisp/transient.el b/lisp/transient.el
index f8449ea8ed..48475a382d 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1095,8 +1095,32 @@ but unfortunately that does not exist (yet?)."
;;; Keymaps
+(defvar transient-base-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "ESC ESC ESC") 'transient-quit-all)
+ (define-key map (kbd "C-g") 'transient-quit-one)
+ (define-key map (kbd "C-q") 'transient-quit-all)
+ (define-key map (kbd "C-z") 'transient-suspend)
+ (define-key map (kbd "C-v") 'transient-scroll-up)
+ (define-key map (kbd "M-v") 'transient-scroll-down)
+ (define-key map [next] 'transient-scroll-up)
+ (define-key map [prior] 'transient-scroll-down)
+ map)
+ "Parent of other keymaps used by Transient.
+
+This is the parent keymap of all the keymaps that are used in
+all transients: `transient-map' (which in turn is the parent
+of the transient-specific keymaps), `transient-edit-map' and
+`transient-sticky-map'.
+
+If you change a binding here, then you might also have to edit
+`transient-sticky-map' and `transient-common-commands'. While
+the latter isn't a proper transient prefix command, it can be
+edited using the same functions as used for transients.")
+
(defvar transient-map
(let ((map (make-sparse-keymap)))
+ (set-keymap-parent map transient-base-map)
(define-key map (kbd "C-p") 'universal-argument)
(define-key map (kbd "C--") 'negative-argument)
(define-key map (kbd "C-t") 'transient-show)
@@ -1104,45 +1128,22 @@ but unfortunately that does not exist (yet?)."
(define-key map (kbd "C-h") 'transient-help)
(define-key map (kbd "M-p") 'transient-history-prev)
(define-key map (kbd "M-n") 'transient-history-next)
- ;; While setting suffix levels `transient-common-commands'
- ;; isn't used, making this duplication necessary.
- (define-key map (kbd "C-g") 'transient-quit-one)
- (define-key map (kbd "C-q") 'transient-quit-all)
- (define-key map (kbd "C-z") 'transient-suspend)
- (define-key map (kbd "ESC ESC ESC") 'transient-quit-all)
- (define-key map (kbd "C-v") 'transient-scroll-up)
- (define-key map (kbd "M-v") 'transient-scroll-down)
- (define-key map [next] 'transient-scroll-up)
- (define-key map [prior] 'transient-scroll-down)
map)
- "Base keymap used by all transients.")
+ "Top-level keymap used by all transients.")
(defvar transient-edit-map
(let ((map (make-sparse-keymap)))
+ (set-keymap-parent map transient-base-map)
(define-key map (kbd "?") 'transient-help)
(define-key map (kbd "C-h") 'transient-help)
(define-key map (kbd "C-x l") 'transient-set-level)
- (define-key map (kbd "C-g") 'transient-quit-one)
- (define-key map (kbd "C-q") 'transient-quit-all)
- (define-key map (kbd "C-z") 'transient-suspend)
- (define-key map (kbd "ESC ESC ESC") 'transient-quit-all)
- (define-key map (kbd "C-v") 'transient-scroll-up)
- (define-key map (kbd "M-v") 'transient-scroll-down)
- (define-key map [next] 'transient-scroll-up)
- (define-key map [prior] 'transient-scroll-down)
map)
"Keymap that is active while a transient in is in \"edit mode\".")
(defvar transient-sticky-map
(let ((map (make-sparse-keymap)))
+ (set-keymap-parent map transient-base-map)
(define-key map (kbd "C-g") 'transient-quit-seq)
- (define-key map (kbd "C-q") 'transient-quit-all)
- (define-key map (kbd "C-z") 'transient-suspend)
- (define-key map (kbd "ESC ESC ESC") 'transient-quit-all)
- (define-key map (kbd "C-v") 'transient-scroll-up)
- (define-key map (kbd "M-v") 'transient-scroll-down)
- (define-key map [next] 'transient-scroll-up)
- (define-key map [prior] 'transient-scroll-down)
map)
"Keymap that is active while an incomplete key sequence is active.")
@@ -2733,8 +2734,7 @@ that does that. Of course \"Q\" may already be bound to
something
else, so that function binds \"M-q\" to that command instead.
Of course \"M-q\" may already be bound to something else, but
we stop there."
- (define-key transient-map "q" 'transient-quit-one)
- (define-key transient-edit-map "q" 'transient-quit-one)
+ (define-key transient-base-map "q" 'transient-quit-one)
(define-key transient-sticky-map "q" 'transient-quit-seq)
(setq transient-substitute-key-function
'transient-rebind-quit-commands))
- [elpa] externals/transient 20c231e0ec 089/366: transient--layout-member-1: Refactor, (continued)
- [elpa] externals/transient 20c231e0ec 089/366: transient--layout-member-1: Refactor, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient cac657a03e 092/366: Support inserting/removing groups and doing it using coordinates, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 6236a4fd38 019/366: Bind ESC ESC ESC in all maps, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient e889030b0f 027/366: Quote a parenthesis in a doc-string, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2033ac1ed9 031/366: transient-mode-line-format: New option, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 08b4778890 033/366: Make it trivial to use "q" to quit again, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9429cb628a 035/366: transient-scroll-down: Fix pasto, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 7e45a57ec8 030/366: No longer depend on lv to display the transient buffer, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 625683c9ea 029/366: transient--pre-exit: Don't reselect original window, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a2dada29c8 034/366: manual: Add a FAQ, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a2222d294c 038/366: transient-base-map: New parent of other shared keymaps,
Jonas Bernoulli <=
- [elpa] externals/transient b1da0cab5d 040/366: Remove my personal key bindings, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient bbf81297c6 041/366: Prevent infix commands from being added to command-history, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a6295fa7ee 042/366: Declare that prefix and suffix commands are for interactive use only, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2872b4a661 045/366: transient-init-value: Define for transient-prefix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a47ae9499b 049/366: transient-{set, save}: Support exiting the transient, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9e30038d2d 051/366: transient-set-level: Limit when it is called, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 544b3bb864 057/366: Support automatically disabling incompatible arguments, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 28aac32e82 058/366: Fix previous commit, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4f7ee36899 060/366: transient-infix-set: Bugfixes, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 7a7c3e15b6 065/366: transient-show-popup: Support even suppressing one-line summary, Jonas Bernoulli, 2022/01/25