[PATCH 2/3] emacs: whitespace-cleanup and indent-region for emacs/*.el files

Austin Clements amdragon at MIT.EDU
Tue Jan 17 09:38:38 PST 2012


Quoth Tomi Ollila on Jan 17 at 12:46 pm:
> On Mon, 16 Jan 2012 23:32:00 -0500, Austin Clements <amdragon at mit.edu> wrote:
> > Cleanup is the type of pain that should only be suffered once, so I'd
> > be much happier with this if there was an accompanying git hook that
> > prevented more mis-formatted code from slipping in.
> 
> We'd need a script to be called from .git/hooks/pre-commit to do
> extra checking; developer needs first activate this pre-commit
> and then add call to our checking routine. Imagine the amount
> of false positives this hook starts to generate...

It's unfortunate (but sensible) that git doesn't provide an automatic
way to set up verify scripts like this, but that doesn't mean we can't
make it easy.  Put a script in devel (or whatever it winds up being
called) that can be sourced from the pre-commit hook and then mention
this in HACKING.

Why it would generate false positives, assuming the cleanup goes in at
the same time the hook goes in (or the script is somehow clever enough
to only check changed lines)?

> ... but. developer can run 'git commit --no-verify' ...aargh no;
> I guess if pre-commit hook fails, commit-msg hook is not run
> and this is bypassed; maybe NO_FORMATCHECK_HOOK=1 git commit ...
> is the answer.

Maybe the script could generate a warning/prompt, rather than
preventing the commit altogether?

> But what we at least need is Guidelines document that states 
> these formatting issues clearly and precicely. Surely 
> self-respecting programmers understands to follow there (and soon 
> adjusts their workflow -- i.e. activate/run these checkers
> after list response).

I think the guidelines for elisp are pretty well known.  I agree that
we need such a document for the C/C++ code.  I started writing one a
while ago, but other things took over before I got very far.


More information about the notmuch mailing list