2009-08-22

emacs: make next word first letter cap then delete space

On Aug 22, 8:46 am, Harry Putnam wrote:
> I need to do a pile of editing that involves:
>
> Removing a space between words and upcasing the first letter of the
> next word like:
>
> Some example
> to
> SomeExample
>
> I went thru M-x apropos
>
> But didn't find a likely candidate ... or at least none appeared to be
> the right thing for what I want.
>
> So far I've been
>
> Ctrl To get to the space between words
> Ctrl-d Ctrl-d To remove the space and the leading lowercase char of
> the next word
>
> Shift to replace with uppercase
>
> Then back to Ctrl
>
> Where can I save some keyboard strokes?


you can easily do it with query-replace-regexp.

the regexp you should use is:

“ \([[:lower:]]\)”

and the replacement is

“\,(upcase \1)”

some detail here:

• Text Pattern Matching in Emacs
http://xahlee.org/emacs/emacs_regex.html

• Find and Replace with Emacs
http://xahlee.org/emacs/emacs_find_replace.html

Xah
∑ http://xahlee.org/

No comments:

Post a Comment