]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix the regex once more and add test
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 25 Apr 2015 11:06:54 +0000 (13:06 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 25 Apr 2015 11:06:54 +0000 (13:06 +0200)
* hydra.el (hydra--format): Update.

* hydra-test.el (hydra-format-5): Add test.

Fixes #117

hydra-test.el
hydra.el

index ea416af78e59801597fb3a13219b47d8a0331d72..1c1ab2bf5b98d2bd37b51429f236919e716c20a2 100644 (file)
@@ -1045,6 +1045,19 @@ _f_ auto-fill-mode:    %`auto-fill-function
                     #("j" 0 1 (face hydra-face-blue))
                     #("k" 0 1 (face hydra-face-blue))) ""))))
 
+(ert-deftest hydra-format-5 ()
+  (should
+   (equal (hydra--format
+           nil nil "\n_-_: mark          _u_: unmark\n"
+           '(("-" Buffer-menu-mark)
+             ("u" Buffer-menu-unmark)))
+          '(concat
+           (format
+            "%s: mark          %s: unmark\n"
+            #("-" 0 1 (face hydra-face-red))
+            #("u" 0 1 (face hydra-face-red)))
+            ""))))
+
 (ert-deftest hydra-format-with-sexp-1 ()
   (should (equal
            (let ((hydra-fontify-head-function
index 3b3dda2dbebacbb4f5e9e215f186b6407d031968..bd5640c52647a800bec48f6b432affba953f7aa8 100644 (file)
--- a/hydra.el
+++ b/hydra.el
@@ -474,7 +474,7 @@ The expressions can be auto-expanded according to NAME."
         offset)
     (while (setq start
                  (string-match
-                  "\\(?:%\\( ?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:_\\( ?-?[0-9]*?\\)\\([[:alnum:] -~.,;:/|?<>={}*+#]+?\\)_\\)"
+                  "\\(?:%\\( ?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:_\\( ?-?[0-9]*?\\)\\([-[:alnum:] ~.,;:/|?<>={}*+#]+?\\)_\\)"
                   docstring start))
       (cond ((eq ?_ (aref (match-string 0 docstring) 0))
              (let* ((key (match-string 4 docstring))