[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"
  (setq end (point-marker))
  ; set up for the first line
  (next-line 1)
  (while (< (point) end)
		(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)
); end kill-trailing-whitespace


More information about the llvm-dev mailing list