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: Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed Date: Wed, 30 Aug 2017 19:51:56 +0300 Message-ID: <8337892e37.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1504111954 1715 195.159.176.226 (30 Aug 2017 16:52:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 16:52:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 30 18:52:30 2017 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 1dn6E8-00007m-N1 for ged-emacs-devel@m.gmane.org; Wed, 30 Aug 2017 18:52:28 +0200 Original-Received: from localhost ([::1]:51608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6EF-0000vx-PE for ged-emacs-devel@m.gmane.org; Wed, 30 Aug 2017 12:52:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6E6-0000vg-7S for emacs-devel@gnu.org; Wed, 30 Aug 2017 12:52:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6E1-0004cy-JK for emacs-devel@gnu.org; Wed, 30 Aug 2017 12:52:26 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6E1-0004cu-FY; Wed, 30 Aug 2017 12:52:21 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2223 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dn6Dz-0007Pi-NW; Wed, 30 Aug 2017 12:52:21 -0400 In-reply-to: (message from Keith David Bershatsky on Tue, 29 Aug 2017 11:51:07 -0700) 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:217889 Archived-At: > Date: Tue, 29 Aug 2017 11:51:07 -0700 > From: Keith David Bershatsky > Cc: emacs-devel@gnu.org > > I am creating pilcrows at the end of each line using the following code: > > (let ((face (face-id 'font-lock-warning-face))) > (aset (or buffer-display-table > (setq buffer-display-table (make-display-table))) ?\n `[(182 . ,face) ?\n])) > > Using POS, I would like to obtain X/Y/HPOS/VPOS for any particular eol pilcrow. When you say "X POS for any particular eol pilcrow", do you mean the x coordinate of the beginning of the pilcrow or of its end? And what do you get instead when you use move_it_to like you show? Also, why do you care about the exact coordinate of the pilcrow? You could simply reach it and then do there whatever you want, no matter what is the coordinate. > If I search for POS at the end of the line using move_it_to, then it.current_x and it.current_hpos are not the values that I need. In that situation, I have to subtract frame-char-width from it.current_x, and I have to subtract 1 from it.current_hpos. it.current_x and it.current_hpos are essentially off to a tune of one character to the right of the pilcrow. Subtracting frame-char-width will only work with monospaced fonts, so in general it is not a good idea.