Compare commits

..

No commits in common. "master" and "0.4.0" have entirely different histories.

8 changed files with 276 additions and 1504 deletions

2
.github/FUNDING.yml vendored
View File

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

View File

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

View File

@ -1,7 +1,3 @@
[![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` 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.
@ -38,13 +34,6 @@ 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.
@ -85,10 +74,6 @@ 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
@ -100,7 +85,6 @@ 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`.
@ -123,6 +107,6 @@ The copyright assignment isn't a big deal, it just says that the copyright for y
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.
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 <kbd>M-x</kbd> `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

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

1448
avy.el

File diff suppressed because it is too large Load Diff

View File

@ -141,7 +141,7 @@ Pros and cons of =de-bruijn= over other styles:
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.
few candidets with a shorter path.
See [[https://github.com/abo-abo/avy/issues/51][#51]] and [[https://github.com/abo-abo/avy/issues/5][#5]].
@ -205,294 +205,7 @@ Use this to restore the previous default behavior:
#+begin_src elisp
(setq avy-style 'pre)
#+end_src
* 0.4.0
* trunk
** 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

@ -22,5 +22,11 @@
(add-to-list 'load-path default-directory)
(mapc #'byte-compile-file '("avy.el"))
(require 'avy)
(if (fboundp 'checkdoc-file)
(checkdoc-file "avy.el")
(require 'checkdoc)
(with-current-buffer (find-file "avy.el")
(checkdoc-current-buffer t)))
(global-set-key (kbd "C-c j") 'avy-goto-char)
(global-set-key (kbd "C-'") 'avy-goto-char-2)

View File

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