1

I have read https://www.emacswiki.org/emacs/DeletingWhitespace but couldn't find a way to select a paragraph and remove extra white spaces. For instance:

asd asdasd asdasd asdasdasd asdasda asdasdasdasd asdasdasdasdasdasd asdasd asdasd asdasdasd asdasda asdasdasdasd asdasdasdasdasdasd asdasd asdasd asdasdasd asdasda asdasdasdasd asdasdasdasdasdasd asdasd asdasd asdasdasd asdasda asdasdasdasd asdasdasdasdasdasd asdasd asdasd asdasdasd asdasda asdasdasdasd asdasdasdasdasd

I'd like to be able to select this chunk and apply a function to leave just one white space between words.

Thanks!

1 Answer 1

1

M-x fill-paragraph will reformat the selected paragraph such that there is only a single space between each word.

It will also 'fill' the paragraph, which means inserting line-breaks in order to keep each line shorter than fill-column characters long. If you don't want your lines broken like this, you could set the variable fill-column to a large value (i.e., 10000).

1
  • Yeah, this could work. I have a different function to remove newlines that I can apply afterwards, since I don't want it to become a formatted paragraph. Thanks! Nov 26, 2021 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.