[Top][All Lists]

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

Re: Code formatter

From: Ian Hulin
Subject: Re: Code formatter
Date: Fri, 13 Nov 2009 23:24:15 +0000
User-agent: Thunderbird (X11/20090817)

Hi Carl and list,

Carl Sorensen wrote:

On 11/13/09 9:59 AM, "Trevor Daniels" <address@hidden> wrote:

Chris Snyder wrote Friday, November 13, 2009 4:35 PM
Graham Percival wrote:
I know that you're thinking "this is ridiculous", but unless
somebody does it, newbies will continue to face this difficulty.
This job won't get done by itself.
Yes, I do think it's ridiculous. As I understand, you're saying,
"go find a tool that makes the code conform to a standard we
haven't defined yet."
Chris is right: if progress is to be made the rules
must be defined first.  They can be defined
incrementally; in fact some already exist.  If we
can't agree on the rules there is little point in
searching for a tool.

The rules are already defined (albeit unsatisfactorily in my opinion):

Do whatever emacs does.

Yes, this is unsatisfactory, because many of us don't use emacs.
Nevertheless, it is the defined standard.

In which case we need to understand, note and detail "whatever emacs
does" in the CG, so users of other editors can set their environment up
not to get into trouble (this is the voice of bitter experience speaking
Unfortunately emacs has language-sensitive information in its various
"mode" codes, so that it can be intelligent about indenting things to
the right level when you, as the programmer do something like hit the
enter key and then press <TAB>. This presumably is hidden in the lisp
code which defines the modes for C++ and Scheme.

There are lots of variables here as
Graham pointed out in his one-man role-play earlier in this thread.
Things like:
o Are tab characters used, or does the editor convert these to spaces?
o What is the maximum number of spaces per tab stop?
o What is the indentation size for the language in which the developer
     is currently programming?
 Note: We've got three main language environments when coding for
C++, Scheme, Lilypond source, and in addition we've got to cope with
Scheme embedded in Lilypond source [e.g.].  This last one
confuses the hell out of emacs as it expects all Scheme language code to
be in a *.scm file.
This stuff is hidden in the emacs mode definitions and we need it in
black and white in the CG for users of other editors (e.g. JEdit,
Frescobaldi, vim) so they can configure their environments correctly.

Are these assumptions correct?
o C++ - Tabstops at every eighth character, indent size is four
o Scheme - Tabstops at every eighth character, indent size is two characters
o Lilypond - Tabstops at every eighth character, indent size is four
o Overall club rules -
oo Whitespace should be zero or more tab characters followed by any
spaces necessary to indent to the correct level.
oo Thou shalt not have whitespace followed by a newline or the git
gremlins will come and drag out of your bed at 4 a.m. and eat you alive.
oo "Whatever emacs does" seems to imply we don't want the editor to
convert tab characters to spaces.

Bert and Wilbert (and the man or woman who can program vim, if (s)he's
out there),
is there any way we can get JEdit+LilyPondTool and Frescobaldi (and vim)
to do
"whatever Emacs does" for Lilypond, Scheme and C++?

Carl, I'm attempting to write a Chapter for CG to outline the bare bones of what new developers can get involved in (a sort of 'Intended Audience' Chapter), and I'd like to be able to include answers to the questions I've asked here.


Ian Hulin

reply via email to

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