Subject: Re: bug#32457: 26.1.50; automatically set indent-tabs-mode from .gitattributes

From: Rudolf Schlatte <[email-masked]>
Date: Wed, 18 May 2022 16:22:31 +0200

Robert Pluim <[email-masked]> writes:

>>>>>> On Wed, 18 May 2022 14:18:09 +0200, Lars Ingebrigtsen <[email-masked]> said:
>
>     Lars> Tom Tromey <[email-masked]> writes:
>     >> git can be configured to complain about indenting with tabs
>     >> by using "whitespace=tab-in-indent" in .gitattributes.
>     >> 
>     >> It would be nice if Emacs automatically detected this and set
>     >> indent-tabs-mode to nil.
>     >> 
>     >> git attributes can be queried using "git check-attr", for instance:
>     >> 
>     >> $ git check-attr whitespace -- src/librustc_codegen_llvm/debuginfo/metadata.rs
>     >> src/librustc_codegen_llvm/debuginfo/metadata.rs: whitespace:
>     >> tab-in-indent,trailing-space,tabwidth=4
>
>     Lars> (I'm going through old bug reports that unfortunately weren't resolved
>     Lars> at the time.)
>
>     Lars> I don't think this would be an appropriate feature for Emacs core -- it
>     Lars> would be too surprising if Emacs was setting `indent-tabs-mode' based on
>     Lars> external factors like this (and I'm sure there's a lot of other hints it
>     Lars> could be taking from other VCs).
>
>     Lars> It does sound like it could be a useful ELPA package, though, but I'm
>     Lars> closing this wishlist item in the Emacs bug tracker.
>
> .dir-locals.el supports 'eval', so anyone who wants this could put it there.

There is also EditorConfig (https://editorconfig.org,
http://elpa.nongnu.org/nongnu/editorconfig.html) for setting
indent-tabs-mode and other variables according to a configuration file.