[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: capitalize some words in a region
From: |
Leo Butler |
Subject: |
Re: capitalize some words in a region |
Date: |
Fri, 29 Sep 2023 16:11:26 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Fri, Sep 29 2023, Uwe Brauer <oub@mat.ucm.es> wrote:
> Hi,
>
> I would like to capitalize certain words in a region, but would like to
> leave out words like and/or for and of like in
>
>
> journal of mathematical physics
>
> Should be turn into to
>
>
> Journal of Mathematical Physics
>
> But not into
>
>
> Journal Of Mathematical Physics
>
> Any idea how to do this?
>
> Thanks
>
> Uwe Brauer
The way that comes to mind is to capitalize the phrase and then go back,
with `case-fold-search' set to nil, and downcase the words you want
downcased by `replace-regexp':
M-x replace-regexp \b\(O[nN]\|O[fF]\|...\)\b RET \,(downcase \1) RET
If you do this enough, it seems like a good candidate for a keyboard macro.
HTH,
Leo