[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 48aa2cd 28/78: Improve avy-goto-char-timer so that it may
From: |
Oleh Krehel |
Subject: |
[elpa] master 48aa2cd 28/78: Improve avy-goto-char-timer so that it may read 1 or many chars |
Date: |
Sat, 23 Jan 2016 13:59:50 +0000 |
branch: master
commit 48aa2cd8287bfdd32614eb251e2609ad103d7809
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
Improve avy-goto-char-timer so that it may read 1 or many chars
Now you can use avy-goto-char-timer and type as many chars as you want
given each char comes before avy-timeout-seconds (and the very first
char is mandatory, i.e., there is no timeout for the first one).
---
avy.el | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/avy.el b/avy.el
index fb162f3..ae0b03b 100644
--- a/avy.el
+++ b/avy.el
@@ -1036,19 +1036,30 @@ ARG lines can be used."
(defcustom avy-timeout-seconds 0.5
"How many seconds to wait for the second char.")
+(defun avy--read-string-timer ()
+ "Read as many chars as possible and return them as string.
+At least one char must be read, and then repeatedly one next char
+may be read if it is entered before `avy-timeout-seconds'."
+ (let ((str "") char)
+ (while (setq char (read-char (format "char%s: "
+ (if (string= str "")
+ str
+ (format " (%s)" str)))
+ t
+ (and (not (string= str ""))
+ avy-timeout-seconds)))
+ (setq str (concat str (list char))))
+ str))
+
;;;###autoload
(defun avy-goto-char-timer (&optional arg)
- "Read one or two consecutive chars and jump to the first one.
+ "Read one or many consecutive chars and jump to the first one.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
- (let ((c1 (read-char "char 1: " t))
- (c2 (read-char "char 2: " t avy-timeout-seconds)))
+ (let ((str (avy--read-string-timer)))
(avy-with avy-goto-char-timer
(avy--generic-jump
- (regexp-quote
- (if c2
- (string c1 c2)
- (string c1)))
+ (regexp-quote str)
arg
avy-style))))
- [elpa] master dbd2d20 17/78: avy.el (avy-pop-mark): Handle multiple frames, (continued)
- [elpa] master dbd2d20 17/78: avy.el (avy-pop-mark): Handle multiple frames, Oleh Krehel, 2016/01/23
- [elpa] master a86bdee6 16/78: avy.el (avy-pop-mark): use own history for points and windows, Oleh Krehel, 2016/01/23
- [elpa] master ed120ea 19/78: avy.el (avy-goto-line): Allow numeric prefix arg, Oleh Krehel, 2016/01/23
- [elpa] master 53d457c 18/78: Add misc punctuation to subword commands, Oleh Krehel, 2016/01/23
- [elpa] master 2c74d01 21/78: avy.el (avy--generic-jump): Add beg and end optional args, Oleh Krehel, 2016/01/23
- [elpa] master 009c0bc 22/78: avy.el (avy--line): Work for visual-line-mode, Oleh Krehel, 2016/01/23
- [elpa] master 53decea 24/78: avy.el (avy--line): Don't error on end of buffer, Oleh Krehel, 2016/01/23
- [elpa] master a6cfeda 23/78: avy.el (avy-goto-subword-0): Don't offer invisible chars, Oleh Krehel, 2016/01/23
- [elpa] master 72afecb 25/78: avy.el (avy-push-mark): Bring back push-mark, Oleh Krehel, 2016/01/23
- [elpa] master b1ef1f8 26/78: avy.el (avy--line): Obey avy-background, Oleh Krehel, 2016/01/23
- [elpa] master 48aa2cd 28/78: Improve avy-goto-char-timer so that it may read 1 or many chars,
Oleh Krehel <=
- [elpa] master ac16227 27/78: Add padding for wide-width character, Oleh Krehel, 2016/01/23
- [elpa] master 67662ef 29/78: Fix indentation of defface, Oleh Krehel, 2016/01/23
- [elpa] master f9d7a76 31/78: Improve avy-goto-char-timer., Oleh Krehel, 2016/01/23
- [elpa] master 3f53a2a 30/78: avy.el (avy-goto-line): Fix off-by-one, Oleh Krehel, 2016/01/23
- [elpa] master acdd9e8 33/78: Modify avy--read-string-timer, Oleh Krehel, 2016/01/23
- [elpa] master 22b4ff0 32/78: Define new face avy-goto-char-timer-face for the highlights, Oleh Krehel, 2016/01/23
- [elpa] master bda04b2 35/78: Properly highlight depending on avy-all-windows, Oleh Krehel, 2016/01/23
- [elpa] master c879498 38/78: New commands avy-goto-line-above and avy-goto-line-below, Oleh Krehel, 2016/01/23
- [elpa] master 248bff0 37/78: avy.el (avy--regex-candidates): Simplify, Oleh Krehel, 2016/01/23
- [elpa] master d439b9d 34/78: avy.el (avy--overlay-at-full): Avoid negative length, Oleh Krehel, 2016/01/23