Problem in this thread is that the OP is effectively asking multiple questions:
- how should this be best written
- how should my editor do it
- what's the bug in my editor
- They way I write it of course!
- The way I would write it if I were taking appropriate care
- Is it that it is emacs?
The are many very bad indentation and white space usage styles in use. Aside from a desire for consistency and style informed by "that is the way we always do it", I don't think many people think very much about their code writing style. My own style decisions, which I have thought about, are driven by laziness. I use white space, to the extent reasonably possible, consistently with the conventional usage in (English) written prose. That way I already have a parsing tool (my brain) that knows how to break stuff up without needing different settings packages for prose and code.
Other style decisions are made based on intelligibility, such as keeping lines short with the important stuff toward the front, minimizing nesting, keeping functions reasonably short, and so on. Look at pretty much any of my code on PerlMonks to see how that looks. Note though that my block delimiting brace usage for Perl is K&R which I avoid in other languages (I prefer Whitesmiths).
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|