[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Disabling show-wspace for a specific mode or buffer
From: |
Michael Heerdegen |
Subject: |
Re: Disabling show-wspace for a specific mode or buffer |
Date: |
Thu, 28 Jun 2012 00:23:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
"Drew Adams" <drew.adams@oracle.com> writes:
> > (add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs)
> > (add-hook 'font-lock-mode-hook 'show-ws-highlight-trailing-whitespace)
> >
> > My problem is that in 99% of buffers I want this behavior, but
> > sometimes I don't. For example, when I run the command M-x w3m to
> > browse the web, I don't want to see trailing whitespace highlighted.
> > Can anyone suggest a solution for this problem?
>
> Sorry, but there is no simple way to do that. But you can do it in this
> roundabout way (ugly!):
>
> (add-hook 'change-major-mode-hook
> (lambda ()
> (add-hook 'font-lock-mode-hook
> 'show-ws-highlight-trailing-whitespace)))
>
> (add-hook 'after-change-major-mode-hook
> (lambda ()
> (when (eq major-mode 'THE-MODE)
> (remove-hook 'font-lock-mode-hook
> 'show-ws-highlight-trailing-whitespace)
> (show-ws-dont-highlight-trailing-whitespace)))
> 'append)
Maybe an alternative approach would be to add the highlighting functions
to the text-mode-hook:
(add-hook 'text-mode-hook 'show-ws-highlight-tabs)
(add-hook 'text-mode-hook 'show-ws-highlight-trailing-whitespace)
Since most editing modes run `text-mode-hook', and other modes don't,
maybe this way you can get along with less exceptions? Just an idea.
Michael.
- Disabling show-wspace for a specific mode or buffer, Valera Rozuvan, 2012/06/27
- Re: Disabling show-wspace for a specific mode or buffer, Alp Aker, 2012/06/27
- Re: Disabling show-wspace for a specific mode or buffer, Valera Rozuvan, 2012/06/27
- Re: Disabling show-wspace for a specific mode or buffer, Alp Aker, 2012/06/27
- Re: Disabling show-wspace for a specific mode or buffer, Alp Aker, 2012/06/27
- Re: Disabling show-wspace for a specific mode or buffer, Valera Rozuvan, 2012/06/27
- RE: Disabling show-wspace for a specific mode or buffer, Drew Adams, 2012/06/27
- Re: Disabling show-wspace for a specific mode or buffer, Valera Rozuvan, 2012/06/27
- RE: Disabling show-wspace for a specific mode or buffer, Drew Adams, 2012/06/27
RE: Disabling show-wspace for a specific mode or buffer, Drew Adams, 2012/06/27
Message not available
- Re: Disabling show-wspace for a specific mode or buffer,
Michael Heerdegen <=
Re: Disabling show-wspace for a specific mode or buffer, John Wiegley, 2012/06/27