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

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

[elpa] externals/hydra b7279c7c19 33/46: hydra.el (hydra--hint-row): Pre


From: Stefan Monnier
Subject: [elpa] externals/hydra b7279c7c19 33/46: hydra.el (hydra--hint-row): Prep to return list
Date: Tue, 25 Oct 2022 22:27:22 -0400 (EDT)

branch: externals/hydra
commit b7279c7c1957afe1e562b30e36672ff4d1cf772a
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    hydra.el (hydra--hint-row): Prep to return list
---
 hydra.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/hydra.el b/hydra.el
index 61f92ec2f4..521a65e7f4 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1112,19 +1112,21 @@ representing the maximum dimension of their owning 
group.
     (nreverse (cdr res))))
 
 (defun hydra--hint-row (heads body)
-  (let ((lst (hydra-interpose
-              "| "
-              (mapcar (lambda (head)
-                        (funcall hydra-key-doc-function
-                                 (hydra-fontify-head head body)
-                                 (let ((n (hydra--head-property head 
:max-key-len)))
-                                   (+ n (cl-count ?% (car head))))
-                                 (nth 2 head) ;; doc
-                                 (hydra--head-property head :max-doc-len)))
-                      heads))))
-    (replace-regexp-in-string
-     "\s+$" ""
-     (apply #'concat lst))))
+  (let* ((lst (hydra-interpose
+               "| "
+               (mapcar (lambda (head)
+                         (funcall hydra-key-doc-function
+                                  (hydra-fontify-head head body)
+                                  (let ((n (hydra--head-property head 
:max-key-len)))
+                                    (+ n (cl-count ?% (car head))))
+                                  (nth 2 head) ;; doc
+                                  (hydra--head-property head :max-doc-len)))
+                       heads)))
+         (len (length lst))
+         (new-last (replace-regexp-in-string "\s+$" "" (car (last lst)))))
+    (when (= 0 (length (setf (nth (- len 1) lst) new-last)))
+      (setf (nth (- len 2) lst) "|"))
+    (apply #'concat lst)))
 
 (defun hydra--hint-from-matrix (body heads-matrix)
   "Generate a formated table-style docstring according to BODY and 
HEADS-MATRIX.



reply via email to

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