all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: c-mark-function goes too far
Date: Wed, 10 Jan 2007 08:53:14 +0900	[thread overview]
Message-ID: <87hcuz69lh.fsf@catnip.gol.com> (raw)
In-Reply-To: <mailman.2837.1168213818.2155.bug-gnu-emacs@gnu.org> (Eric Hanchrow's message of "Sun\, 07 Jan 2007 15\:31\:27 -0800")

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!]

-miles
-- 
`...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]

  parent reply	other threads:[~2007-01-09 23:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-07  2:24 c-mark-function goes too far Pete Klammer
2007-01-07 23:31 ` Eric Hanchrow
     [not found] ` <mailman.2837.1168213818.2155.bug-gnu-emacs@gnu.org>
2007-01-09 23:53   ` Miles Bader [this message]
2007-01-10 18:46     ` Richard Stallman
2007-01-10 20:44       ` Alan Mackenzie
2007-01-11  4:55         ` Miles Bader
2007-01-11  5:10         ` Richard Stallman

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=87hcuz69lh.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --cc=bug-gnu-emacs@gnu.org \
    /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.