From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: Indenting with spaces rather than tabs Date: Sat, 30 Jan 2021 18:46:32 +0000 Message-ID: <87v9bei7p3.fsf@robertthorpeconsulting.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7078"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: wael-zwaiter@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 30 19:48:11 2021 Return-path: Envelope-to: geh-help-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 1l5vI3-0001iQ-Al for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 19:48:11 +0100 Original-Received: from localhost ([::1]:50580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5vI2-0002cR-CP for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 13:48:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5vH5-0002bt-FL for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 13:47:11 -0500 Original-Received: from outbound-smtp56.blacknight.com ([46.22.136.240]:50939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5vH2-0008Tv-Up for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 13:47:11 -0500 Original-Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp56.blacknight.com (Postfix) with ESMTPS id 422AD24A006 for ; Sat, 30 Jan 2021 18:47:04 +0000 (GMT) Original-Received: (qmail 6174 invoked from network); 30 Jan 2021 18:47:03 -0000 Original-Received: from unknown (HELO rt-inspiron-3480) (rt@robertthorpeconsulting.com@[109.76.74.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 30 Jan 2021 18:47:03 -0000 In-Reply-To: (wael-zwaiter@gmx.com) Received-SPF: pass client-ip=46.22.136.240; envelope-from=rt@robertthorpeconsulting.com; helo=outbound-smtp56.blacknight.com 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127458 Archived-At: wael-zwaiter@gmx.com writes: > Can I do as follows, so that tabs are removed when "dfv-untabify-state" > is "true". > > (defvar dfv-untabify-state nil) > (defun clean-before-save () > "Removes trailing spaces and tabs upon exiting" > > (delete-trailing-whitespace) > (when (dfv-untabify-state) > (unless (member major-mode '(makefile-gmake-mode makefile-mode)) > (untabify (point-min) (point-max))) )) Yes you can do that. I think Mr.Berg gave some similar code in this thread. Be careful though about accidentally wrecking files. I notice you've exempted makefiles, which is a good idea. You might want to exempt more, like config files. If you're doing work on a VC system with others then changing tabs becomes a major irritation. That's because it creates a lot of false changes (i.e. line changes where the code hasn't really changed). BR, Robert Thorpe