[LLVMdev] Trailing whitespace removal (important for CVS users!)
Bill Wendling
isanbard at gmail.com
Thu Apr 21 13:51:40 PDT 2005
On 4/21/05, Chris Lattner <sabre at nondot.org> wrote:
> On Thu, 21 Apr 2005, Reid Spencer wrote:
> > Why not put all this into a pre-commit filter in CVS and be done with
> > it? We'd never be bothered with it again as it would never be committed
> > again.
>
> I'd rather not have CVS commit scripts mucking with the code. If you want
> to have the nightly tester whine about source code with spaces at the end
> of lines (like it whines about compiler warnings), that would be fine.
>
> BTW, does anyone know how to tell xemacs to autodelete end of line spaces?
>
(defun kill-trailing-whitespace()
"removes all whitespace at the end of every line in the buffer"
(interactive)
(end-of-buffer)
(setq end (point-marker))
(beginning-of-buffer)
; set up for the first line
(next-line 1)
(beginning-of-line)
(while (< (point) end)
(progn
(set-mark-command nil)
(re-search-backward "[^ &^ &^
]" nil)
; save the non-whitespace char
(forward-char 1)
(delete-region (point) (mark))
; put the <CR> we just deleted back
(insert "
")
(next-line 1)
(beginning-of-line)
)
)
); end kill-trailing-whitespace
;========================================================
-bw
More information about the llvm-dev
mailing list