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: Marcin Borkowski
Subject: Re: How to get the number of displayed line the point is in?
Date: Thu, 07 Jun 2018 19:12:53 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2018-06-03, at 12:52, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:

> 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.

Thanks, and this might be the best solution (I have fairly good control
over everything in the buffer - e.g., I have truncate-line-mode on.)

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

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