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: Wed, 7 Mar 2018 13:27:35 -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> <838tb5rxoe.fsf@gnu.org> <83lgf5q73p.fsf@gnu.org> <4742f0ae-86b5-48f9-4601-4dbba9e6380d@gmail.com> <83bmfzreaq.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 1520447162 8732 195.159.176.226 (7 Mar 2018 18:26:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Mar 2018 18:26:02 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 07 19:25:57 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 1etdlE-0001Xz-9K for ged-emacs-devel@m.gmane.org; Wed, 07 Mar 2018 19:25:56 +0100 Original-Received: from localhost ([::1]:34910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etdnH-0008Ow-1I for ged-emacs-devel@m.gmane.org; Wed, 07 Mar 2018 13:28:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etdmy-0008Gt-PL for emacs-devel@gnu.org; Wed, 07 Mar 2018 13:27:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etdms-0006SH-9Q for emacs-devel@gnu.org; Wed, 07 Mar 2018 13:27:42 -0500 Original-Received: from mail-it0-x232.google.com ([2607:f8b0:4001:c0b::232]:53954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etdms-0006Rq-45; Wed, 07 Mar 2018 13:27:38 -0500 Original-Received: by mail-it0-x232.google.com with SMTP id w63so4415632ita.3; Wed, 07 Mar 2018 10:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aP2ckn+1kpI368wpPWP6tQAxmJSVkv9v3SGUTHb2pvE=; b=SUJRiIZviqpNMWqBCkmoSmdl43ueKqT61BZTHezabTYaHfSQ8c/6an0EHh/aXwV4Aq QQKINq1rnr3RgBtwtjicsUf+zGeN+v7xHSNE+KkzS1BG0yPgDR7Xxhu0NlJKhr4gEqtl 51SyHy7Aebk/sr7CJRKBtmLgzjOU2olRsYsS16h5C/nyQdPJpXC5So/s8j7ZqCfN2iwr JZqqc7t4tOPTogIR41Z0lbKf5+o1o57rVEfi/S0YTiSLx3C2SGRqMqm5YeTZT523q+Ax j/vWdorBmX2zjmoByTFu8VWvYTLzXaMM+x7Ux8BL+/wJSOKBppG9lo/S3PourbmKMVB9 83Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aP2ckn+1kpI368wpPWP6tQAxmJSVkv9v3SGUTHb2pvE=; b=ALA3rdd4Sn2VcHQ4OaYiDR5RGRR/55Ybst36uXWzvAL6I+eGgrFzxGTLCtG/Gw8W6U xUw+ZlFYKo5m8HsJR0DTFwhgw2ZPMBYseAuF0Jf2c5QuLMpTlkFJjgsdx7nKXv5cvK1a 73g01yr+dma9UOnMRIC1tPqLWa2ZAAq8RQZeKTNtu9OV4MFfNrugO3XMroE6iEaAvLXd hw2Ti8eDTuT94EFfMV4IBOOO+jybO1xSaJyNY1q22D9XkYZ/wyMwlwcKtD4Al38i9iPz 0rLZmUUaZjqiI2ENfgb10zQtAXpPydLcBqrDZKziJ6e16Dku1eieqEJ6/K0V2x1Pu5rd TuVQ== X-Gm-Message-State: AElRT7H8rbAf6YYb02WTq7pbJGuBCCgms49DmnjxXcB1KBE82P/sv02c +ks0sO3NhDFEOopHGiHrX/GQ73rD X-Google-Smtp-Source: AG47ELtZ+1ospQ2eUjVZIZgm4vd+uNpw+DrxNYOePQlYY6HRqYzVZCuagJqfqxrwJQqvpbX74lzqAg== X-Received: by 10.36.81.208 with SMTP id s199mr5440423ita.46.1520447257385; Wed, 07 Mar 2018 10:27:37 -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 u68sm12553862iou.0.2018.03.07.10.27.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 10:27:36 -0800 (PST) In-Reply-To: <83bmfzreaq.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:c0b::232 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:223422 Archived-At: On 2018-03-07 12:22, Eli Zaretskii wrote: >> Cc: emacs-devel@gnu.org, eggert@cs.ucla.edu >> From: Clément Pit-Claudel >> Date: Tue, 6 Mar 2018 16:47:51 -0500 >> >>> I don't see a need for such a feature, sorry. We have indentation >>> already; its only problem is that it doesn't work well with variable >>> pitch fonts. That's what we need to try to fix, if we care about the >>> capability of displaying program code with such fonts. >> >> I'm thoroughly confused: doesn't the algorithm that Paul proposed, and that I show an implementation of, do exactly that? > > Not AFAIU, no. It is an implementation of a different indentation > method. I don't see why we should want to go that way, since there's > nothing wrong with the existing algorithm, except for handling of > variable-pitch fonts. Can you clarify what you call an indentation method? I think that's the source of my confusion. I wouldn't call what I wrote an indentation method. Maybe I'm not understanding you because of that? >> Do you want to get the indentation code involved because the heuristic isn't perfect? > > More like because the existing indentation algorithms are okay, and I > see no need to change them to something else. Neither do I, and indeed I'm not proposing to change existing indentation algorithms :) >> In your world, concretely, what happens when I open xdisp.c and press M-x variable-pitch-mode? Does everything look misaligned until I M-x indent-region the whole file? > > Yes. It isn't different from what happens when you change tab-width. But changing tab-width doesn't change the contents of the buffer, whereas what you're advocating for does, right? >> What about a file from a different project that uses a different indenting convention? > > Not sure how that is relevant. A different indentation convention > will look differently, of course. This is relevant because the method that Paul originally proposed (which I'm not even advocating for — I'm not even sure yet whether it's good or bad) does not require changing the buffer or the actual number of spaces present on each line in the buffer. Maybe I just don't understand what you're advocating for. AFAIU, you're suggesting that we should teach indentation methods about variable-pitch fonts, so that they indent text to a particular pixel offset instead of a particular column. Is that correct? If it is correct, then it solves a problem that's different from the one I was thinking in, which is to display existing code with a variable pitch font, without the indentation function. Some questions on the solution you propose: * What happens in major modes that don't provide indentation support? * What happens in indentation-sensitive languages (Python, F#, Haskell, etc)? * What happens in comments? * Do I need to call M-x indent-region every time I switch between variable-pitch and fixed-pitch? * If I close and reopen a file in variable-pitch mode, do I need to re-run M-x indent-region? * In variable-pitch mode, what gets saved to disk after I run M-x indent-region? Thanks, Clément.