]> code.delx.au - gnu-emacs-elpa/commitdiff
Allow "_", "!", and "&" as keys in docstrings
authorOleh Krehel <ohwoeowho@gmail.com>
Sun, 30 Aug 2015 07:35:17 +0000 (09:35 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sun, 30 Aug 2015 07:35:17 +0000 (09:35 +0200)
* hydra.el (hydra--format): Update.

Fixes #161

hydra.el

index 5902395282c3479c635ad2e47c80d9224552a3e8..3d42c38555b432040bca90ee8f31ba5b0e09a5c1 100644 (file)
--- a/hydra.el
+++ b/hydra.el
@@ -566,16 +566,18 @@ HEAD's binding is returned as a string wrapped with [] or {}."
 _NAME, BODY, DOCSTRING and HEADS are parameters of `defhydra'.
 The expressions can be auto-expanded according to NAME."
   (setq docstring (hydra--strip-align-markers docstring))
+  (setq docstring (replace-regexp-in-string "___" "_β_" docstring))
   (let ((rest (hydra--hint body heads))
         (start 0)
         varlist
         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))
+                    (key (if (equal key "β") "_" key))
                     (head (assoc key heads)))
                (if head
                    (progn