[Top][All Lists]

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

Re: Abbrev should preserve case

From: Glenn Morris
Subject: Re: Abbrev should preserve case
Date: Wed, 20 Jun 2007 18:18:28 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

> ,----
> |    Abbrev expansion preserves case; thus, `foo' expands into `find
> | outer otter'; `Foo' into `Find outer otter', and `FOO' into `FIND OUTER
> | OTTER'
> `----
> From there users may guess, it would be possible to define `foo',
> `Foo' and `FOO' as abbrev names likewise and altogether.

I don't understand what you mean. To me, the quoted text implies that
case is irrelevant in abbrev names. Perhaps it could explicitly say
something about this.

> Which don't work, because `add-abbrev' in line 289 abbrev.el
> down-cases every input, thus only down-cased names are registered.
> ,----
> | (define-abbrev table (downcase name) exp))))
> `----
> Exists a reason for that?

Because otherwise the abbrev mechanism could not work as described in
your first quote. expand-abbrev in abbrev.c downcases words in the
buffer before comparing against the defined abbrevs. If define-abbrev
did allow you to define "FOO" as an abbrev, it would never be

> I would much appreciate, if I could mix freely up- and downcase
> chars. This would extend the range of possible abbrev-names
> considerably.
> The latter is of interest, if you don't use abbrev the common way,
> but for whole phrases, defined by machine.

I don't understand what you mean. Perhaps an example would help.

> If no one objects, I would try to change that.

I don't know what you want to do.

How would you tell the difference between `FOO' meaning "expand to the
upper-case expansion of `foo'" (as it works now), and `FOO' a totally
separate abbreviation? I guess you could try a case-insensitive match
first, then a case-sensitive one if it fails. This would mean that
`FOO' could expand to something different than `foo' only if `foo'
were not defined as an abbrev. Seems a bit complex though.

Admittedly, I think the way it works now is a bit odd, but it's always
been like that.

reply via email to

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