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

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

Re: Deleting all succeeding whitespace


From: Sandip Chitale
Subject: Re: Deleting all succeeding whitespace
Date: 25 Aug 2003 15:50:36 -0700

"Eric Bessette" <address@hidden> wrote in message news:<address@hidden>...
> 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)


reply via email to

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