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: Emanuel Berg
Subject: Re: Indenting with spaces rather than tabs
Date: Fri, 29 Jan 2021 03:00:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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
    (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

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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