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)
  • 2
    This seems to work: (get-buffer-window "*scratch*" 'visible) – glucas Dec 22 '16 at 15:47

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

(get-buffer-window "*scratch*" 'visible)
  • 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 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.