The current version of `avy--regex-candidates` first searches for the
given regex then skip the match if it's invisible. This works fine with
less than a few thousand lines of buffer, however, it takes quit time if
your have tens of thousand lines hidden, say, in org file.
This patch reverse the strategy. Find all visible regions in given the
window first, then map the original search function to that list. This
change reduced candidates search time from 10 or more seconds to instant
on my 100,000+ lines of org file.
It might be possible to have hundreds of visibility-interleaved regions
in a huge window on the 4K or 8K monitor in near the future, but this
reversed strategy should be fast enough for those system.
This fixes#108.
Fixes#109
Before this change, the highlighting was only performed in the selected
window even if avy-all-windows was true. Now it's consistent with the
value of that variable.
1. Handle DEL in order to fix typos.
2. Handle RET in order to use the current input string immediately
without waiting for another char for avy-timeout-seconds.
3. Highlight matches while reading 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 (avy-action-goto): Don't save mark here, since the window was
already changed.
(avy--process): Set mark here.
(avy-ring): New defvar.
(avy-push-mark): New defun.
(avy-pop-mark): Use `avy-ring' unless it's empty. Then use the mark ring.
Fixes#88
Re #69
Re #81
* avy.el (avy-action): New defvar.
(avy-dispatch-alist): New defvar.
Customize this to add new dispatch functionality.
(avy-handler-default): Use `avy-dispatch-alist'.
(avy--with-avy-keys): Set `avy-action' to nil, which means
`avy-action-goto' will be called by default.
(avy--goto): Remove defun. Redirect it as an obsolete alias to identity.
(avy-action-goto): New defun.
(avy-action-mark): New defun.
(avy-action-copy): New defun.
(avy-action-kill): New defun.
(avy--process): Call `avy-action'. This function alone now does
what (avy--goto (avy--process ...)) used to do.
(avy--generic-jump): Remove `avy--goto'.
(avy-goto-char-in-line): Remove `avy--goto'.
(avy-isearch): Remove `avy--goto'.
(avy--line): Set `avy-action' to identity so that `avy--process' doesn't
move point.
(avy-goto-line): Replace `avy--goto' with `avy-action-goto'.
(avy-copy-line): `avy--line' now returns a point, not a cons.
(avy-move-line): `avy--line' now returns a point, not a cons.
(avy-copy-region): `avy--line' now returns a point, not a cons.
**Example of use.**
Suppose you have:
(global-set-key (kbd "M-g w") 'avy-goto-word-1)
To jump to a certain word (e.g. first one on screen): "M-g wa".
To copy the word instead of jumping to it: "M-g wna".
To mark the word after jumping to it: "M-g wma".
To kill the word after jumping to it: "M-g wxa".
Re #78
Now you can set avy-keys also to the arrow keys and page up/down, e.g.,
(setq avy-keys '(left right up down prior next))
and those will be displayed as ▲, ▼, ◀, ▶, △, ▽ in the overlays. The
display is controlled by the variable `avy-key-to-char-alist'.
* avy.el (avy--overlay-at-full): Account for `overlays-in' not being
returned in the buffer order sometimes: it seems to be random order.
Instead, look at the minimum of all overlay starts that are on the
current line.
Fixes#52.
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 (avy-lead-face-2): New face.
(avy-lead-faces): New defconst. Each element will be used to color the
corresponding depth.
(avy--overlay-at-full): Use `avy-lead-faces' to represent the current
decision depth. For `de-bruijn', prepend the old stuff, so that nothing
moves.
Fixes#53