Subject: Re: bug#63438: 30.0.50; abbrev mode wrongly capitalizes with mixed capitalized words

From: Daniel Martín <[email-masked]>
Date: Thu, 11 May 2023 13:45:06 +0200

Daniel Fleischer <[email-masked]> writes:

> Recipe for recreating:
>
> - Add some abbrev definition with mixed capitalization, e.g. "abc"
> should expand to "aBC".
> - Enable abbrev-mode. 
> - Write "aBC".
> - Upon pressing space, abbrev-mode converts it into "ABC". 
>
> There is a code section in `abbrev-insert' that explicitly capitalizes
> the first letter; I'm sure it's there for a reason but I think the
> behavior I showed is unexpected. As for the example "aBC", there are
> real use cases, just to mention one "iPhone".

The docstring of define-abbrev describes that abbreviations support a
property list of options.  One of them is :case-fixed:

‘:case-fixed’: non-nil means that abbreviations are looked up without
  case-folding, and the expansion is not capitalized/upcased.

Perhaps we should make the interactive commands set the :case-fixed
property, if the user wants.

Or to avoid case-folding globally:

(abbrev-table-put global-abbrev-table :case-fixed t)