Compare commits

...

278 Commits

Author SHA1 Message Date
Jeremy Bryant
933d1f36cc Checkdoc fixes
* avy.el (avy-keys-alist): command into quotes
(avy-styles-alist): command into quotes and indent
2024-11-01 13:57:13 +00:00
Brian Kavanagh
be612110cb fix(avy-next/prev): Allow avy-next/prev to handle non-cons candidates.
This commit fixes the `avy-last-candidates-cycle` / `avy-next`
/ `avy-pref` defun's so that they can handle candidates with non-cons
car elements (as are set up by `avy-goto-line`.)  Without this fix,
`avy-next` / `avy-prev` throw errors if the last `avy` commands was
`avy-goto-line`.
2023-04-20 14:04:09 +10:00
Javier Olaechea
d9634efe26 Fix byte-compile warning about linum-mode being possibly undefined
In end of data:
avy.el:1675:10: Warning: the function ‘linum-mode’ is not known to be defined.
2023-03-16 17:59:55 -05:00
Javier Olaechea
8576155193 Quote symbols in docstrings according to conventions
This silences the following warnings during byte-compilation:

avy.el:396:2: Warning: defvar `avy-command' docstring has wrong usage of
    unescaped single quotes (use \= or different quoting)

In avy--next-visible-point:
avy.el:935:2: Warning: docstring has wrong usage of unescaped single quotes
    (use \= or different quoting)

In avy--next-invisible-point:
avy.el:942:2: Warning: docstring has wrong usage of unescaped single quotes
    (use \= or different quoting)

This convention is documented in the Documentation Tips section of the Elisp manual

> • When a documentation string refers to a Lisp symbol, write it as it
>   would be printed (which usually means in lower case), with a grave
>   accent ‘`’ before and apostrophe ‘'’ after it.  There are two
>   exceptions: write ‘t’ and ‘nil’ without surrounding punctuation.

See:
- (info "(elisp)Documentaion Tips")
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation-Tips.html
2023-03-16 17:57:15 -05:00
David J. Rosenbaum
955c8dedd6 avy.el (avy--overlay): Avoid error on empty string
Fixes #351
Fixes #352
2022-09-10 21:36:08 +02:00
Oleh Krehel
6f9eefadc9 avy.el (avy-process): Assume avy-action-oneshot will be let-bound
Re #353
2022-09-10 20:57:38 +02:00
aragaer
fd7b02f556 Add avy-action-oneshot variable to redefine avy-action locally
Could be used this way:

```elisp
(let ((avy-action-oneshot #'push-button))
  (avy-goto-char-timer))
```
2022-08-25 22:32:59 +03:00
Stefan Kangas
ba5f035be3 Fix two byte-compiler warnings
Fixes #336
2022-01-02 09:05:07 +01:00
Stefan Kangas
6b53033883 Add GNU ELPA badge to README.md 2022-01-01 04:09:49 +01:00
lWarne
e92cb37457 avy.el (avy-transpose-lines-in-region): Add
Fixes #317
Fixes #310
2020-12-26 18:34:12 +01:00
Oleh Krehel
bbf1e7339e avy.el (avy-order-closest): Work with avy-goto-line
Fixes #307
2020-06-24 13:48:19 +02:00
Saulius Menkevičius
2dde8b71a0 avy.el (avy-process): Add autoload 2020-05-22 08:10:56 +03:00
Oleh Krehel
f34ff764aa avy.el (avy-escape-chars): Add defcustom
Re #249
2020-05-19 12:07:44 +02:00
Oleh Krehel
36a48baa2c avy.el (avy-goto-char-2): Allow backspace
Fixes #249
2020-05-19 08:59:08 +02:00
Oleh Krehel
acf553cae2 avy.el (avy--overlay-pre): Fix conflict with visual-line-mode 2020-05-19 08:58:53 +02:00
Oleh Krehel
509471bad0 avy.el (avy-text): Store the avy-goto-char-timer text
Fixes #303
2020-04-22 13:53:20 +02:00
Oleh Krehel
aa35412375 avy.el (avy--line-cands): Don't set temporary-goal-column
This was introduced when fixing `avy-goto-line' for the combination of
`org-indent-mode' and `visual-line-mode'. Tested that removing it does
not cause a regression.

Re #110
Fixes #302
2020-04-21 12:27:27 +02:00
Oleh Krehel
954774d6e9 avy.el (avy-action-yank-line): Add and bind to "Y" 2020-03-24 16:28:30 +01:00
Oleh Krehel
3bf83140fa avy.el (avy-goto-line): Can cancel with ESC
Fixes #299
2020-03-11 12:06:02 +01:00
Jonas Bernoulli
cf95ba9582 avy.el (avy-with): Fix typo in doc-string 2019-11-06 13:34:46 +01:00
Daniel H. Leidisch
f9c15c573c Fix subword commands with custom order. 2019-10-25 01:10:14 +02:00
Oleh Krehel
87394c9a88 avy.el (avy-isearch): Return relevant result
Fixes #281
2019-09-25 12:54:05 +02:00
Oleh Krehel
5f2eba5f59 avy.el (avy-isearch): Bind avy-case-fold-search to case-fold-search
Fixes #280
2019-09-25 12:50:48 +02:00
Oleh Krehel
455ebec6f3 avy.el (avy-process): Amend last commit for avy-goto-char-timer
Re #283
2019-09-25 12:42:34 +02:00
Federico Tedin
5127f993f9 avy.el (avy-process): Restart on fail for avy-style 'words
Fixes #283
2019-09-25 12:40:53 +02:00
Oleh Krehel
034de4c0e9 avy.el: Add -above and -below versions of avy-goto-whitespace-end
Re #278
2019-08-28 11:51:02 +02:00
Oleh Krehel
27d1af3fa6 avy.el (avy-goto-whitespace-end): New command
* avy.el (avy--regex-candidates): Allow `group' to be a function.
(avy-jump): Pass `group' to `avy--regex-candidates'.

Fixes #278
2019-08-27 20:07:10 +02:00
Oleh Krehel
01a311ca6a avy.el: Get rid of magic char numbers 2019-08-22 16:32:05 +02:00
Oleh Krehel
66886e265c avy.el (avy-read): Don't call `avy--key-to-char' too early
If the key is intended for dispatch, it's not necessary for
`avy--key-to-char' to encode it as a char.
2019-06-30 17:38:41 +02:00
Oleh Krehel
343fc42de1 avy.el (avy-process): Return nil on "C-g" and "ESC" 2019-06-30 17:26:34 +02:00
Oleh Krehel
9ae059deaa .github/FUNDING.yml: Add 2019-06-25 21:50:07 +02:00
Oleh Krehel
aadca9308a avy.el (avy-resume): Work better for avy-goto-timer
Fixes #277
2019-06-25 21:49:51 +02:00
Arte Ebrahimi
f91ae613a8 avy.el (avy-goto-line): Call avy-action-goto only when avy-action is not set
Fixes #274
2019-05-20 11:47:00 +02:00
Yanghao Xie
8686845ed9 avy.el (avy-flyspell-correct-function): Add
Fixes #273
2019-05-14 17:51:15 +02:00
Oleh Krehel
0e59474430 avy.el (avy--read-candidates): Fix docstring
Don't quote key bindings.
This patch was applied in GNU ELPA earlier.
2019-05-11 16:00:29 +02:00
Oleh Krehel
b408f76e3d doc/Changelog.org: quote issues 2019-05-11 15:10:59 +02:00
Oleh Krehel
f2cf43b537 doc/Changelog.org: Release 0.5.0
Fixes #271
2019-05-11 15:05:05 +02:00
Oleh Krehel
a7230906c4 avy.el (avy--overlay-at-full): More consistent face order
Fixes #270
2019-05-06 17:06:39 +02:00
Oleh Krehel
4d52b5cb7e avy.el (avy--line-cands): Allow "invisible" 'org-link
Fixes #269
2019-04-04 10:55:30 +02:00
Oleh Krehel
85b5d574cd avy.el (avy-jump): Add predicate argument
Fixes #267
2019-03-28 17:17:29 +01:00
Oleh Krehel
9a15d1f37b avy.el (avy-show-dispatch-help): Add and bind to "?"
Fixes abo-abo/ace-window#91
2019-03-25 11:46:40 +01:00
Oleh Krehel
152b07fe5a avy.el (avy-process): Return res 2019-03-25 11:46:40 +01:00
Oleh Krehel
fd0101e9e3 avy.el (avy-push-mark): Turn off message 2019-03-25 11:46:40 +01:00
Oleh Krehel
7d73ceeb74 avy.el: Use avy-process instead of avy--process
Re #266
2019-03-19 19:13:51 +01:00
Ivan Yonchovski
8db2759adf Change avy--process to accept cleanup function
Renamed to `avy-process' to indicate that it is used from another packages.

Fixes #255
Fixes #266
2019-03-19 19:11:15 +01:00
Oleh Krehel
e80251056d avy.el (avy-jump): New API, don't use avy--generic-jump
Fixes #265
2019-02-04 13:01:07 +01:00
Oleh Krehel
91240220ad avy.el (avy--generic-jump): Update docstring about removed arg 2019-01-26 21:29:12 +01:00
Oleh Krehel
b19a23af27 avy.el (avy--visible-p): buffer-invisibility-spec can be t
In that case, according to the doc if (get-char-property s 'invisible)
is non-nil, it's invisible.

Fixes #264
Re #261
2019-01-22 15:20:20 +01:00
Oleh Krehel
5b3676f1a4 avy.el (avy-next): New command to go to the next candidate after avy-read
Example config:

    (defhydra hydra-avy-cycle ()
      ("j" avy-next "next")
      ("k" avy-prev "prev")
      ("q" nil "quit"))

    (global-set-key (kbd "C-M-'") 'hydra-avy-cycle/body)

After e.g. `avy-goto-char' or `avy-goto-char-timer', use the above
hydra to cycle between the last candidates.

Fixes #254
2019-01-22 12:59:26 +01:00
Oleh Krehel
74501e1235 avy.el: More fixes to org-toggle-link-display
Fix `avy-goto-subword-0', `avy-goto-subword-1', `avy-goto-char-timer'.

Re #261
2019-01-21 17:44:22 +01:00
duianto
118a3d616e
Update readme.md: add melpa badges
This makes it easy to see the current version from the main repository page.
2019-01-18 15:49:29 +01:00
Oleh Krehel
e9f4d85b88 avy.el (avy-goto-char-timer): Obey avy-background for initial search
Fixes #259
2019-01-17 17:47:18 +01:00
Oleh Krehel
002b8f3451 avy.el (avy--visible-p): Add to fix org-toggle-link-display
Fixes #261
2019-01-17 17:39:01 +01:00
Oleh Krehel
909483e104 avy.el (avy--process): Make `overlay-fn' arg optional 2019-01-15 15:25:30 +01:00
Oleh Krehel
16482e0012 avy.el (avy--generic-jump): Remove `style' arg 2019-01-15 15:19:30 +01:00
Oleh Krehel
e7c0fc046d avy.el (avy-pre-action): New defvar
Fixes #260
2019-01-15 15:14:10 +01:00
whatacold
24b51374be Ignore mistyping when no candidates available
Fixes #256
2018-11-26 18:05:03 +01:00
Oleh Krehel
4f1b8a17d8 avy.el: Fix compiler warnings
Re #258
2018-11-26 18:01:40 +01:00
Adam Porter
bcc0cb0891 avy.el (avy-org-refile-as-child): Don't refile when avy aborted
And ensure refiled heading is visible by calling org-reveal in the
after-refile hook.

When the avy session is aborted with C-g, avy--generic-jump returns
t.  Now we detect that and do not attempt to refile.

Fixes #258
2018-11-26 18:01:30 +01:00
Jiangbin Zhao
df4c4ac488 Show number of matches so far in prompt
Fixes #253
2018-10-09 18:48:31 +02:00
Jiangbin Zhao
c2e2a4a3f2 avy.el (avy--read-candidates): Custom keys for deleting last read char
Add a defcustom for list of events that delete last read char, with
the default being '(8 127) which represents C-h and DEL.

Fixes #251
2018-10-01 10:37:01 +02:00
Yuki
abe150c7bd Introduce single candidate jump customization 2018-09-27 18:08:28 +02:00
Oleh Krehel
cd8fb10759 avy.el (avy--read-candidates): Quit on ESC
Fixes #249
2018-09-13 20:19:19 +02:00
Felipe
a29558d22c Add C-h/DEL/RET info to README for avy-goto-char-timer
Fixes #245
2018-08-31 14:02:24 +02:00
Oleh Krehel
157486aeb1 avy.el: Fix compiler warning 2018-08-14 23:21:25 +02:00
Lane Spangler
fd7b929719 Add option to display an indented goto line overlay
It may be useful to display the overlay for `avy-goto-line` next to the first
non whitespace character on each line so that your eyes do not have to look
across from the code on the line to the left edge of the buffer.

This commit adds a defcustom for `avy-indent-line-overlay` which enables this
new behavior when non nil.
2018-08-13 15:55:01 -04:00
Oleh Krehel
c4e2d50d6d avy.el: avy-goto-char will now display shortest overlays for cands near point
Fixes #242
2018-08-08 17:48:18 +02:00
chm
1de623383e Add avy-goto-end-of-line
Fixes #240
2018-08-06 10:55:56 +02:00
Oleh Krehel
7c40f5e381 avy.el (avy--process): Fix the candidates list being modified when restarting
For example, with multiple windows, `avy-goto-char' followed by "x"
would change the overlays to a subset of the overlays in the current window.
2018-06-15 17:01:33 +02:00
Sebastian Wålinder
7cfe11e3c1 Added ability to display avy candidates from bottom to top
And made scope limitation possible with avy-goto-line-above and below.

Fixes #236
2018-06-12 11:12:13 +02:00
Oleh Krehel
70e384aee5 avy.el (avy--process-1): Extract 2018-06-07 18:17:53 +02:00
Oleh Krehel
8606a8984b avy.el (avy--process): Remove redundant copy-sequence
Hopefully redundant:)
2018-06-07 18:14:38 +02:00
Oleh Krehel
6331b7a6de avy.el (avy--process): Fix avy-goto-line for empty buffer
Fixes #238
2018-06-07 18:11:56 +02:00
Oleh Krehel
58e8636d32 avy.el (avy-action-zap-to-char): More convenient use-cases
Use case 1:

Start (cursor is |):

    This is my sentence and |there is some description

avy-goto-char "d" in description, action "z" results in:

    This is my sentence and |description

Use case 2:

Same start;

avy-goto-char "t" in "This", action "z" results in:

    |there is some description

The nice thing is that the both sequences are reversible with "C-y".

Fixes #234.
2018-05-14 20:00:23 +02:00
walseb
08370cdbc3 Add option to limit avy-goto-subword-0 scope
Fixes #235
2018-04-15 21:59:21 +02:00
Oleh Krehel
2d613eb050 avy.el (avy-action-zap-to-char): Add and bind to "z"
Fixes #234
2018-03-22 21:33:23 +01:00
Oleh Krehel
34d3531a3c avy.el (avy-action-goto): Remove lag 2017-12-30 11:20:36 +01:00
Oleh Krehel
93d4bd2c67 avy.el: Fix indentation 2017-12-30 11:20:36 +01:00
Oleh Krehel
6459f7f12a README.md: Mention avy-resume
Re abo-abo/swiper#1383
2017-12-24 16:30:41 +01:00
Bob Weiner
869261ae81 Display actual character that triggered an error
Fixes #227
2017-12-11 18:23:22 +01:00
Bob Weiner
d4aa876154 Note that change to store full avy path is for external packages 2017-12-11 18:17:48 +01:00
Bob Weiner
9489ca9064 Add window selection via mouse button press and fix typo 2017-12-11 18:17:48 +01:00
Oleh Krehel
793a5e22a7 avy.el (avy-action-teleport): Add save-excursion 2017-12-11 17:19:52 +01:00
Edward Betts
631214d11c Correct spelling mistake
Fixes #218
2017-12-11 17:19:01 +01:00
Oleh Krehel
7f83bbc645 avy.el (avy-action-ispell): Adjust for avy-goto-line
Fixes #191
2017-12-10 20:06:35 +01:00
Oleh Krehel
78392e670e avy.el (avy-action-teleport): Adjust for avy-goto-line
Re #191
2017-12-10 20:06:34 +01:00
Oleh Krehel
a25b255b25 avy.el (avy-action-yank): Adjust for avy-goto-line
Re #191
2017-12-10 20:06:33 +01:00
Oleh Krehel
dee0284f3f avy.el (avy-action-kill-move): Adjust for avy-goto-line
Re #191
2017-12-10 20:06:32 +01:00
Oleh Krehel
1b9f061d27 avy.el (avy-action-kill-stay): Adjust for avy-goto-line
Re #191
2017-12-10 20:06:32 +01:00
Oleh Krehel
56f6590c20 avy.el (avy-action-copy): Adjust for avy-goto-line
Re #191
2017-12-10 20:06:30 +01:00
Oleh Krehel
4af1993290 avy.el (avy-read): Update avy-current-path before returning
Re #226
2017-12-10 09:44:23 +01:00
Oleh Krehel
ddf3c580e7 avy.el (avy-handler-default): Fix typo 2017-12-09 17:28:52 +01:00
Oleh Krehel
176f34f491 avy.el (avy-handler-default): Error msg on mouse clicks
Re #226
2017-12-09 14:01:56 +01:00
Bob Weiner
a0ce6a7558 Add avy-mouse-event-window and fix typo
Fixes #226
2017-12-09 14:01:50 +01:00
Nir Friedman
c08fc7c1c6 Add option to match newline in avy-goto-char-timer
Fixes #220
Fixes #225
2017-11-26 18:15:18 +02:00
Christoph Michelbach
9103291214 Update description to be easier to understand. 2017-11-11 18:21:46 +01:00
Jonas Bernoulli
36f768d9e3 avy.el (avy-words): Specify custom type
Fixes #219
2017-10-14 09:20:04 +02:00
Oleh Krehel
245b5d62fe avy.el: Fix compile warnings
Re #214
2017-08-19 19:39:36 +02:00
Oleh Krehel
8556274978 avy.el (avy-org-goto-heading-timer): Simplify
Re #214
2017-08-13 11:54:44 +02:00
Adam Porter
f4c45d329a avy.el: Add org-mode commands for jumping to and refiling headings
* (avy-org-refile-as-child): Refile current heading to a heading
  selected with Avy.
* (avy-org-goto-heading-timer): Jump to a heading selected with Avy.
  Like avy-goto-char-timer, but for Org headings.
* (avy--read-string-with-timeout): Read a string from the minibuffer
  with a timeout.  Basically factored out of avy-goto-char-timer.
2017-08-12 15:47:07 -05:00
fabacino
0ed6408f18 avy.el: Fix checkdoc warnings
Fixes #212
2017-08-04 20:35:40 +02:00
fabacino
49b070d7da avy-test.el: Fix checkdoc warnings 2017-08-04 20:35:04 +02:00
fabacino
240d717632 Makefile: Add target checkdoc to check documentation guidelines of lisp files
Fixes #211
2017-08-04 20:34:06 +02:00
fabacino
83859c30fa avy.el: Add new avy-style to use words as sequences 2017-08-04 11:05:02 +02:00
Oleh Krehel
228ed97d07 avy.el (avy-action-teleport): Add and bind to "t"
Fixes #207
2017-07-02 11:37:00 +02:00
ketanaka
f2bedeeb58 Allow "C-h" to delete for avy-goto-char-timer
Fixes #193
2017-04-11 15:08:36 +02:00
Oleh Krehel
105efc8482 avy.el (avy-action-copy): Copy line for avy-goto-line
* avy.el (avy-command): New defvar.
(avy-with): Actions can now access the symbol from `avy-with' using
`avy-command'.
(avy-action-copy): Copy line for `avy-goto-line'. Copy sexp for all
other commands.

Fixes #191
2017-04-07 10:11:17 +02:00
Oleh Krehel
54bce2cfb0 avy.el (avy-move-region): Update
Fixes #188
2017-04-02 21:14:29 +02:00
Oleh Krehel
3980c03f6c avy.el (avy-move-region): Insert in original window
Fixes #187
2017-04-02 10:12:22 +02:00
Oleh Krehel
0c30cdba9e avy.el (avy-action-yank): Add and bind to "y"
Fixes #183
2017-03-26 20:57:33 +02:00
Peter Nguyen
d609eb98bd Add avy-goto-word-0-below and avy-goto-word-0-above
These commands limit the scope of avy-goto-word-0 to above or below the
point thus save the number of keys required to jump to a certain word

Fixes #186
2017-03-25 16:45:14 +01:00
Oleh Krehel
b8d7163915 avy.el (avy-action-goto): Add raise-frame 2017-02-08 10:48:22 +01:00
Oleh Krehel
c911850a45 avy.el (avy--overlay-at-full): Fix for visual-line-mode
`end-of-visual-line' is bugged somehow:

This code sometimes produces (point) < beg:

    (goto-char beg)
    (save-excursion
      (end-of-visual-line)
      (point))

which should never happen.

Re #179
2017-02-08 10:46:06 +01:00
Oleh Krehel
0f5e99b5e9 avy.el: Use next-char-property-change, not next-overlay-change
* avy.el (avy--next-visible-point):
(avy--next-invisible-point): Update.

Fixes #168
2016-08-14 11:50:36 +02:00
Oleh Krehel
a9119039ee avy.el (avy-goto-word-1): Work for "^A"-"^Z"
Fixes #167
2016-08-03 15:36:25 +02:00
Oleh Krehel
a5fb9369e7 avy.el (avy-resume): Make it show up in M-x
Re #165
2016-07-22 14:12:45 +02:00
Oleh Krehel
dd112c88e2 avy.el (avy-goto-subword-1): Check char-after
When at `point-max', `char-after' returns nil. This can't be passed to `downcase'.

Fixes #163
2016-07-11 17:58:26 +02:00
Xu Ma
07153e4fb7 Add kill and save region functionality.
Fixes #158
2016-07-10 09:41:13 +02:00
Oleh Krehel
e460d7ebe8 avy.el (flyspell-correct-word-before-point): Declare 2016-07-08 09:59:20 +02:00
MadAnd
20ecb9bed6 Use flyspell if its minor mode is active
Fixes #160
Fixes #161
2016-07-03 08:17:34 +02:00
justbur
b522bfe320 avy.el (avy-resume): Add
Holds last command avy command after user input. This is a quick way to
bring back the same markers after a jump.

Fixes #157
2016-06-20 21:40:05 +02:00
Oleh Krehel
05a5003c2b avy.el: Fix linum-related compile warnings 2016-06-18 08:22:14 +02:00
justbur
5515f28779 Allow using symbols instead of words in word cmds
* avy.el (avy-goto-word-0-regexp): Add symbol option
 * avy.el (avy-goto-word-1): Add symbol boundary optional arg
 * avy.el (avy-goto-symbol-1): Add
 * avy.el (avy-goto-symbol-1-above): Add
 * avy.el (avy-goto-symbol-1-below): Add
2016-06-17 20:16:08 -04:00
Oleh Krehel
4e4c488eef Add avy-linum-mode
* avy.el (avy--linum-strings): New defun.
(avy--linum-update-window): New defun. This is a copy-paste of
`linum-update-window' with just a few lines added.
(avy-linum-mode): New minor mode. Currently, only works with
`avy-all-windows' set to nil.
(avy--line): When `avy-linum-mode' is on, don't display
overlays. Instead, display a simple message.

Fixes #155
2016-06-13 22:53:06 +02:00
Oleh Krehel
430d75085f avy.el (avy--line-cands): Split away from avy--line
* avy.el (avy--line): Update.
2016-06-13 22:31:39 +02:00
Oleh Krehel
4dcf0a9a9a avy.el (avy-goto-char-2): Translate "RET" to "C-j"
Fixes #153
2016-06-01 07:58:16 +02:00
justbur
33af738ae7 avy.el (avy-goto-word-1-above): Add
avy.el (avy-goto-word-1-below): Add
2016-05-19 08:36:18 -04:00
Oleh Krehel
d644be1399 avy.el (avy-goto-char-2-above): Simplify
* avy.el (avy-goto-char-2): Add BEG and END.
(avy-goto-char-2-below): Simplify.
2016-05-18 08:39:11 +02:00
justbur
ba950a0ad5 avy.el (avy-goto-char-2-above): Add
avy.el (avy-goto-char-2-below): Add

These are versions of avy-goto-char-2 that are restricted to matches
before or after the point in the current window.

Fixes #148
2016-05-17 12:52:35 -04:00
Mark Triggs
58bc417c55 Escape regex metacharacters for standard isearch
Doing an isearch for '[' and then invoking avy-isearch would trigger an
error like:

     Invalid regexp: "Unmatched [ or [^"

If we are not doing a regex-based search, escape the search string to
avoid these kind of issues.
2016-05-15 15:15:51 +10:00
York Zhao
2e3c2f7c88 Add new command `avy-move-region'
Fixes #75
2016-05-13 07:52:33 +02:00
Junpeng Qiu
85a384a151 Add char at window start for avy-goto-subword-0 2016-05-03 22:01:06 -04:00
Oleh Krehel
53706d2ebf avy.el (avy-all-windows-alt): Change the default to nil
Fixes #144
2016-04-21 10:24:59 +02:00
Oleh Krehel
4c072be8e6 README.md (avy-goto-char-timer): Add entry
Re #143
2016-04-18 14:39:32 +02:00
Oleh Krehel
5ba3602538 Assign avy-action-ispell to "i"
Re #142
2016-04-14 13:15:00 +02:00
Emmanuel Denloye-Ito
c0db3642d6 Add avy-action-ispell to avy.el
The point should return to its starting location after the desired word
is corrected. As is the case for the other avy-action-{something}
functions, this function is also added to the avy-dispatch-alist.

Fixes #142
2016-04-14 13:12:26 +02:00
Oleh Krehel
a80f95c015 Add "X" dispatch to kill a word without moving there
* avy.el (avy-dispatch-alist): Extend.
(avy-action-kill-move): Rename from `avy-action-kill'.
(avy-action-kill-stay): New defun.

To kill a word without moving there:

1. `avy-goto-word-1' or `avy-goto-char'.
2. word's letter.
3. X.
4. words' overlay chars.
2016-04-02 19:49:10 +02:00
Oleh Krehel
9e61f786d8 avy.el: Improve defcustom :type
* avy.el (avy-keys-alist):
(avy-styles-alist): Add 'function as a possible key-type.
2016-03-26 09:46:03 +01:00
Oleh Krehel
3b75d9520d Make "C-g" and "ESC" fail silently when reading char
* avy.el (avy-ignored-modes): Add type.
(avy-handler-default): Silence "C-g" and "ESC".
(avy-goto-line): Call `avy-handler-function' instead of
`avy-handler-default'.
(avy-timeout-seconds): Add type.

Fixes #137
2016-03-16 13:48:29 +01:00
Oleh Krehel
5f76c9d16e avy.el (avy-goto-word-0-regexp): New defcustom
* avy.el (avy-goto-word-0): Use `avy-goto-word-0-regexp'.

Fixes #136
2016-02-29 09:33:07 +01:00
Oleh Krehel
16370f92ec avy.el (avy--goto): Remove obsolete alias
* avy.el (avy--with-avy-keys): Remove obsolete.

Also clean up whitespace - too long lines and wrong indentation.
2016-02-26 20:54:14 +01:00
Oleh Krehel
730581ae87 avy.el: Fix compilation warning
Fixes #134
2016-02-03 08:57:25 +01:00
Oleh Krehel
5f6dd00f5d avy.el (avy-action-copy): Save window and frame
Fixes #133
2016-01-27 09:22:03 +01:00
Oleh Krehel
11fbd70347 Bump version 2016-01-23 14:34:14 +01:00
Oleh Krehel
369af594e5 avy.el (avy--overlay): Fix interaction with goto-address-mode
The other overlay has no priority, but sets a face. That face is
overridden by the avy overlay (which has priority).

Fixes abo-abo/ace-link#24
2016-01-20 09:22:34 +01:00
denin
15d0679385 copy/move line to an initial window 2016-01-06 18:23:14 +03:00
Oleh Krehel
212a132d5f Don't shorten selector string for visual-line-mode and bolp
* avy.el (avy--overlay-at-full): When at an empty line, there's plenty
  of space to display the full selector. No need to truncate it to avoid
  visual-line-mode reformatting the buffer text.

Fixes #129
2016-01-06 10:36:33 +01:00
OrionU
dd80749441 Add case fold search to avy-goto-char-timer
Fixes #128
2016-01-06 09:31:19 +01:00
Oleh Krehel
808bb8011a avy.el (avy--regex-candidates): Modify case-fold-search condition
Fixes #126
2016-01-05 11:45:04 +01:00
Oleh Krehel
bae6fb15d0 avy.el (avy-copy-region): Keep same selectors for the second pass
With `avy-all-windows' t, the call to `avy--line' would change the
window.

Fixes #121
Fixes #120
2016-01-05 11:13:18 +01:00
Oleh Krehel
9d18bf9fc2 avy.el (avy--overlay): Fix overlays at point-max
* avy.el (avy--overlay): When an overlay is requested at `point-max',
  use 'after-string overlay property instead of 'display.

Fixes #125
2015-12-22 11:45:44 +01:00
Oleh Krehel
47035cf4ea avy.el (avy--line): Don't modify avy-action
Fixes #124
2015-12-22 09:18:02 +01:00
Aleksey Fedotov
72ecbfa220 avy.el (avy-goto-line): fix for narrowed regions
When 'avy-goto-line' is called with numbered argument, it tries to mimic
behaviour of 'goto-line'. However, if some part of text is hidden by
narrowing, 'avy-goto-line' failed to account for that.

This patch temporarily disables narrowing, jumps on line and then
restores narrowing, just like 'goto-line' does.

Fixes #122
Fixes #123
2015-12-19 15:30:47 +01:00
Oleh Krehel
b1a1953e1c Customize extra chars for avy-goto-subword-1
* avy.el (avy-subword-extra-word-chars): New defcustom.
(avy-goto-subword-0): Modify the syntax table temporarily using
`avy-subword-extra-word-chars'.

Fixes #116
2015-12-07 14:56:58 +01:00
Oleh Krehel
fa6d1e1242 avy.el (avy-copy-region): Fix for multi-buffer use
Fixes #119
2015-12-07 11:01:52 +01:00
Oleh Krehel
54074c764d avy.el (avy-all-windows-alt): New defcustom
* avy.el (avy-dowindows): Use `avy-all-windows-alt'.
(avy--regex-candidates):
(avy--read-candidates): Use `current-prefix-arg'. At some later point, it
could be passed as an argument instead.

Fixes #118
2015-12-07 10:36:01 +01:00
Oleh Krehel
a45159a8ca avy.el (avy-goto-line-above): Exclude the current line
* avy.el (avy-goto-line-below): Exclude the current line

Re #106
2015-12-03 12:53:12 +01:00
Oleh Krehel
4132dd647e avy.el (avy-goto-line-above): Work in a single window
* avy.el (avy-goto-line-above):
(avy-goto-line-below): Bind `avy-all-windows' to nil.

Re #106
2015-12-03 10:20:23 +01:00
Oleh Krehel
a0414291f1 avy.el (avy-copy-region): Obey avy-line-insert-style
Re #117
2015-12-02 09:38:18 +01:00
Oleh Krehel
54fb4d65e1 avy.el (avy-line-insert-style): Customize avy-copy-line, avy-move-line
* avy.el (avy-copy-line):
(avy-move-line): Update.

Fixes #117
2015-12-01 14:37:09 +01:00
Dale Sedivec
4a23a0d63e Fix De Bruijn "No catch for tag" error
When using avy-goto-line and typing a line number with avy-style
de-bruijn, you would get an error after entering your line number and
pressing RET:

    No catch for tag: done, exit

I believe this is because avy-read is wrapped with (catch 'done ...) but
avy-read-de-bruijn doesn't catch done.  This adds the catch to
avy-read-de-bruijn.
2015-11-15 10:37:08 -06:00
Oleh Krehel
f341c2f18f avy.el (avy--find-visible-regions): Add bounds safety
Re abo-abo/lispy#139
2015-11-14 11:17:53 +01:00
Oleh Krehel
edf1259f25 avy.el (avy--read-candidates): Use avy-dowindows
Fixes #114
2015-11-11 13:50:04 +01:00
Oleh Krehel
1b78fb0d89 Improve the faces for the last change
* avy.el (avy--overlay-at-full): Update.
2015-10-26 08:59:27 +01:00
Oleh Krehel
9ae44133ca Fix overlays at end-of-line with visual-line-mode
* avy.el (avy--overlay-at-full): Update.

Fixes #112
2015-10-26 08:56:10 +01:00
Oleh Krehel
dddce37cdd Fix 'at-full moving text for chars near end of visual line
* avy.el (avy--overlay-at-full): Update.
2015-10-25 15:18:27 +01:00
Oleh Krehel
567570af41 Fix 'at-full moving text when visual-line-mode is on
* avy.el (avy--overlay-at-full): Compute line-end-position according to
  `visual-line-mode'.
(avy--update-offset-and-str): Add one more arg.

Note that `visual-line-mode' is actually extremely slow. If you have a
lot of candidates, you'll get a perceptible slowdown.
2015-10-25 15:08:13 +01:00
Oleh Krehel
0756c0b48a avy.el (avy--overlay-at-full): Use avy--overlay
* avy.el (avy-styles-alist): Reset to nil.
(avy--overlay): Also set 'category to 'avy.
(avy--overlay-at-full): Use `avy--overlay'.

Fixes #110
2015-10-25 14:50:24 +01:00
Oleh Krehel
d4b693f274 avy.el (avy--overlay): Take BEG END, instead of only BEG
* avy.el (avy--overlay):
(avy--overlay-pre):
(avy--overlay-at):
(avy--overlay-post): Update.
Previously, END was implied to be (1+ BEG).
2015-10-25 14:29:45 +01:00
Oleh Krehel
13377d92b2 avy.el (avy--update-offset-and-str): Split from avy--overlay-at-full
* avy.el (avy--update-offset-and-str): New defun.
(avy--overlay-at-full): Update.
2015-10-25 14:17:34 +01:00
Oleh Krehel
2d07a49f7f Make avy--overlay-at use avy--overlay
* avy.el (avy--overlay): Add optional COMPOSE-FN argument.
(avy--overlay-at): Use `avy--overlay'.
2015-10-25 13:30:14 +01:00
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
Oleh Krehel
44d76b9d2a Bump version to 0.3.0
* doc/Changelog.org: Start tracking the changes in each new version.
2015-06-19 17:59:25 +02:00
Nelson Loyola
a7c92d884f Updated screenshot image for ivy-goto-char.
Fixes #65
Fixes #64
2015-06-17 19:44:30 +02:00
Oleh Krehel
e5104ca416 avy.el (avy-goto-word-1): Quote punctuation
Fixes #63
2015-06-15 19:48:08 +02:00
Oleh Krehel
7b0ba80620 avy.el (avy-style): Switch the default from 'pre to 'at-full 2015-06-15 16:25:49 +02:00
Oleh Krehel
7376a0c611 avy.el (avy--overlay-at-full): Fixup (for overlays-in)
* 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.
2015-06-15 16:17:58 +02:00
Oleh Krehel
15c7f9fe39 targets/avy-init.el: Use the new checkdoc-file
* targets/avy-init.el (checkdoc-file): This function is now available in
  trunk Emacs.
2015-06-08 13:07:52 +02:00
Oleh Krehel
054390f5f6 avy.el (avy-translate-char-function): Fixup doc 2015-06-08 13:04:31 +02:00
Tim Perkins
236293a401 avy.el (avy-isearch): Allow different styles
Fixes #61
2015-06-06 16:41:57 -04:00
York Zhao
035d663ab4 Add `avy-translate-char-function' to translate user input key
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
2015-06-04 17:37:59 +02:00
Oleh Krehel
02bf35b6a0 Modify at-full' and de-bruijn' overlays to color depth
* 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
2015-06-03 18:19:00 +02:00
Oleh Krehel
6dfa445e07 README.md: Mention a custom-command tutorial
Fixes #55
2015-06-03 17:30:14 +02:00
Oleh Krehel
27b3da3f4b avy.el (avy-goto-char-in-line): Fix to this window
Fixes #58
2015-06-02 18:54:04 +02:00
Oleh Krehel
fc93fe676c avy.el (avy-ignored-modes): New defcustom.
* avy.el (avy-dowindows): Use `avy-ignored-modes'.

Fixes #57
2015-06-02 17:38:38 +02:00
Oleh Krehel
7a008217e3 avy.el (avy-dowindows): Ignore pdf-view-mode
Fixes #57
2015-06-02 16:59:57 +02:00
Oleh Krehel
1350ab318e avy.el (avy-goto-char-in-line): Quote char
Fixes #56
2015-06-02 16:57:50 +02:00
Oleh Krehel
78d20e0b02 Fix jumping to other frames
* avy.el (avy--goto): Select the window frame if needed.

Fixes #54
2015-05-30 10:11:04 +02:00
Oleh Krehel
9ddde6dd79 avy.el (avy--overlay-at-full): Improve
Re #51
2015-05-26 16:59:01 +02:00
Oleh Krehel
b5e02ac61c Fixup byte-compile warnings
* avy.el (avy-tree): Move.
2015-05-26 16:05:05 +02:00
Oleh Krehel
55c77c5eb8 For De Bruin, don't build a tree
* avy.el (avy--group-by): Remove.
(avy--path-alist-to-tree): Remove.
(avy-tree-de-bruijn): Remove.
(avy-read-de-bruijn): New defun.
(avy--process): Update.

Instead of building a tree (from a flat sequence) and traversing it,
just use the flat sequence.  This has the advantage of candidates being
in proper buffer-sequential order.

Re #51
Re #5
2015-05-26 15:40:21 +02:00
Tassilo Horn
27b98bb730 Add 'de-bruijn option for avy-style
* avy.el (avy-style): New choice option.
(avy--de-bruijn): New defun.
(avy--path-alist-1): New defun.
(avy--group-by): New defun.
(avy--path-alist-to-tree): New defun.
(avy-tree-de-bruijn): New defun, semi-compatible with `avy-tree'.
(avy--process): Use `avy-tree-de-bruijn' when `avy-style' is 'de-bruijn.
(avy--style-fn): Use `avy--overlay-at-full' when `avy-style' is
'de-bruijn.

Fixes #51
Re #5

TODO: When tree produced by `avy-tree-de-bruijn' is traversed
depth-first, the results should be in-order of their appearance in the
window. Only in this case the overlay functions will work correctly,
since they need to be applied sequentially from window end to window
start.
2015-05-26 14:30:41 +02:00
Oleh Krehel
791c16c6ac avy.el (avy-goto-char-in-line): New command
Fixes #49
2015-05-25 10:12:17 +02:00
Oleh Krehel
aa2eb24f53 Makefile: "all" should depend on "compile" 2015-05-19 16:21:47 +02:00
Oleh Krehel
199c52606d Bump version 2015-05-19 14:29:03 +02:00
Oleh Krehel
be74714fd4 avy.el (avy--overlay-at-full): Work-around 20607
* avy.el (avy--overlay-at-full): There's a problem when there are two
  overlays at the same point in the same buffer, but in different
  windows, *only if* they are of different length. Make them the same
  length to work-around this bug.

See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20607

Fixes #47
2015-05-18 20:38:20 +02:00
Oleh Krehel
a4f4015db4 avy.el (avy--overlay-at-full): Check overlay window
* avy.el (avy--overlay-at-full): Update.

Re #47
2015-05-18 19:14:03 +02:00
Oleh Krehel
92a7884d9c avy.el (avy-window-list): Fixup last commit
* avy.el (avy-window-list): Update.

Fixes #45
2015-05-18 16:31:46 +02:00
Oleh Krehel
b288c69aa0 make compile should run checkdoc
* targets/avy-init.el: Call `checkdoc' for "avy.el". This will actually
  work only in trunk Emacs.
2015-05-18 10:14:00 +02:00
Oleh Krehel
d6b741b444 Allow for all operations to work across frames
* avy.el (avy-all-windows): Change the custom type to choice: this
  window/this frame/all frames.
(avy-window-list): New defun.
(avy-dowindows): Use `avy-window-list'.
(avy--process): Use `avy-window-list'.
2015-05-18 08:57:12 +02:00
Oleh Krehel
dc06220ba0 Fix the at-full style interaction with tabs
* avy.el (avy--overlay-at-full): When at tab, visualize it using
  `tab-width' spaces. Assume the path is shorter than `tab-width'.

Fixes #43
2015-05-17 13:44:17 +02:00
Oleh Krehel
4b4b7b46f1 README.md: Add a link to the wiki for defcustoms 2015-05-17 13:31:16 +02:00
Oleh Krehel
50cfc74ed0 Fixup the last commit and add contribution guidelines
* avy.el (avy-goto-char):
(avy-goto-char-2):
(avy-goto-word-1):
(avy-goto-subword-1):
(avy-goto-word-or-subword-1): Update argument list and docstring.

* README.md: Add a "Contributing" section.

Re #44
2015-05-17 12:40:56 +02:00
Yang Zhao
59c6b9d15e Expose chars to be read as args. 2015-05-16 21:53:09 -07:00
Oleh Krehel
ea6f5c5953 Customize how `avy-lead-face-0' is applied
* avy.el (avy-highlight-first): New defcustom. When non-nil, use
  `avy-lead-face-0' even on terminal chars.
(avy--overlay-pre): Update.
(avy--overlay-at-full): Update.
(avy--overlay-post): Update.

Fixes #42
2015-05-16 19:33:17 +02:00
Oleh Krehel
1127467669 avy.el (avy-move-line): Use ARG lines 2015-05-16 17:59:35 +02:00
Ting-Yu Lin
f0694a2b73 Remove empty line after original one being moved
Fixed #40.
2015-05-14 18:10:17 +08:00
Oleh Krehel
a39f689908 Allow all kinds of styles for `avy-goto-line'
* avy.el (avy--line): Use the custom style. Use line end postion for
  'post style.

Fixes abo-abo/ace-link#17

Any of the following do something different now:

(setq avy-styles-alist
      '((avy-goto-line . post)))
(setq avy-styles-alist
      '((avy-goto-line . at)))
(setq avy-styles-alist
      '((avy-goto-line . at-full)))
(setq avy-styles-alist
      '((avy-goto-line . pre)))
2015-05-14 00:05:28 +02:00
Oleh Krehel
b0512fc8f7 avy.el (avy--overlay-at): Use `avy--overlay-offset'
Fixes abo-abo/lispy#70
2015-05-13 23:31:34 +02:00
Oleh Krehel
8efed4072a Add `avy-lead-face-1' for dimmed matched chars
* avy.el (avy-lead-face-0): Update doc.
(avy-lead-face-1): New face.
(avy-current-path): New defvar.
(avy-read): Store the current matched chars in `avy-current-path'.
(avy--overlay-pre):
(avy--overlay-post): Extend the string with the matched part. This
prevents shifting during selection, and looks nice too.

Fixes #38
2015-05-12 12:46:09 +02:00
Oleh Krehel
e35f1ed51f Use `avy-lead-face-0' for 'pre and 'post
* avy.el (avy--overlay-pre): Update.
(avy--overlay-post): Update.

Re #38
2015-05-12 12:01:59 +02:00
Oleh Krehel
7433f309a7 With 'at-full style, use full len to check for overlap
avy.el (avy--overlay-at-full): Update.
2015-05-12 10:52:39 +02:00
Oleh Krehel
b602a560be Stop 'at-full from shifting text
* avy.el (avy-read): Call DISPLAY-FN in buffer's reverse order.
(avy--overlay-at-full): When there's an avy overlay after point, shorten
the current overlay to one letter.

Re #5
2015-05-11 21:26:23 +02:00
Oleh Krehel
0d83599d80 Update group name 2015-05-11 19:48:56 +02:00
Oleh Krehel
eed8f6fa8b avy.el (avy--regex-candidates): Add optional group arg 2015-05-11 14:39:19 +02:00
Oleh Krehel
ca69b1f5a0 Add debug declarations 2015-05-11 14:39:01 +02:00
Oleh Krehel
dfbf0e21a6 targets/avy-init.el: Update 2015-05-11 14:38:46 +02:00
Bozhidar Batsov
60dd24ba79 Update avy-jump mentions in the README 2015-05-11 11:41:22 +03:00
Oleh Krehel
410c4acecc Merge avy-jump.el into avy.el
Fixes #31
2015-05-11 10:33:16 +02:00
Oleh Krehel
2e936d8cc3 avy-jump.el (avy-goto-word-or-subword-1): New command
Fixes #33
2015-05-11 10:26:09 +02:00
Oleh Krehel
755c25a89b Add a new face for 'at-full style
* avy-jump.el (avy-lead-face-0): New face.
(avy--overlay-at-full): If the path is longer than 1, propertize the
first char with `avy-lead-face-0'.

Re #5
2015-05-11 09:45:49 +02:00
Oleh Krehel
ca302b4fe6 targets/avy-init.el: Move
* Makefile: Update.

Fixes #32
Fixes milkypostman/melpa/#2758
2015-05-11 09:39:44 +02:00
Oleh Krehel
04d26c4d21 avy-jump.el (avy-case-fold-search): New defcustom
* avy-jump.el (avy--regex-candidates): Use `avy-case-fold-search'.
When it is t, the case will be ignored while jumping.

Fixes abo-abo/ace-window#34
2015-05-10 13:30:38 +02:00
Oleh Krehel
05e5c4d12e README.md: mention avy-goto-line -> goto-line 2015-05-09 20:01:57 +02:00
Oleh Krehel
a53ffb7cec Allow to break from avy-goto-line' into goto-line'
* avy.el (avy-handler-default): New defun.
(avy-handler-function): New variable. Bind this temporarily to catch bad chars.
(avy-read): Forward to `avy-handler-default'.

* avy-jump.el (avy--goto): Consider the case of 'exit symbol being
  returned.
(avy-goto-line): Bind `avy-handler-function' to catch digits and call
`goto-line' in that case.

Fixes #29
2015-05-09 18:14:50 +02:00
Oleh Krehel
a08b049edd Fix jumping to newlines with at-full style
* avy-jump.el (avy--overlay-at-full): Update.

Re #5
2015-05-09 16:44:58 +02:00
Oleh Krehel
3716cd0b02 avy-jump.el (avy-goto-subword-0): Update candidate order
Re #27
2015-05-09 14:43:52 +02:00
Oleh Krehel
cd8e62603f avy-jump.el (avy-dowindows): Simplify
Re #27
2015-05-09 14:23:23 +02:00
Oleh Krehel
c2e7de3a4d avy-jump.el (avy-goto-subword-0): Add nreverse
Re #27
2015-05-09 14:21:59 +02:00
9 changed files with 2691 additions and 619 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
liberapay: abo-abo
patreon: abo_abo

View File

@ -3,18 +3,21 @@ emacs ?= emacs
LOAD = -l avy.el -l avy-test.el
.PHONY: all test clean
.PHONY: all test clean checkdoc
all: test
all: compile test checkdoc
test:
$(emacs) -batch $(LOAD) -f ert-run-tests-batch-and-exit
checkdoc:
$(emacs) -batch -l targets/checkdoc.el
compile:
$(emacs) -batch -l avy-init.el
$(emacs) -batch -l targets/avy-init.el
run:
$(emacs) -Q -l avy-init.el
$(emacs) -Q -l targets/avy-init.el
clean:
rm -f *.elc

View File

@ -1,8 +1,12 @@
[![GNU ELPA](https://elpa.gnu.org/packages/avy.svg)](https://elpa.gnu.org/packages/avy.html)
[![MELPA](https://melpa.org/packages/avy-badge.svg)](https://melpa.org/#/avy)
[![MELPA Stable](https://stable.melpa.org/packages/avy-badge.svg)](https://stable.melpa.org/#/avy)
## Introduction
`avy-jump` is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also [ace-jump-mode](https://github.com/winterTTr/ace-jump-mode) and [vim-easymotion](https://github.com/Lokaltog/vim-easymotion) - `avy-jump` uses the same idea.
`avy` is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also [ace-jump-mode](https://github.com/winterTTr/ace-jump-mode) and [vim-easymotion](https://github.com/Lokaltog/vim-easymotion) - `avy` uses the same idea.
![logo](https://raw.githubusercontent.com/wiki/abo-abo/avy-jump/images/avy-avatar-1.png)
![logo](https://raw.githubusercontent.com/wiki/abo-abo/avy/images/avy-avatar-1.png)
## Command overview
@ -13,12 +17,12 @@ You can bind some of these useful commands in your config.
> Input one char, jump to it with a tree.
```elisp
(global-set-key (kbd "π") 'avy-goto-char)
(global-set-key (kbd "C-:") 'avy-goto-char)
```
After <kbd>πb</kbd>:
After <kbd>C-: b</kbd>:
![avy-goto-char](http://oremacs.com/download/avi-goto-char.png)
![avy-goto-char](https://raw.githubusercontent.com/wiki/nloyola/avy/images/avy-goto-char.png)
### `avy-goto-char-2`
@ -34,6 +38,13 @@ After <kbd>C-' bu</kbd>:
![avy-goto-char-2](http://oremacs.com/download/avi-goto-char-2.png)
### `avy-goto-char-timer`
> Input an arbitrary amount of consecutive chars, jump to the first one with a tree.
This is a more flexible version of `avy-goto-char-2`. First part works similarly to `isearch`: you type a query and it's highlighted dynamically on the screen. When you stop typing for `avy-timeout-seconds` (0.5s by default), you'll be able to select one of the candidates with `avy`. As you're inputting characters, you can use `C-h` (backspace) or `DEL` (delete) to
forget the last typed character and `RET` to end the input sequence immediately and select a candidate.
### `avy-goto-line`
> Input zero chars, jump to a line start with a tree.
@ -46,6 +57,8 @@ After <kbd>M-g f</kbd>:
![avy-goto-line](http://oremacs.com/download/avi-goto-line.png)
You can actually replace the <kbd>M-g g</kbd> binding of `goto-line`, since if you enter a digit for `avy-goto-line`, it will switch to `goto-line` with that digit already entered.
### `avy-goto-word-1`
> Input one char at word start, jump to a word start with a tree.
@ -72,6 +85,10 @@ After <kbd>M-g e</kbd>:
![avy-goto-word-0](http://oremacs.com/download/avi-goto-word-0.png)
### Org-mode commands
* `avy-org-goto-heading-timer`: Type part of an Org heading. When you stop typing, if only one heading on the screen matches, it will be jumped to; if more than one matches, you can jump to a heading with Avy. This is like `avy-goto-char-timer` but for Org headings.
* `avy-org-refile-as-child`: With point in an entry you want to refile, run this command, select a heading with Avy, and the entry will be refiled as its first child heading. This makes it quick and easy to refile to headings that are visible on-screen, even to other windows or buffers.
### Other commands
@ -83,18 +100,29 @@ You add this to your config to bind some stuff:
```elisp
(avy-setup-default)
(global-set-key (kbd "C-c C-j") 'avy-resume)
```
It will bind, for example, `avy-isearch` to <kbd>C-'</kbd> in `isearch-mode-map`, so that you can select one of the currently visible `isearch` candidates using `avy`.
### Style customization
### Customization
There are four styles of overlay functions to choose from. You can choose to use one style for all functions, or you can select a different style for each function. Customize `avy-style` and `avy-styles-alist` respectively for this.
The styles to choose from:
See the comprehensive custom variable list on [the defcustom wiki page](https://github.com/abo-abo/avy/wiki/defcustom).
- pre: the full path will be displayed before target, leaving all original text
- at: the single character path will be displayed on target, obscuring the target
- at-full: the full path will be displayed on target, obscuring the target and the text behind it
- post: the full path will be displayed after target, leaving all original text
See how to write your own avy commands on [the custom-commands wiki page](https://github.com/abo-abo/avy/wiki/custom-commands).
At first it seems that `pre` and `post` are advantageous over `at` and `at-full`, since you can still see the original text with them. However, they make the text shift a bit. If you don't like that, use either `at` or `at-full`.
## Contributing
### Copyright Assignment
Avy is subject to the same [copyright assignment](http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html) policy as Emacs itself, org-mode, CEDET and other packages in [GNU ELPA](http://elpa.gnu.org/packages/). Any [legally significant](http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant) contributions can only be accepted after the author has completed their paperwork. Please see [the request form](http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future) if you want to proceed.
The copyright assignment isn't a big deal, it just says that the copyright for your submitted changes to Emacs belongs to the FSF. This assignment works for all projects related to Emacs. To obtain it, you need to send one email, then send one letter (if you live in the US, it's digital), and wait for some time (in my case, I had to wait for one month).
### Style
The basic code style guide is to use `(setq indent-tabs-mode nil)`. It is provided for you in [.dir-locals.el](https://github.com/abo-abo/avy/blob/master/.dir-locals.el), please obey it.
Before submitting the change, run `make compile` and `make test` to make sure that it doesn't introduce new compile warnings or test failures. Also run `make checkdoc` to see that your changes obey the documentation guidelines.
Use your own judgment for the commit messages, I recommend a verbose style using `magit-commit-add-log`.

View File

@ -1,579 +0,0 @@
;;; avy-jump.el --- jump to things tree-style. -*- lexical-binding: t -*-
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Oleh Krehel
;; This file is part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; This package offers various commands for navigating to things using `avy'.
;; They are in the "Commands" outline.
;;; Code:
;;* Requires
(require 'cl-lib)
(require 'avy)
;;* Customization
(defgroup avy-jump nil
"Jump to things tree-style."
:group 'convenience
:prefix "avy-")
(defcustom avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
"Default keys for jumping."
:type '(repeat :tag "Keys" character))
(defcustom avy-keys-alist nil
"Alist of avy-jump commands to `avy-keys' overriding the default `avy-keys'."
:type '(alist
:key-type (choice :tag "Command"
(const avy-goto-char)
(const avy-goto-char-2)
(const avy-isearch)
(const avy-goto-line)
(const avy-goto-subword-0)
(const avy-goto-subword-1)
(const avy-goto-word-0)
(const avy-goto-word-1)
(const avy-copy-line)
(const avy-copy-region)
(const avy-move-line))
:value-type (repeat :tag "Keys" character)))
(defcustom avy-style 'pre
"The default method of displaying the overlays.
Use `avy-styles-alist' to customize this per-command."
:type '(choice
(const :tag "Pre" pre)
(const :tag "At" at)
(const :tag "At Full" at-full)
(const :tag "Post" post)))
(defcustom avy-styles-alist nil
"Alist of avy-jump commands to the style for each command.
If the commands isn't on the list, `avy-style' is used."
:type '(alist
:key-type (choice :tag "Command"
(const avy-goto-char)
(const avy-goto-char-2)
(const avy-isearch)
(const avy-goto-line)
(const avy-goto-subword-0)
(const avy-goto-subword-1)
(const avy-goto-word-0)
(const avy-goto-word-1)
(const avy-copy-line)
(const avy-copy-region)
(const avy-move-line))
:value-type (choice
(const :tag "Pre" pre)
(const :tag "At" at)
(const :tag "At Full" at-full)
(const :tag "Post" post))))
(defmacro avy--with-avy-keys (command &rest body)
"Set `avy-keys' according to COMMAND and execute BODY."
(declare (indent 1))
`(let ((avy-keys (or (cdr (assq ',command avy-keys-alist))
avy-keys))
(avy-style (or (cdr (assq ',command avy-styles-alist))
avy-style)))
,@body))
(defcustom avy-background nil
"When non-nil, a gray background will be added during the selection."
:type 'boolean)
(defcustom avy-word-punc-regexp "[!-/:-@[-`{-~]"
"Regexp of punctuation chars that count as word starts for `avy-goto-word-1.
When nil, punctuation chars will not be matched.
\"[!-/:-@[-`{-~]\" will match all printable punctuation chars."
:type 'regexp)
(defface avy-lead-face
'((t (:foreground "white" :background "#e52b50")))
"Face used for the leading chars.")
(defface avy-background-face
'((t (:foreground "gray40")))
"Face for whole window background during selection.")
;;* Internals
(defcustom avy-all-windows t
"When non-nil, loop though all windows for candidates."
:type 'boolean)
(defmacro avy-dowindows (flip &rest body)
"Depending on FLIP and `avy-all-windows' run BODY in each or selected window."
(declare (indent 1))
`(let ((avy-all-windows (if ,flip
(not avy-all-windows)
avy-all-windows)))
(dolist (wnd (if avy-all-windows
(cons (selected-window)
(delete (selected-window) (window-list)))
(list (selected-window))))
(with-selected-window wnd
(unless (memq major-mode '(image-mode doc-view-mode))
,@body)))))
(defun avy--goto (x)
"Goto X.
X is (POS . WND)
POS is either a position or (BEG . END)."
(if (null x)
(message "zero candidates")
(select-window (cdr x))
(let ((pt (car x)))
(when (consp pt)
(setq pt (car pt)))
(unless (= pt (point)) (push-mark))
(goto-char pt))))
(defun avy--process (candidates overlay-fn)
"Select one of CANDIDATES using `avy-read'.
Use OVERLAY-FN to visualize the decision overlay."
(unwind-protect
(cl-case (length candidates)
(0
nil)
(1
(car candidates))
(t
(avy--make-backgrounds
(if avy-all-windows
(window-list)
(list (selected-window))))
(avy-read (avy-tree candidates avy-keys)
overlay-fn
#'avy--remove-leading-chars)))
(avy--done)))
(defvar avy--overlays-back nil
"Hold overlays for when `avy-background' is t.")
(defun avy--make-backgrounds (wnd-list)
"Create a dim background overlay for each window on WND-LIST."
(when avy-background
(setq avy--overlays-back
(mapcar (lambda (w)
(let ((ol (make-overlay
(window-start w)
(window-end w)
(window-buffer w))))
(overlay-put ol 'face 'avy-background-face)
(overlay-put ol 'window w)
ol))
wnd-list))))
(defun avy--done ()
"Clean up overlays."
(mapc #'delete-overlay avy--overlays-back)
(setq avy--overlays-back nil)
(avy--remove-leading-chars))
(defun avy--regex-candidates (regex &optional beg end pred)
"Return all elements that match REGEX.
Each element of the list is ((BEG . END) . WND)
When PRED is non-nil, it's a filter for matching point positions."
(let (candidates)
(avy-dowindows nil
(let ((we (or end (window-end (selected-window) t))))
(save-excursion
(goto-char (or beg (window-start)))
(while (re-search-forward regex we t)
(unless (get-char-property (point) 'invisible)
(when (or (null pred)
(funcall pred))
(push (cons (cons (match-beginning 0)
(match-end 0))
wnd) candidates)))))))
(nreverse candidates)))
(defvar avy--overlay-offset 0
"The offset to apply in `avy--overlay'.")
(defvar avy--overlays-lead nil
"Hold overlays for leading chars.")
(defun avy--remove-leading-chars ()
"Remove leading char overlays."
(mapc #'delete-overlay avy--overlays-lead)
(setq avy--overlays-lead nil))
(defun avy--overlay (str pt wnd)
"Create an overlay with STR at PT in WND."
(when (<= (1+ pt) (with-selected-window wnd (point-max)))
(let* ((pt (+ pt avy--overlay-offset))
(ol (make-overlay pt (1+ pt) (window-buffer wnd)))
(old-str (with-selected-window wnd
(buffer-substring pt (1+ pt)))))
(when avy-background
(setq old-str (propertize
old-str 'face 'avy-background-face)))
(overlay-put ol 'window wnd)
(overlay-put ol 'display (concat str old-str))
(push ol avy--overlays-lead))))
(defun avy--overlay-pre (path leaf)
"Create an overlay with PATH at LEAF.
PATH is a list of keys from tree root to LEAF.
LEAF is normally ((BEG . END) . WND)."
(avy--overlay
(propertize (apply #'string (reverse path))
'face 'avy-lead-face)
(cond ((numberp leaf)
leaf)
((consp (car leaf))
(caar leaf))
(t
(car leaf)))
(if (consp leaf)
(cdr leaf)
(selected-window))))
(defun avy--overlay-at (path leaf)
"Create an overlay with PATH at LEAF.
PATH is a list of keys from tree root to LEAF.
LEAF is normally ((BEG . END) . WND)."
(let ((str (propertize
(string (car (last path)))
'face 'avy-lead-face))
(pt (if (consp (car leaf))
(caar leaf)
(car leaf)))
(wnd (cdr leaf)))
(let ((ol (make-overlay pt (1+ pt)
(window-buffer wnd)))
(old-str (with-selected-window wnd
(buffer-substring pt (1+ pt)))))
(when avy-background
(setq old-str (propertize
old-str 'face 'avy-background-face)))
(overlay-put ol 'window wnd)
(overlay-put ol 'display (if (string= old-str "\n")
(concat str "\n")
str))
(push ol avy--overlays-lead))))
(defun avy--overlay-at-full (path leaf)
"Create an overlay with PATH at LEAF.
PATH is a list of keys from tree root to LEAF.
LEAF is normally ((BEG . END) . WND)."
(let* ((str (propertize
(apply #'string (reverse path))
'face 'avy-lead-face))
(len (length path))
(pt (if (consp (car leaf))
(caar leaf)
(car leaf)))
(wnd (cdr leaf)))
(let ((ol (make-overlay pt (+ pt len)
(window-buffer wnd)))
(old-str (with-selected-window wnd
(buffer-substring pt (1+ pt)))))
(when avy-background
(setq old-str (propertize
old-str 'face 'avy-background-face)))
(overlay-put ol 'window wnd)
(overlay-put ol 'display (if (string= old-str "\n")
(concat str "\n")
str))
(push ol avy--overlays-lead))))
(defun avy--overlay-post (path leaf)
"Create an overlay with PATH at LEAF.
PATH is a list of keys from tree root to LEAF.
LEAF is normally ((BEG . END) . WND)."
(avy--overlay
(propertize (apply #'string (reverse path))
'face 'avy-lead-face)
(cond ((numberp leaf)
leaf)
((consp (car leaf))
(cdar leaf))
(t
(car leaf)))
(if (consp leaf)
(cdr leaf)
(selected-window))))
(defun avy--style-fn (style)
"Transform STYLE symbol to a style function."
(cl-case style
(pre #'avy--overlay-pre)
(at #'avy--overlay-at)
(at-full 'avy--overlay-at-full)
(post #'avy--overlay-post)
(t (error "Unexpected style %S" style))))
(defun avy--generic-jump (regex window-flip style)
"Jump to REGEX.
When WINDOW-FLIP is non-nil, do the opposite of `avy-all-windows'.
STYLE determines the leading char overlay style."
(let ((avy-all-windows
(if window-flip
(not avy-all-windows)
avy-all-windows)))
(avy--goto
(avy--process
(avy--regex-candidates regex)
(avy--style-fn style)))))
;;* Commands
;;;###autoload
(defun avy-goto-char (&optional arg)
"Read one char and jump to it.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
(avy--with-avy-keys avy-goto-char
(avy--generic-jump
(let ((c (read-char "char: ")))
(if (= 13 c)
"\n"
(regexp-quote (string c))))
arg
avy-style)))
;;;###autoload
(defun avy-goto-char-2 (&optional arg)
"Read two consecutive chars and jump to the first one.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
(avy--with-avy-keys avy-goto-char-2
(avy--generic-jump
(regexp-quote (string
(read-char "char 1: ")
(read-char "char 2: ")))
arg
avy-style)))
;;;###autoload
(defun avy-isearch ()
"Jump to one of the current isearch candidates."
(interactive)
(avy--with-avy-keys avy-isearch
(let* ((candidates
(avy--regex-candidates isearch-string))
(avy-background nil)
(candidate
(avy--process candidates #'avy--overlay-post)))
(isearch-done)
(avy--goto candidate))))
;;;###autoload
(defun avy-goto-word-0 (arg)
"Jump to a word start.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
(avy--with-avy-keys avy-goto-word-0
(avy--generic-jump "\\b\\sw" arg avy-style)))
;;;###autoload
(defun avy-goto-word-1 (&optional arg)
"Read one char at word start and jump there.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
(avy--with-avy-keys avy-goto-word-1
(let* ((str (string (read-char "char: ")))
(regex (cond ((string= str ".")
"\\.")
((and avy-word-punc-regexp
(string-match avy-word-punc-regexp str))
str)
(t
(concat
"\\b"
str)))))
(avy--generic-jump regex arg avy-style))))
(declare-function subword-backward "subword")
;;;###autoload
(defun avy-goto-subword-0 (&optional arg predicate)
"Jump to a word or subword start.
The window scope is determined by `avy-all-windows' (ARG negates it).
When PREDICATE is non-nil it's a function of zero parameters that
should return true."
(interactive "P")
(require 'subword)
(avy--with-avy-keys avy-goto-subword-0
(let ((case-fold-search nil)
candidates)
(avy-dowindows arg
(let ((ws (window-start)))
(save-excursion
(goto-char (window-end (selected-window) t))
(subword-backward)
(while (> (point) ws)
(when (or (null predicate)
(and predicate (funcall predicate)))
(push (cons (point) (selected-window)) candidates))
(subword-backward)))))
(avy--goto
(avy--process candidates (avy--style-fn avy-style))))))
;;;###autoload
(defun avy-goto-subword-1 (&optional arg)
"Prompt for a subword start char and jump there.
The window scope is determined by `avy-all-windows' (ARG negates it).
The case is ignored."
(interactive "P")
(avy--with-avy-keys avy-goto-subword-1
(let ((char (downcase (read-char "char: "))))
(avy-goto-subword-0
arg (lambda () (eq (downcase (char-after)) char))))))
(defun avy--line (&optional arg)
"Select a line.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(let ((avy-background nil)
candidates)
(avy-dowindows arg
(let ((ws (window-start)))
(save-excursion
(save-restriction
(narrow-to-region ws (window-end (selected-window) t))
(goto-char (point-min))
(while (< (point) (point-max))
(unless (get-char-property
(max (1- (point)) ws) 'invisible)
(push (cons (point) (selected-window)) candidates))
(forward-line 1))))))
(avy--process (nreverse candidates) #'avy--overlay-pre)))
;;;###autoload
(defun avy-goto-line (&optional arg)
"Jump to a line start in current buffer.
The window scope is determined by `avy-all-windows' (ARG negates it)."
(interactive "P")
(avy--with-avy-keys avy-goto-line
(avy--goto (avy--line arg))))
;;;###autoload
(defun avy-copy-line (arg)
"Copy a selected line above the current line.
ARG lines can be used."
(interactive "p")
(avy--with-avy-keys avy-copy-line
(let ((start (car (avy--line))))
(move-beginning-of-line nil)
(save-excursion
(insert
(buffer-substring-no-properties
start
(save-excursion
(goto-char start)
(move-end-of-line arg)
(point)))
"\n")))))
;;;###autoload
(defun avy-move-line (arg)
"Move a selected line above the current line.
ARG lines can be used."
(interactive "p")
(avy--with-avy-keys avy-move-line
(let ((start (car (avy--line))))
(move-beginning-of-line nil)
(save-excursion
(save-excursion
(goto-char start)
(move-end-of-line arg)
(kill-region start (point)))
(insert
(current-kill 0)
"\n")))))
;;;###autoload
(defun avy-copy-region ()
"Select two lines and copy the text between them here."
(interactive)
(avy--with-avy-keys avy-copy-region
(let ((beg (car (avy--line)))
(end (car (avy--line)))
(pad (if (bolp) "" "\n")))
(move-beginning-of-line nil)
(save-excursion
(insert
(buffer-substring-no-properties
beg
(save-excursion
(goto-char end)
(line-end-position)))
pad)))))
;;;###autoload
(defun avy-setup-default ()
"Setup the default shortcuts."
(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-style)))
(define-obsolete-variable-alias
'avy-goto-char-style 'avy-style "0.1.0"
"Use `avy-style' and `avy-styles-alist' instead.")
(define-obsolete-variable-alias
'avy-goto-word-style 'avy-style "0.1.0"
"Use `avy-style' and `avy-styles-alist' instead.")
(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")
(define-obsolete-face-alias 'avi-lead-face 'avy-lead-face "0.1.0")
(define-obsolete-function-alias 'avi--goto 'avy--goto "0.1.0")
(define-obsolete-function-alias 'avi--process 'avy--process "0.1.0")
(define-obsolete-variable-alias 'avi-all-windows 'avy-all-windows "0.1.0")
(define-obsolete-function-alias 'avi--overlay-pre 'avy--overlay-pre "0.1.0")
(define-obsolete-function-alias 'avi--overlay-at 'avy--overlay-at "0.1.0")
(define-obsolete-function-alias 'avi--overlay-post 'avy--overlay-post "0.1.0")
(define-obsolete-function-alias 'avi-goto-char 'avy-goto-char "0.1.0")
(define-obsolete-function-alias 'avi-goto-char-2 'avy-goto-char-2 "0.1.0")
(define-obsolete-function-alias 'avi-isearch 'avy-isearch "0.1.0")
(define-obsolete-function-alias 'avi-goto-word-0 'avy-goto-word-0 "0.1.0")
(define-obsolete-function-alias 'avi-goto-subword-0 'avy-goto-subword-0 "0.1.0")
(define-obsolete-function-alias 'avi-goto-word-1 'avy-goto-word-1 "0.1.0")
(define-obsolete-function-alias 'avi-goto-line 'avy-goto-line "0.1.0")
(define-obsolete-function-alias 'avi-copy-line 'avy-copy-line "0.1.0")
(define-obsolete-function-alias 'avi-move-line 'avy-move-line "0.1.0")
(define-obsolete-function-alias 'avi-copy-region 'avy-copy-region "0.1.0")
(define-obsolete-function-alias 'avi--regex-candidates 'avy--regex-candidates "0.1.0")
(provide 'avy-jump)
;;; avy-jump.el ends here

View File

@ -66,3 +66,7 @@
(108 (97 leaf . 8)
(115 leaf . 9)
(100 leaf . 10))))))
(provide 'avy-test)
;;; avy-test.el ends here

2156
avy.el

File diff suppressed because it is too large Load Diff

498
doc/Changelog.org Normal file
View File

@ -0,0 +1,498 @@
* 0.3.0
** Fixes
*** Candidate window reversal
See [[https://github.com/abo-abo/avy/issues/27][#27]].
*** Jumping to newlines with =at-full= style
See [[https://github.com/abo-abo/avy/issues/5][#5]].
*** Stop =at-full= style from shifting text sometimes
See [[https://github.com/abo-abo/avy/issues/5][#5]].
*** Fix =at-full= interaction with tabs
When at a tab, visualize it using =tab-width= spaces.
See [[https://github.com/abo-abo/avy/issues/43][#43]].
*** Fix overlay issue when the same buffer is in two windows
See [[https://github.com/abo-abo/avy/issues/47][#47]] and http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20607.
*** Quote punctuation chars
See [[https://github.com/abo-abo/avy/issues/63][#63]].
*** Update screenshot for =avy-goto-char= in README.md
Use ~C-:~ as the new suggested binding instead of the pi char.
See [[https://github.com/abo-abo/avy/issues/64][#64]].
** New Features
*** =avy-goto-line= can now break into =goto-line=
Just enter a digit and you'll be transferred into =goto-line= prompt
with that digit already entered. This means that you can just bind
~M-g g~ to =avy-goto-line= without losing anything.
See [[https://github.com/abo-abo/avy/issues/29][#29]].
*** =avy-goto-line= now works with all kinds of overlay styles
Any of the following do something different now:
#+begin_src elisp
(setq avy-styles-alist
'((avy-goto-line . post)))
(setq avy-styles-alist
'((avy-goto-line . at)))
(setq avy-styles-alist
'((avy-goto-line . at-full)))
(setq avy-styles-alist
'((avy-goto-line . pre)))
#+end_src
See [[https://github.com/abo-abo/ace-link/issues/17][#17]].
*** New defcustom =avy-case-fold-search=
Non-nil when searches should ignore case, so e.g. =avy-goto-char= "b"
will match both "b" and "B". On by default. Use this to turn off this
behavior:
#+begin_src elisp
(setq avy-case-fold-search nil)
#+end_src
See [[https://github.com/abo-abo/avy/issues/34][#34]].
*** New command =avy-goto-word-or-subword-1=
Enter one char, and select a visible word or subword that starts with
it, depending on =subword-mode=. Move the point there.
See [[https://github.com/abo-abo/avy/issues/33][#33]].
*** =avy-move-line= should remove empty line after original one is moved
See [[https://github.com/abo-abo/avy/issues/40][#40]].
*** =avy-move-line= now takes a prefix arg
Use e.g. ~M-3~ before =avy-move-line= to move 3 lines at once.
*** Most commands can be used non-interactively
Example:
#+begin_src elisp
(defun avy-goto-lp ()
(interactive)
(avy-goto-char ?\())
#+end_src
This command only goes to the "(" character. This is actually very
similar to [[http://oremacs.com/lispy/#lispy-ace-paren][=lispy-ace-paren=]], except the implementation is only one
line.
See [[https://github.com/abo-abo/avy/issues/44][#44]].
*** (almost) all defcustoms are explained on the wiki
See [[https://github.com/abo-abo/avy/wiki/defcustom][the defcustom wiki page]].
*** Allow all operations to work across frames
You have to customize =avy-all-windows= for this. By default, it's set
to work on all windows on the current frame.
To make it work only on the current window, use:
#+begin_src elisp
(setq avy-all-windows nil)
#+end_src
To make it work on all frames, use:
#+begin_src elisp
(setq avy-all-windows 'all-frames)
#+end_src
*** New command =avy-goto-char-in-line=
This is =avy-goto-char= reduced only to the current line. Few
candidates means very short decision chars path.
See [[https://github.com/abo-abo/avy/issues/49][#49]].
*** New overlay style =de-bruijn=
How to use it:
#+begin_src elisp
(setq avy-style 'de-bruijn)
#+end_src
What it does: when your leading chars are clumped up together, it's
impossible to overlay the decision path without shifting the buffer
text a bit. For example, with the word "buffer", you =avy-goto-char= "b", and:
- the path for the first "f" is "aj"
- the path for the second "f" is "ak"
It's not possible to overlay 4 characters over "ff" in "buffer". But
to with =de-bruijn= style, which results in the path being "aj" and
"jk". It's possible to overlay "ajk" just fine.
Pros and cons of =de-bruijn= over other styles:
- a pro is that it's possible to display the full decision path for
clumped up chars, which is truncated for other styles
- a con is that the decision path is of the same length (e.g. 2 or 3)
for all candidates, while with other styles it's possible to have a
few candidates with a shorter path.
See [[https://github.com/abo-abo/avy/issues/51][#51]] and [[https://github.com/abo-abo/avy/issues/5][#5]].
*** New defcustom =avy-ignored-modes=
This is meant for visual modes like =doc-view-mode= or =image-mode=
that can have a huge number of chars in a single window. Which results
in a huge number of candidates even in other windows.
Current setting:
#+begin_src elisp
(setq avy-ignored-modes '(image-mode doc-view-mode pdf-view-mode))
#+end_src
See [[https://github.com/abo-abo/avy/issues/57][#57]].
*** New tutorial on writing custom commands
See the [[https://github.com/abo-abo/avy/wiki/custom-commands][the custom-commands wiki page]] and [[https://github.com/abo-abo/avy/issues/55][#55]].
*** New face setup
New variable =avy-lead-faces= will determine the faces used to color
the current decision depth you're in. For example, if to select a
particular candidate you need to press "abc":
- "a" will be highlighted with a face that corresponds to depth 3
- "b" will be highlighted with a face that corresponds to depth 2
- "c" will be highlighted with a face that corresponds to depth 1
But if another candidate needs "ef":
- "e" will be highlighted with a face that corresponds to depth 2
- "f" will be highlighted with a face that corresponds to depth 1
See [[https://github.com/abo-abo/avy/issues/53][#53]].
*** New variable =avy-translate-char-function=
You can use this, for example, to interpret one character as another in =avy-keys=.
Example:
#+begin_src elisp
(setq avy-translate-char-function
(lambda (c) (if (= c 32) ?a c)))
#+end_src
This will translate ~SPC~ (32) into ~a~. So you can press either ~a~ or ~SPC~ to mean "a".
*** =avy-isearch= works for different styles
See [[https://github.com/abo-abo/avy/issues/61][#61]].
*** Switch the default style from =pre= to =at-full=
I've come to like =at-full= more than =pre= over time. The difference
is that =pre= hides no chars in your buffer, while =at-full= doesn't
shift text.
Use this to restore the previous default behavior:
#+begin_src elisp
(setq avy-style 'pre)
#+end_src
* 0.4.0
** Fixes
*** =avy-goto-char-timer= obeys =avy-styles-alist=
See [[https://github.com/abo-abo/avy/issues/67][#67]].
*** Add =de-bruijn= to the defcustom of =avy-styles-alist=
See [[https://github.com/abo-abo/avy/issues/73][#73]].
*** Respect the current input method for target chars
See [[https://github.com/abo-abo/avy/issues/76][#76]].
*** =avy-goto-subword-0= shouldn't offer invisible chars
See [[https://github.com/abo-abo/avy/issues/90][#90]].
*** Better =case-fold-search= handling
See [[https://github.com/abo-abo/avy/issues/87][#87]].
*** Add misc punctuation to subword commands
See [[https://github.com/abo-abo/avy/issues/93][#93]].
*** Add padding for wide-width chars (ex. Japanese and Chinese)
See [[https://github.com/abo-abo/avy/issues/96][#96]].
*** =avy-goto-line=
**** Push mark for numeric line
See [[https://github.com/abo-abo/avy/issues/74][#74]].
**** Allow numeric prefix arg
The old behavior remains for ARG 1 or 4. For all other ARG, simply go
to that line.
See [[https://github.com/abo-abo/avy/issues/86][#86]].
**** Work for =visual-line-mode=
See [[https://github.com/abo-abo/avy/issues/91][#91]].
**** Don't error on end of buffer
See [[https://github.com/abo-abo/avy/issues/91][#91]].
**** Obey =avy-background=
See [[https://github.com/abo-abo/avy/issues/94][#94]].
**** Fix for narrowed regions
See [[https://github.com/abo-abo/avy/issues/122][#122]], [[https://github.com/abo-abo/avy/issues/123][#123]].
**** Don't modify =avy-action=
See [[https://github.com/abo-abo/avy/issues/124][#124]].
*** =avy-goto-char-timer=
**** May read as many chars as you want
See [[https://github.com/abo-abo/avy/issues/97][#97]].
**** Highlight matches while reading chars
See [[https://github.com/abo-abo/avy/issues/98][#98]].
**** Highlight depending on =avy-all-windows=
See [[https://github.com/abo-abo/avy/issues/104][#104]].
**** Make faster for =org-mode=
See [[https://github.com/abo-abo/avy/issues/100][#100]].
**** Add case fold search
See [[https://github.com/abo-abo/avy/issues/128][#128]].
*** =avy-copy-region=
**** Keep the same selectors for the second pass
See [[https://github.com/abo-abo/avy/issues/120][#120]], [[https://github.com/abo-abo/avy/issues/121][#121]].
**** Copy/move to initial window
See [[https://github.com/abo-abo/avy/issues/131][#131]].
*** Search only in the visible region
See [[https://github.com/abo-abo/avy/issues/108][#108]], [[https://github.com/abo-abo/avy/issues/109][#109]].
*** Fix jumping to the last char of a folded Org outline
See [[https://github.com/abo-abo/avy/issues/108][#108]].
*** Fix for both =org-indent-mode= and =visual-line-mode=
See [[https://github.com/abo-abo/avy/issues/110][#110]].
*** Beep when there are no matches
See [[https://github.com/abo-abo/avy/issues/111][#111]].
*** Simplify overlay code
Most functions reuse =avy--overlay= now.
*** Fix de-bruijn "no catch for tag"
See [[https://github.com/abo-abo/avy/issues/116][#116]].
*** Fix overlays at =point-max=
See [[https://github.com/abo-abo/avy/issues/125][#125]].
*** Improve =case-fold-search= condition
See [[https://github.com/abo-abo/avy/issues/126][#126]].
*** Don't shorten selector string for =visual-line-mode= and =bolp=
See [[https://github.com/abo-abo/avy/issues/129][#129]].
*** Fix interaction with =goto-address-mode=
** New Features
*** Allow non-printing keys in =avy-keys=
Now you can set avy-keys also to the arrow keys and page up/down, e.g.
#+begin_src elisp
(setq avy-keys '(left right up down prior next))
#+end_src
and those will be displayed as ▲, ▼, ◀, ▶, △, ▽ in the overlays. The
display is controlled by the variable =avy-key-to-char-alist=.
See [[https://github.com/abo-abo/avy/issues/77][#77]].
*** Allow to switch action midway from goto to kill/mark/copy
For example, suppose you have:
#+begin_src elisp
(global-set-key (kbd "M-t") 'avy-goto-word-1)
#+end_src
- To jump to a certain word starting with "w" (e.g. first one on
screen): ~M-t w a~
- To copy the word instead of jumping to it: ~M-t w na~.
- To mark the word after jumping to it: ~M-t w ma~.
- To kill the word after jumping to it: ~M-t w xa~.
You can customize =avy-dispatch-alist= to modify these actions.
See [[https://github.com/abo-abo/avy/issues/78][#78]].
*** New command =avy-pop-mark=
Goes back to the last location of =push-mark=:
- has its own history,
- handles multiple frames.
See [[https://github.com/abo-abo/avy/issues/81][#81]] [[https://github.com/abo-abo/avy/issues/88][#88]] [[https://github.com/abo-abo/avy/issues/69][#69]].
*** New commands =avy-goto-line-above= and =avy-goto-line-below=
See [[https://github.com/abo-abo/avy/issues/106][#106]].
*** New defcustom =avy-line-insert-style=
Allows to modify the behavior of =avy-copy-line=, =avy-move-line=, and =avy-copy-region=.
See [[https://github.com/abo-abo/avy/issues/117][#117]].
*** New defcustom =avy-all-windows-alt=
Allows to customize the behavior of =universal-argument= modifying
=avy-all-windows=.
See [[https://github.com/abo-abo/avy/issues/118][#118]].
*** New defcustom =avy-subword-extra-word-chars=
Allows to customize the behavior of =avy-goto-subword-0= and
=avy-goto-subword-1= by adding extra chars that should match as word
constituents.
See [[https://github.com/abo-abo/avy/issues/116][#116]].
* 0.5.0
** Fixes
*** el:avy-action-copy
Save selected window and frame. See [[https://github.com/abo-abo/avy/issues/133][#133]].
Copy line for el:avy-goto-line. See [[https://github.com/abo-abo/avy/issues/191][#191]].
*** el:avy-read
Make ~C-g~ and ~ESC~ fail silently when reading char. See [[https://github.com/abo-abo/avy/issues/137][#137]].
Display error message on mouse clicks. See [[https://github.com/abo-abo/avy/issues/226][#226]].
Update el:avy-current-path before returning. See [[https://github.com/abo-abo/avy/issues/226][#226]].
Quit on ~ESC~. See [[https://github.com/abo-abo/avy/issues/249][#249]].
Fix for el:org-toggle-link-display. See [[https://github.com/abo-abo/avy/issues/261][#261]].
Fix for el:buffer-invisibility-spec being t. See [[https://github.com/abo-abo/avy/issues/264][#264]].
Allow "invisible" 'org-link. See [[https://github.com/abo-abo/avy/issues/269][#269]].
*** el:avy-goto-word-1
Works for "^A"-"^Z", see [[https://github.com/abo-abo/avy/issues/167][#167]].
*** el:avy-goto-subword-0
Add char at window start if empty, See [[https://github.com/abo-abo/avy/issues/145][#145]].
Add option to limit scope. See [[https://github.com/abo-abo/avy/issues/235][#235]].
*** el:avy-goto-subword-1
Check el:char-after. See [[https://github.com/abo-abo/avy/issues/163][#163]].
*** el:avy-isearch
Escape regex. See [[https://github.com/abo-abo/avy/issues/147][#147]].
*** el:avy-goto-char-2
Translate ~RET~ to ~C-j~. See [[https://github.com/abo-abo/avy/issues/153][#153]].
*** el:avy-action-goto
Add el:raise-frame.
*** el:avy-goto-char-timer
Allow ~C-h~ to delete. See [[https://github.com/abo-abo/avy/issues/193][#193]].
Obey el:avy-background for the initial search. See [[https://github.com/abo-abo/avy/issues/259][#259]].
*** el:avy-goto-line
Fix for empty buffer. See [[https://github.com/abo-abo/avy/issues/238][#238]].
Add ability to display candidates from bottom to top. See [[https://github.com/abo-abo/avy/issues/236][#236]].
*** el:avy--overlay-at-full
More consistent face order.
See [[https://github.com/abo-abo/avy/issues/270][#270]].
*** documentation
See [[https://github.com/abo-abo/avy/issues/223][#223]], [[https://github.com/abo-abo/avy/issues/226][#226]], [[https://github.com/abo-abo/avy/issues/218][#218]], [[https://github.com/abo-abo/avy/issues/245][#245]], [[https://github.com/abo-abo/avy/issues/262][#262]].
** New Features
*** API
New functions have been added as drop-in replacements of double-dash (private) avy
functions that were used in other packages and configs. Please replace the references to
the obsolete functions.
**** el:avy-jump
New API function to replace el:avy--generic-jump. See [[https://github.com/abo-abo/avy/issues/265][#265]], [[https://github.com/abo-abo/avy/issues/267][#267]].
**** el:avy-process
New API function to replace el:avy--process. See [[https://github.com/abo-abo/avy/issues/266][#266]].
*** New actions
**** el:avy-action-kill-stay
Kill a word with el:avy-goto-char without moving there.
Bound to ~X~.
**** el:avy-action-ispell
Auto-correct word at point. See [[https://github.com/abo-abo/avy/issues/142][#142]], [[https://github.com/abo-abo/avy/issues/160][#160]], [[https://github.com/abo-abo/avy/issues/161][#161]].
Bound to ~i~.
**** el:avy-action-yank
Yank sexp starting at selected point at the current point. See [[https://github.com/abo-abo/avy/issues/183][#183]].
Bound to ~y~.
**** el:avy-action-teleport
Kill sexp starting on selected point and yank into the current location. See [[https://github.com/abo-abo/avy/issues/207][#207]].
Bound to ~t~.
**** el:avy-action-zap-to-char
Kill from point up to selected point. See [[https://github.com/abo-abo/avy/issues/234][#234]].
Bound to ~z~.
*** New defcustoms
**** New el:avy-style setting: 'words
Use this setting:
#+begin_src elisp
(setq avy-style 'words)
#+end_src
And you'll see overlays like "by", "if", "is", "it", "my" for 2-letter sequences, and
"can", "car", "cog" for 3-letter sequences. You might find them easier to type than "hla",
"lls" and "jhl". But you will have to adjust your el:avy-dispatch-alist, e.g. to use only
upper case characters.
See [[https://github.com/abo-abo/avy/issues/210][#210]], [[https://github.com/abo-abo/avy/issues/219][#219]].
**** el:avy-orders-alist
Use it to customize the order of candidates with relation to point. The default is for
el:avy-goto-char to have the shortest overlay for candidates closest to point.
See [[https://github.com/abo-abo/avy/issues/242][#242]].
**** el:avy-indent-line-overlay
When non-nil el:avy-goto-line will display the line overlay next to the first
non-whitespace character of each line. See [[https://github.com/abo-abo/avy/issues/244][#244]].
**** el:avy-single-candidate-jump
When non-nil, and there is only one candidate, jump there. See [[https://github.com/abo-abo/avy/issues/250][#250]].
**** el:avy-del-last-char-by
Customize keys which delete the last read char. The defaults are ~C-h~ and ~DEL~. See [[https://github.com/abo-abo/avy/issues/251][#251]].
**** el:avy-goto-word-0-regexp
Customize el:avy-goto-word-0. See [[https://github.com/abo-abo/avy/issues/136][#136]], [[https://github.com/abo-abo/avy/issues/156][#156]].
**** el:avy-pre-action
Function to all before el:avy-action. See [[https://github.com/abo-abo/avy/issues/260][#260]].
**** el:avy-enter-times-out
When non-nil (the default), ~RET~ exists el:avy-goto-char-timer early.
When nil, it matches a newline.
See [[https://github.com/abo-abo/avy/issues/220][#220]], [[https://github.com/abo-abo/avy/issues/225][#225]].
*** New commands
**** el:avy-move-region
Select two lines and move the text between them above the current line.
See [[https://github.com/abo-abo/avy/issues/75][#75]], [[https://github.com/abo-abo/avy/issues/187][#187]], [[https://github.com/abo-abo/avy/issues/188][#188]].
**** el:avy-goto-end-of-line
Call el:avy-goto-line and move to the end of the line. See [[https://github.com/abo-abo/avy/issues/240][#240]].
**** el:avy-linum-mode
Minor mode that uses avy hints for el:linum-mode.
**** el:avy-resume
Holds last command avy command after user input. This is a quick way to bring back the
same markers after a jump. See [[https://github.com/abo-abo/avy/issues/157][#157]], [[https://github.com/abo-abo/avy/issues/165][#165]].
**** el:avy-next
Go to the next candidate after el:avy-read.
Example config:
#+begin_src elisp
(defhydra hydra-avy-cycle ()
("j" avy-next "next")
("k" avy-prev "prev")
("q" nil "quit"))
(global-set-key (kbd "C-M-'") 'hydra-avy-cycle/body)
#+end_src
After e.g. el:avy-goto-char or el:avy-goto-char-timer, use the above hydra to cycle
between the last candidates. See [[https://github.com/abo-abo/avy/issues/254][#254]].
**** *-above and *-below variants
Command versions restricted to matches before or after the point.
See [[https://github.com/abo-abo/avy/issues/148][#148]]:
- el:avy-goto-char-2-above
- el:avy-goto-char-2-below
See [[https://github.com/abo-abo/avy/issues/151][#151]]:
- el:avy-goto-word-1-above
- el:avy-goto-word-1-below
See [[https://github.com/abo-abo/avy/issues/156][#156]]:
- el:avy-goto-symbol-1-above
- el:avy-goto-symbol-1-below
See [[https://github.com/abo-abo/avy/issues/186][#186]]:
- el:avy-goto-word-0-below
- el:avy-goto-word-0-above
**** kill and save region functionality
New avy-enabled commands:
- el:avy-kill-whole-line
- el:avy-kill-region
- el:avy-kill-ring-save-whole-line
- el:avy-kill-ring-save-region
See [[https://github.com/abo-abo/avy/issues/158][#158]].
**** org-mode functionality
New avy-enabled commands:
- el:avy-org-refile-as-child
- el:avy-org-goto-heading-timer
See [[https://github.com/abo-abo/avy/issues/214][#214]], [[https://github.com/abo-abo/avy/issues/258][#258]].
*** el:avy-goto-char-timer
Show the number of matches so far in the prompt. See [[https://github.com/abo-abo/avy/issues/253][#253]].
*** el:avy-read
Ignore mistyping when no candidates are available. See [[https://github.com/abo-abo/avy/issues/256][#256]].
When the overlays are shown, press ~?~ to get dispatch help.

View File

@ -20,7 +20,7 @@
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
(add-to-list 'load-path default-directory)
(mapc #'byte-compile-file '("avy.el" "avy-jump.el"))
(require 'avy-jump)
(mapc #'byte-compile-file '("avy.el"))
(require 'avy)
(global-set-key (kbd "C-c j") 'avy-goto-char)
(global-set-key (kbd "C-'") 'avy-goto-char-2)

2
targets/checkdoc.el Normal file
View File

@ -0,0 +1,2 @@
(checkdoc-file "avy-test.el")
(checkdoc-file "avy.el")