Re: Feature request: style consistency checking and mimicking an existing file's style
david ingamells <[email protected]>
| Newsgroups | gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <[email protected]> |
Dan Hipschman wrote:
> Hi all.
>
> This is just a thought, and I know it would be a fair bit of work, which
> I don't myself have time for right now, but what do you think of two new
> options for GNU indent, --check and --mimic? First I'll describe
> --mimic. It would read in a sample C file, figure out the style options
> that would be used to produce such output, and then use those options
> for the remaining (normal) input files.
>
> For example, if foo.c is:
>
> void foo(void)
> {
> if (blah) {
> bonk();
> }
> }
>
> then 'indent --mimic foo.c' would be equivalent to
> 'indent -br -npcs -npsl'. This makes it a lot easier to figure out the
> correct options to indent since it's WYSIWYG. Of course, the style that
> is being mimicked needs to be consistent, which brings me to --check.
> This would not output anything, but would check that the input has a
> consistent style. That is, there exists a single set of options that
> could produce that style. Implementing --check and --mimic boil down to
> pretty much the same thing since to check for consistency we need to
> remember what style we see in the file, and once we have that it is not
> hard to use it for the output.
>
> Of course, trying to understand arbitrary style could be difficult, if
> it happens to fall outside the range of what indent can currently
> produce yet still be consistent. However in that case it could be fair
> to simply report that there are no set of options to produce such
> output, since we are not really losing any functionality over what we
> currently have, but it would reduce headaches for people searching for a
> nonexistent set of options.
>
> Apologies if something like this has been proposed; I didn't go through
> all the mailing list archives.
>
> Dan
>
>
> _______________________________________________
> bug-indent mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/bug-indent
>
>
>
It looks to me like you're proposing something larger than indent itself!
I can't see anyone taking up the challenge, however if they do I'd suggest
that they write an independent program to generate the indent command line
from a given source file.