From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21533: 24.5; current-column result varies between specified spaces using :width and :relative-width Date: Tue, 22 Sep 2015 19:57:23 +0300 Message-ID: <83y4fyl7d8.fsf@gnu.org> References: <560165C5.2020904@orcon.net.nz> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1442941108 28584 80.91.229.3 (22 Sep 2015 16:58:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Sep 2015 16:58:28 +0000 (UTC) Cc: 21533@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 22 18:58:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ZeQtO-0000pl-5F for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Sep 2015 18:58:10 +0200 Original-Received: from localhost ([::1]:41547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeQtN-0000A8-GN for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Sep 2015 12:58:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeQtK-00009h-D1 for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2015 12:58:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeQtH-00013x-1y for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2015 12:58:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeQtG-00012h-VG for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2015 12:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZeQtG-0006YF-Jf for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2015 12:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Sep 2015 16:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21533 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21533-submit@debbugs.gnu.org id=B21533.144294103725127 (code B ref 21533); Tue, 22 Sep 2015 16:58:02 +0000 Original-Received: (at 21533) by debbugs.gnu.org; 22 Sep 2015 16:57:17 +0000 Original-Received: from localhost ([127.0.0.1]:41876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeQsX-0006XD-5h for submit@debbugs.gnu.org; Tue, 22 Sep 2015 12:57:17 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:40039) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZeQsU-0006X2-ID for 21533@debbugs.gnu.org; Tue, 22 Sep 2015 12:57:15 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NV3009007VI2400@a-mtaout23.012.net.il> for 21533@debbugs.gnu.org; Tue, 22 Sep 2015 19:57:11 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NV3008Z98FBY760@a-mtaout23.012.net.il>; Tue, 22 Sep 2015 19:57:11 +0300 (IDT) In-reply-to: <560165C5.2020904@orcon.net.nz> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106812 Archived-At: > Date: Wed, 23 Sep 2015 02:29:25 +1200 > From: Phil Sainty > > I can't tell whether this is expected behaviour or not? > > Starting from emacs -Q, in the *scratch* buffer, I get the following > results from evaluating these forms with C-j: > > (progn (insert (propertize " " 'display '(space :width 2))) > (current-column)) > 2 > > (progn (insert (propertize " " 'display '(space :relative-width 2))) > (current-column)) > 1 > > Which is to say that a specified space of :width 2 occupies 2 columns, > while a specified space of :relative-width 2 occupies only 1 column. Simply put, current-column did not support :relative-width. Now it does, so your example should work as expected with the development sources. But beware: current-column is not guaranteed to always produce the exact results you'd expect on GUI displays when wider-than-normal characters are involved. That's because character width in column units is always an integer: 0, 1, or 2, whereas the actual pixel width of those characters depends on the font and is in general not an integral multiple of the "normal character width". For example, try your test case with the (double-width) character ᄀ instead of the space. Or try ^A (Ctrl-A). If you want accurate screen coordinates, use pixel coordinates returned by functions like posn-at-point instead. You can convert the pixel coordinates into units of canonical character width (a.k.a. "columns") if you divide the pixel coordinates by the value returned by the function default-font-width. Also note that :relative-width is only supported on GUI frames. The documentation omitted this crucial fact; I fixed that as well. > (What I'm actually *doing* is scaling indentation, and so if the column > numbers vary with the scaling, then re-indenting the buffer causes > changes; and I want the effect to be purely visual.) If you only ever need to scale TAB and SPC characters, then the above restrictions don't apply, I think. But it is still useful to keep them in mind.