From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Getting column position accounting for overlays Date: Wed, 05 Aug 2015 18:21:05 +0300 Message-ID: <831tfhu5ge.fsf@gnu.org> References: <83a8u6tplx.fsf@gnu.org> <55C1D323.50505@thregr.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1438788101 7243 80.91.229.3 (5 Aug 2015 15:21:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Aug 2015 15:21:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Yuri D'Elia Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 05 17:21:34 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZN0VZ-0003IO-RZ for ged-emacs-devel@m.gmane.org; Wed, 05 Aug 2015 17:21:34 +0200 Original-Received: from localhost ([::1]:40911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN0VZ-0002au-4k for ged-emacs-devel@m.gmane.org; Wed, 05 Aug 2015 11:21:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN0VK-0002ap-Fn for emacs-devel@gnu.org; Wed, 05 Aug 2015 11:21:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN0VG-0003yz-W9 for emacs-devel@gnu.org; Wed, 05 Aug 2015 11:21:18 -0400 Original-Received: from mtaout26.012.net.il ([80.179.55.182]:59930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN0VG-0003wR-Mw for emacs-devel@gnu.org; Wed, 05 Aug 2015 11:21:14 -0400 Original-Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NSM006007ZPVC00@mtaout26.012.net.il> for emacs-devel@gnu.org; Wed, 05 Aug 2015 18:24:36 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NSM0021Y8508A50@mtaout26.012.net.il>; Wed, 05 Aug 2015 18:24:36 +0300 (IDT) In-reply-to: <55C1D323.50505@thregr.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188446 Archived-At: > From: Yuri D'Elia > Date: Wed, 5 Aug 2015 11:10:59 +0200 > > I'd like the equivalent of (current-column), or character length between > (beginning-of-line) and cursor position [modulus tabs], but using the > actual displayed overlays. I think you want this: (/ (car (window-text-pixel-size nil (line-beginning-position) (point))) (default-font-width)) But that's a guess. Please tell more about your use case, because I don't quite understand why would you need this. Also note that default-font-width didn't exist before Emacs 25. > I would almost have expected something to extract the visualized string > between two points, like `buffer-substring' but iterating through > overlays; but couldn't find any (did I miss it?) The overlay strings are directly accessible via 'overlay-get', so why would anyone need the feature you expected to exist? > (posn-col-row (posn-at-point)) "would" work, but 1) seems inefficient, > especially considering I don't care about variable-pitch fonts and 2) > doesn't work if the point is not visible. If you don't care about variable-pitch fonts, how come you do care about overlay and display strings? They are conceptually the same: they extend the width of the text by using data that is not directly available from buffer text.