From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71499: [PATCH] Make whitespace.el cleanup add missing final newline Date: Thu, 13 Jun 2024 11:30:51 +0300 Message-ID: <86jzitz1l0.fsf@gnu.org> References: <9453e7ef-dc31-4074-bba7-55a192313ccd@app.fastmail.com> <86tthy1u37.fsf@gnu.org> <86cyom1os2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26471"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71499@debbugs.gnu.org, stefankangas@gmail.com, bkhl@elektrubadur.se To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 13 10:32:48 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sHft1-0006Zz-T2 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Jun 2024 10:32:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHfsO-0003W4-7I; Thu, 13 Jun 2024 04:32:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHfsL-0003Vg-Ij for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2024 04:32:05 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHfsJ-0004HX-Fl for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2024 04:32:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sHfsH-0006ra-Th for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2024 04:32:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2024 08:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71499 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71499-submit@debbugs.gnu.org id=B71499.171826746926247 (code B ref 71499); Thu, 13 Jun 2024 08:32:01 +0000 Original-Received: (at 71499) by debbugs.gnu.org; 13 Jun 2024 08:31:09 +0000 Original-Received: from localhost ([127.0.0.1]:34391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sHfrQ-0006pG-Sg for submit@debbugs.gnu.org; Thu, 13 Jun 2024 04:31:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sHfrN-0006oW-5S for 71499@debbugs.gnu.org; Thu, 13 Jun 2024 04:31:06 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHfrH-00046Y-SZ; Thu, 13 Jun 2024 04:30:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=RQnkNP6ZUR1cd8jcO2Ur6/mPXWfvTs6f8SOU5G55aVo=; b=XxMUPGM7t4ccrgFzGksf 0o18t+KwtfrTqv5oeOo4LV3lZ22F/hH6g+lQ9h45BWpAWEj1D63Xb30BkpdlMJadsenP9vFzbXAxf dr+HsHDVhAUo3P3KX0SgfIVEe66gvO8GcA+cbcZ/WB+UNhmJq9qfj1zRg8lB7q8Lq9C+KQWTrw0uX /AhkVUPduECW1N4chr0sXyjb4fYLbHGULVzxR0v0ggD8l5TnEnyLo1WzWtWN1pVSAPxc1NNgS3yps cu2Ce1qra/hMFPPQI2U9vCRfjXFEyaaWyBw2VB01/3+P0k2jAjPotSTK91LzzAz8k6qVYtUU/Js0C /nXcMhts4VLIfg==; In-Reply-To: (message from Andrea Corallo on Thu, 13 Jun 2024 03:38:42 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287188 Archived-At: > From: Andrea Corallo > Cc: Eli Zaretskii , Björn Lindström > , > 71499@debbugs.gnu.org > Date: Thu, 13 Jun 2024 03:38:42 -0400 > > Stefan Kangas writes: > > > Eli Zaretskii writes: > > > >>> I thought about that, but since whitespace-cleanup generally applies > >>> clean-up according to white-space style, I thought it was simply an > >>> oversight that it doesn't apply a fix when it is set to highlight > >>> missing end-of-file newline. > >>> > >>> Adding a separate way to configure this removes the simplicity of > >>> configuring your preferred whitespace-style as a single option. > >>> > >>> However, If you still disagree I can make another patch somehow > >>> maintains the old behaviour as the default, so just let me know. > >> > >> Let's see what others think, and take it from there. > >> > >> Stefan, Andrea: WDYT about this change? > > > > AFAIU, the purpose of whitespace.el is to detect and eventually fix > > incorrect whitespace, and it has two ways of doing this: > > > > - Visual highlighting > > - Commands to fix problems (`whitespace-report` and > > `whitespace-cleanup). > > > > Since it is mostly configured in the centralized option, > > `whitespace-style`, it seems natural that if a user wants to detect > > `missing-newline-at-eof`, she would also want this to be fixed by > > `whitespace-cleanup`. This seems even more natural given that > > `whitespace-report` already considers that a problem worthy of > > reporting. IOW, I tend to agree that this not already being the case > > looks like an oversight. > > > > So I think the existing options are fine, and the patch could go in > > as-is, despite the fact that it is backwards-incompatible. If users > > really hate it, I guess we will hear about it and can react. > > > > If we want to be really cautious, we might want to consider waiting with > > this change until Emacs 31. That should provide ample time for people > > to notice the new behaviour and react. > > > > My two cents. > > I'm as well for having the patch in, but I guess would be safer in 31 so > we have plenty of time to react if needed. OK, thanks. I will then install after the branch is cut. Meanwhile, Björn, I have a few comments to the patch: . it needs a NEWS entry announcing the new feature . is there any reason your code to handle the missing newline is not identical to what the implementation of require-final-newline does?