]> code.delx.au - gnu-emacs-elpa/commitdiff
Allow e.g. "_M-\\^_" in docstrings
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 25 Jan 2016 08:12:42 +0000 (09:12 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 25 Jan 2016 08:12:42 +0000 (09:12 +0100)
* hydra.el (hydra--format): Update regexp. Warn instead of error on
  unrecognized keys.

Fixes #178

hydra.el

index 898e2090380043201043d217d6f195e9558c029e..2d5f440be4368674f95bc4f1c9ffac42cc83ed6b 100644 (file)
--- a/hydra.el
+++ b/hydra.el
@@ -586,7 +586,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))
@@ -601,7 +601,7 @@ The expressions can be auto-expanded according to NAME."
                              hydra-key-format-spec
                              (concat "%" (match-string 3 docstring) "s"))
                             t nil docstring)))
-                 (error "Unrecognized key: _%s_" key))))
+                 (warn "Unrecognized key: _%s_" key))))
 
             (t
              (let* ((varp (if (eq ?` (aref (match-string 2 docstring) 0)) 1 0))