[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 035d663 14/24: Add `avy-translate-char-function' to transl
From: |
Oleh Krehel |
Subject: |
[elpa] master 035d663 14/24: Add `avy-translate-char-function' to translate user input key |
Date: |
Thu, 25 Jun 2015 10:17:51 +0000 |
branch: master
commit 035d663ab412c0e3f3df22581a5f864b2df30b59
Author: York Zhao <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add `avy-translate-char-function' to translate user input key
This can be useful for adding mirror key. For example, one can make SPACE an
alternative of 'a', by adding:
(setq avy-translate-char-function
(lambda (c) (if (= c 32) ?a c)))
to allow typing SPACE instead of character 'a' to jump to the location
highlighted by 'a'.
Fixes #59
---
avy.el | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/avy.el b/avy.el
index 427378d..9b7e00b 100644
--- a/avy.el
+++ b/avy.el
@@ -134,6 +134,17 @@ When nil, punctuation chars will not be matched.
"List of modes to ignore when searching for candidates.
Typically, these modes don't use the text representation.")
+(defvar avy-translate-char-function #'identity
+ "Function to translate user input key. This can be useful for
+adding mirror key. E.g. one can make SPACE an alternative of 'a',
+by adding:
+
+\(setq avy-translate-char-function
+ (lambda (c) (if (= c 32) ?a c)))
+
+to allow typing SPACE instead of character 'a' to jump to the location
+highlighted by 'a'.")
+
(defface avy-lead-face-0
'((t (:foreground "white" :background "#4f57f9")))
"Face used for first non-terminating leading chars.")
@@ -319,7 +330,7 @@ multiple DISPLAY-FN invokations."
(push (cons path leaf) avy--leafs)))
(dolist (x avy--leafs)
(funcall display-fn (car x) (cdr x))))
- (let ((char (read-char))
+ (let ((char (funcall avy-translate-char-function (read-char)))
branch)
(funcall cleanup-fn)
(if (setq branch (assoc char tree))
@@ -348,7 +359,7 @@ multiple DISPLAY-FN invokations."
(while (< i len)
(dolist (x (reverse alist))
(avy--overlay-at-full (reverse (car x)) (cdr x)))
- (let ((char (read-char)))
+ (let ((char (funcall avy-translate-char-function (read-char))))
(avy--remove-leading-chars)
(setq alist
(delq nil
- [elpa] master 1350ab3 08/24: avy.el (avy-goto-char-in-line): Quote char, (continued)
- [elpa] master 1350ab3 08/24: avy.el (avy-goto-char-in-line): Quote char, Oleh Krehel, 2015/06/25
- [elpa] master 27b3da3 11/24: avy.el (avy-goto-char-in-line): Fix to this window, Oleh Krehel, 2015/06/25
- [elpa] master 7b0ba80 19/24: avy.el (avy-style): Switch the default from 'pre to 'at-full, Oleh Krehel, 2015/06/25
- [elpa] master 8d38a89 23/24: avy.el (avy-goto-char-timer): Obey avy-styles-alist, Oleh Krehel, 2015/06/25
- [elpa] master 9ddde6d 06/24: avy.el (avy--overlay-at-full): Improve, Oleh Krehel, 2015/06/25
- [elpa] master 44d76b9 22/24: Bump version to 0.3.0, Oleh Krehel, 2015/06/25
- [elpa] master 791c16c 02/24: avy.el (avy-goto-char-in-line): New command, Oleh Krehel, 2015/06/25
- [elpa] master 6dfa445 12/24: README.md: Mention a custom-command tutorial, Oleh Krehel, 2015/06/25
- [elpa] master 7376a0c 18/24: avy.el (avy--overlay-at-full): Fixup (for overlays-in), Oleh Krehel, 2015/06/25
- [elpa] master 15c7f9f 17/24: targets/avy-init.el: Use the new checkdoc-file, Oleh Krehel, 2015/06/25
- [elpa] master 035d663 14/24: Add `avy-translate-char-function' to translate user input key,
Oleh Krehel <=
- [elpa] master 27b98bb 03/24: Add 'de-bruijn option for avy-style, Oleh Krehel, 2015/06/25
- [elpa] master a7c92d8 21/24: Updated screenshot image for ivy-goto-char., Oleh Krehel, 2015/06/25
- [elpa] master f727b53 24/24: Merge commit '8d38a898f23b3105c5d098f0cfb6c3383547e394' from avy, Oleh Krehel, 2015/06/25
- [elpa] master 02bf35b 13/24: Modify `at-full' and `de-bruijn' overlays to color depth, Oleh Krehel, 2015/06/25
- [elpa] master 236293a 15/24: avy.el (avy-isearch): Allow different styles, Oleh Krehel, 2015/06/25
- [elpa] master 054390f 16/24: avy.el (avy-translate-char-function): Fixup doc, Oleh Krehel, 2015/06/25
- [elpa] master 78d20e0 07/24: Fix jumping to other frames, Oleh Krehel, 2015/06/25
- [elpa] master 7a00821 09/24: avy.el (avy-dowindows): Ignore pdf-view-mode, Oleh Krehel, 2015/06/25
- [elpa] master e5104ca 20/24: avy.el (avy-goto-word-1): Quote punctuation, Oleh Krehel, 2015/06/25
- [elpa] master 55c77c5 04/24: For De Bruin, don't build a tree, Oleh Krehel, 2015/06/25