help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the number of displayed line the point is in?


From: Ben Bacarisse
Subject: Re: How to get the number of displayed line the point is in?
Date: Sun, 03 Jun 2018 11:52:38 +0100

Marcin Borkowski <mbork@mbork.pl> writes:

> as in the subject.  I want to know how far the point is from the top of
> the screen.  (What I actually need to do is to inert something in the
> current buffer in such a position so that it appears precisely on the
> last visible line.)

I'd start with:

(progn
  (goto-char (window-end))
  (forward-line -1))

and work round problems like partial lines, the last line not having a
newline after it and whether the display changes as a result of the
positioning as you encounter them!

Caveat: I'm no expert.  For all I know there's a
"put-point-at-start-of-last-whole-visible-line-in-window-without-scrolling"
function.

-- 
Ben.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]