branch: externals/hydra commit b7279c7c1957afe1e562b30e36672ff4d1cf772a Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@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.