GNU bug report logs -
#32278
27.0.50; replace-buffer-contents calls change functions with wrong arguments
Previous Next
Reported by: Michał Kondraciuk <k.michal <at> zoho.com>
Date: Thu, 26 Jul 2018 12:06:02 UTC
Severity: normal
Found in version 27.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 07/27/2018 12:06 PM, Eli Zaretskii wrote:
> Thanks. I just threw away the attempt to be smarter about where the
> changes are done, and went back to the original code that announces
> changes in the entire region.
>
> If anyone wants to add smarter code, they should do this on master.
Thanks. Can you tell me if the workaround below (calling change functions manually) is
correct/safe for emacs versions where this is not fixed? It's a function that
non-destructively replaces region contents.
(defun my-replace-region (beg end text)
"Replace region BEG END with TEXT.
As far as possible the replacement is non-destructive."
(let ((source (current-buffer)))
(with-temp-buffer
(insert text)
(let ((replacement (current-buffer)))
(with-current-buffer source
(save-restriction
(widen)
(narrow-to-region beg end)
(let ((inhibit-modification-hooks t))
(run-hook-with-args 'before-change-functions beg end)
(replace-buffer-contents replacement)
(run-hook-with-args 'after-change-functions beg
(+ beg (length text)) (- end beg)))))))))
This bug report was last modified 3 years and 286 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.