(defface cperl-my-trailing-spaces-face '((((class color)) ;; define your tastes (background, foreground) ( :background "grey98" ; :underline "grey" ) )) "My face for trailing spaces in cperl mode" :group 'cperl-mode) ; Here is the most important part. It says to add ; this face to the customizable group cperl-mode ;; now you can "bind" this face to cperl-invalid-face (set-default 'cperl-invalid-face 'cperl-my-trailing-spaces-face)