From: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: before-change-functions called twice at yank
Date: Tue, 11 Apr 2006 08:58:26 +0200 [thread overview]
Message-ID: <443B5392.2040001@gmx.at> (raw)
In-Reply-To: <443ADE3B.7000800@soem.dk>
> Do emacs -q and evaluate
>
> (progn
> (add-hook 'before-change-functions
> (lambda (b e)
> (message "before-change: '%s'" (buffer-substring b e))) nil t)
> (add-hook 'after-change-functions
> (lambda (b e l)
> (message "after-change: '%s'" (buffer-substring b e))) nil t))
>
>
> in the *scratch* buffer. If you press the letter a, the message buffer
> will get
>
> before-change: ''
> after-change: 'a'
>
> as expected. Now yank the string "foo". Then the message buffer gets
>
> before-change: ''
> after-change: 'foo'
> before-change: 'foo'
>
> This seems as a bug to me. Am I missing something?
Indeed you should see another message from `after-change-functions' like:
before-change: ''
after-change: 'foo'
before-change: 'foo'
after-change: 'foo'
The last two messages are due to `remove-yank-excluded-properties' which
removes `yank-excluded-properties' from the string inserted. You can
avoid running the hooks either by doing
(let ((inhibit-read-only t)
(inhibit-modification-hooks t))
in `remove-yank-excluded-properties' directly or by wrapping the calls to
`remove-yank-excluded-properties' in `insert-for-yank-1' (and possibly
`insert-buffer-substring-as-yank') as
(let ((inhibit-modification-hooks t))
(remove-yank-excluded-properties opoint (point)))
next prev parent reply other threads:[~2006-04-11 6:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-10 22:37 before-change-functions called twice at yank Lars Hansen
2006-04-11 6:58 ` martin rudalics [this message]
2006-04-11 7:23 ` Lars Hansen
2006-04-15 18:57 ` Bugs in remove-list-of-text-properties and a patch [WAS: before-change-functions called twice at yank] Lars Hansen
2006-04-17 0:56 ` Richard Stallman
2006-04-17 8:51 ` Lars Hansen
[not found] ` <44435682.4050409@soem.dk>
2006-04-18 1:42 ` Richard Stallman
2006-04-20 11:46 ` Lars Hansen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=443B5392.2040001@gmx.at \
--to=rudalics@gmx.at \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).