If avy--read-candidates doesn't find any candidates for the current
input, the user has surely made a typo. In that case, beep at the user
to make him aware of that.
* avy.el (avy-styles-alist): Make `avy-goto-line' use the 'pre style.
(avy--overlay): Clone `line-prefix' and `wrap-prefix' text properties if
any. These are the properties that `org-indent-mode' uses.
(avy--line): Set `temporary-goal-column' to 0 - this affects
`line-move-visual'.
Fixes#110
avy.el (avy--read-candidates): For the last char in the
outline, (get-char-property (point) 'invisible) returns t, although it's
still visible.
Re #100
Previously, the candidate list would be generated twice: by
`avy--read-string-timer' and by `avy--generic-jump'.
* avy.el (avy--read-string-timer): Rename to `avy--read-candidates'.
(avy--read-candidates): Return the list of candidates instead of a
string which the candidates match.
(avy-goto-char-timer): Update.
Re #100
avy.el (avy--regex-candidates): For the last char in the outline,
(get-char-property (point) 'invisible) returns t, although it's still
visible.
Re #108
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'.