[plt-scheme] Re: Emacs tags for MzScheme modules

From: Jim Blandy (jimb at redhat.com)
Date: Mon Nov 3 16:41:14 EST 2003

Eli Barzilay <eli at barzilay.org> writes:

> On Nov  3, Jim Blandy wrote:
> > If one wanted to preserve this property, one might consider writing
> > a patch to 'etags' that adds a '--mzscheme' language, which
> > recognizes the module declaration, and looks at things indented
> > within that form instead of just looking for open parens in the
> > leftmost column.  I'll bet the Emacs maintainers would be willing to
> > include such a patch in the Emacs distribution (but I can't speak
> > for them, of course).
> Still, you have the problem of a regexp facility that is not enough to
> know what a real definition is vs what an internal one is...  So if
> you're willing to put up with the inexact nature of that, then you can
> just as well use the hacked up solution of providing a manual
> regexp...

Well, I haven't looked at etags's Scheme support, so I'm speaking ex
hat here, but some of the etags analyzers actually do half-hearted
tokenization and depth counting.  (You only need to recognize a few
kinds of tokens, like strings, character literals, comments, and
parens.)  If the Scheme parser does that, then it could tell what
depth it was at, and ignore internal definitions.

To be honest, I'm kind of embarrassed to be advocating this.  But I
really have been happy with the results for years, and I suspect that
an approach based on a full parser would be more fragile in practice.

What the module inspection approach gets you that the ad-hoc approach
will never be able to touch is the ability to recognize definitions
introduced by macros.  I don't have enough experience with MzScheme to
say how important that is in practice.

Posted on the users mailing list.