Allow for "_[_" and "_]_" in docs

* hydra.el (hydra--format): Update.

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

Fixes #143
master
Oleh Krehel 11 years ago
parent fca56c3cbb
commit adc29975ae
  1. 17
      hydra-test.el
  2. 2
      hydra.el

@ -1096,6 +1096,23 @@ _f_ auto-fill-mode: %`auto-fill-function
#("u" 0 1 (face hydra-face-red)))
""))))
(ert-deftest hydra-format-6 ()
(should
(equal (hydra--format
nil nil "\n[_]_] forward [_[_] backward\n"
'(("]" forward-char)
("[" backward-char)))
'(concat
(format
"[%s] forward [%s] backward\n"
#("]"
0 1 (face
hydra-face-red))
#("["
0 1 (face
hydra-face-red)))
""))))
(ert-deftest hydra-format-with-sexp-1 ()
(should (equal
(let ((hydra-fontify-head-function

@ -513,7 +513,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))

Loading…
Cancel
Save