How do you delete trailng white space in emacs? -
i have text file has fixed length lines, padded trailing spaces like:
hello world ↩ other line ↩ x ↩ and want remove trailing spaces on each line looks like
hello world↩ other line↩ x↩ is possible write emacs macro can solve this?
edit: lines can have arbitrary number of spaces in before trailing spaces @ end, so
hi world ↩ can valid line in file.
emacs has built-in fixup-whitespace (m-space), shrinks more 1 space 1 space:
hello world ↩ ^ cursor m-x fixup-whitespace hello world ↩ ^ cursor so, can define macro that:
- first calls
fixup-whitespace - then removes last whitespace
another 1 m-x replace-regexp ret [ ]+' ret ' ret, solves problem using regular expressions.
Comments
Post a Comment