abo-abo / avy

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

should avy-window-list return windows in hidden frames? #293

Open ryanswilson59 opened 4 years ago

ryanswilson59 commented 4 years ago

The current behavior of (avy-window-list) is return windows that the user cannot see. In my normal usage I have lots of hidden frames, and this caused avy tree using multiple windows to require many more characters than necessary, as candidates from hidden windows were being used. Maybe this is how the function should work, but I found this inconvenient.

I fixed this by changing the source of avy-window-list too

(defun avy-window-list ()
  "Return a list of windows depending on `avy-all-windows'."
  (cond ((eq avy-all-windows 'all-frames)
         (cl-mapcan #'window-list (visible-frame-list)))

        ((eq avy-all-windows t)
         (window-list))

        ((null avy-all-windows)
         (list (selected-window)))

        (t
         (error "Unrecognized option: %S" avy-all-windows))))

This simply replaces (frame-list) with (visible-frame-list)