From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Variable-width font indentation Date: Mon, 5 Mar 2018 15:28:05 -0500 Message-ID: References: <87inaiss6l.fsf@web.de> <6FCF6ACA-4F29-4B6B-BE9D-D7130C6E9495@gnu.org> <87fu5moe4c.fsf@web.de> <877eqyocro.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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1520281625 863 195.159.176.226 (5 Mar 2018 20:27:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Mar 2018 20:27:05 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: Paul Eggert To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 05 21:27:00 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 1eswhF-0007jp-V9 for ged-emacs-devel@m.gmane.org; Mon, 05 Mar 2018 21:26:58 +0100 Original-Received: from localhost ([::1]:51405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eswjI-0002wJ-Le for ged-emacs-devel@m.gmane.org; Mon, 05 Mar 2018 15:29:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eswiR-0002ue-NO for emacs-devel@gnu.org; Mon, 05 Mar 2018 15:28:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eswiO-0004Uq-Jc for emacs-devel@gnu.org; Mon, 05 Mar 2018 15:28:11 -0500 Original-Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]:44578) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eswiO-0004Ue-EI for emacs-devel@gnu.org; Mon, 05 Mar 2018 15:28:08 -0500 Original-Received: by mail-io0-x22e.google.com with SMTP id h23so19414206iob.11 for ; Mon, 05 Mar 2018 12:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UGBSp45dTbdrA/qUpyc36TH6oo4QUfGqiWQQFQnh8mU=; b=WAxtzoC+NohbDdH4LpjE46Wi4lb6bdLB2tRFxOooppMyoYir/3cdw8wPwVjpsI/RRE +U/aTGxasA7LnfH/Z6Sr0Ig+I+EUcuwr3eNAf8T2Qmgi3Ag5PakIMLnrijXyD2tHDKs6 DUXrth5dM6DgNUW+BT27oQlVzj6VZVGAtBL4TzYfML2Kg73eoQWuSCudgCumlIHQ2uaK cXmlBePhtohEbBrW8FwoDica4UBW9kPYTV/4IWAGwtrufb0ZbYLfcsI3Av3jO/fcMgOy I9tzlGp+n6ar/50dhamSnTKd1jOyQ06/aK7R2iXpnbpeWLMb0o8vLnl3OyGCh4dkiIcl Ziaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UGBSp45dTbdrA/qUpyc36TH6oo4QUfGqiWQQFQnh8mU=; b=acxRdQtZpMj92WMMj3QGmqh0NfpoOYbQgOFwtD1tUPugP7+i7hMTD3V0arXSGKmHH/ sOI6YEzhlPXqLDtM3q3E7EvVXkTbabjeffRw95WZNZvyXZxYU4Qpbf9ZtgrdoDhXAGCa Q/byVciVzHq8+m10iEsECxyd0P6SDiRJhQAJxG/fFaRd6S6kGpgJTizbjDu/g5EkpkJ3 WU8OxjeQ+fo6YjkBma1+PKTxS9ooAV/vTCZoRlh2S3iw8fiabouOtjfz70gxEhZzSjHO gd3wW6Fcn6s9ih+1UzzkTWV73JozNZJbL0Tznqn0ZTBmnhieLV2y8FfiMsAyYtYgHWii uLKQ== X-Gm-Message-State: AElRT7FKzke/viJHvEu7IUcztbfs2F3CuWazRHM/tlCsYleccq7hTfuz 8kzGBwx3H7rUjo3Av5snpus= X-Google-Smtp-Source: AG47ELtNAjyipA5MIjqDwug1hz+W4Wg/FJ/m+MCPnWTa7fxF/0BCOjtGgSFphd4+3g1F6fs26cH8Fg== X-Received: by 10.107.7.23 with SMTP id 23mr19231580ioh.113.1520281687431; Mon, 05 Mar 2018 12:28:07 -0800 (PST) Original-Received: from [18.26.2.123] (26-2-123.dynamic.csail.mit.edu. [18.26.2.123]) by smtp.gmail.com with ESMTPSA id f69sm8897761iod.2.2018.03.05.12.28.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 12:28:06 -0800 (PST) In-Reply-To: <83lgf6s3aa.fsf@gnu.org> Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::22e 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:223298 Archived-At: On 2018-03-05 14:58, Eli Zaretskii wrote: > How does it know that today, when we only support well the > fixed-pitch fonts? Or are you talking about a different problem? A different problem, IIUC. The problem is the following: Assume you wrote the following C code, then changed to variable-pitch: void pr () { printf ("hello, world\n"); } int main (int argc, char** argv) { pr (); return 0; } Depending on which font you use (and the width of a space in that font), the `char** argv' part will move right or left, instead of remaining aligned. The usual solution is to proceed as Paul suggested: > It assumes the input is fixed-width, and that leading white space is > intended to indent with respect to previous lines. IOW, you scale the spaces preceding `char** argv' to make the `c' of `char' line up with the `i' of int. Applying this strategy to all lines doesn't work, unfortunately: it indents the `pr ()' and `printf (' lines differently, because the `in' of `int main' and the `vo' of `void' occupy different widths. I don't know of a good solution to this problem: in general, there's not enough information to distinguish 'indentation' spaces (the two spaces before `printf (', `pr ()', and `return 0') and 'line-up' spaces (the spaces before `char ()'). I hope I'm missing something. Clément.