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

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

Re: Indenting with spaces rather than tabs


From: Philip K.
Subject: Re: Indenting with spaces rather than tabs
Date: Mon, 01 Feb 2021 10:46:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

moasenwood--- via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> wael-zwaiter wrote:
>
>> Want to indent with spaces rather than tabs and have found
>> the command
>>
>> (setq-default indent-tabs-mode nil)
>>
>> But one can also use "M-x untabify".
>>
>> What should I use for my init file?
>
> (defun untab-all ()
>   (unless (member major-mode '(makefile-gmake-mode
>                                makefile-mode) ) ; exceptions

This should probably be (unless (derived-mode-p 'makefile-mode) ...)

>     (untabify (point-min) (point-max)))
>   nil) ; tell "did not write buffer to disk"
>
> (setq-default tab-width 3)
>
> (setq-default indent-tabs-mode nil)
>
> ;; (setq before-save-hook nil)
> (defun before-save-hook-f ()
>   (untab-all)
>   (delete-trailing-whitespace) )
> (add-hook 'before-save-hook #'before-save-hook-)f

-- 
        Philip K.



reply via email to

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