[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a85a617 03/36: Allow to use e.g. "↑" in place of "<up>" i
From: |
Oleh Krehel |
Subject: |
[elpa] master a85a617 03/36: Allow to use e.g. "↑" in place of "<up>" in the docstring |
Date: |
Sat, 22 Jul 2017 11:22:20 -0400 (EDT) |
branch: master
commit a85a617306edccb5f61cf566a90f2cf7ac50c42e
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Allow to use e.g. "↑" in place of "<up>" in the docstring
* hydra.el (hydra-docstring-keys-translate-alist): New defvar.
(hydra--format): Add "↑" to the regex, modify the head accordingly for
the `hydra-fontify-head' call.
Re #186
---
hydra.el | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/hydra.el b/hydra.el
index d624581..a048df8 100644
--- a/hydra.el
+++ b/hydra.el
@@ -581,6 +581,9 @@ HEAD's binding is returned as a string wrapped with [] or
{}."
(setq str (replace-match "" nil nil str))))
str))
+(defvar hydra-docstring-keys-translate-alist
+ '(("↑" . "<up>")))
+
(defun hydra--format (_name body docstring heads)
"Generate a `format' statement from STR.
\"%`...\" expressions are extracted into \"%S\".
@@ -594,7 +597,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:] ~.,;:/|?<>address@hidden&^]+?\\)[_?]\\)"
+ "\\(?:%\\(
?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\(
?-?[0-9]*?\\)\\(\\[\\|]\\|[-[:alnum:] ~.,;:/|?<>address@hidden&^↑]+?\\)[_?]\\)"
docstring start))
(cond ((eq ?? (aref (match-string 0 docstring) 0))
(let* ((key (match-string 4 docstring))
@@ -612,10 +615,19 @@ The expressions can be auto-expanded according to NAME."
((eq ?_ (aref (match-string 0 docstring) 0))
(let* ((key (match-string 4 docstring))
(key (if (equal key "β") "_" key))
- (head (assoc key heads)))
+ normal-key
+ (head (or (assoc key heads)
+ (when (setq normal-key
+ (cdr (assoc
+ key
hydra-docstring-keys-translate-alist)))
+ (assoc normal-key heads)))))
(if head
(progn
- (push (hydra-fontify-head head body) varlist)
+ (push (hydra-fontify-head (if normal-key
+ (cons key (cdr head))
+ head)
+ body)
+ varlist)
(setq docstring
(replace-match
(or
- [elpa] master 76d51ec 23/36: Fix compile warnings, (continued)
- [elpa] master 76d51ec 23/36: Fix compile warnings, Oleh Krehel, 2017/07/22
- [elpa] master dd5f703 27/36: hydra.el: Use error-message-string, not message, Oleh Krehel, 2017/07/22
- [elpa] master d2aaf86 20/36: Fix e.g. _f_(foo) in format string, Oleh Krehel, 2017/07/22
- [elpa] master a72d68a 28/36: hydra.el (hydra-fontify-head-default): Fix head keys as "%f", Oleh Krehel, 2017/07/22
- [elpa] master 3527b32 24/36: Fix byte compiler warnings, Oleh Krehel, 2017/07/22
- [elpa] master 943636f 35/36: hydra.el: Bump version, Oleh Krehel, 2017/07/22
- [elpa] master 3db82e5 29/36: Implement named columns, Oleh Krehel, 2017/07/22
- [elpa] master 95008ea 30/36: hydra.el: Add automatic lookup for remaped cmd, Oleh Krehel, 2017/07/22
- [elpa] master 32b8352 36/36: Merge commit '943636fe4a35298d9d234222bc4520dec9ef2305' from hydra, Oleh Krehel, 2017/07/22
- [elpa] master 91f8e7c 22/36: hydra.el: Bump version, Oleh Krehel, 2017/07/22
- [elpa] master a85a617 03/36: Allow to use e.g. "↑" in place of "<up>" in the docstring,
Oleh Krehel <=
- [elpa] master 9c2589f 19/36: Update the package description, Oleh Krehel, 2017/07/22
- [elpa] master 63de503 21/36: hydra.el (hydra-key-regex): Add "$", Oleh Krehel, 2017/07/22
- [elpa] master 81d88e4 15/36: hydra.el (hydra-show-hint): Extract from defhydra, Oleh Krehel, 2017/07/22
- [elpa] master 1d378c6 16/36: Allow to set hydra verbosity, Oleh Krehel, 2017/07/22
- [elpa] master 2ebf862 25/36: Move Amaranth warning message to a defvar, Oleh Krehel, 2017/07/22
- [elpa] master a07b92a 26/36: lv.el (lv-window): Rename to " *LV*", Oleh Krehel, 2017/07/22
- [elpa] master 36fb5e0 32/36: hydra.el (defhydra): Use copy-tree on heads, Oleh Krehel, 2017/07/22
- [elpa] master 02f2907 33/36: hydra.el (hydra--sort-heads): change ordering method of columns, Oleh Krehel, 2017/07/22
- [elpa] master 2751f00 31/36: Remove trailing whitespace from :column docstring, Oleh Krehel, 2017/07/22
- [elpa] master 38ce88a 34/36: hydra.el : fix some docstring warning, Oleh Krehel, 2017/07/22