summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNir Friedman <quicknir@gmail.com>2017-11-25 18:23:16 -0500
committerOleh Krehel <ohwoeowho@gmail.com>2017-11-26 18:15:18 +0200
commitc08fc7c1c6997f7e843175e632d3d812e9f5a5b5 (patch)
treee6657bc5afcf30a9c45e5dfd01c27be86884807e
parent91032912146f16c09987d8d35083f09809d6afaa (diff)
Add option to match newline in avy-goto-char-timer
Fixes #220 Fixes #225
-rw-r--r--avy.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/avy.el b/avy.el
index 70e1ca4..877e6b4 100644
--- a/avy.el
+++ b/avy.el
@@ -1768,6 +1768,10 @@ newline."
"How many seconds to wait for the second char."
:type 'float)
+(defcustom avy-enter-times-out t
+ "Whether enter exits avy-goto-char-timer early. If nil it matches newline"
+ :type 'boolean)
+
(defun avy--read-candidates (&optional re-builder)
"Read as many chars as possible and return their occurences.
At least one char must be read, and then repeatedly one next char
@@ -1802,7 +1806,9 @@ Otherwise, the whole regex is highlighted."
(cond
;; Handle RET
((= char 13)
- (setq break t))
+ (if avy-enter-times-out
+ (setq break t)
+ (setq str (concat str (list ?\n)))))
;; Handle C-h, DEL
((memq char '(8 127))
(let ((l (length str)))