96 Commits

Author SHA1 Message Date
Oleh Krehel
3257d81b4a Add avy-candidate-* helper functions
* avy.el (avy-candidate-beg):
(avy-candidate-end):
(avy-candidate-wnd): New defun.
(avy--overlay-pre):
(avy--overlay-at):
(avy--overlay-at-full):
(avy--overlay-post): Update.
2015-10-25 13:20:41 +01:00
Oleh Krehel
cf36a599f2 avy.el (avy--old-str): New defun.
* avy.el (avy--overlay):
(avy--overlay-at):
(avy--overlay-at-full): Simplify.
2015-10-25 12:40:40 +01:00
Tassilo Horn
0166808bc1 Beep when there are no matches
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.
2015-10-22 15:25:13 +02:00
Oleh Krehel
f28d238e0e Fix for combined org-indent-mode and visual-line-mode
* 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
2015-10-22 10:57:21 +02:00
Oleh Krehel
964664c9fd Fix jumping to the last char of a folded Org outline
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
2015-10-22 10:26:26 +02:00
Oleh Krehel
df181f1e77 avy.el (avy--read-candidates): Use avy-window-list
Re #100
2015-10-21 20:37:55 +02:00
Oleh Krehel
0a18a45959 avy.el (avy--read-candidates): Fix reverse order
Re #100
2015-10-21 18:17:06 +02:00
Oleh Krehel
2313410bd7 Optimize avy-goto-char-timer
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
2015-10-21 13:37:12 +02:00
Oleh Krehel
513c42991c Make avy-goto-char-timer faster for org-mode
* avy.el (avy--read-string-timer): Use `avy--find-visible-regions'.
(avy-goto-char-timer): Make ARG work properly to negate
`avy-all-windows'.

Re #100
2015-10-21 12:44:31 +02:00
Oleh Krehel
528125e096 avy.el (avy--process): Add window to candidates if not present
`avy-read-de-bruijn' relies on the window being the cdr of each
candidate.

Fixes abo-abo/ace-link#22
2015-10-20 10:35:37 +02:00
Oleh Krehel
f7ddd4b687 Fix jumping to the last char of a folded Org outline
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
2015-10-19 16:11:40 +02:00
Oleh Krehel
c87949847d New commands avy-goto-line-above and avy-goto-line-below
* avy.el (avy--line): Add BEG, END optional args.
(avy-goto-line-above): New command.
(avy-goto-line-below): New command.

Fixes #106
2015-10-19 11:57:47 +02:00
Oleh Krehel
248bff08bb avy.el (avy--regex-candidates): Simplify
Remove the let-bound BEG and END that would shadow the function's args.
2015-10-19 10:08:26 +02:00
Yasushi SHOJI
70bd6cec70 Search only in the visible region
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
2015-10-19 10:02:18 +02:00
Tassilo Horn
bda04b287b Properly highlight depending on avy-all-windows
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.
2015-10-06 21:31:12 +02:00
Oleh Krehel
d439b9d44f avy.el (avy--overlay-at-full): Avoid negative length
Fixes #102
2015-09-22 11:51:11 +02:00
momomo5717
acdd9e8b3d Modify avy--read-string-timer 2015-09-19 19:00:39 +09:00
Tassilo Horn
22b4ff0658 Define new face avy-goto-char-timer-face for the highlights 2015-09-17 08:22:52 +02:00
Tassilo Horn
f9d7a76cd4 Improve avy-goto-char-timer.
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.
2015-09-16 18:29:37 +02:00
Oleh Krehel
3f53a2a15e avy.el (avy-goto-line): Fix off-by-one 2015-09-11 12:24:02 +02:00
Oleh Krehel
67662efdb3 Fix indentation of defface
Re #97
2015-09-09 17:27:10 +02:00
Tassilo Horn
48aa2cd828 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).
2015-09-09 16:51:17 +02:00
Akira Tamamori
ac162279f2 Add padding for wide-width character
Add padding for wide-width character (ex. Japanese and Chinese).
2015-09-04 10:38:10 +09:00
Oleh Krehel
b1ef1f8f8c avy.el (avy--line): Obey avy-background
Fixes #94
2015-08-24 11:11:26 +02:00
Oleh Krehel
72afecbc29 avy.el (avy-push-mark): Bring back push-mark
Fixes abo-abo/ace-window#41
2015-08-21 20:59:19 +02:00
Oleh Krehel
53decea669 avy.el (avy--line): Don't error on end of buffer
Re #91
2015-08-21 18:17:53 +02:00
Oleh Krehel
a6cfedaf5e avy.el (avy-goto-subword-0): Don't offer invisible chars
Fixes #90
2015-08-21 14:50:57 +02:00
Oleh Krehel
009c0bc1ed avy.el (avy--line): Work for visual-line-mode
Use `point' instead of `line-beginning-position'.

Fixes #91
2015-08-21 14:47:32 +02:00
Oleh Krehel
2c74d0160a avy.el (avy--generic-jump): Add beg and end optional args
* avy.el (avy-goto-char-in-line): Update.

Fixes #89
2015-08-21 14:34:07 +02:00
Oleh Krehel
36b296c82a avy.el (subword-backward-regexp): Fix declaration 2015-08-21 14:31:34 +02:00
Oleh Krehel
ed120ea164 avy.el (avy-goto-line): Allow numeric prefix arg
The old behavior remains for ARG 1 and 4. For all other ARG, simply go
to that line.

Fixes #86
2015-08-21 14:22:56 +02:00
Oleh Krehel
53d457cfe4 Add misc punctuation to subword commands
* avy.el (avy-goto-subword-0): Temporarily bind
  `subword-backward-regexp' to allow chars like ! or @ to count as
  subword parts.

Fixes #93
2015-08-21 13:19:36 +02:00
Oleh Krehel
dbd2d2018d avy.el (avy-pop-mark): Handle multiple frames
Re #88
2015-08-07 15:48:30 +02:00
Oleh Krehel
a86bdee66c avy.el (avy-pop-mark): use own history for points and windows
* 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
2015-08-07 15:06:28 +02:00
B Jacquet
1e578a147a Considers letter case only if given Upcase letter
Fixes #87
2015-08-07 12:58:36 +02:00
Oleh Krehel
30067ddc09 avy.el (avy-action-goto): Don't push mark when region is active
* avy.el (avy-action-goto): When the region is active, the user probably
  doesn't want to move the mark.

Fixes #84
2015-07-29 17:59:42 +02:00
Dror Levin
e8cebf1616 Make arg optional in avy-goto-subword-1 2015-07-21 15:42:21 +03:00
Markus Hauck
d22493c0ec Autload avy-goto-word-or-subword-1
Fixes #82
2015-07-21 09:31:53 +02:00
Oleh Krehel
492ac494e9 avy.el (avy-pop-mark): Add
Fixes #81
2015-07-21 09:28:29 +02:00
Oleh Krehel
26123a7b37 avy.el (avy-goto-line): Fixup goto-line clause
Fixes #79
2015-07-16 22:03:25 +02:00
Oleh Krehel
3b9a60a334 avy.el (avy-dispatch-alist): Upgrade to defcustom
* avy.el (avy-handler-default): `avy-dispatch-alist' is actually an
  alist now.
2015-07-16 16:07:28 +02:00
Oleh Krehel
a6db8a3506 Rename avy--with-avy-keys to avy-with
* avy.el (avy-with): Macro renamed from `avy--with-avy-keys'.
(avy--with-avy-keys): Add obsolete alias.
2015-07-16 16:06:21 +02:00
Oleh Krehel
465d5f2f9c Improve docstrings
* avy.el (avy-keys): Update.
(avy-background-face): Update.
2015-07-16 16:05:33 +02:00
Oleh Krehel
1d1e4b62e8 Allow to switch action midway from goto to kill/mark/copy
* 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
2015-07-16 15:13:31 +02:00
Oleh Krehel
7928d11ef3 Remove the old obsolete aliases 2015-07-16 14:25:06 +02:00
Tassilo Horn
0cac5890f1 Allow non-printing keys in avy-keys
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'.
2015-07-14 08:31:49 +02:00
Oleh Krehel
36e4d145c8 Respect the current input method for target chars
* avy.el (avy-goto-char):
(avy-goto-char-in-line):
(avy-goto-char-2):
(avy-goto-word-1):
(avy-goto-subword-1):
(avy-goto-char-timer): Update.

Fixes #76
2015-07-07 17:11:47 +02:00
Oleh Krehel
eb28aeb40e avy.el (avy-goto-line): push mark for numeric line
Fixes #74
2015-07-01 14:32:04 +02:00
Junpeng Qiu
8c8ad97de1 Add de-bruijn to the defcustom of avy-styles-alist 2015-06-25 15:54:32 -04:00
Oleh Krehel
8d38a898f2 avy.el (avy-goto-char-timer): Obey avy-styles-alist
Fixes #67
2015-06-21 17:04:59 +02:00