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

1 Answer 1

5

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

(get-buffer-window "*scratch*" 'visible)
1
  • 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
    Commented Dec 24, 2016 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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