Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 17 Feb 2025 00:01:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 16 19:01:33 2025 Received: from localhost ([127.0.0.1]:39221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tjoZo-0000by-Rg for submit <at> debbugs.gnu.org; Sun, 16 Feb 2025 19:01:33 -0500 Received: from [2001:470:142::17] (port=41020 helo=lists.gnu.org) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>) id 1tjoZl-0000ba-Ng for submit <at> debbugs.gnu.org; Sun, 16 Feb 2025 19:01:31 -0500 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 <eg642616@HIDDEN>) id 1tjoZL-00040R-BT for bug-gnu-emacs@HIDDEN; Sun, 16 Feb 2025 19:01:13 -0500 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>) id 1tjoZJ-0001lA-EH for bug-gnu-emacs@HIDDEN; Sun, 16 Feb 2025 19:01:03 -0500 Received: by mail-ot1-x344.google.com with SMTP id 46e09a7af769-727090df861so717002a34.1 for <bug-gnu-emacs@HIDDEN>; Sun, 16 Feb 2025 16:01:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739750459; x=1740355259; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=CuiObhuMHt7ZJFw5sqNsxPYOasasEvdGn9x6yyMEAIE=; b=Tn005GWHgQzfGO92GTV382a3y8WrfQfXuyaUKf/tOosT7NZDuAi2hV7lgI6Cw5KYlo M5d1dLrbISsBAEXuw+RVmlouzfvsdz+yAWUOAhsIUCNaNYhaCQvkdds5owInJeXAN6sz zJNR8h873v0pBN73Bqf9XZHIdUXZTON1stTJ7C6mFrAoDbUmNSFZKcd8OnJg5M42a24g 3N/QH4MjJiE22sVbuX7VjcAFYFpu4+CPBwImOdZT4mHmxXD0wCF2ZIwRqlfUhR6fsx9T 5qgXqM1MIyoaQlNikv2NQ9+2EPMnUbH7ILAhnQ90knZCKAmadeKzhT4IZZ1xZzE4tKwU E0lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739750459; x=1740355259; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CuiObhuMHt7ZJFw5sqNsxPYOasasEvdGn9x6yyMEAIE=; b=VyT70f5iqSmYD9HDWr3XgfY0o1YBn3BdV4Epjancus94rEMSY6wxWrgZcrnsroZaog KcpWOb7ryCRxvpMw1D3BhTnF1IhtUEPG2uhoefllmhONbfBS9gf3rrAEiJjHhpiPTGoy /47pOPVU7CW/retQjoqncuzoR7IFr7Bjsb1XkMjTLNoV3iH5mvH5jPrp7rWarxkcUTPQ 1968os9/NneauR6ied0U2kVuqgiOK7Su08i+E7UHZYNicoW63oTctGOPq/pBeqgj7pfg DKy/Qm0dAh59xzQVO26YZHaguO8wD9HiQB1s5juIraBjINUrwr2NICymXqQsAoESa1xV 0MpA== X-Gm-Message-State: AOJu0YxW+h3ZtTZVu5Ia7Q1W6lHrJcqIYheN9VC+8/qx/TL1SzQM+526 zH/v/UVz/p5yHbivRp4p19w6rOhawyaqd4XfUSFvRfTsyXWdJE/1k2nfQtMf X-Gm-Gg: ASbGnctseQr/u4Pvd7KEbusHOtjz2jpb/R8SlIrjhQJ6AT9PG+L5+9c2n+qtDNwQk5T shJOl6rmjx1/D70KeO8VOMXQhVLzpwRNzMGsqyG4Pz5wwyf9XmrxFfXVN2tMvrSZkIEy5GJ/5Ci ekl3O99T38k77gh1Q8Ym2gg3CPOcGd1kIFm0XeBTIGsLBAP00nZ50teOBAfP3nB3od78Eb2zWyu 4oFyMlqLxyNdauCmSZrqh5qSPHqwWPWoJljkFvRDWKxvgPBiop3l6dt7oY= X-Google-Smtp-Source: AGHT+IEk9+I0AelrAZIzP/YmDBSdBK6vKn362inW6Q/qkn5IQ1flZ31/n3NIcP1lLCPBGP5J7LbiCg== X-Received: by 2002:a05:6830:350b:b0:71e:1c5:4f7c with SMTP id 46e09a7af769-72712063768mr5510107a34.14.1739750459293; Sun, 16 Feb 2025 16:00:59 -0800 (PST) Received: from fedora ([2806:10ae:e:8463::1]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2b963a066c1sm3610181fac.41.2025.02.16.16.00.57 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2025 16:00:58 -0800 (PST) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Add new minor mode for clear whitespaces on save. X-Debbugs-Cc: Date: Sun, 16 Feb 2025 18:00:56 -0600 Message-ID: <874j0th22v.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::344; envelope-from=eg642616@HIDDEN; helo=mail-ot1-x344.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Tags: patch This feature adds a minor mode (and global) for clean whitespaces in current file/buffer on save. I know that already exists the option 'auto-cleanup' in whitespace-action that does the same, however, it just depends on the whitespace-mode, so if i turn-off whitespace-mode auto-cleanup won't work. Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 SPOOFED_FREEMAIL_NO_RDNS From SPOOFED_FREEMAIL and no rDNS X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Tags: patch This feature adds a minor mode (and global) for clean whitespaces in current file/buffer on save. I know that already exists the option 'auto-cleanup' in whitespace-action that does the same, however, it just depends on the whitespace-mode, so if i turn-off whitespace-mode auto-cleanup won't work. Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.0 SPOOFED_FREEMAIL_NO_RDNS From SPOOFED_FREEMAIL and no rDNS --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Tags: patch This feature adds a minor mode (and global) for clean whitespaces in current file/buffer on save. I know that already exists the option 'auto-cleanup' in whitespace-action that does the same, however, it just depends on the whitespace-mode, so if i turn-off whitespace-mode auto-cleanup won't work. Also I know there's already a package on MELPA that does something like this, however i think this kind of functionality must be included in Emacs so I did my own implementation. This patch is just a working prototype, and I want to know if there is interest in this so I can polish it. In GNU Emacs 31.0.50 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) of 2025-02-03 built on 49a55a317a644839ad7d857f65aa5be0 System Description: Fedora Linux 41 (Workstation Edition) Configured using: 'configure --build=3Dx86_64-redhat-linux --host=3Dx86_64-redhat-linux --pr= ogram-prefix=3D --disable-dependency-tracking --prefix=3D/usr --exec-prefix= =3D/usr --bindir=3D/usr/bin --sbindir=3D/usr/sbin --sysconfdir=3D/etc --dat= adir=3D/usr/share --includedir=3D/usr/include --libdir=3D/usr/lib64 --libex= ecdir=3D/usr/libexec --localstatedir=3D/var --runstatedir=3D/run --sharedst= atedir=3D/var/lib --mandir=3D/usr/share/man --infodir=3D/usr/share/info --w= ith-cairo --with-dbus --with-gif --with-gpm=3Dno --with-harfbuzz --with-jpe= g --with-modules --with-native-compilation=3Daot --with-pgtk --with-png --w= ith-rsvg --with-sqlite3 --with-tiff --with-tree-sitter --with-webp --with-x= pm build_alias=3Dx86_64-redhat-linux host_alias=3Dx86_64-redhat-linux CC=3D= gcc 'CFLAGS=3D-DMAIL_USE_LOCKF -O2 -flto=3Dauto -ffat-lto-objects -fexcepti= ons -g -grecord-gcc-switches -pipe -Wall -Werror=3Dformat-security -Wp,-U_F= ORTIFY_SOURCE,-D_FORTIFY_SOURCE=3D3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=3D/usr= /lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=3D/usr/= lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=3Dx86-64 -mtune=3Dgeneric -f= asynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-d= ialect=3Dgnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' 'LDFLA= GS=3D-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -= specs=3D/usr/lib/rpm/redhat/redhat-hardened-ld -specs=3D/usr/lib/rpm/redhat= /redhat-annobin-cc1 -Wl,--build-id=3Dsha1 -specs=3D/usr/lib/rpm/redhat/red= hat-package-notes ' CXX=3Dg++ 'CXXFLAGS=3D-O2 -flto=3Dauto -ffat-lto-object= s -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=3Dformat-securi= ty -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3D3 -Wp,-D_GLIBCXX_ASSERTIONS -s= pecs=3D/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -sp= ecs=3D/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=3Dx86-64 -mtune= =3Dgeneric -fasynchronous-unwind-tables -fstack-clash-protection -fcf-prote= ction -mtls-dialect=3Dgnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-poi= nter ' PKG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/usr/share/pkgconfig' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-new-minor-mode-for-clear-whitespaces-on-save.patch From 894a27e270373db41674ba6bc460fdee29f15585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN> Date: Sun, 16 Feb 2025 16:33:46 -0600 Subject: [PATCH] Add new minor mode for clear whitespaces on save. Add minor mode and global minor mode for clean whitespaces in current file/buffer on save. * lisp/whitespace.el (whitespace-autoclean-on-save-mode): New minor mode. (turn-on-whitespace-cleanup-on-save): New function. (global-whitespace-cleanup-on-save): New global minor mode. --- lisp/whitespace.el | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index efee11faf98..98210febf2d 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1008,11 +1008,21 @@ whitespace-newline-mode ;; sync states (running a batch job) (setq whitespace-newline-mode whitespace-mode)) +(define-minor-mode whitespace-autoclean-on-save-mode + "Toggle cleanup of whitespace before saving the buffer. +Cleans up any whitespace in the buffer before saving." + :lighter " wscln" + :init-value nil + :global nil + :group 'whitespace + (if whitespace-autoclean-on-save-mode + (add-hook 'write-file-functions 'whitespace-cleanup nil t) + (remove-hook 'write-file-functions 'whitespace-cleanup t))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; User commands - Global mode - ;;;###autoload (define-globalized-minor-mode global-whitespace-mode whitespace-mode @@ -1069,6 +1079,20 @@ global-whitespace-newline-mode "use `global-whitespace-mode' with `whitespace-style' set to `(newline-mark newline)' instead." "28.1") +(defun turn-on-whitespace-autoclean-on-save () + "Turn on whitespace visualization." + ;; prepare local hooks + (if (not whitespace-autoclean-on-save-mode) + (whitespace-autoclean-on-save-mode) + (whitespace-autoclean-on-save-mode))) + +;;;###autoload +(define-globalized-minor-mode global-whitespace-cleanup-on-save + whitespace-autoclean-on-save + turn-on-whitespace-autoclean-on-save + :init-value nil + :group 'whitespace) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; User commands - Toggle -- 2.48.1 --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs. --=-=-=--
Elijah Gabe Pérez <eg642616@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#76355
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.