I have set show-trailing-whitespace as default in my .emacs file but I don't want it to work on shell and some specific buffer. I can disable it manually every time I open an emacs shell but I want more of a permanent solution. How can I do that?
Chances are that you'll want to do this for numerous modes, so I would suggest using an approach which makes that simpler to specify. e.g.:
(defun my-hide-trailing-whitespace-maybe () "Disable `show-trailing-whitespace' in selected modes." (when (derived-mode-p 'shell-mode 'some-other-mode '...) (setq show-trailing-whitespace nil))) (add-hook 'after-change-major-mode-hook 'my-hide-trailing-whitespace-maybe)
Put the following line in your init-file:
(add-hook 'shell-mode-hook (lambda () (setq show-trailing-whitespace nil)))
show-trailing-whitespace locally in shell buffers.
shell-mode-hook to any major mode hook you want if you like to disable
show-trailing-whitespace also in other modes.