Eric M. Ludlam | 2 Oct 2009 06:20
Gravatar

Re: Am I looking at a comment?

On Thu, 2009-10-01 at 14:13 +0300, Hannu Koivisto wrote:
> "Eric M. Ludlam" <eric <at> siege-engine.com> writes:
> 
> > To know your current context, you need a good start location, then you
> > need to parse from there to point and see where you are.  Semantic uses
> > Emacs syntax tables, so it is probably easier to just use
> > parse-partial-sexp to do the job.
> 
> Well, I was kind of hoping that Semantic would at least know what's
> the best "good start location" (I'd expect it to need that itself
> when the buffer is updated) and/or it would already have up-to-date
> (to the extent that it's possible to be up-to-date) information
> about the current context that you could use for building tools.
> Using parse-partial-sexp feels like an abstraction violation (maybe
> in the future Semantic will use something else than Emacs syntax
> tables).

Yes, Semantic does know a good starting point.  You can use

(semantic-current-tag)

to get the tag under point.  You can then use

(semantic-tag-start TAG)

to get a starting point.  If no tag under point, you can use

semantic-find-tag-by-overlay-prev

to find the previous tag, whos end point would be a safe starting place.

Semantic uses syntax tables in order to use Emacs built-ins for parsing
data.  Semantic could use just about anything I suppose, but since it
overlays the buffer with tag info, that seems the most rational thing to
do.

Eric

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

Gmane