unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Whitespace deletion
@ 2005-12-08 19:46 August Karlstrom
  2005-12-08 22:05 ` Kevin Rodgers
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: August Karlstrom @ 2005-12-08 19:46 UTC (permalink / raw)


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

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
  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>
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-12-08 22:05 UTC (permalink / raw)


August Karlstrom wrote:
 > 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

Does this help?

,----[ C-h k M-^ ]
| M-^ runs the command delete-indentation
|    which is an interactive compiled Lisp function in `simple'.
| (delete-indentation &optional ARG)
|
| Join this line to previous and fix up whitespace at join.
| If there is a fill prefix, delete it from the beginning of this line.
| With argument, join this line to following line.
`----

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
       [not found] ` <mailman.18498.1134079821.20277.help-gnu-emacs@gnu.org>
@ 2005-12-09  1:05   ` August Karlstrom
  2005-12-09  2:15     ` Quokka
  0 siblings, 1 reply; 8+ messages in thread
From: August Karlstrom @ 2005-12-09  1:05 UTC (permalink / raw)


Kevin Rodgers wrote:
> August Karlstrom wrote:
>  > 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
> 
> Does this help?
> 
> ,----[ C-h k M-^ ]
> | M-^ runs the command delete-indentation
> |    which is an interactive compiled Lisp function in `simple'.
> | (delete-indentation &optional ARG)
> |
> | Join this line to previous and fix up whitespace at join.
> | If there is a fill prefix, delete it from the beginning of this line.
> | With argument, join this line to following line.
> `----

No. Did you try it on my example?


August

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
  2005-12-09  1:05   ` August Karlstrom
@ 2005-12-09  2:15     ` Quokka
  0 siblings, 0 replies; 8+ messages in thread
From: Quokka @ 2005-12-09  2:15 UTC (permalink / raw)


August Karlstrom wrote:
> Kevin Rodgers wrote:
>> August Karlstrom wrote:
>>  > 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
>>
>> Does this help?
>>
>> ,----[ C-h k M-^ ]
>> | M-^ runs the command delete-indentation
>> |    which is an interactive compiled Lisp function in `simple'.
>> | (delete-indentation &optional ARG)
>> |
>> | Join this line to previous and fix up whitespace at join.
>> | If there is a fill prefix, delete it from the beginning of this line.
>> | With argument, join this line to following line.
>> `----
> 
> No. Did you try it on my example?

Have a look at
http://www.emacswiki.org/cgi-bin/wiki/DeletingWhitespace

I think the kill-whitespace function will do what you want.

Paul

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
  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  5:56 ` William Xu
  2005-12-09 17:44 ` B. T. Raven
  2005-12-09 20:27 ` Alan Mackenzie
  4 siblings, 0 replies; 8+ messages in thread
From: William Xu @ 2005-12-09  5:56 UTC (permalink / raw)


August Karlstrom <fusionfive@comhem.se> writes:

> Hi,
>
> Is there an Emacs command that works like just-one-space, but also
> deletes newlines?

There does be a similar just-one-blank-line, but its name is
`delete-blank-lines'.

Adavice `delete-blank-lines' a little bit, you may get what you want.

-- 
William

((email . "william.xwl@gmail.com")
 (blog  . "http://matchsticker.mysmth.net"))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
  2005-12-08 19:46 Whitespace deletion August Karlstrom
                   ` (2 preceding siblings ...)
  2005-12-09  5:56 ` William Xu
@ 2005-12-09 17:44 ` B. T. Raven
  2005-12-09 19:17   ` August Karlstrom
  2005-12-09 20:27 ` Alan Mackenzie
  4 siblings, 1 reply; 8+ messages in thread
From: B. T. Raven @ 2005-12-09 17:44 UTC (permalink / raw)



"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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
  2005-12-09 17:44 ` B. T. Raven
@ 2005-12-09 19:17   ` August Karlstrom
  0 siblings, 0 replies; 8+ messages in thread
From: August Karlstrom @ 2005-12-09 19:17 UTC (permalink / raw)


B. T. Raven wrote:
> "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? 

-!- is used in the Emacs manual to denote the position of point.


August

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Whitespace deletion
  2005-12-08 19:46 Whitespace deletion August Karlstrom
                   ` (3 preceding siblings ...)
  2005-12-09 17:44 ` B. T. Raven
@ 2005-12-09 20:27 ` Alan Mackenzie
  4 siblings, 0 replies; 8+ messages in thread
From: Alan Mackenzie @ 2005-12-09 20:27 UTC (permalink / raw)


August Karlstrom <fusionfive@comhem.se> wrote on Thu, 08 Dec 2005
19:46:51 GMT:
> Hi,

> Is there an Emacs command that works like just-one-space, but also
> deletes newlines?

There is in CC Mode (that's c-mode, c++-mode, java-mode, ....), namely
c-hungry-backspace.  Or, if you're at the other end of the gap,
c-hungry-delete-forward.  As from CC Mode 5.31, they're bound by default
to C-c C-DEL and C-c C-d.  You'll probably have to insert that single
space by hand, though.

[ .... ]

> Regards,

> August

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-12-09 20:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2005-12-09 19:17   ` August Karlstrom
2005-12-09 20:27 ` Alan Mackenzie

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).