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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/transient 293a437d66 206/366: Support padding of keys r


From: Jonas Bernoulli
Subject: [elpa] externals/transient 293a437d66 206/366: Support padding of keys regardless of the group's class
Date: Tue, 25 Jan 2022 18:54:41 -0500 (EST)

branch: externals/transient
commit 293a437d6655b985c0aeef6fabc7dd6345495cc4
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Support padding of keys regardless of the group's class
---
 docs/transient.org  |  9 ++++-----
 docs/transient.texi |  9 ++++-----
 lisp/transient.el   | 18 ++++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/docs/transient.org b/docs/transient.org
index da7b344f66..399f548cf0 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.2.0 (v0.2.0-53-ge2fee198+1)
+#+SUBTITLE: for version 0.2.0 (v0.2.0-54-gd76f73f8+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.2.0 (v0.2.0-53-ge2fee198+1).
+This manual is for Transient version 0.2.0 (v0.2.0-54-gd76f73f8+1).
 
 #+BEGIN_QUOTE
 Copyright (C) 2018-2020 Jonas Bernoulli <jonas@bernoul.li>
@@ -842,9 +842,8 @@ constructor of that class.
   changes to the children including constructing new children from
   scratch.  Also see ~transient-setup-children~.
 
-- The constructors of ~transient-column~ and ~transient-columns~ accept an
-  additional keyword argument ~:pad-keys~.  If non-nil, then keys of all
-  contained suffixes are right padded, effectively aligning the
+- The boolean ~:pad-keys~ argument controls whether keys of all suffixes
+  contained in a group are right padded, effectively aligning the
   descriptions.
 
 The ELEMENTs are either all subgroups (vectors), or all suffixes
diff --git a/docs/transient.texi b/docs/transient.texi
index e52637b2fe..6f95a4a79a 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.2.0 (v0.2.0-53-ge2fee198+1)
+@subtitle for version 0.2.0 (v0.2.0-54-gd76f73f8+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.2.0 (v0.2.0-53-ge2fee198+1).
+This manual is for Transient version 0.2.0 (v0.2.0-54-gd76f73f8+1).
 
 @quotation
 Copyright (C) 2018-2020 Jonas Bernoulli <jonas@@bernoul.li>
@@ -1078,9 +1078,8 @@ scratch.  Also see @code{transient-setup-children}.
 
 
 @item
-The constructors of @code{transient-column} and @code{transient-columns} 
accept an
-additional keyword argument @code{:pad-keys}.  If non-nil, then keys of all
-contained suffixes are right padded, effectively aligning the
+The boolean @code{:pad-keys} argument controls whether keys of all suffixes
+contained in a group are right padded, effectively aligning the
 descriptions.
 @end itemize
 
diff --git a/lisp/transient.el b/lisp/transient.el
index 87dfe62496..fe348a641a 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -695,19 +695,18 @@ They become the value of this this argument.")
   ((suffixes       :initarg :suffixes       :initform nil)
    (hide           :initarg :hide           :initform nil)
    (description    :initarg :description    :initform nil)
-   (setup-children :initarg :setup-children))
+   (setup-children :initarg :setup-children)
+   (pad-keys       :initarg :pad-keys))
   "Abstract superclass of all group classes."
   :abstract t)
 
-(defclass transient-column (transient-group)
-  ((pad-keys :initarg :pad-keys))
+(defclass transient-column (transient-group) ()
   "Group class that displays each element on a separate line.")
 
 (defclass transient-row (transient-group) ()
   "Group class that displays all elements on a single line.")
 
-(defclass transient-columns (transient-group)
-  ((pad-keys :initarg :pad-keys))
+(defclass transient-columns (transient-group) ()
   "Group class that displays elements organized in columns.
 Direct elements have to be groups whose elements have to be
 commands or string.  Each subgroup represents a column.  This
@@ -2834,6 +2833,7 @@ have a history of their own.")
     (insert desc ?\n)))
 
 (cl-defmethod transient--insert-group ((group transient-row))
+  (transient--maybe-pad-keys group)
   (dolist (suffix (oref group suffixes))
     (insert (transient-format suffix))
     (insert "   "))
@@ -2874,9 +2874,11 @@ have a history of their own.")
   (let* ((subgroups (oref group suffixes))
          (n (length subgroups)))
     (dotimes (s n)
-      (transient--insert-group (nth s subgroups))
-      (when (< s (1- n))
-        (insert ?\n)))))
+      (let ((subgroup (nth s subgroups)))
+        (transient--maybe-pad-keys subgroup group)
+        (transient--insert-group subgroup)
+        (when (< s (1- n))
+          (insert ?\n))))))
 
 (cl-defgeneric transient-format (obj)
   "Format and return OBJ for display.



reply via email to

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