all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Juha Nieminen <nospam@thanks.invalid>
Cc: Chong Yidong <cyd@stupidchicken.com>,
	help-gnu-emacs@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Problem with parenthesis matching and autoindentation in MacOS X version of emacs
Date: Mon, 15 Dec 2008 18:39:05 +0000	[thread overview]
Message-ID: <20081215183905.GB2765@muc.de> (raw)
In-Reply-To: <49463d12$0$4789$9b536df3@news.fv.fi>

Hi, Juha!

On Mon, Dec 15, 2008 at 01:18:42PM +0200, Juha Nieminen wrote:
>   I'm using emacs in MacOS X, and it reports its version as:
> GNU Emacs 22.1.50.1 (i386-apple-darwin8.10.1, Carbon Version 1.6.0) of 
> 2007-08-20 on macpro

>   It has an annoying problem/bug regarding parenthesis matching and 
> autoindentation. (These problems do not happen in the linux nor the 
> Windows versions.) For example if I write this code in C++ mode:

> void foo()
> {
>     if(x < 0 || x >= puzzleWidth || y < 0 || y >= puzzleHeight)
>         {
>         }
> }

> it will report a "Mismatched parenteses" at the parenthesis which ends 
> the if conditional, and after that it will autoindent the {} symbols 
> wrongly (as seen above). If I replace the above with this:

> void foo()
> {
>     const bool isOutside =
>         x < 0 || x >= puzzleWidth || y < 0 || y >= puzzleHeight;
>     if(isOutside)
>     {
>     }
> }

> then it will not report the mismatch, and will indent the {} properly.

>   Any idea what could be wrong?

Yes.  There're bugs in C++ Mode to do with template brackets (who on
earth "designed" this feature in C++?).  C++ Mode is probably marking
your (newly typed) "<" and ">" as template delimiters, than unmarking the
">" as soon as it has become a ">=".

In C++, it's impossible, in the general case, to distinguish < "less
than" from < "open template", unless the thing doing the analysis is a
compiler.  C++ Mode tries to mark template delimiters as parentheses, but
sometimes it gets it badly wrong.  I've almost finished a fix for a
problem here, which I'm hoping will be ready in time for Emacs 23.  (Hi,
Yidong and Stefan!).

Please try your code snippets in C mode.  There probably isn't a problem
there.  If there is, could you report it to bug-cc-mode@gnu.org, please.

> (As said, this doesn't happen in linux nor Windows.)

I suspect this isn't actually the case.  Whether or not problems appear
is highly dependent on the order you type the characters.  Anyhow, I'm
trying to fix the cause of the problem by always marking "<" and ">" as
parens in matching pairs.

Could you please check again, typing the EXACT SAME sequence of
characters on the Mac and either GNU/Linux or Windows, whether you
actually do get different results on different systems.  Thanks in
advance!

-- 
Alan Mackenzie (Nuremberg, Germany).




  reply	other threads:[~2008-12-15 18:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 11:18 Problem with parenthesis matching and autoindentation in MacOS X version of emacs Juha Nieminen
2008-12-15 18:39 ` Alan Mackenzie [this message]
     [not found] ` <mailman.2805.1229365442.26697.help-gnu-emacs@gnu.org>
2008-12-16 19:46   ` Juha Nieminen
2008-12-17 16:29     ` Alan Mackenzie
     [not found]     ` <mailman.2957.1229530429.26697.help-gnu-emacs@gnu.org>
2008-12-18  0:32       ` Juha Nieminen

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=20081215183905.GB2765@muc.de \
    --to=acm@muc.de \
    --cc=cyd@stupidchicken.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nospam@thanks.invalid \
    /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.