From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Valera Rozuvan Newsgroups: gmane.emacs.help Subject: Re: Disabling show-wspace for a specific mode or buffer Date: Wed, 27 Jun 2012 23:56:04 +0300 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1340830582 9104 80.91.229.3 (27 Jun 2012 20:56:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jun 2012 20:56:22 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Alp Aker , drew.adams@oracle.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 27 22:56:20 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 1SjzHb-0003pu-HU for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 22:56:15 +0200 Original-Received: from localhost ([::1]:50792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjzHb-0004rr-AQ for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Jun 2012 16:56:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjzHV-0004nS-6g for help-gnu-emacs@gnu.org; Wed, 27 Jun 2012 16:56:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjzHS-0003fs-NQ for help-gnu-emacs@gnu.org; Wed, 27 Jun 2012 16:56:08 -0400 Original-Received: from mail-gg0-f169.google.com ([209.85.161.169]:36120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjzHS-0003f6-Gq for help-gnu-emacs@gnu.org; Wed, 27 Jun 2012 16:56:06 -0400 Original-Received: by ggm4 with SMTP id 4so1559930ggm.0 for ; Wed, 27 Jun 2012 13:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=wRC0HNBd59VsMgu3YM+7mCsOF5doLGrsBNgjGwOzy48=; b=zGll9CsO5JTBXlp28qBCHFxJCA1CRPaSdVX082LQsRssi/X1NYUWxRRV0D7YEA/JtF vQh/FuNsXh1U+ryc4mvlsyMq5gY4Nct66kN+vp/SIYOMZ4KEbCAp0AjcD3ohWfUXmwtn N9UCLxUZL50Fv6f7YbVKuTYmJHhmzzQ6IfDJm2H0NEF+xWODlpyjusX4RqlQY0mU0euQ epeAtBadNp3vFmenFehK6H3Etss/DkV9LhgQZBwU2f9viu03LJxPtrOao9tj24enafEA TaNwMkXgiCfGqPqmtyqW6t1rsgjqVCzA7WCZHjb6l4szPallpiXnC4FOhh3jzkRxYb/i /sJw== Original-Received: by 10.50.88.201 with SMTP id bi9mr2699637igb.27.1340830564444; Wed, 27 Jun 2012 13:56:04 -0700 (PDT) Original-Received: by 10.50.23.34 with HTTP; Wed, 27 Jun 2012 13:56:04 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.169 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:85537 Archived-At: > Actually, that's not important. =A0But try Drew's suggestion, or my > other suggestion. Thanks for your replies! I have modified your suggestions, and came up with the following: (defun show-ws-dont-highlight-trailing-whitespace () "Don't highlight whitespace characters at line ends." (interactive) (when (fboundp 'font-lock-remove-keywords) (font-lock-remove-keywords nil '(("[\240\040\t]+$" (0 'show-ws-trailing-whitespace t))))) (when (called-interactively-p 'any) (font-lock-fontify-buffer))) (defun show-ws-highlight-trailing-whitespace () "Highlight whitespace characters at line ends." (interactive) (font-lock-add-keywords nil '(("[\240\040\t]+$" (0 'show-ws-trailing-whitespace t)))) (when (called-interactively-p 'any) (font-lock-fontify-buffer))) (global-set-key (kbd "") 'show-ws-dont-highlight-trailing-whitespace) (global-set-key (kbd "") 'show-ws-highlight-trailing-whitespace) Now when I press F11 - the highlighting is turned off (F12 turns it back on). I believe that this approach is the best for me because I don't have to hard code into ~/.emacs the modes for which I want to disable the highlighting functionality. Thanks, Valera Rozuvan