This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

[Solved] Get position in an other window

3 posts · 5596 views

Hi
I want to know the line number corresponding to the point of a window which is not the current one.
I tried
(window-point my-window)
but I got the point and not the line number.
Unfortunately, line-number-at-pos is only working for current buffer. Is there a line-number-at-pos function working with other windows?

Thanks

Last edited by chep on , edited 1 time in total.

Re: Get position in an other window

You can temporarily make a buffer current using with-current-buffer macro, so something like this:
(with-current-buffer (window-buffer my-window)
  (line-number-at-pos))

Re: Get position in an other window

Exactly what I was looking for.
Thank you very much.