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: Variable-width font alignment Date: Sat, 10 Mar 2018 10:56:50 +0200 Message-ID: <83bmfwux4d.fsf@gnu.org> References: <87inaiss6l.fsf@web.de> <83zi3uz4nb.fsf@gnu.org> <0b1dd3fa-e0b0-ed20-a256-dd92d1c1826f@dancol.org> <8bc3c4c7-dfc7-987a-95e7-bd309e2326c6@cs.ucla.edu> <03118DC0-39DA-4AB5-980E-A33809B9A5EE@raeburn.org> <83vaeas8uz.fsf@gnu.org> <83lgf6s3aa.fsf@gnu.org> <838tb5rxoe.fsf@gnu.org> <83lgf5q73p.fsf@gnu.org> <4742f0ae-86b5-48f9-4601-4dbba9e6380d@gmail.com> <83bmfzreaq.fsf@gnu.org> <838tb2ptpw.fsf@gnu.org> <2ca6f8cf-96f6-9caf-d72b-739a8f9cc28d@cs.ucla.edu> <83lgf1odfl.fsf@gnu.org> <83y3j1usn8.fsf@gnu.org> <86h8pofiwm.fsf_-_@stephe-leake.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1520672133 22568 195.159.176.226 (10 Mar 2018 08:55:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Mar 2018 08:55:33 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 10 09:55:28 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 1euaHm-0005hn-RF for ged-emacs-devel@m.gmane.org; Sat, 10 Mar 2018 09:55:26 +0100 Original-Received: from localhost ([::1]:49781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euaJo-0003AH-10 for ged-emacs-devel@m.gmane.org; Sat, 10 Mar 2018 03:57:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euaJE-0003A9-Sh for emacs-devel@gnu.org; Sat, 10 Mar 2018 03:56:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1euaJB-0003IE-0i for emacs-devel@gnu.org; Sat, 10 Mar 2018 03:56:56 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euaJA-0003I9-Th; Sat, 10 Mar 2018 03:56:52 -0500 Original-Received: from [176.228.60.248] (port=2545 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1euaJ8-0008IX-OH; Sat, 10 Mar 2018 03:56:51 -0500 In-reply-to: <86h8pofiwm.fsf_-_@stephe-leake.org> (message from Stephen Leake on Sat, 10 Mar 2018 02:12:57 -0600) 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:223576 Archived-At: > From: Stephen Leake > Date: Sat, 10 Mar 2018 02:12:57 -0600 > > Trace => Verbosity > 1, > Put_Parse_Table => Verbosity > 0, > Ignore_Unused_Tokens => Verbosity > 1, > Ignore_Unknown_Conflicts => Verbosity > 1); > > It seems to me that implementing this in a variable width font requires some > sort of align-region-local tab setting, which is a change to current align > algorithms (which just insert spaces). Whatever we do to adapt indentation to variable-pitch fonts, we _must_ still begin by inserting spaces so that the same text looks aligned with fixed-pitch fonts. Otherwise, we will be unable to let other people view our code/documents in other editors which use fixed-pitch fonts, or even in Emacs with fixed-pitch fonts. The features that align text when variable-pitch fonts are in use must work _on_top_ of the "basic" alignment that just uses spaces and tabs as we do today. > One step in align.el `align-areas' computes an `align-column'. In > variable-pitch-mode, we could convert that into a tab setting by > computing the pixel column of that character column in the line with the > least whitespace/longest text ("Ignore_Unknown_Conflicts =>" above). > > I could try doing this. What is the best approach to implementing an > align-region-local tab setting? Any local change in whitespace width would need to use 'display' text properties, such as '(space :width (N))'. The problem with that is that you cannot easily record this when you save the file, so these properties will have to be recomputed anew each time the file is visited. Which will take us down the path of font-lock and JIT lock, something that I'd like to avoid. We could also record that in a separate file, but I'm not sure such meta-data approach will be acceptable. Another idea would be to modify align-areas such that it attempts to find an align-column that will align given text without changing the width of space and tab, by looking for some kind of LCD for the widths of the text strings involved in this. Not sure if this is workable, though.