emacs-devel
[Top][All Lists]
Advanced

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

Re: Semantic parser uses c-forward-conditional


From: Eric M. Ludlam
Subject: Re: Semantic parser uses c-forward-conditional
Date: Tue, 22 Sep 2009 07:43:47 -0400

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





reply via email to

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