all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Eric M. Ludlam" <eric@siege-engine.com>
To: Alan Mackenzie <acm@muc.de>
Cc: Chong Yidong <cyd@stupidchicken.com>,
	"Eric M. Ludlam" <zappo@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: Semantic parser uses c-forward-conditional
Date: Tue, 22 Sep 2009 07:43:47 -0400	[thread overview]
Message-ID: <1253619827.10118.38.camel@projectile.siege-engine.com> (raw)
In-Reply-To: <20090922105735.GA3722@muc.de>

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	other threads:[~2009-09-22 11:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21 19:19 Semantic parser uses c-forward-conditional Chong Yidong
2009-09-21 19:21 ` Chong Yidong
2009-09-22 10:57 ` Alan Mackenzie
2009-09-22 11:43   ` Eric M. Ludlam [this message]
2009-09-22 22:08     ` Alan Mackenzie
2009-09-23  6:30   ` Richard Stallman
2009-09-23  9:24     ` Alan Mackenzie
2009-09-23 11:22       ` Eric M. Ludlam
2009-09-24 20:44         ` Alan Mackenzie
2009-09-22 16:24 ` Richard Stallman

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=1253619827.10118.38.camel@projectile.siege-engine.com \
    --to=eric@siege-engine.com \
    --cc=acm@muc.de \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=zappo@gnu.org \
    /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.