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

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

Re: Indentation with spaces


From: Emanuel Berg
Subject: Re: Indentation with spaces
Date: Thu, 09 Jun 2022 05:08:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Skip Montanaro wrote:

> As for TAB not inserting a literal TAB character,
> indentation is controlled by the major mode. I believe that
> for ELisp, the default indentation is just two spaces.
> (Don't quote me on that though.)

Why is `indent-tabs-mode' t by default? Tabs should not
be used.

Anyway here is how I do it:

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/tabs.el

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

(setq-default tab-width 3)

(setq-default indent-tabs-mode nil)

(provide 'tabs)

And then

;; (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
https://dataswamp.org/~incal




reply via email to

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