unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "B. T. Raven" <ecinmn@peoplepc.com>
Subject: Re: Whitespace deletion
Date: Fri, 09 Dec 2005 17:44:35 GMT	[thread overview]
Message-ID: <7ojmf.1585$3Z.638@newsread1.news.atl.earthlink.net> (raw)
In-Reply-To: L40mf.39868$d5.196261@newsb.telia.net


"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

  parent reply	other threads:[~2005-12-09 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 19:46 Whitespace deletion August Karlstrom
2005-12-08 22:05 ` Kevin Rodgers
     [not found] ` <mailman.18498.1134079821.20277.help-gnu-emacs@gnu.org>
2005-12-09  1:05   ` August Karlstrom
2005-12-09  2:15     ` Quokka
2005-12-09  5:56 ` William Xu
2005-12-09 17:44 ` B. T. Raven [this message]
2005-12-09 19:17   ` August Karlstrom
2005-12-09 20:27 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='7ojmf.1585$3Z.638@newsread1.news.atl.earthlink.net' \
    --to=ecinmn@peoplepc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).