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

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

Re: whitespace issues


From: Emanuel Berg
Subject: Re: whitespace issues
Date: Wed, 01 Jul 2015 01:25:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Rusi <rustompmody@gmail.com> writes:

> 1. Is it possible to have some sort of save-hook so
> that all leading (indentation) whitespace is cleaned
> up to space alone and tabs are removed?

Do this and indentation will be in whitespaces only:

    (setq-default indent-tabs-mode nil)

Only in Makefiles you still get tabs - otherwise they
(the Makefiles) won't work.

But to answer your question, yes, you can use
`before-save-hook' and `untabify'.

If you want to add exceptions, it could look like
this:

    (defun untab-all ()
      (unless (member major-mode '(makefile-gmake-mode
                                   makefile-mode) ) ; exceptions
        (untabify (point-min) (point-max)))
      nil) ; tell 'did not write buffer to disk'

But I think it is better to have the file as you edit
it be as close to the finished form as possible, and
not have it post-processed like that.

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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