[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to add a temporary blank line at the end of buffer safely
From: |
Eli Zaretskii |
Subject: |
Re: How to add a temporary blank line at the end of buffer safely |
Date: |
Thu, 11 Jan 2018 18:03:51 +0200 |
> Date: Thu, 11 Jan 2018 16:45:43 +0800 (CST)
> From: tumashu <address@hidden>
>
> Doesn't vertical-motion fit the bill? If not, why not?
> ------------------------------------------------------------------------
> @Eli Zaretskii Thanks for your suggestion, it works very well, the only
> problem is that
> it can not work when point at the end line of buffer, I use the below code to
> handle this problem,
> (add a temp "\n" then remove) but it seem to hacky. any good way to solve
> this problem:
Something like the below, perhaps?
(aref (font-info (font-at POS)) 3)
This will give you the height of the font used at position POS. Then
you could add that to the y-coordinate of the line at EOB, to get the
bottom y-coordinate of that line. (Caveat: font-at doesn't like to be
called at EOB, so make sure you are one buffer position before that.)