[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 7a7c3e15b6 065/366: transient-show-popup: Sup
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 7a7c3e15b6 065/366: transient-show-popup: Support even suppressing one-line summary |
Date: |
Tue, 25 Jan 2022 18:54:27 -0500 (EST) |
branch: externals/transient
commit 7a7c3e15b6da6fb53b1af1a5e5eea06418f48a5f
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient-show-popup: Support even suppressing one-line summary
This still displays the key that invoked the transient prefix command
because otherwise there would be absolutely nothing that indicates
that we are in some transient state. This is similar to how typing
an incomplete key sequence (e.g. "C-x") causes that to be displayed.
Closes #41.
---
lisp/transient.el | 77 ++++++++++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 32 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 10287720f2..eda0ee82c5 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -71,15 +71,25 @@
(defcustom transient-show-popup t
"Whether to show the current transient in a popup buffer.
-If t, then show the popup as soon as a transient command is
-invoked. If nil, then do not show the popup unless the user
-explicitly requests it, by pressing the prefix \"C-x\". If a
-number, then show the popup after this many seconds of inactivity
-or when the user explicitly requests it."
+- If t, then show the popup as soon as a transient command is
+ invoked.
+
+- If nil, then do not show the popup unless the user explicitly
+ requests it, by pressing an incomplete prefix key sequence.
+
+- If a number, then delay displaying the popup and instead show
+ a brief one-line summary. If zero or negative, then suppress
+ even showing that summary and display the pressed key only.
+
+ Show the when the user explicitly requests it by pressing an
+ incomplete prefix key sequence. Unless zero, then also show
+ the popup after that many seconds of inactivity (using the
+ absolute value)."
:package-version '(transient . "0.1.0")
:group 'transient
:type '(choice (const :tag "instantly" t)
(const :tag "on demand" nil)
+ (const :tag "on demand (no summary)" 0)
(number :tag "after delay" 1)))
(defcustom transient-display-buffer-action
@@ -1635,13 +1645,14 @@ EDIT may be non-nil."
mwheel-scroll))
(transient--show))
(when (and (numberp transient-show-popup)
+ (not (zerop transient-show-popup))
(not transient--timer))
(transient--timer-start))
(transient--show-brief)))
(defun transient--timer-start ()
(setq transient--timer
- (run-at-time transient-show-popup nil
+ (run-at-time (abs transient-show-popup) nil
(lambda ()
(transient--timer-cancel)
(transient--show)))))
@@ -2321,32 +2332,34 @@ have a history of their own.")
(defun transient--show-brief ()
(let ((message-log-max nil))
- (message
- "%s- [%s] %s"
- (key-description (this-command-keys))
- (oref transient--prefix command)
- (mapconcat
- #'identity
- (sort
- (cl-mapcan
- (lambda (suffix)
- (let ((key (kbd (oref suffix key))))
- ;; Don't list any common commands.
- (and (not (memq (oref suffix command)
- `(,(lookup-key transient-map key)
- ,(lookup-key transient-sticky-map key)
- ;; From transient-common-commands:
- transient-set
- transient-save
- transient-history-prev
- transient-history-next
- transient-quit-one
- transient-toggle-common
- transient-set-level)))
- (list (propertize (oref suffix key) 'face 'transient-key)))))
- transient--suffixes)
- #'string<)
- (propertize "|" 'face 'transient-unreachable-key)))))
+ (if (and transient-show-popup (<= transient-show-popup 0))
+ (message "%s-" (key-description (this-command-keys)))
+ (message
+ "%s- [%s] %s"
+ (key-description (this-command-keys))
+ (oref transient--prefix command)
+ (mapconcat
+ #'identity
+ (sort
+ (cl-mapcan
+ (lambda (suffix)
+ (let ((key (kbd (oref suffix key))))
+ ;; Don't list any common commands.
+ (and (not (memq (oref suffix command)
+ `(,(lookup-key transient-map key)
+ ,(lookup-key transient-sticky-map key)
+ ;; From transient-common-commands:
+ transient-set
+ transient-save
+ transient-history-prev
+ transient-history-next
+ transient-quit-one
+ transient-toggle-common
+ transient-set-level)))
+ (list (propertize (oref suffix key) 'face
'transient-key)))))
+ transient--suffixes)
+ #'string<)
+ (propertize "|" 'face 'transient-unreachable-key))))))
(defun transient--show ()
(transient--timer-cancel)
- [elpa] externals/transient a2222d294c 038/366: transient-base-map: New parent of other shared keymaps, (continued)
- [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
- [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 <=
- [elpa] externals/transient d7a1e81440 067/366: transient-show-popup: Update documentation, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 5a360bb206 090/366: Remove conflicting suffix when inserting new suffix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4ce1868e62 091/366: Fix replacing a suffix with another suffix bound to same key, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 52fb9a6c07 093/366: transient--insert-suffix: Cosmetics, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4adc28538b 069/366: transient--window: Unset when exiting transient, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient af8d725d26 073/366: transient--original-window: New variable, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4ef8229feb 082/366: transient--buffer-name: New variable, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9fb3f797f1 103/366: Regenerate manual, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 7b62e01e72 064/366: transient-show-popup: Also show the key that invoked the prefix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient c7ad1f01f4 080/366: transient--delete-window: Protect against misconfiguration, Jonas Bernoulli, 2022/01/25