From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juha Nieminen Newsgroups: gmane.emacs.help Subject: Re: Problem with parenthesis matching and autoindentation in MacOS X version of emacs Date: Tue, 16 Dec 2008 19:46:31 GMT Organization: Sonera Customer Message-ID: References: <49463d12$0$4789$9b536df3@news.fv.fi> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1229494825 30975 80.91.229.12 (17 Dec 2008 06:20:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2008 06:20:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 07:21:23 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LCpmZ-0006RS-QG for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 07:21:20 +0100 Original-Received: from localhost ([127.0.0.1]:49776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCplN-0002Km-61 for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 01:20:05 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!feeder.erje.net!feeder2.news.saunalahti.fi!feeder1.news.saunalahti.fi!nntp.inet.fi!central1.inet.fi!inet.fi!read4.inet.fi.POSTED!53ab2750!not-for-mail User-Agent: Thunderbird 2.0.0.18 (X11/20081112) Original-Newsgroups: gnu.emacs.help In-Reply-To: X-Enigmail-Version: 0.95.7 Original-Lines: 76 Original-NNTP-Posting-Host: 88.195.136.151 Original-X-Complaints-To: abuse@inet.fi Original-X-Trace: read4.inet.fi 1229456791 88.195.136.151 (Tue, 16 Dec 2008 21:46:31 EET) Original-NNTP-Posting-Date: Tue, 16 Dec 2008 21:46:31 EET Original-Xref: news.stanford.edu gnu.emacs.help:165372 X-Mailman-Approved-At: Wed, 17 Dec 2008 01:17:10 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60713 Archived-At: Alan Mackenzie wrote: > 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 ">=". It behaves very erratically (although predictably). For example if I start typing this: if(x < 0) then the parenthesis matching works ok. However, if I know delete the ) and change it to: if(x < 0> it will now match the "closing angle bracket" to the <. Ok, fine, I suppose. However, now it's when it becomes weird. If I now delete the < and replace it again with ), that is: if(x < 0) in other words, it's now exactly like the first version above, it will mismatch the ) with the <, and indentation goes haywire. It will keep this erroneous matching mode until I delete everything from the 'x' forward and write it again. It's rather annoying. I really don't want to sound rude, but given how usual expressions like "x < something || x > something_else" are, how come this problem got into a released version? OTOH, who am I to talk? I have been using emacs for something like 10 years to write C++, and only now do I notice this problem. I suppose I don't use that kind of expression all that often, after all. How recently was this new parenthesis matching code introduced into emacs? > 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!). Would it be a great loss if the <> "brackets" were not included in the matching logic at all? Is there a way to turn the matching off for <>? >> (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! It's strange. I have been using emacs for years to write C++ in both linux and windows, and only now do I notice this problem happening there as well. I assumed there was no problem because I had never noticed before. However, now that I try it in linux, it also happens there. I suppose that for the time being I'll just have to code my way around the problem like this: if(0 > x || x >= puzzleWidth || 0 > y || y >= puzzleHeight) (I'm just having a very hard time visualizing the meaning of "0 > x" in my head, as I'm not accustomed to thinking that way. It's a bit like, instead of saying "if the amount of money you own is less than zero", you say "if zero is larger than the amount of money you own", which is rather backwards and hard to understand...)