[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2751f00 31/36: Remove trailing whitespace from :column doc
From: |
Oleh Krehel |
Subject: |
[elpa] master 2751f00 31/36: Remove trailing whitespace from :column docstring |
Date: |
Sat, 22 Jul 2017 11:22:25 -0400 (EDT) |
branch: master
commit 2751f00c2c3daa8cc00f0fee7d01c803ddde7bb2
Author: David AMAR <address@hidden>
Commit: David AMAR <address@hidden>
Remove trailing whitespace from :column docstring
Table doctrings generated from :column algorithm no longer have trailing
whitespace
Test hydra-column-1 modified accordingly
Trimming whitespace in hydra-test.el no longer breaks non-regression
---
hydra-test.el | 57 ++++++++++++++++++++++++++++-----------------------------
hydra.el | 29 +++++++++++++++--------------
2 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/hydra-test.el b/hydra-test.el
index 8057d80..94a19a4 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1441,7 +1441,7 @@ t: info-to"
;; basic rendering
;; column compatibility with ruby style and no colum specified
;; column declared several time
-;; nil column
+;; nil column
(ert-deftest hydra-column-1 ()
(should (equal (eval
(cadr
@@ -1456,7 +1456,7 @@ t: info-to"
_h_ _l_ (O)(o)
^_j_^ ( O )
^^^^ (’’)(’’)
-^^^^
+^^^^
"
("h" backward-char nil)
("l" forward-char nil)
@@ -1476,37 +1476,36 @@ _h_ _l_ (O)(o)
("o" nil "ok" :column "firstcol")
("Os" 5x5-bol "outside of table 2" :column
nil)
("Ot" 5x5-eol "outside of table 3")))))))
-
-#(" k ()()
+ #(" k ()()
h l (O)(o)
j ( O )
(’’)(’’)
-
-
-firstcol | secondcol
------------ | ------------
-e: exchange | r: reset
-n: new-copy | y: yank
-d: delete | u: undo
-o: ok | s: string
- | p: paste
+
+
+firstcol | secondcol
+----------- | ------------
+e: exchange | r: reset
+n: new-copy | y: yank
+d: delete | u: undo
+o: ok | s: string
+ | p: paste
[Of]: outside of table 1, [Os]: outside of table 2, [Ot]: outside of table 3."
-2 3 (face hydra-face-pink)
-17 18 (face hydra-face-pink)
-21 22 (face hydra-face-pink)
-38 39 (face hydra-face-pink)
-142 143 (face hydra-face-pink)
-156 157 (face hydra-face-pink)
-170 171 (face hydra-face-pink)
-184 185 (face hydra-face-pink)
-198 199 (face hydra-face-pink)
-212 213 (face hydra-face-pink)
-226 227 (face hydra-face-blue)
-240 241 (face hydra-face-pink)
-268 269 (face hydra-face-pink)
-283 285 (face hydra-face-pink)
-309 311 (face hydra-face-pink)
-335 337 (face hydra-face-pink)))))
+ 2 3 (face hydra-face-pink)
+ 17 18 (face hydra-face-pink)
+ 21 22 (face hydra-face-pink)
+ 38 39 (face hydra-face-pink)
+ 129 130 (face hydra-face-pink)
+ 143 144 (face hydra-face-pink)
+ 152 153 (face hydra-face-pink)
+ 166 167 (face hydra-face-pink)
+ 174 175 (face hydra-face-pink)
+ 188 189 (face hydra-face-pink)
+ 196 197 (face hydra-face-blue)
+ 210 211 (face hydra-face-pink)
+ 234 235 (face hydra-face-pink)
+ 244 246 (face hydra-face-pink)
+ 270 272 (face hydra-face-pink)
+ 296 298 (face hydra-face-pink)))))
(provide 'hydra-test)
diff --git a/hydra.el b/hydra.el
index 830ac5a..0fce192 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1053,25 +1053,26 @@ every heads-group have equal length by adding padding
heads where applicable."
finally return decorated-heads-matrix)))
(defun hydra--hint-from-matrix (body heads-matrix)
- "Generate a formated table-style docstring according to HEADS-MATRIX and
BODY data and structure
+ "Generate a formated table-style docstring according to BODY and
HEADS-MATRIX data and structure.
HEADS-MATRIX is expected to be a list of heads with following features:
Each heads must have the same length
Each head must have a property max-key-len and max-doc-len."
(when heads-matrix
(cl-loop with first-heads-col = (nth 0 heads-matrix)
- with last-row-index = (- (length first-heads-col) 1)
- for row-index from 0 to last-row-index
- for heads-in-row = (mapcar (lambda (heads) (nth row-index heads))
heads-matrix)
- concat (concat
- (mapconcat (lambda (head)
- (funcall hydra-key-doc-function
- (hydra-fontify-head head body) ;; key
- (hydra--head-property head :max-key-len)
- (nth 2 head) ;; doc
- (hydra--head-property head :max-doc-len)))
- heads-in-row "| ") "\n")
- into matrix-image
- finally return matrix-image)))
+ with last-row-index = (- (length first-heads-col) 1)
+ for row-index from 0 to last-row-index
+ for heads-in-row = (mapcar (lambda (heads) (nth row-index heads))
heads-matrix)
+ concat (concat
+ (replace-regexp-in-string "\s+$" ""
+ (mapconcat (lambda (head)
+ (funcall
hydra-key-doc-function
+
(hydra-fontify-head head body) ;; key
+
(hydra--head-property head :max-key-len)
+ (nth 2
head) ;; doc
+
(hydra--head-property head :max-doc-len)))
+ heads-in-row "| "))
"\n")
+ into matrix-image
+ finally return matrix-image)))
;; previous functions dealt with automatic docstring table generation from
:column head property
(defun hydra-idle-message (secs hint name)
- [elpa] master 91f8e7c 22/36: hydra.el: Bump version, (continued)
- [elpa] master 91f8e7c 22/36: hydra.el: Bump version, Oleh Krehel, 2017/07/22
- [elpa] master a85a617 03/36: Allow to use e.g. "↑" in place of "<up>" in the docstring, Oleh Krehel, 2017/07/22
- [elpa] master 9c2589f 19/36: Update the package description, Oleh Krehel, 2017/07/22
- [elpa] master 63de503 21/36: hydra.el (hydra-key-regex): Add "$", Oleh Krehel, 2017/07/22
- [elpa] master 81d88e4 15/36: hydra.el (hydra-show-hint): Extract from defhydra, Oleh Krehel, 2017/07/22
- [elpa] master 1d378c6 16/36: Allow to set hydra verbosity, Oleh Krehel, 2017/07/22
- [elpa] master 2ebf862 25/36: Move Amaranth warning message to a defvar, Oleh Krehel, 2017/07/22
- [elpa] master a07b92a 26/36: lv.el (lv-window): Rename to " *LV*", Oleh Krehel, 2017/07/22
- [elpa] master 36fb5e0 32/36: hydra.el (defhydra): Use copy-tree on heads, Oleh Krehel, 2017/07/22
- [elpa] master 02f2907 33/36: hydra.el (hydra--sort-heads): change ordering method of columns, Oleh Krehel, 2017/07/22
- [elpa] master 2751f00 31/36: Remove trailing whitespace from :column docstring,
Oleh Krehel <=
- [elpa] master 38ce88a 34/36: hydra.el : fix some docstring warning, Oleh Krehel, 2017/07/22