[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Whitespace deletion
From: |
B. T. Raven |
Subject: |
Re: Whitespace deletion |
Date: |
Fri, 09 Dec 2005 17:44:35 GMT |
"August Karlstrom" <fusionfive@comhem.se> wrote in message
news:L40mf.39868$d5.196261@newsb.telia.net...
> Hi,
>
> Is there an Emacs command that works like just-one-space, but also
> deletes newlines?
>
> Example:
>
> I want to -!-
>
> join these two lines
>
> should become
>
> I want to -!-join these two lines
>
>
> Regards,
>
> August
>
The resultant ...-!-join... looks pathological. Is -!- shorthand for some
variable text or is it constant? Can there be white space after -!- but
before the newline? If not then, after placing point somewhere on the
second line, you could wrap some commands in a macro (underscore = space
to make it visible):
C-x (
C-a
M-SPC
Backspace
Backspace
M-SPC
C-r _-
M-SPC
C-x )
If that doesn't do it then you probably have to write something in elisp.
Here are some regexes I use a lot (not programming though, just in text
mode):
C-M-% \(^C-qC-j\)+ RET \1 RET ;; collapse multiple blank lines into one
C-M-% ^C-qC-j+ RET RET ;;remove all blank lines
C-M-% _\([;!?]\) RET \1 RET ;; remove space before sem, bang, quest
C-M-% _+ RET _ RET ;; collapse all instances of multiple spaces to
one space
Ed