From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: newline-and-indent vs. electric-indent-mode Date: Tue, 26 Jan 2021 04:04:32 +0200 Message-ID: <452e56da-a92e-bb19-54d9-faabff2b7c2d@yandex.ru> References: <87wnw5yt58.fsf@hajtower> <01d07f6d-cc4c-2f54-4bae-a611bba7be93@yandex.ru> <66b7932d-4cee-9628-fae0-168ee6ebc041@yandex.ru> <801ef866-4212-5b74-350e-9942953174fe@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29195"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: Madhu , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 26 03:06:16 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4DkG-0007Ug-6g for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Jan 2021 03:06:16 +0100 Original-Received: from localhost ([::1]:45730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4DkF-00061W-72 for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Jan 2021 21:06:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4Dij-0005YP-1c for emacs-devel@gnu.org; Mon, 25 Jan 2021 21:04:41 -0500 Original-Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:34963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4Dif-0002oJ-R7 for emacs-devel@gnu.org; Mon, 25 Jan 2021 21:04:40 -0500 Original-Received: by mail-ed1-x52c.google.com with SMTP id j13so17946258edp.2 for ; Mon, 25 Jan 2021 18:04:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OMH6SNbJjnISjg7kbLHeuowO8Uy/XUIsUXK4DX1WIkQ=; b=pFL9SYClk9x0TpkV6B52QdxsFYBuZS3nmxTZrGobMxW9UhjaPNKM6SWnO0omuxb7Qf vL9cQ6hp6B4wylwstbLYqLifMp7Y42TWKEtvAg9Q5s3uDzCmX017R3k/z9vZ+iHZGeQ0 hvgFFFAe81EZz7wfNC7EZw0Nfy/Kbs5kT7oK5tdUu1/GYHBKCM9dwvZhskwvcLBUTpoq yarFHYHaZUgEyF8rypiQZ7YRXM1KBisvgRcdesCG55JA4u8+/SsGmALrNDHLyTtuUuBX PomUFAzdMDz+GjDEiwYNauS4tMIoiiR9dk30PR4g79yJiminDWx5v9dC1rbj6oX+yj6l C9IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OMH6SNbJjnISjg7kbLHeuowO8Uy/XUIsUXK4DX1WIkQ=; b=JUeZgQhusAyPOdyj++L6eTasLbVmQSKG8dNjBJKFLinsNfpnxAImtb7KH0MTzxUtzh 0YLGO4SgOyuSBsLI+JI5MC9yRjCQnGjfl7geUGVad01BR7J7w1uwNDoVjXRE/R3GZ87s st6ouIOBgtOV1qrTzH9yk6KAUY80LfcUyAr9+4SE2wY99XNq5rWk8FwzcxChBWjndCtU 43QrKrMlceA8mNR7bfuKsiuapOahuDtxVKtoazXZISw3dnjHqGwwzddmcB5Dfln3XGb6 /h0twcMo78gsQ0p+3t7Wz+4gpPVge2kIaQXWqrUWnUKgdwDh8dqREXVD4ON4IJyc4T8J u/eQ== X-Gm-Message-State: AOAM531p0ip94NbXml5bBRgkijfu72Dv+OyCmUm7CTrCQf/OxXShVlK+ i3Yrri+gpVtwc/y4mv+q5XSW5frdZu0= X-Google-Smtp-Source: ABdhPJy+gOu3SOg4pSggO64dQy6nRWPUfFNVew0Zk6CR+ZVHw+FC+p1ZgQH1bNwG9anEulSz5TsKEw== X-Received: by 2002:aa7:d511:: with SMTP id y17mr2855869edq.112.1611626675598; Mon, 25 Jan 2021 18:04:35 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id cx6sm11955179edb.53.2021.01.25.18.04.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jan 2021 18:04:34 -0800 (PST) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=raaahh@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263431 Archived-At: On 25.01.2021 17:15, Stefan Monnier wrote: >>> The problem with `whitespace-cleanup-mode` is that it's global. >>> I'd like something that only operates locally, i.e. only touches lines >>> you've modified. >> That would be https://github.com/lewang/ws-butler. > > That's better, indeed, tho if you look at the implementation you see > that it has to deal with lots of corner cases, so it ends up "ugly and > brittle": I'm not sure "cleanup on save" is the better option. > I don't mean to say that Le Wang did a bad job, BTW: the issues aren't > caused by a bad design or implementation, but by a hard problem. Indeed, there are a lot of hooks involved, but it seemed to work last time I tried it. > I was thinking instead of something that removes the trailing space(s) > when point leaves the line (like Madhu suggested). Of course that's > also fraught with danger (e.g. you don't want that whitespace to > disappear just because you did `C-x C-x`), so the result might end up > just as ugly&brittle. Or if I just did C-n C-p, or something more complex to the same effect. But I suppose somebody could try creating a prototype, and then we'd see just how jarring this approach is (or not). Alternatively, one could start with looking into how others editors do it. >> whitespace-cleanup-mode is working out just fine for me, though, because by >> default is only cleans files that were clean previously. > > I'd like a feature that is also active in non-clean files. I just clean such a file manually once, and then the feature is active. Or I don't, and use whitespace-mode to make sure I don't leave new trailing whitespace around. Files like that are a minority in my experience, so it's not too big a price to pay for being able to rely on a simple implementation. YMMV, of course.