How to remove all newlines from selected region in Emacs?
M-x replace-string
C-q C-j
RET
RET
The trick is to quote the C-j
with C-q
, but otherwise replacing newlines is like replacing anything else.
With my key bindings, which I think are standard, on windows:
Select region
shift-alt-%
ctrl-Q ctrl-J
return
return
!
Or to put it another way, query replace region, ctrl-q to get extended characters, ctrl-j to put in a newline, replace with nothing, all of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With