[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hydra 67098cc914 22/46: hydra.el (hydra--format): Add e
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hydra 67098cc914 22/46: hydra.el (hydra--format): Add extra newline |
Date: |
Tue, 25 Oct 2022 22:27:21 -0400 (EDT) |
branch: externals/hydra
commit 67098cc9149854a95b589c3763843eabc82c9b2d
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
hydra.el (hydra--format): Add extra newline
* hydra-test.el (hydra-columns-2): Add test.
Fixes #306
---
hydra-test.el | 23 +++++++++++++++++++++++
hydra.el | 8 +++++++-
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/hydra-test.el b/hydra-test.el
index 7d9d90887e..4e77b7ade0 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1466,6 +1466,29 @@ t: info-to"
314 315 (face hydra-face-blue)
322 323 (face hydra-face-blue)))))
+(ert-deftest hydra-columns-2 ()
+ (should (equal (eval
+ (cadr
+ (nth 2
+ (nth 3
+ (macroexpand
+ '(defhydra hydra-foo (:color blue)
+ "Silly hydra"
+ ("x" forward-char "forward" :column "sideways")
+ ("y" backward-char "back")
+ ("a" next-line "down" :column "vertical")
+ ("b" previous-line "up")))))))
+ #("Silly hydra:
+sideways | vertical
+----------- | -----------
+x: forward | a: down
+y: back | b: up
+"
+ 62 63 (face hydra-face-blue)
+ 76 77 (face hydra-face-blue)
+ 84 85 (face hydra-face-blue)
+ 98 99 (face hydra-face-blue)))))
+
;; checked:
;; basic rendering
;; column compatibility with ruby style and no colum specified
diff --git a/hydra.el b/hydra.el
index e738b18d70..49066e9bd2 100644
--- a/hydra.el
+++ b/hydra.el
@@ -724,7 +724,13 @@ The expressions can be auto-expanded according to NAME."
(t
(let ((r `(replace-regexp-in-string
" +$" ""
- (concat ,docstring ": "
+ (concat ,docstring
+ ,(cond ((string-match-p "\\`\n" rest)
+ ":")
+ ((string-match-p "\n" rest)
+ ":\n")
+ (t
+ ": "))
(replace-regexp-in-string
"\\(%\\)" "\\1\\1" ,rest)))))
(if (stringp rest)
- [elpa] externals/hydra f0745366ff 34/46: hydra.el (hydra--hint-from-matrix-1): Extract, (continued)
- [elpa] externals/hydra f0745366ff 34/46: hydra.el (hydra--hint-from-matrix-1): Extract, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 1dab16cd2a 35/46: hydra.el (hydra--hint-from-matrix): Prep to return list, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 8119d82fe9 13/46: hydra.el (hydra--make-defun): require hydra, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 1e72f96a14 15/46: hydra.el (defhydra): Add :base-map option to body plist, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra df3025f7e3 04/46: hydra.el (hydra-key-regex): Add "\\", Stefan Monnier, 2022/10/25
- [elpa] externals/hydra 49611c1509 07/46: hydra.el (hydra--generate-matrix): Refactor, Stefan Monnier, 2022/10/25
- [elpa] externals/hydra e228432bb6 08/46: hydra.el (hydra--hint-from-matrix): Adjust for "%" in key, Stefan Monnier, 2022/10/25
- [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 <=
- [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, 2022/10/25
- [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