[Top][All Lists]

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

Re: Semantic parser uses c-forward-conditional

From: Alan Mackenzie
Subject: Re: Semantic parser uses c-forward-conditional
Date: Tue, 22 Sep 2009 10:57:35 +0000
User-agent: Mutt/1.5.9i

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

    (require 'cc-cmds)
    (defmacro forward-cedet-c-conditional (count &optional target-depth 
      (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

As a matter of interest, have you grepped CEDET to find other similar

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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