[Top][All Lists]

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

The grand indentation unification project

From: Daniel Hackney
Subject: The grand indentation unification project
Date: Sat, 26 May 2012 15:45:47 -0400

While working on adding configurable lisp paths to package.el, I noticed
that many whitespace-only changes were created, cluttering up the diffs.
It would make patches smaller and more focused if there were a single
whitespace style applied throughout all of the elisp sources. This
doesn't mean radically changing things; but rather applying the current
style throughout. From what I see, the current source has
`indent-tabs-mode' non-nil and a `tab-width' of 8 and mostly sticks to
this formula.

There are some places where it deviates from this style, such as using 8
spaces rather than a tab for indentation in some parts, having a space
before a tab, or a single-semicolon comment at column 1. `indent-region'
does not catch all of these, especially indentation using 8 spaces
rather than a tab (because `indent-to' specifically avoids changing
spaces to tabs if there are the right number of spaces).

I propose adding to the `emacs-lisp-mode' section of ".dir-locals.el" in
the source root `(indent-tabs-mode . t)' and a definition for
`whitespace-style' to use tabs for indentation. Then, when committing
changes, the buffer would be run through `indent-region' and
`whitespace-cleanup'. This would ensure whitespace consistency for all
files in the repo and prevent diff conflicts which consist entirely of
whitespace changes.

As an extra guarantee of consistency, use "emacs -Q" when re-indenting
files so that no user customizations can change the indentation.

Daniel M. Hackney

reply via email to

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