abo-abo / avy

Jump to things in Emacs tree-style
1.71k stars 109 forks source link

Conflict with dired-x omit-mode when called non-interactively #279

Open cyberthal opened 5 years ago

cyberthal commented 5 years ago

Any version of the avy goto line function doesn't work in dired with dired-x omit-mode enabled, when called non-interactively. Only the first file line is affected, which is line 2 in the dired buffer. When invoking the same avy commands interactively, there's a visual tell for this bug. Line 2 is indented when the avy overlay is active. When called non-interactively, if avy selects line 2, (dired-find-file) will complain that there is no file on the line.

I don't know whether this bug is dired-x's fault or avy's.

I reproduced it in Spacemacs without my customizations, but didn't attempt to reproduce it in regular GNU Emacs.

One way to replicate the bug is to open a dired buffer, and do

#+begin_src elisp
(progn
(dired-omit-mode)
(beginning-of-buffer)
(let ((avy-all-windows nil))
      (avy-goto-line-below 0))
(dired-find-file))
#+end_src

Pick line 2 when prompted. It should be inappropriately indented. It should return this error:

#+begin_src elisp
Debugger entered--Lisp error: (error "No file on this line")
  signal(error ("No file on this line"))
  error("No file on this line")
  dired-get-file-for-visit()
  dired-find-file()
  (progn (dired-omit-mode) (beginning-of-buffer) (let ((avy-all-windows nil)) (avy-goto-line-below 0)) (dired-find-file))
  eval((progn (dired-omit-mode) (beginning-of-buffer) (let ((avy-all-windows nil)) (avy-goto-line-below 0)) (dired-find-file)) nil)
  eval-expression((progn (dired-omit-mode) (beginning-of-buffer) (let ((avy-all-windows nil)) (avy-goto-line-below 0)) (dired-find-file)) nil nil 127)
  funcall-interactively(eval-expression (progn (dired-omit-mode) (beginning-of-buffer) (let ((avy-all-windows nil)) (avy-goto-line-below 0)) (dired-find-file)) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)
#+end_src
abo-abo commented 4 years ago

Just tested now, and it seems to works fine for me. Please try to reproduce with emacs -Q.