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!

Emmanuel Goldstein
  • 1,014
  • 8
  • 18

1 Answers1

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

Tyler
  • 22,234
  • 1
  • 54
  • 94
  • 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! – Emmanuel Goldstein Nov 26 '21 at 06:53