From: Jambunathan K <kjambunathan@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Confusion about first-change-hook
Date: Wed, 19 Dec 2012 02:31:53 +0530 [thread overview]
Message-ID: <874njjgjlq.fsf@gmail.com> (raw)
In-Reply-To: <878v8vi11x.fsf@engster.org> (David Engster's message of "Tue, 18 Dec 2012 20:59:38 +0100")
David Engster <deng@randomsample.de> writes:
> I wanted to do something very simple: Activate whitespace-mode only when
> I start editing a buffer. So I looked into the manual and found
> `first-change-hook', which seemed exactly what I wanted.
This seems to work:
(add-hook 'c++-mode-hook
(lambda nil
(add-hook 'before-change-functions 'activate-whitespace-mode
nil 'local)))
(defun activate-whitespace-mode (beg end)
(whitespace-mode 1)
(remove-hook 'before-change-functions
'activate-whitespace-mode 'local))
>
> However, I soon saw that whitespace-mode got immediately activated in my
> C++ buffers. The reason is that changing a text property apparently
> already counts as "changing the buffer". Is this really the desired
> behavior? If so, what else is there to achieve the above? Should I file
> a wishlist-bug for something like 'buffer-modified-hook'?
>
> -David
>
>
--
next prev parent reply other threads:[~2012-12-18 21:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 19:59 Confusion about first-change-hook David Engster
2012-12-18 20:43 ` Stefan Monnier
2012-12-18 21:00 ` David Engster
2012-12-19 1:01 ` Stefan Monnier
2012-12-18 21:01 ` Jambunathan K [this message]
2012-12-18 21:09 ` David Engster
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=874njjgjlq.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=emacs-devel@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.