[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-humanities] How can I `upcase-word` for ALL words in the buff
From: |
Joost |
Subject: |
Re: [emacs-humanities] How can I `upcase-word` for ALL words in the buffer without typing the word twice? |
Date: |
Tue, 04 Apr 2023 22:26:03 +0200 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-334-g8c072af647-fm-20230330.001-g8c072af6 |
On Tue, 4 Apr 2023, at 21:50, David Hedlund wrote:
> Normally I'd use.
>
> M-x RET replace-string RET parser RET PARSER
>
> M-x RET replace-string RET args RET ARGS
>
> However, I don't like the idea of typing the word twice (lowercase, then
> uppercase),
The doc string for `replace-regexp` has this:
```
In interactive calls, the replacement text may contain ‘\,’
followed by a Lisp expression used as part of the replacement
text. Inside of that expression, ‘\&’ is a string denoting the
whole match, ‘\N’ a partial match, ‘\#&’ and ‘\#N’ the respective
numeric values from ‘string-to-number’, and ‘\#’ itself for
‘replace-count’, the number of replacements occurred so far, starting
from zero.
```
So what you can do is:
M-x replace-regexp RET
parser RET
\,(upcase \&) RET
Place point at the start of the buffer (or wherever you want to start the
replacement), since the command works from point.
HTH
--
Joost Kremers
Life has its moments