A whole workout on deleting whitespace? It's worth it…
You might want to start by enabling whitespace mode: `M-x whitespace-mode`
Let's start with closing the gap between lines…
`M-^` Join a line with the previous line
`C-x C-o ` Delete white space after current line up to next line.
What’s great about the above two commands is that the point can be _anywhere_ on the line when you call them.
The next two commands aren’t quite so quick to use, the point needs to be in the whitespace you're trying to delete.
`M-SPACE` Delete all spaces but one between two characters
`M-\` Delete all whitespace between two characters
Don't forget the rectangle commands:
`C-x r k ` Kills the rectangle between the point and the mark.
Find out more about how to use that command in [[Rectangles|this workout]].
Lastly, removing line breaks. Use
`C-M-%` query replace regex
Use `C-q C-m` or `C-q C-j` to find the line breaks.