Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to delete until the first displayable character in a line?

4 views
Skip to first unread message

Ronald

unread,
Dec 12, 2006, 10:35:19 AM12/12/06
to
How to delete towards the right or the left until the first displayed
character or the start/end of a line.

Ronald

unread,
Dec 12, 2006, 10:52:18 AM12/12/06
to
Ronald wrote:
> How to delete towards the right or the left until the first displayed
> character or the start/end of a line.

On the hand, to delete characters until the first undisplayable character.

Robert Thorpe

unread,
Dec 12, 2006, 12:21:52 PM12/12/06
to
Ronald wrote:
> How to delete towards the right or the left until the first displayed
> character or the start/end of a line.

>From the left to the end of the line is C-k
A prefix argument determines how many, so ..
C-u 2 C-k kills the next two, C-u -1 C-k text from point back to the
start of the line.
C-u C-k kills the next 4 lines.

> On the hand, to delete characters until the first undisplayable character.

Don't know how to do that. Possibly you could use zap-to-char.

Why on earth do you want to do that anyway?

Kevin Rodgers

unread,
Dec 12, 2006, 1:55:06 PM12/12/06
to help-gn...@gnu.org

What characters do you consider undisplayable?

--
Kevin

Ronald

unread,
Dec 12, 2006, 5:20:26 PM12/12/06
to
> What characters do you consider undisplayable?
space tab ...


Ronald

unread,
Dec 12, 2006, 5:27:34 PM12/12/06
to
> A prefix argument determines how many, so ..
> C-u 2 C-k kills the next two, C-u -1 C-k text from point back to the
> start of the line.
> C-u C-k kills the next 4 lines.

It's hard to count how many spaces there are, even harder with tabs.
What's easy is that do that in one line is enough for me.

>> On the hand, to delete characters until the first undisplayable
>> character.
> Don't know how to do that. Possibly you could use zap-to-char.
> Why on earth do you want to do that anyway?

Because if the previous deleting can be done, I think it is a good
companion. :-)


Dieter Wilhelm

unread,
Dec 12, 2006, 7:12:00 PM12/12/06
to Ronald, help-gn...@gnu.org
Ronald <foll...@163.com> writes:

> How to delete towards the right or the left until the first displayed
> character or the start/end of a line.

1. M-\: deletes white space to the right *and* the left.

2. M-- M-\: deletes white space only to the left. (There's a bug right now
when calling delete-horizontal-space with M-\ but I'll report it.)

3. C-M-s SPC RET C-w: kills white space to the right.

--
Best wishes

H. Dieter Wilhelm
Darmstadt, Germany


Robert Thorpe

unread,
Dec 13, 2006, 6:19:42 AM12/13/06
to
Ronald wrote:
> > A prefix argument determines how many, so ..
> > C-u 2 C-k kills the next two, C-u -1 C-k text from point back to the
> > start of the line.
> > C-u C-k kills the next 4 lines.
>
> It's hard to count how many spaces there are, even harder with tabs.
> What's easy is that do that in one line is enough for me.

But why do you want to count spaces and tabs?

> >> On the hand, to delete characters until the first undisplayable
> >> character.
> > Don't know how to do that. Possibly you could use zap-to-char.
> > Why on earth do you want to do that anyway?
>
> Because if the previous deleting can be done, I think it is a good
> companion. :-)

Right, I think I'm still not seeing what you're trying to do. (By the
way, most Emacs people consider "undisplayable" characters to be ones
in international characters sets that can't be displayed with their
current font.)

To delete stuff that is not whitespace can also be done using regexp.

M-x replace-regexp RET \w RET RET will remove all words leaving only
punctuation and space. M-x replace-regexp \S SPC RET RET will remove
all words and punctuation leaving only space. If you use
query-replace-regexp for the commands above then Emacs will ask you
about each occurance, meaning you can do it only once, then escape by
pressing C-g.

Mathias Dahl

unread,
Dec 13, 2006, 7:21:05 AM12/13/06
to
Ronald <foll...@163.com> writes:

> How to delete towards the right or the left until the first
> displayed character or the start/end of a line.

Depending on what you need the above for, `just-one-space' (for me
M-SPC is bound to this command) might be useful to you.

Dieter Wilhelm

unread,
Dec 23, 2006, 7:47:09 AM12/23/06
to Ronald, help-gn...@gnu.org
Dieter Wilhelm <die...@duenenhof-wilhelm.de> writes:

> Ronald <foll...@163.com> writes:
>
>> How to delete towards the right or the left until the first displayed
>> character or the start/end of a line.
>

> 1. M-\: deletes white space to the right *and* the left.
>
> 2. M-- M-\: deletes white space only to the left. (There's a bug right now
> when calling delete-horizontal-space with M-\ but I'll report it.)

2. works now with CVS Emacs.

0 new messages