help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: replace-regexp, the byte-compiler, docstrings, and suggestions


From: Robert Thorpe
Subject: Re: replace-regexp, the byte-compiler, docstrings, and suggestions
Date: Sat, 18 Oct 2014 18:57:20 +0100

Emanuel Berg <embe8573@student.uu.se> writes:
> (defun untab-all ()
>   (if (not (member major-mode '(makefile-gmake-mode
>                                 makefile-mode) )) ; exceptions
>       (untabify (point-min) (point-max)) )
>   nil) ; tell 'did not write buffer to disk'
>
> (setq before-save-hook '(untab-all delete-trailing-whitespace))

Code like this can be useful if you only deal with your own code.  If
you program in collaboration with others it's troublesome.  Converting
all the whitespace in a file causes version control programs to indicate
a lot of changes have happened.

In my opinion it's better to work this way:
* Write a script to remove all of the tabs in all your personal file.
Do that as a one-off operation
* Set indent-tabs-mode so Emacs never generates new tabs.
* Don't untab files before saving them.

The advantage of this is that your own stuff will always be tab-clean
but you can still cooperate with others who use VC.

BR,
Robert Thorpe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]