[Top][All Lists]

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

Re: Abbrev should preserve case

From: Stefan Monnier
Subject: Re: Abbrev should preserve case
Date: Thu, 21 Jun 2007 04:01:27 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

> Might it not be the best solution to drop the down-case
> commands in abbrev.c?

The case-insensitivity (and magical treatment of case in general) is
a feature, as evidenced by the amount of extra code in abbrev.c to
implement it.  So we do not want to just throw it all out.

> Imaging the use of machine written abbrevs for NLP, context analyses etc.,
> speed will matter. Therefore I suggest to do the work in C as far as
> possible, avoid re-implementations. (I intend to take part here as far as
> it's welcome and I'm able to.)

The expand-abbrev code has no loop.  So there is no issue
w.r.t performance (at least as long as we stick to the current constraint
that abbreviations can only contain chars of word-syntax"): the code of
expand-abbrev basically extracts the word before point, looks it up in
a hash-table (actually, an obarray) and then uses the result to do the
expansion (if any).  The only part that will get slower with larger
abbrev-tables is the hash-lookup which is coded in C anyway.

> Please consider if a derived mode must copy all the
> abbrevs. I'd say a derived mode should rather note the
> differences, but read the major-mode first. Then the
> abbrev-file, which already counts 500K here, would
> shrink a lot.

This may be solved by the use of inheritance.  Although given the rather
limited amount of derived major modes in use, I'm not sure your 500KB would
really shrink that much.


reply via email to

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