emacs-elpa-diffs
[Top][All Lists]
Advanced

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]