unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Leo Butler <Leo.Butler@umanitoba.ca>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: capitalize some words in a region
Date: Fri, 29 Sep 2023 16:11:26 +0000	[thread overview]
Message-ID: <87wmw9x8lt.fsf@t14.reltub.ca> (raw)
In-Reply-To: <87sf6xj8i0.fsf@mat.ucm.es> (Uwe Brauer's message of "Fri, 29 Sep 2023 17:37:27 +0200")

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


      parent reply	other threads:[~2023-09-29 16:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29 15:37 capitalize some words in a region Uwe Brauer
2023-09-29 16:04 ` Emanuel Berg
2023-09-29 18:08   ` [External] : " Drew Adams
2023-09-29 19:47     ` Uwe Brauer
2023-10-01 19:17       ` Howard Melman
2023-10-02  8:05         ` Uwe Brauer
2023-09-29 16:11 ` Leo Butler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmw9x8lt.fsf@t14.reltub.ca \
    --to=leo.butler@umanitoba.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).