Alex Rivera | Logout

Emacs Command to Delete Up to Non-Whitespace Character

Asked 2009-01-15T00:37:15.080
47

I often want to make a multiline function call and reduce it down to one line. For example, convert...

function_call(
     'first_arg',
     'second')

to

function_call('first_arg', 'second')

Does emacs have some commands to help with this. Specifically, is there a command that will delete all whitespace from the point to the first non-whitespace character?

Edit
Report

1 Answer

36

Take a look at the fixup-whitespace function. It comes with Emacs, in simple.el. Its docs are:

Fixup white space between objects around point. Leave one space or none, according to the context.

A similar function, just-one-space, that

Deletes all spaces and tabs around point, leaving one space

is typically bound to M-SPC.

answered 2009-01-15T00:47:35.807

Your Answer