From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to add a temporary blank line at the end of buffer safely Date: Thu, 11 Jan 2018 18:03:51 +0200 Message-ID: <83lgh44c2g.fsf@gnu.org> References: <6294bab5.8cc2.160e46579de.Coremail.tumashu@163.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1515686568 32504 195.159.176.226 (11 Jan 2018 16:02:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 11 Jan 2018 16:02:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: tumashu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 11 17:02:44 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZfJM-0007gi-Qz for ged-emacs-devel@m.gmane.org; Thu, 11 Jan 2018 17:02:36 +0100 Original-Received: from localhost ([::1]:52644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZfLM-0005W3-CO for ged-emacs-devel@m.gmane.org; Thu, 11 Jan 2018 11:04:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZfKh-0005Ut-MD for emacs-devel@gnu.org; Thu, 11 Jan 2018 11:04:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZfKc-0006VX-Q6 for emacs-devel@gnu.org; Thu, 11 Jan 2018 11:03:59 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZfKc-0006VJ-Mo; Thu, 11 Jan 2018 11:03:54 -0500 Original-Received: from [176.228.60.248] (port=3106 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eZfKb-00048J-QF; Thu, 11 Jan 2018 11:03:54 -0500 In-reply-to: <6294bab5.8cc2.160e46579de.Coremail.tumashu@163.com> (message from tumashu on Thu, 11 Jan 2018 16:45:43 +0800 (CST)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221837 Archived-At: > Date: Thu, 11 Jan 2018 16:45:43 +0800 (CST) > From: tumashu > > 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.)