From: "Peter Milliken" <peterm@resmed.com.au>
Subject: Re: Is there a mode that helps enforce coding guidelines?
Date: Thu, 29 May 2003 13:38:38 +1000 [thread overview]
Message-ID: <4hfBa.57$TO5.3660@nnrp1.ozemail.com.au> (raw)
In-Reply-To: f0077d93.0305280605.3f2e9e83@posting.google.com
*some* of this list could be achieved using code
abbreviations/templates/skeletons whatever you want to call them i.e.
write/generate the code in the correct format/framework to begin with -
these tools will help with indentation and where to put braces etc
(depending upon the language of course :-)). They also generate the code
constructs in their entirety i.e. it saves on typing - which leads to higher
productivity, plus you nolonger have to worry about certain syntax errors
caused by forgetting to add a ';' or a clasing '}' (or worst of all - an
extra ';' in the wrong place!). Imagine hitting 3 keys to get the following:
if ({expression}) {
{statement}...
}
[elsif_part]...
[else_part]
Then all you have to do is fill in the blanks and delete what isn't wanted
(single command). Or, 3 keystrokes to get this:
switch ({expression}) {
[case_part]...
default :
[statement]...
break;
}
There are quite a few utilities available for Emacs in this area, some come
standard with Emacs, others are add-ons available from the Internet
repositories. Ones that I know of are template.el, skeleton.el (both come
standard with Emacs) and a package I have authored called else-mode.el
(http://www.zipworld.com.au/~peterm). There is plenty of help available for
any of these, skeleton is the most popular and you can see good examples of
its use in the java mode stuff. I believe there is documentation being
compiled on Emacs Wiki for skeleton, ELSE (else-mode.el) comes with a
comprehensive users manual. So there shouldn't be any impediment to getting
code structures generated in the correct format at least.
I personally find coding templates a big help when moving between different
coding standards i.e. one project wants the opening { on the same line as
the if statement, the next project wants it on the line following, the next
project doesn't want one at all unless there are multiple statements after
the if! :-) All of these and more are easily configurable and available with
minimal work.
In the meantime, good luck with your search :-)
Peter
"Petter Wintzell" <petter_wintzell@yahoo.com> wrote in message
news:f0077d93.0305280605.3f2e9e83@posting.google.com...
> Hi,
>
> Is there an Emacs mode that can help a programmer follow a set of
> coding guidelines and style rules? I am thinking of the simple rules
> that exist in many companies and projects regarding line length,
> comment style, indent style, hanging braces, variable names and what
> not.
>
> I would like a mode that highlighted the text when I broke a
> guideline. It would also be nice if the mode could help me correct the
> error.
>
> One thing that would also be nice is if one could switch between
> different rule sets, so that I can easily have one set of rules when
> coding at work, one when coding at home, one when participating in a
> particular open source project, etc.
>
> Is there any such mode or functionality?
>
> Regards,
> /Petter
next prev parent reply other threads:[~2003-05-29 3:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-28 14:05 Is there a mode that helps enforce coding guidelines? Petter Wintzell
2003-05-28 16:27 ` Dan Anderson
2003-05-29 12:44 ` Kevin Dziulko
2003-05-28 16:43 ` Kai Großjohann
2003-05-28 17:03 ` Phillip Lord
2003-05-28 18:29 ` Kai Großjohann
2003-05-29 14:09 ` Phillip Lord
2003-05-28 17:50 ` Sandip Chitale
2003-05-29 3:38 ` Peter Milliken [this message]
2003-06-01 21:45 ` Alan Mackenzie
2003-06-02 10:37 ` Petter Wintzell
2003-06-03 15:58 ` Colin Marquardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='4hfBa.57$TO5.3660@nnrp1.ozemail.com.au' \
--to=peterm@resmed.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.