unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Deleting all succeeding whitespace
@ 2003-08-24 16:30 Eric Bessette
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Bessette @ 2003-08-24 16:30 UTC (permalink / raw)


I'd like to have a key binding that deletes all of the whitespace after the
current cursor position.  Is there a function in emacs that does this?  Can
I create one, if so, I'd appreciate some help?

Thanks,
Eric

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

* Re: Deleting all succeeding whitespace
       [not found] <mailman.871.1061746115.29551.help-gnu-emacs@gnu.org>
@ 2003-08-24 20:05 ` Karl Pflästerer
  2003-08-25 17:54   ` Kevin Rodgers
  2003-08-25 22:50 ` Sandip Chitale
  1 sibling, 1 reply; 4+ messages in thread
From: Karl Pflästerer @ 2003-08-24 20:05 UTC (permalink / raw)


On 24 Aug 2003, Eric Bessette <- ebessette@qwest.net wrote:

> I'd like to have a key binding that deletes all of the whitespace after the
> current cursor position.  Is there a function in emacs that does this?  Can
> I create one, if so, I'd appreciate some help?

A function which does nearly what you want is `just-one-space'.  Its
default binding is `M-SPC'.  Maybe you could use its definition as a
start?


   KP

-- 
Der wahre Weltuntergang ist die Vernichtung des Geistes, der andere hängt von
dem gleichgiltigen Versuch ab, ob nach der Vernichtung des Geistes noch eine
Welt bestehen kann.
                   Karl Kraus 'Untergang der Welt durch schwarze Magie'

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

* Re: Deleting all succeeding whitespace
  2003-08-24 20:05 ` Karl Pflästerer
@ 2003-08-25 17:54   ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-08-25 17:54 UTC (permalink / raw)


Karl Pflästerer wrote:

> On 24 Aug 2003, Eric Bessette <- ebessette@qwest.net wrote:
> 
> 
>>I'd like to have a key binding that deletes all of the whitespace after the
>>current cursor position.  Is there a function in emacs that does this?  Can
>>I create one, if so, I'd appreciate some help?
> 
> A function which does nearly what you want is `just-one-space'.  Its
> default binding is `M-SPC'.  Maybe you could use its definition as a
> start?

delete-horizontal-space is another useful command, bound to M-\.

-- 
Kevin Rodgers

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

* Re: Deleting all succeeding whitespace
       [not found] <mailman.871.1061746115.29551.help-gnu-emacs@gnu.org>
  2003-08-24 20:05 ` Karl Pflästerer
@ 2003-08-25 22:50 ` Sandip Chitale
  1 sibling, 0 replies; 4+ messages in thread
From: Sandip Chitale @ 2003-08-25 22:50 UTC (permalink / raw)


"Eric Bessette" <ebessette@qwest.net> wrote in message news:<mailman.871.1061746115.29551.help-gnu-emacs@gnu.org>...
> I'd like to have a key binding that deletes all of the whitespace after the
> current cursor position.  Is there a function in emacs that does this?  Can
> I create one, if so, I'd appreciate some help?
> 
> Thanks,
> Eric
I have this:

(defun delete-forward-backward-horizontal-space (arg)
  "Delete all spaces and tabs forward from point. With argument delete
all spaces and tabs backword."
  (interactive "*P")
  (let ((orig-pos (point)))
    (delete-region
     orig-pos
     (progn
       (if arg
           (skip-chars-backward " \t")
           (skip-chars-forward " \t"))
       (constrain-to-field nil orig-pos t)))))

(global-set-key [(meta ?\  )]              
'delete-forward-backward-horizontal-space)

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

end of thread, other threads:[~2003-08-25 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-24 16:30 Deleting all succeeding whitespace Eric Bessette
     [not found] <mailman.871.1061746115.29551.help-gnu-emacs@gnu.org>
2003-08-24 20:05 ` Karl Pflästerer
2003-08-25 17:54   ` Kevin Rodgers
2003-08-25 22:50 ` Sandip Chitale

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