From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: newline-and-indent vs. electric-indent-mode Date: Tue, 26 Jan 2021 16:58:29 +0100 Message-ID: <34f67c4f-de0b-2882-0ddd-4a5f9dee0042@gmx.at> 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="22183"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Madhu , emacs-devel@gnu.org To: Stefan Monnier , Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 26 16:59:49 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 1l4Qkt-0005bP-Mb for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Jan 2021 16:59:47 +0100 Original-Received: from localhost ([::1]:51942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4Qks-0001XV-NK for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Jan 2021 10:59:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4Qjs-0000Je-TS for emacs-devel@gnu.org; Tue, 26 Jan 2021 10:58:44 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:42863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4Qjq-000678-Qf for emacs-devel@gnu.org; Tue, 26 Jan 2021 10:58:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1611676713; bh=BOCNBtuiQRNWJeOlY46DOzr5C2kCjxls5DlNqwjfo8E=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=S4AZ5CAcrEYAtMl4OwVJ7b7846fM7GqCK4SwyqLd4qkFaIk/dtylHf0Ywwz+mZXRW BPvoZOInKRrG/k08cXaTr/pCtFMZ1W0AzMuPAArtd8OWmkBPtq0J7oaE+fHXo1oEXI +Uk1E3yJ9kUXf41AD7RuQslCBpZeRDEFdZYQU/mA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([46.125.249.16]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MQMyf-1lHxPt3ZOD-00MKA8; Tue, 26 Jan 2021 16:58:33 +0100 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:btqn+C7UaD+lC6Asl3hx2e6QfrdqPh/i2AP+3vrJQNQ0Dzjsy4w 7Q0kUuRdDaxVR+r06c4m3DoR47CgbQEXO1Hlb/iKdF9KxSHdvzGsOk0Oywc0t/FReO5B02J CoF/S956+KDk0wbN0CHDGDkNblVxmcYB08/dvNo5vjTPM9rT4x0+N2E/G4BniiuPQvTWtIm Fzbil4or3kO/T8wdjE7oA== X-UI-Out-Filterresults: notjunk:1;V03:K0:5eZeu3EwNTk=:zylHebSuD9YxYzIuOr0nZo wuDhoAo5luNN7DMnrmKezeeokgjtR5c2N7jk0nQQmW4ngPb0jfrPPDToY0fAyfSMlvqKxKtvc Em1k9xzE5rsrWIJVbT8FAVW31LKsP4TwXW/BPRWFenj0ilWWuJ9tQbahPT7Qtp4JNbFopAc4F Ew7qEaROTHKoBQvBIcUfeo1QfupIbVA+312Zny9Af4LNtA6Kt7aI2i1UO2A7okch56sL8AaH4 BHIsi5SfzAnGLfbkD22+yBYnpOrH6mq/ygn5/d+1o9rHAz66gyRsG1rYQrEzz+VCx98Yt9FaW aRkKLDHIYtTCY7DFm/KAjV/owAh7ICtlqIHkML2k8JBYytOKypxuHh4DYdYPV6U1I3MVtVZj2 +OcRSW3taR29opGBDDBI/tqXy2G0qh0sb0hXeS6/l56wvTYiicoIBxbjZ/iaoZ507tDz+rZ+z N/2w3fq1zj5McVoiOM6h85DgQkbeYD8AUT6mhsdWclpXGP4msyfirZZOXlx/whhPtLbDuxeAz 2gJPc7DFX09wCRATt0ijHtXE2x7D6LgpQOQBgTn8Yd3Jo6JYlJaepgfr5E9EF/XotbuF5pJN0 hbYLs+RJMgcqhgZ0eQcI1dF2SPmLh26PEUtKoEIJsx9biF1ELUH+tBrExqeTvFADaWGhRxI32 pyA9vXak2QkkKf+NyU4NJUy9qVHjTx4wSeHo3dCnWNVRdo5Mwm2LJN+i0wEZDw+K9tLtc0E3c owrlPV7clelUrydFcQlcK5PZ6bPvclFGT1BwfW69o26UObPv01PkSCceWbaq/3sz16eXi3xt Received-SPF: pass client-ip=212.227.17.22; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:263465 Archived-At: >>> 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": It's the best you can get I would say. You can't really postpone trimming to 'kill-buffer' and anything before 'save-buffer' can be just too early. Yet, saving will irrevocably trim all whitespace so you can't get it back for future editing. > 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. > > 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. We could put some phantom space there and restore it as soon as point reenters that line. And maybe handle the current line specially when saving the buffer. martin