Remember, trailing whitespace is contagious and can easily take over a file much like North American Ivy!
Be a good camper and don't commit trailing whitespace.
If you're using Emacs, try adding this to
your ~/.emacs file.
(setq-default show-trailing-whitespace t) (setq-default default-indicate-empty-lines t) (setq-default indent-tabs-mode nil) (set-variable default-indicate-empty-lines t)
You can customize the file to help out with other guidelines too. If you want
to be safe, have tabs (excluding those
escaped: \t) expand to spaces when you save:
(defun perl-mode-untabify ()
(save-excursion
(goto-char (point-min))
(while (re-search-forward "[ \t]+$" nil t)
(delete-region (match-beginning 0) (match-end 0)))
(goto-char (point-min))
(if (search-forward "\t" nil t)
(untabify (1- (point)) (point-max))))
nil)
(add-hook 'perl-mode-hook
'(lambda ()
(make-local-variable 'write-contents-hooks)
(add-hook 'write-contents-hooks 'perl-mode-untabify)))
vim users can add the following to
their ~/.vimrc file.
>>>>>>>>>>>>>> syntax enable set cindent smartindent smarttab showmatch shiftwidth=4 set expandtab au BufRead,BufNewFile *.bml setfiletype perl set backup set list listchars=trail:_ highlight SpecialKey ctermfg=DarkGray ctermbg=yellow <<<<<<<<<<<<<<<
shiftwidth and expandtab make sure the
indents are made up of 4 spaces.
backup, makes a backup file named filename~, which might be
useful on occasions when your main file gets overwritten by accident.
listchars and highlight SpecialKey combined
mark trailing whitespace with a grey underscore on a yellow background,
quite easy to notice if you are working against a black background.
Also, tab characters will show up as grey ^I on a yellow background.