2

this question is related to the question How to know my buffer's visible/focused status?.

I would like to check if there exists a frame in which a given buffer is visible. I tried the following but it gives true even if scratch is invisible.

(get-buffer-window (find-buffer-visiting "*scratch*") 'visible)
Name
  • 7,689
  • 4
  • 38
  • 84

1 Answers1

5

It's not clear why you want the call to find-buffer-visiting. The following works as expected:

(get-buffer-window "*scratch*" 'visible)
Dan
  • 32,584
  • 6
  • 98
  • 168
  • 1
    The first argument is supposed to be a buffer, so although it is permissive and accepts a buffer name instead, I recommend you write `(get-buffer-window (get-buffer "*scratch*") 'visible)`, to try and reduce the confusion between buffers and buffer names. – Stefan Dec 24 '16 at 00:16