]> code.delx.au - gnu-emacs-elpa/commitdiff
hydra.el (hydra--format): Be non-greedy with width spec
authorOleh Krehel <ohwoeowho@gmail.com>
Thu, 23 Apr 2015 19:48:26 +0000 (21:48 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Thu, 23 Apr 2015 19:48:26 +0000 (21:48 +0200)
* hydra.el (hydra--format): Since the key spec is non-greedy, the width
  spec should be non-greedy too.

Otherwise, the following will match more than _1_:
    _1_: h1         _2_: h2

Fixes #117

hydra.el

index 125bb1c3fcda718c439896ef17b6186d26dc1a39..2d3a2e92da8a465556986ad6f20bda1e8ccdb397 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))