all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Valera Rozuvan <valera.rozuvan@gmail.com>
To: Alp Aker <alptekin.aker@gmail.com>, drew.adams@oracle.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Disabling show-wspace for a specific mode or buffer
Date: Wed, 27 Jun 2012 23:56:04 +0300	[thread overview]
Message-ID: <CAM8kQFyV35OEdToSpGa5wshFn6T=vkagXeQi7r-pKXMYCsoneQ@mail.gmail.com> (raw)
In-Reply-To: <CACxch4ragOiBpfbWDieKVmkuXf5SSmaSXbiKuSKgiADi+pVAyg@mail.gmail.com>

> Actually, that's not important.  But 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 "<f11>") 'show-ws-dont-highlight-trailing-whitespace)
(global-set-key (kbd "<f12>") '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



  reply	other threads:[~2012-06-27 20:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 18:27 Disabling show-wspace for a specific mode or buffer Valera Rozuvan
2012-06-27 20:01 ` Alp Aker
2012-06-27 20:10   ` Valera Rozuvan
2012-06-27 20:31     ` Alp Aker
2012-06-27 20:41       ` Alp Aker
2012-06-27 20:56         ` Valera Rozuvan [this message]
2012-06-27 21:16           ` Drew Adams
2012-06-27 21:45             ` Valera Rozuvan
2012-06-27 22:12               ` Drew Adams
2012-06-27 20:27 ` Drew Adams
     [not found] ` <mailman.3588.1340828845.855.help-gnu-emacs@gnu.org>
2012-06-27 22:23   ` Michael Heerdegen
2012-06-28  2:11 ` John Wiegley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM8kQFyV35OEdToSpGa5wshFn6T=vkagXeQi7r-pKXMYCsoneQ@mail.gmail.com' \
    --to=valera.rozuvan@gmail.com \
    --cc=alptekin.aker@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.