From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: gmane.emacs.help Subject: Re: How to get the number of displayed line the point is in? Date: Sun, 03 Jun 2018 11:52:38 +0100 Organization: A noiseless patient Spider Message-ID: <876030rvk9.fsf@bsb.me.uk> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528023207 17974 195.159.176.226 (3 Jun 2018 10:53:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Jun 2018 10:53:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 03 12:53:23 2018 Return-path: Envelope-to: geh-help-gnu-emacs@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 1fPQdX-0004bS-HM for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Jun 2018 12:53:23 +0200 Original-Received: from localhost ([::1]:34460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPQfe-0005pb-B2 for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Jun 2018 06:55:34 -0400 Original-Path: usenet.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-Injection-Info: h2725194.stratoserver.net; posting-host="ac9a520c2f92f111e157d1a667c091fe"; logging-data="18840"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ihdyLNVAlSfp7vd1gA8O3nAhiqCqr2Yw=" Cancel-Lock: sha1:+Th52o2vp1Pz3pn9ytUVDwXhwhc= sha1:PEb1csfFswzb6ZFBf6MJaKRx0Mc= X-BSB-Auth: 1.1419f3da492244254414.20180603115238BST.876030rvk9.fsf@bsb.me.uk Original-Xref: usenet.stanford.edu gnu.emacs.help:222834 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116955 Archived-At: Marcin Borkowski 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.