abo-abo / avy

Jump to things in Emacs tree-style
1.72k stars 110 forks source link

Flyspell misspelled words in org-mode links break avy-mode #271

Closed michaelmhoffman closed 5 years ago

michaelmhoffman commented 5 years ago

To reproduce:

  1. (flyspell-mode t)

  2. Create test.org with the following contents:

* correct
* [[link][incxrrect]]
* correct
* [[link][incorr3ct]]
* correct
  1. Move the cursor over the incorrectly spelled words to ensure they get Flyspell's wavy red underline.

  2. (avy-goto-char ?r)

The only rs that are marked are before the first misspelled word, or in subsequent misspelled words, as seen in screenshot:

image

michaelmhoffman commented 5 years ago

(avy--find-visible-regions (point-min) (point-max)) returns ((1 . 30) (53 . 76)).

30 is the newline after incxrrect 53 is the i in incorr3ct 76 is the end of buffer

Expected: ((1 . 76))

That is the output I get when I have flyspell-mode disabled.

abo-abo commented 5 years ago

For me, (avy--find-visible-regions (point-min) (point-max)) returns ((1 . 13) (21 . 30) (32 . 45) (53 . 62) (64 . 75)).

So I can't reproduce the bug.

abo-abo commented 5 years ago

Tried make run from this repository that launched emacs-26.1 -Q. Still can't reproduce.

michaelmhoffman commented 5 years ago

Here's a more straightforward test case. I'm using the latest avy from MELPA stable (0.4.0) but can try with the repo version.

  1. Create test.el in same direction as test.org:
(require 'package)
(setq package-load-list
      '((avy "0.4.0")))
(package-initialize)

(find-file "test.org")
(flyspell-mode t)

(redisplay)
(flyspell-buffer)

(avy-goto-char ?r)
(message "%s" (avy--find-visible-regions (point-min) (point-max)))
  1. emacs-26.2 -Q -l test.el

Output: image

  1. Type a

Output: ((1 . 30))

michaelmhoffman commented 5 years ago

Tested on commit a7230906c44a1da78e1405f3694f1e61f43043dc and it works as expected. Please feel free to close.

Could we have a new melpa-stable version with this fix please? :smile:

Thanks again for your work on this useful package and sorry for the confusion.

My script for testing in the avy repo is below for posterity:

(add-to-list 'load-path ".")
(require 'avy)

(find-file "test.org")
(flyspell-mode t)

(redisplay)
(flyspell-buffer)

(avy-goto-char ?r)
(message "%s" (avy--find-visible-regions (point-min) (point-max)))
abo-abo commented 5 years ago

Thanks.