[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 08b4778890 033/366: Make it trivial to use "q
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 08b4778890 033/366: Make it trivial to use "q" to quit again |
Date: |
Tue, 25 Jan 2022 18:54:24 -0500 (EST) |
branch: externals/transient
commit 08b4778890e0b13c24a64a6737e6d6f8a14da9af
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Make it trivial to use "q" to quit again
Closes #18.
---
docs/transient.org | 8 ++++++--
docs/transient.texi | 10 ++++++++--
lisp/transient.el | 31 +++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/docs/transient.org b/docs/transient.org
index f18c9ad0da..1d468ca645 100644
--- a/docs/transient.org
+++ b/docs/transient.org
@@ -8,7 +8,7 @@
#+TEXINFO_DIR_CATEGORY: Emacs
#+TEXINFO_DIR_TITLE: Transient: (transient).
#+TEXINFO_DIR_DESC: Transient Commands
-#+SUBTITLE: for version 0.1.0 (v0.1.0-30-g2033ac1+1)
+#+SUBTITLE: for version 0.1.0 (v0.1.0-31-gf0213e0+1)
#+TEXINFO_DEFFN: t
#+OPTIONS: H:4 num:4 toc:2
@@ -37,7 +37,7 @@ Calling a suffix command usually causes the transient to be
exited
but suffix commands can also be configured to not exit the transient.
#+TEXINFO: @noindent
-This manual is for Transient version 0.1.0 (v0.1.0-30-g2033ac1+1).
+This manual is for Transient version 0.1.0 (v0.1.0-31-gf0213e0+1).
#+BEGIN_QUOTE
Copyright (C) 2018-2019 Jonas Bernoulli <jonas@bernoul.li>
@@ -219,6 +219,10 @@ the latter, then you can later resume the stack of
transients using
or else the current transient. When quitting the current transient,
then it returns to the previous transient, if any.
+Transient's predecessor bound ~q~ instead of ~C-g~ to the quit command.
+To learn how to get that binding back see ~transient-bind-q-to-quit~'s
+doc-string.
+
- Key: C-q, transient-quit-all
This command quits the currently active incomplete key sequence, if
diff --git a/docs/transient.texi b/docs/transient.texi
index 92d52414ea..7e68fcf043 100644
--- a/docs/transient.texi
+++ b/docs/transient.texi
@@ -31,7 +31,7 @@ General Public License for more details.
@finalout
@titlepage
@title Transient User and Developer Manual
-@subtitle for version 0.1.0 (v0.1.0-30-g2033ac1+1)
+@subtitle for version 0.1.0 (v0.1.0-31-gf0213e0+1)
@author Jonas Bernoulli
@page
@vskip 0pt plus 1filll
@@ -65,7 +65,7 @@ Calling a suffix command usually causes the transient to be
exited
but suffix commands can also be configured to not exit the transient.
@noindent
-This manual is for Transient version 0.1.0 (v0.1.0-30-g2033ac1+1).
+This manual is for Transient version 0.1.0 (v0.1.0-31-gf0213e0+1).
@quotation
Copyright (C) 2018-2019 Jonas Bernoulli <jonas@@bernoul.li>
@@ -337,7 +337,13 @@ the latter, then you can later resume the stack of
transients using
This key quits the currently active incomplete key sequence, if any,
or else the current transient. When quitting the current transient,
then it returns to the previous transient, if any.
+@end table
+
+Transient's predecessor bound @code{q} instead of @code{C-g} to the quit
command.
+To learn how to get that binding back see @code{transient-bind-q-to-quit}'s
+doc-string.
+@table @asis
@kindex C-q
@cindex transient-quit-all
@item @kbd{C-q} @tie{}@tie{}@tie{}@tie{}(@code{transient-quit-all})
diff --git a/lisp/transient.el b/lisp/transient.el
index 74958d2986..2304f56ac2 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2709,6 +2709,37 @@ resumes the suspended transient.")
(which-key-mode 1)
(remove-hook 'post-transient-hook 'transient--resume-which-key-mode)))
+(defun transient-bind-q-to-quit ()
+ "Modify some keymaps to bind \"q\" to the appropriate quit command.
+
+\"C-g\" is the default binding for such commands now, but Transient's
+predecessor Magit-Popup used \"q\" instead. If you would like to get
+that binding back, then call this function in your init file like so:
+
+ (with-eval-after-load \\='transient
+ (transient-bind-q-to-quit))
+
+Individual transients may already bind \"q\" to something else
+and such a binding would shadow the quit binding. If that is the
+case then \"Q\" is bound to whatever \"q\" would have been bound
+to by setting `transient-substitute-key-function' to a function
+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-sticky-map "q" 'transient-quit-seq)
+ (setq transient-substitute-key-function
+ 'transient-rebind-quit-commands))
+
+(defun transient-rebind-quit-commands (obj)
+ "See `transient-bind-q-to-quit'."
+ (let ((key (oref obj key)))
+ (cond ((string-equal key "q") "Q")
+ ((string-equal key "Q") "M-q")
+ (t key))))
+
;;; Font-Lock
(defconst transient-font-lock-keywords
- [elpa] externals/transient a729bbba45 022/366: transient--ensure-infix-command: Avoid false-positives, (continued)
- [elpa] externals/transient a729bbba45 022/366: transient--ensure-infix-command: Avoid false-positives, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 6467626e4e 024/366: Stop talking about the "echo area", Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 1ffd0ba498 071/366: transient--original-buffer: Renamed from transient--source-buffer, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 892bc840c0 072/366: transient--original-buffer: Set globally, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient fa3b7574bb 087/366: transient--layout-member: Use appropriate argument order, Jonas Bernoulli, 2022/01/25
- [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 <=
- [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, 2022/01/25
- [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