[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d2aaf86 20/36: Fix e.g. _f_(foo) in format string
From: |
Oleh Krehel |
Subject: |
[elpa] master d2aaf86 20/36: Fix e.g. _f_(foo) in format string |
Date: |
Sat, 22 Jul 2017 11:22:23 -0400 (EDT) |
branch: master
commit d2aaf869ecba10664e1fa8abd69689f941e3b8f8
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Fix e.g. _f_(foo) in format string
The "_f_" was getting replaced with "%s", which was subsequently
interpreted as "%s(foo)".
* hydra-test.el (hydra-format-9): New test.
Fixes #197
---
hydra-test.el | 11 +++++++++++
hydra.el | 9 +++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/hydra-test.el b/hydra-test.el
index 88d12a8..4c61ea1 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1114,6 +1114,17 @@ _f_ auto-fill-mode: %`auto-fill-function
#("test: [b]: back."
7 8 (face hydra-face-red))))))
+(ert-deftest hydra-format-9 ()
+ (should
+ (equal
+ (hydra--format nil '(nil nil :hint nil) "\n_f_(foo)"
+ '(("f" forward-char nil :exit nil)))
+ '(concat
+ (format
+ "%s(foo)"
+ #("f" 0 1 (face hydra-face-red)))
+ ""))))
+
(ert-deftest hydra-format-with-sexp-1 ()
(should (equal
(let ((hydra-fontify-head-function
diff --git a/hydra.el b/hydra.el
index 3322abd..1ec80ea 100644
--- a/hydra.el
+++ b/hydra.el
@@ -651,12 +651,13 @@ The expressions can be auto-expanded according to NAME."
head)
body)
varlist)
- (setq docstring
- (replace-match
+ (let ((replacement
(or
hydra-key-format-spec
- (concat "%" (match-string 3 docstring) "s"))
- t nil docstring)))
+ (concat "%" (match-string 3 docstring) "s"))))
+ (setq docstring
+ (replace-match replacement t nil docstring))
+ (setq start (+ start (length replacement)))))
(setq start (match-end 0))
(warn "Unrecognized key: _%s_" key))))
- [elpa] master 270b917 14/36: hydra.el (defhydra): Don't eval hints during the definition, (continued)
- [elpa] master 270b917 14/36: hydra.el (defhydra): Don't eval hints during the definition, Oleh Krehel, 2017/07/22
- [elpa] master 200a444 10/36: hydra.el (hydra--hint): Revert return "" for :hint nil, Oleh Krehel, 2017/07/22
- [elpa] master 798684a 13/36: hydra-examples.el: Don't byte-compile, Oleh Krehel, 2017/07/22
- [elpa] master 1eee0f3 18/36: hydra.el (hydra-get-property): New defun., Oleh Krehel, 2017/07/22
- [elpa] master 272dc4a 05/36: hydra.el (hydra-docstring-keys-translate-alist): Update, Oleh Krehel, 2017/07/22
- [elpa] master 5be27f4 02/36: Add a shortcut to supply a head's eval-able docstring, Oleh Krehel, 2017/07/22
- [elpa] master 585db09 17/36: hydra-examples.el: Add example of setting verbosity, Oleh Krehel, 2017/07/22
- [elpa] master 6d5bdf7 11/36: Introduce (:hint none), Oleh Krehel, 2017/07/22
- [elpa] master 76d51ec 23/36: Fix compile warnings, Oleh Krehel, 2017/07/22
- [elpa] master dd5f703 27/36: hydra.el: Use error-message-string, not message, Oleh Krehel, 2017/07/22
- [elpa] master d2aaf86 20/36: Fix e.g. _f_(foo) in format string,
Oleh Krehel <=
- [elpa] master a72d68a 28/36: hydra.el (hydra-fontify-head-default): Fix head keys as "%f", Oleh Krehel, 2017/07/22
- [elpa] master 3527b32 24/36: Fix byte compiler warnings, Oleh Krehel, 2017/07/22
- [elpa] master 943636f 35/36: hydra.el: Bump version, Oleh Krehel, 2017/07/22
- [elpa] master 3db82e5 29/36: Implement named columns, Oleh Krehel, 2017/07/22
- [elpa] master 95008ea 30/36: hydra.el: Add automatic lookup for remaped cmd, Oleh Krehel, 2017/07/22
- [elpa] master 32b8352 36/36: Merge commit '943636fe4a35298d9d234222bc4520dec9ef2305' from hydra, Oleh Krehel, 2017/07/22
- [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