From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Disabling show-wspace for a specific mode or buffer Date: Wed, 27 Jun 2012 13:27:12 -0700 Message-ID: <45A139EE1BCC4FF487698781A0C18EA7@us.oracle.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340828852 27670 80.91.229.3 (27 Jun 2012 20:27:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jun 2012 20:27:32 +0000 (UTC) To: "'Valera Rozuvan'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 27 22:27:30 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sjypk-0001Bi-7J for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 22:27:28 +0200 Original-Received: from localhost ([::1]:41499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjypk-0007WX-2P for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 16:27:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjypf-0007WS-4a for help-gnu-emacs@gnu.org; Wed, 27 Jun 2012 16:27:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sjypb-0005eL-W6 for help-gnu-emacs@gnu.org; Wed, 27 Jun 2012 16:27:22 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:45107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sjypb-0005dE-Q8 for help-gnu-emacs@gnu.org; Wed, 27 Jun 2012 16:27:19 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q5RKRFdi021607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Jun 2012 20:27:16 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q5RKREtj008080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Jun 2012 20:27:14 GMT Original-Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q5RKREph019409; Wed, 27 Jun 2012 15:27:14 -0500 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 27 Jun 2012 13:27:14 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac1UmiSjWk/T2e9ZRHKGhGBoalSE5AAAIn4w X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 148.87.113.117 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85534 Archived-At: > I am using the package show-wspace ( > http://www.emacswiki.org/emacs/show-wspace.el ) to visually show > trailing whitespace and tab characters in all my files. I achieve this > by adding the following line to the ~/.emacs file: > > (add-to-list 'load-path "~/.emacs.d/") ;; show-wspace.el can > be found here > (require 'show-wspace) > > (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) where THE-MODE is the mode of the buffer where you do not want the highlighting. It's an old library - the code should probably be rewritten to define a minor mode (and a globalized version of it).