From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric M. Ludlam" Newsgroups: gmane.emacs.devel Subject: Re: Semantic parser uses c-forward-conditional Date: Tue, 22 Sep 2009 07:43:47 -0400 Message-ID: <1253619827.10118.38.camel@projectile.siege-engine.com> References: <87zl8oumvl.fsf@stupidchicken.com> <20090922105735.GA3722@muc.de> Reply-To: eric@siege-engine.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1253622197 16015 80.91.229.12 (22 Sep 2009 12:23:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Sep 2009 12:23:17 +0000 (UTC) Cc: Chong Yidong , "Eric M. Ludlam" , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 22 14:23:09 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mq4Oi-0003O7-Fc for ged-emacs-devel@m.gmane.org; Tue, 22 Sep 2009 14:23:08 +0200 Original-Received: from localhost ([127.0.0.1]:57685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mq4Oh-0001dA-Re for ged-emacs-devel@m.gmane.org; Tue, 22 Sep 2009 08:23:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mq3yi-0007ED-Vv for emacs-devel@gnu.org; Tue, 22 Sep 2009 07:56:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mq3yi-0007E0-5F for emacs-devel@gnu.org; Tue, 22 Sep 2009 07:56:16 -0400 Original-Received: from [199.232.76.173] (port=50846 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mq3yh-0007Dx-TN for emacs-devel@gnu.org; Tue, 22 Sep 2009 07:56:15 -0400 Original-Received: from static-71-184-83-10.bstnma.fios.verizon.net ([71.184.83.10]:49462 helo=projectile.siege-engine.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mq3yW-0006cq-Lx; Tue, 22 Sep 2009 07:56:05 -0400 Original-Received: from projectile.siege-engine.com (localhost [127.0.0.1]) by projectile.siege-engine.com (8.14.3/8.14.3/Debian-6) with ESMTP id n8MBhmSa015962; Tue, 22 Sep 2009 07:43:48 -0400 Original-Received: (from zappo@localhost) by projectile.siege-engine.com (8.14.3/8.14.3/Submit) id n8MBhmaE015961; Tue, 22 Sep 2009 07:43:48 -0400 X-Authentication-Warning: projectile.siege-engine.com: zappo set sender to eric@siege-engine.com using -f In-Reply-To: <20090922105735.GA3722@muc.de> X-Mailer: Evolution 2.26.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115517 Archived-At: On Tue, 2009-09-22 at 10:57 +0000, Alan Mackenzie wrote: > Hi, Yidong! > > On Mon, Sep 21, 2009 at 03:19:10PM -0400, Chong Yidong wrote: > > Hi Alan, > > > Semantic's C parser calls c-forward-conditional while it's parsing C > > files. This happens frequently, often at idle time, if you visit a > > large C file. > > Ah. c-forward-conditional is really intended as an interactive command > rather than for use in a lisp function - a bit like beginning-of-buffer. > > > The trouble is that c-forward-conditional sets the mark. The call to it > > is wrapped in a save-excursion, so it doesn't clobber the user's mark, > > but it does lead to a stream of ugly "Mark set" messages. > > > Would it be possible to change c-forward-conditional so that it pushes > > the mark only if called interactively? > > I'm not very keen on that, but how about this instead: a new defun > c-forward-conditional-1 which does the same, except it doesn't push a > mark, doesn't throw errors like "No following conditional at this > level", and returns the final point, or nil? > > Then all occurances inside CEDET can be changed to > (cedet-forward-c-conditional), where the following macro goes into > CEDET: > > (require 'cc-cmds) > (defmacro forward-cedet-c-conditional (count &optional target-depth with-else) > .... > (if (fboundp 'c-forward-conditional-1) ...) > .... > ) > > This will avoid complexifying cc-cmds.el, whilst still allowing CEDET > and friends to work with older CC MODE versions. It would also be good > for CC MODE to separate out the "engine" part of the command from the > "wrapper". The above seems like a fine solution to me. > As a matter of interest, have you grepped CEDET to find other similar > problems? All the C support for the parser is in one. It also uses c-end-of-macro which stands out for me. Eric