titlecase.el icon indicating copy to clipboard operation
titlecase.el copied to clipboard

Support keeping entirely capitalized words (optionally)

Open ideasman42 opened this issue 4 years ago • 3 comments

Often fully capitalized words are initials, and should not be changed, e.g.

  • ISO Standard references - APA Style
  • GNU General Public License
  • Optimizing RAM Usage

... in these cases, instead of maintaining a list of acronyms, I think a reasonable rule of thumb is not to adjust fully capitalized words. Or at least have a rule to do so.

Note that this is how my much shorter script worked: https://emacs.stackexchange.com/a/66362/2418

ideasman42 avatar Jan 18 '22 22:01 ideasman42

Dammit, this means my implementation still has bugs. I was just about to come over here to open an issue about capital letters at the end of a region not staying capitalized ...

However, the current main should properly keep these ALL-CAPS words capitalized; can you make sure it does?

EDIT on reading this comment over again I want to make it clear that the "dammit" at the beginning of it is directed at myself --- this issue has plagued me for some hours now!

DOUBLE EDIT I do want to note that on my Emacs at least, when capitalizing the phrases you've provided the acronyms stay capitalized. I'm running the latest main of titlecase.

duckwork avatar Jan 18 '22 22:01 duckwork

Ah, then this is a bug, some titles I tried failed so I assumed it was unsupported, but as you state, this works sometimes too.

These fails for me:

  • Emacs: API 29 -> Emacs: Api 29
  • API API API -> Api Api Api
  • API Three API -> API Three Api

ideasman42 avatar Jan 18 '22 22:01 ideasman42

Hm, this is something. I thought at first it was just the last word logic being weird, but it might be something else.

However, the second one

  • API API API -> Api Api Api

is correct, at least for this version of titlecase.el. If it detects the whole text is all-caps before title-casing, it lowercases everything first. Of course, I made this configurable too (see titlecase-normalize-functions).

duckwork avatar Jan 19 '22 01:01 duckwork