help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting chunks of whitespace


From: Richard V. Molen
Subject: Re: Deleting chunks of whitespace
Date: 15 Nov 2002 13:08:48 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Benjamin Lewis <bclewis@cs.sfu.ca> writes:

> On 15 Nov 2002, Richard V. Molen wrote:
> 
> > Benjamin Lewis <bclewis@cs.sfu.ca> writes:
> > 
> >> Not quite what you want, but you could check out
> >> `delete-horizontal-space' and 'just-one-space', bound by default to
> >> `M-\' and 'M-<SPC>' respectively.
> > 
> > These key bindings are nice since they mesh well with M-d.
> > 
> > On another editor there was a function like that I miss...
> > 
> > if the cursor is at the end of line, pull up the next line (like C-k) 
> > else
> > if the cursor is on non-whitespace, delete all characters to end of line
> > that are non-whitespace.
> > else
> > if the cursor is on whitespace, delete all characters to the end of line
> > that are whitespace.
> > 
> > Does anyone have such a function?
> 
> Not sure I understand.  Where would you use this that C-k doesn't do what
> you want?

Though I tried, in review, what I said wasn't quite accurate.

Here's an example of what I'm looking for.  Given this text and
calling this function repeatedly...

... cursor ...
   ... v ...
This is          some-text    on_the_first/line
Second line

... cursor ...
   ... v ...
This is some-text    on_the_first/line
Second line

... cursor ...
   ... v ...
This is on_the_first/line
Second line

... cursor ...
   ... v ...
This is 
Second line

... cursor ...
   ... v ...
This is Second line

> 
> Is the function `delete-trailing-whitespace' helpful?

assuming the Second line had whitespace (shown as '@')
... cursor ...
   ... v ...
This is Second line@@@@@@@@

... cursor ...
   ... v ...
This is 

This is behavior is similar to alternating between M-SPC & M-d
and then doing a C-k if at there's no more on the current line.
Two exceptions being the: 1. the cursor doesn't move (not a big
deal) 2. M-d would not cut all non-whitespace characters, but
only alphanumeric strings.

-- 
Richard V. Molen

Warning!!
Signature under construction, safety glasses required.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]