[Top][All Lists]

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

Re: Major modes and features

From: Stefan Monnier
Subject: Re: Major modes and features
Date: Tue, 20 Mar 2001 14:59:30 -0500

> Speedbar keeps a regex which matches files which will contain tag able
> text.  This falls behind as new languages and Imenu support is added.
> Kevin Broady's recent request was for speedbar to somehow query
> auto-mode-alist and compare that to some list of major modes to
> determine if a given file supports imenu for tagging purposes.
> That, of course, just pushes the maintenance out to a list of major modes.

I'm not sure what would be the best solution, but if there's one, I think
it shouldn't involve any special effort on the part of the major mode
author.  I.e. no special `autoload' cookie for some features that some
package might like to test.

The information you're looking for *is* available already, the only problem
is a problem of performance since you don't want to load all packages
all the time.  Most performance problems can be reduced by clever
tricks and/or caching and I think this one is no exception.

How about having two REs: the RE that matches files for which imenu
is available and another for which imenu is not available (that's
the cache).
If the cache fails (i.e. a file matches neither and neither does it match
completion-ignored-extensions), try to find the corresponding entry
in auto-mode-alist, setup the mode in a temporary buffer, check whether
imenu support is available and update the relevant RE.  Since this
involves loading the package, it should be avoided, either by instructing
the user to update the settings or by doing the update automatically
via customize.

How about that ?


reply via email to

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