GNU bug report logs - #77221
[PATCH] modification hooks are called 3x for each yank

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Sun, 23 Mar 2025 22:15:01 UTC

Severity: normal

Tags: patch

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: JD Smith <jdtsmith <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] modification hooks are called 3x for each yank
Date: Sun, 23 Mar 2025 18:14:03 -0400
[Message part 1 (text/plain, inline)]
Evaluate:

 (add-hook 'after-change-functions (lambda (beg end len) (message "GOT %s->%s [%s]" beg end len)) nil t)

Then yank text.  You'll see the before/after change functions are called 3x upon each yank.  This is due to the final text property changes made by `insert-for-yank-1'.  For substantial amounts of yanked text, this is inefficient.  

Patch attached.

[0001-Limit-yanks-to-a-single-set-of-modification-hook-cal.patch (application/octet-stream, attachment)]

This bug report was last modified 87 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.