Add avy-goto-char-timer

avy-jump.el (avy-goto-char-timer): New command. Generalize
`avy-goto-char' and `avy-goto-char-2' with a timer.

* avy-jump.el (avy-timeout-seconds): New defcustom.

Fixes #13
This commit is contained in:
Oleh Krehel 2015-05-08 18:19:40 +02:00
parent e49f6d02eb
commit bca96ae3b4

View File

@ -442,6 +442,24 @@ ARG lines can be used."
(eval-after-load 'isearch
'(define-key isearch-mode-map (kbd "C-'") 'avy-isearch)))
(defcustom avy-timeout-seconds 0.5
"How many seconds to wait for the second char.")
;;;###autoload
(defun avy-goto-char-timer (&optional arg)
"Read one or two 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: "))
(c2 (read-char "char 2: " nil avy-timeout-seconds)))
(avy--generic-jump
(regexp-quote
(if c2
(string c1 c2)
(string c1)))
arg
avy-goto-char-style)))
(define-obsolete-variable-alias 'avi-keys 'avy-keys "0.1.0")
(define-obsolete-variable-alias 'avi-background 'avy-background "0.1.0")
(define-obsolete-variable-alias 'avi-word-punc-regexp 'avy-word-punc-regexp "0.1.0")