From: Eli Zaretskii <eliz@gnu.org>
To: "Michał Kondraciuk" <k.michal@zoho.com>
Cc: 32278@debbugs.gnu.org
Subject: bug#32278: 27.0.50; replace-buffer-contents calls change functions with wrong arguments
Date: Fri, 27 Jul 2018 13:06:13 +0300 [thread overview]
Message-ID: <83in51ro16.fsf@gnu.org> (raw)
In-Reply-To: <96205085-151d-5021-d0bc-44b22df363cf@zoho.com> (message from Michał Kondraciuk on Wed, 25 Jul 2018 18:17:53 +0200)
> From: Michał Kondraciuk <k.michal@zoho.com>
> Date: Wed, 25 Jul 2018 18:17:53 +0200
>
> When I evaluate the sexp below in emacs -Q, I get unexpected arguments
> passed to change functions.
>
> (with-current-buffer "*scratch*"
> (erase-buffer)
> (insert "foo")
>
> (add-hook 'before-change-functions
> (lambda (&rest args) (message "before %s" args)) nil t)
> (add-hook 'after-change-functions
> (lambda (&rest args) (message "after %s" args)) nil t)
>
> (with-temp-buffer
> (insert "ffooo")
> (let ((replacement (current-buffer)))
> (with-current-buffer "*scratch*"
> (replace-buffer-contents replacement)))))
>
> The only messages I get are:
>
> before (4 4)
> after (4 6 0)
>
> I would expect something like:
>
> before (1 1) ;before inserting f in front
> after (1 2 0) ;after inserting f in front
> before (5 5) ;before inserting o at the end
> after (5 6 0) ;after inserting o at the end
>
> Or maybe something like this:
>
> before (1 4)
> after (1 6 3)
>
> Or anything else that would allow me to incrementally build a buffer
> with the same contents as source buffer using just change functions.
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.
next prev parent reply other threads:[~2018-07-27 10:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 16:17 bug#32278: 27.0.50; replace-buffer-contents calls change functions with wrong arguments Michał Kondraciuk
2018-07-27 10:06 ` Eli Zaretskii [this message]
2018-07-27 11:24 ` Michał Kondraciuk
2018-07-27 12:28 ` Eli Zaretskii
2021-08-12 13:30 ` Lars Ingebrigtsen
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=83in51ro16.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=32278@debbugs.gnu.org \
--cc=k.michal@zoho.com \
/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.