From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: wael-zwaiter@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Indenting with spaces rather than tabs Date: Sat, 30 Jan 2021 20:25:47 +0100 Message-ID: References: <87v9bei7p3.fsf@robertthorpeconsulting.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15746"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Robert Thorpe Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 30 20:27:15 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 1l5vtr-00040v-Hy for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 20:27:15 +0100 Original-Received: from localhost ([::1]:47774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5vtq-0008BM-Hd for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 14:27:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5vsV-00089R-Vl for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 14:25:51 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:51501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5vsU-0008Qz-3j for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 14:25:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612034747; bh=wkYjzeB4Qutz7WOkbspklP+6MVKRbRKvLRmzO9ags90=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=jeF+q7VV8392eQ20xe+/ipeWx9xHRkJSfV5DIvYAg05qMWyHtayMFAHW25tFbBnD6 jBMto7Uw2MPjPI3ch9Jec9oAXHQmdSIfkj5gAJHFR7WKR2i1OjNbKzmoFTGnD2mq69 mlwip+qh3rjYZ56l7D+dp+jBo2X2KKW3APB+k6gg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs16.server.lan [172.19.170.184]) (via HTTP); Sat, 30 Jan 2021 20:25:47 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87v9bei7p3.fsf@robertthorpeconsulting.com> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:uvMbwpZNORFM1LkwcIoMLzBppcIBZuGPznyCbRgpwyEbZY8SZnisXWeFQZA2r+UGyFUHH 2txoRE9MGBgMr9jkRje3ktQI73kef9Pc0Ngo2r/ieSTcEdyQNQ4eMKCJ8bQC+/fvhXTmqwfIXu5t D6SkjKS3ORxt7pvLTJNbpzxO1nH/XSkJs7Z+532Pnjz8kAOFoQBAqqjZBH80qHWuwnDyAZltvmW6 d5F/aJpJpT659XVxdI9O4lt2ApJmualVH51pRVoZiZ+QSTlsJ9Pm1HZSsm5/YvYE9rZ5JTz1WX/d J4= X-UI-Out-Filterresults: notjunk:1;V03:K0:CS8s6Soe06s=:UPQfq4cUZ0IzM/HYL5uT9O tZTxN8IGvpdtIAf02Da7NMnt8O7k6i1FvyOVDwP7274xL5ZsIp21bDflFNLljSYIPJ9CIb2Bp xwjKVW+pcqpxQjOUkJPXH0MRSLvEPVeY0CK7gwAHIxp4WY8Aoq3N96rF0CetCZFnxYWycqFAU GZFkouPRnkXcMG6FUMEJ44XE+ssYiC41yH42knzvGBtjyxA2rotKy98fEPkBw9RPOddoMfZ0h aQI6jtubfmuySjJsYVo18CBbOUG2IupvPJBT080+8UqyO9mPrvA+y/cG0qyasXx/ILRF55JjI F0Zs0FrWAGWm76hXlr3vr+fXCKM2gd8hgqOhxbsKZ5ZQVfC05je2NGBq+sbpJmEBp2Gz9f4Fk YByN3kCPeu+wMjb9K8LQmj0heczwVAkkGEefMJ3EO3tGxmRTcMGSpS+7uVKTbvuQ0Cch7pIhx YXbdI/jtXQS4fyz76Yyhvudxmaul9CnDmppecyMSaOJTVfMSXjb8LcNSXbzvEwT2xID3ZLyBc ElbzOygW1NF/fW8G2eJHibsWd8Dzdg9yRbUMV9c1iELqMBngHEyDZXM1lD+7Vw5sMdbstP/dY QVBkY3HNhz5mI= Received-SPF: pass client-ip=212.227.17.20; envelope-from=wael-zwaiter@gmx.com; 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_H2=-0.001, 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:127459 Archived-At: I am having problems with this code (defun break-comments () "Break lines when they exceed a specific character length." (setq-local comment-auto-fill-only-comments t)) (defvar dfv-break-comments-state nil) ;; Cycles line breaking tool (defun cycle-break-comments () "Break comments in programming languages." (interactive) (pcase dfv-break-comments-state ;; (1 (setq-local comment-auto-fill-only-comments nil) (auto-fill-mode 0) (setq dfv-break-comments-state 0) (message "%s" "Disable: Break comments")) ;; (_ (setq fill-column 72) (auto-fill-mode) (if (not nil dfv-break-comments-state) (add-hook 'prog-mode-hook #'break-comments) (progn (add-hook 'sh-mode-hook #'break-comments) (add-hook 'fortran-mode-hook #'break-comments) (add-hook 'emacs-lisp-mode-hook #'break-comments) (add-hook 'c-mode-hook #'break-comments) (add-hook 'c++-mode-hook #'break-comments) (add-hook 'awk-mode-hook #'break-comments) (add-hook 'R-mode-hook #'break-comments) (add-hook 'octave-mode-hook #'break-comments))) ;; (add-hook 'texinfo-mode-hook #'break-comments) (add-hook 'text-mode-hook #'break-comments) ;; (setq dfv-break-comments-state 1) (message "%s" "Break comments using prog-mode-hook")) )) ;; Break comments using auto-fill (global-set-key (kbd "H-q") #'cycle-break-comments) > Sent: Sunday, January 31, 2021 at 6:46 AM > From: "Robert Thorpe" > To: wael-zwaiter@gmx.com > Cc: help-gnu-emacs@gnu.org > Subject: Re: Indenting with spaces rather than tabs > > 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 > >