From cd8dc95cb66cf5d0dc3cc49d7593bce24ab36a15 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Thu, 2 Nov 2023 12:51:42 +0100 Subject: [PATCH] [maybe] transient--column-max-width: New function --- lisp/transient.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index ebdaf4cb..d76babc4 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -3570,15 +3570,8 @@ have a history of their own.") (insert ?\n))))) (cl-defmethod transient--insert-group ((group transient-columns)) - (let* ((columns - (mapcar - (lambda (column) - (transient--maybe-pad-keys column group) - (let ((rows (mapcar #'transient-format (oref column suffixes)))) - (when-let ((desc (transient-format-description column))) - (push desc rows)) - (flatten-tree rows))) - (oref group suffixes))) + (let* ((columns (mapcar #'transient--column-max-width + (oref group suffixes))) (vp (or (oref transient--prefix variable-pitch) transient-align-variable-pitch)) (rs (apply #'max (mapcar #'length columns))) @@ -3617,6 +3610,13 @@ have a history of their own.") (when (= c (1- cs)) (insert ?\n)))))))) +(defun transient--column-max-width (column &optional parent) + (transient--maybe-pad-keys column group) + (let ((rows (mapcar #'transient-format (oref column suffixes)))) + (when-let ((desc (transient-format-description column))) + (push desc rows)) + (flatten-tree rows))) + (cl-defmethod transient--insert-group ((group transient-subgroups)) (let* ((subgroups (oref group suffixes)) (n (length subgroups)))