unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* capitalize some words in a region
@ 2023-09-29 15:37 Uwe Brauer
  2023-09-29 16:04 ` Emanuel Berg
  2023-09-29 16:11 ` Leo Butler
  0 siblings, 2 replies; 7+ messages in thread
From: Uwe Brauer @ 2023-09-29 15:37 UTC (permalink / raw)
  To: help-gnu-emacs



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 



-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the NATO membership of the Ukraine.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: capitalize some words in a region
  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 16:11 ` Leo Butler
  1 sibling, 1 reply; 7+ messages in thread
From: Emanuel Berg @ 2023-09-29 16:04 UTC (permalink / raw)
  To: help-gnu-emacs

Uwe Brauer wrote:

> 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?

There was a guy who wrote some Elisp to do just that, it was
discussed on this very list but that's all I remember, maybe
you can find it by searching the archives

  http://lists.gnu.org/archive/html/help-gnu-emacs

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: capitalize some words in a region
  2023-09-29 15:37 capitalize some words in a region Uwe Brauer
  2023-09-29 16:04 ` Emanuel Berg
@ 2023-09-29 16:11 ` Leo Butler
  1 sibling, 0 replies; 7+ messages in thread
From: Leo Butler @ 2023-09-29 16:11 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [External] : Re: capitalize some words in a region
  2023-09-29 16:04 ` Emanuel Berg
@ 2023-09-29 18:08   ` Drew Adams
  2023-09-29 19:47     ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2023-09-29 18:08 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs@gnu.org

> There was a guy who wrote some Elisp to do just that, it was
> discussed on this very list but that's all I remember, maybe
> you can find it by searching the archives

This guy, perhaps? ;-)

https://mail.gnu.org/archive/html/help-gnu-emacs/2019-04/msg00187.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [External] : Re: capitalize some words in a region
  2023-09-29 18:08   ` [External] : " Drew Adams
@ 2023-09-29 19:47     ` Uwe Brauer
  2023-10-01 19:17       ` Howard Melman
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2023-09-29 19:47 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

>>> "DA" == Drew Adams <drew.adams@oracle.com> writes:

>> There was a guy who wrote some Elisp to do just that, it was
>> discussed on this very list but that's all I remember, maybe
>> you can find it by searching the archives

> This guy, perhaps? ;-)

> https://mail.gnu.org/archive/html/help-gnu-emacs/2019-04/msg00187.html

Well I was not successful with my search in this list, however the 
following was very useful:

https://emacs.stackexchange.com/questions/26286/toggle-letter-case-exclude-custom-words-from-a-list


https://karl-voit.at/2015/05/25/elisp-title-capitalization/ 

And especially 
https://github.com/novoid/title-capitalization.el

Which turned out precisely what I was looking for.

Regards

Uwe Brauer 

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the NATO membership of the Ukraine.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [External] : Re: capitalize some words in a region
  2023-09-29 19:47     ` Uwe Brauer
@ 2023-10-01 19:17       ` Howard Melman
  2023-10-02  8:05         ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Howard Melman @ 2023-10-01 19:17 UTC (permalink / raw)
  To: help-gnu-emacs


Uwe Brauer <oub@mat.ucm.es> writes:

> Well I was not successful with my search in this list, however the 
> following was very useful:
>
> https://emacs.stackexchange.com/questions/26286/toggle-letter-case-exclude-custom-words-from-a-list
>
>
> https://karl-voit.at/2015/05/25/elisp-title-capitalization/ 
>
> And especially 
> https://github.com/novoid/title-capitalization.el
>
> Which turned out precisely what I was looking for.

See also: https://codeberg.org/acdw/titlecase.el

-- 

Howard




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [External] : Re: capitalize some words in a region
  2023-10-01 19:17       ` Howard Melman
@ 2023-10-02  8:05         ` Uwe Brauer
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Brauer @ 2023-10-02  8:05 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]


> Uwe Brauer <oub@mat.ucm.es> writes:


> See also: https://codeberg.org/acdw/titlecase.el

Thanks, I will try this out as well, better to have too many than to few pkgs.😇
-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the NATO membership of the Ukraine.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-02  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).