[Top][All Lists]

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

Re: c-mark-function goes too far

From: Miles Bader
Subject: Re: c-mark-function goes too far
Date: Wed, 10 Jan 2007 08:53:14 +0900

Eric Hanchrow <offby1@blarg.net> writes:
> I don't remember the details, but I think Emacs always assumed that
> function definitions begin with a left-brace at the left column.
> Presumably c-mark-function is making that same assumption, and
> searching forward for one, and not finding it.

Yes, it's actually a somewhat complicated issue, it's not a quick fix
sort of thing.

It might help people using this syntax to set the Emacs variable
`open-paren-in-column-0-is-defun-start' to nil, but I'm not really sure
of all the consequences of doing that.

Languages like Java have it much worse -- even isolated braces are
indented because functions are always methods within a class, so Emacs
function-oriented commands basically never do the right thing.

I find that as a _person_ reading code I tend to use similar assumptions
when reading code, which makes "function opening brace at the end of the
line" code a fair bit harder to read for me -- that "opening brace in
column 0" is really easy for your eye to find when quickly scanning
code.  My guess as to the reason is that (1) it's much easier to quickly
locate a brace that's isolated on a line by itself, and (2) the end of
the line is harder to track simply because it doesn't have a fixed
position.  [Of course it was a lot worse in the old K&R days, when some
people would mix that brace style with K&R-style function arguments
... ugh!]

`...the Soviet Union was sliding in to an economic collapse so comprehensive
 that in the end its factories produced not goods but bads: finished products
 less valuable than the raw materials they were made from.'  [The Economist]

reply via email to

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