[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hydra 3846e2728f 32/46: hydra.el (hydra-interpose): Ext
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hydra 3846e2728f 32/46: hydra.el (hydra-interpose): Extract |
Date: |
Tue, 25 Oct 2022 22:27:22 -0400 (EDT) |
branch: externals/hydra
commit 3846e2728f2a7bffa1b1116479426b2ab3c40a28
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
hydra.el (hydra-interpose): Extract
---
hydra.el | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/hydra.el b/hydra.el
index b1d4bd52b9..61f92ec2f4 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1103,17 +1103,28 @@ representing the maximum dimension of their owning
group.
decorated-heads) res)))
(nreverse res))))
+(defun hydra-interpose (x lst)
+ "Insert X in between each element of LST."
+ (let (res y)
+ (while (setq y (pop lst))
+ (push y res)
+ (push x res))
+ (nreverse (cdr res))))
+
(defun hydra--hint-row (heads body)
- (replace-regexp-in-string
- "\s+$" ""
- (mapconcat (lambda (head)
- (funcall hydra-key-doc-function
- (hydra-fontify-head head body) ;; key
- (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 "| ")))
+ (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))))
(defun hydra--hint-from-matrix (body heads-matrix)
"Generate a formated table-style docstring according to BODY and
HEADS-MATRIX.
- [elpa] externals/hydra 87cc74b264 17/46: hydra.el (hydra--format): Make no docstring equivalent to :hint nil, (continued)
- [elpa] externals/hydra 87cc74b264 17/46: hydra.el (hydra--format): Make no docstring equivalent to :hint nil, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra cf96140079 12/46: hydra-test.el: Regenerate tests for the last commit, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra c30e04d3f6 19/46: lv.el (lv-window): Turn off display-line-numbers, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 67098cc914 22/46: hydra.el (hydra--format): Add extra newline, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra ffff068d7f 23/46: Update readme.md, add repo name and melpa badges, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 05871dd6c8 26/46: hydra.el (defhydra): Document the :column feature, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 425f20e7ed 27/46: README.md: Link to :column code, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 67e454bf10 29/46: hydra.el (defhydra+): Update indent spec, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 1e423933a9 30/46: hydra.el: sexp hints are now supported for :columns, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 16563fbc4c 31/46: hydra.el (hydra--hint-row): Extract, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 3846e2728f 32/46: hydra.el (hydra-interpose): Extract,
Stefan Monnier <=
- [elpa] externals/hydra 38a567fc5b 36/46: hydra.el (hydra--hint-from-matrix): Return a list, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 9c4a4711bc 38/46: hydra.el (hydra-key-doc-function-default): Accept also sexp as doc, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra e0e3282efa 39/46: hydra.el (hydra-hint-display-type): Add, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 6842731f08 43/46: hydra.el (hydra-lv): Declare obsolete, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 7081ee6d44 46/46: Merge commit 'f27fce1b2f0a9162e159557bdeb2c0c94defb4d2' into externals/hydra, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra f27fce1b2f 45/46: hydra.el: Bump version, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra aa55bbd196 37/46: hydra.el (hydra--hint-from-matrix): Don't wrap with concat, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra d96180865c 40/46: hydra.el (hydra-hint-display-alist): Add, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 480ae63137 42/46: Declare dependency on separate lv package, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra acb69859f3 44/46: hydra-test.el: Update tests for the last commit, Stefan Monnier, 2022/10/25