all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Michał Kondraciuk" <k.michal@zoho.com>
To: 32278@debbugs.gnu.org
Subject: bug#32278: 27.0.50; replace-buffer-contents calls change functions with wrong arguments
Date: Wed, 25 Jul 2018 18:17:53 +0200	[thread overview]
Message-ID: <96205085-151d-5021-d0bc-44b22df363cf@zoho.com> (raw)

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.

Repository revision: c67407e7520a97a92737200bf559c48a927db470






             reply	other threads:[~2018-07-25 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 16:17 Michał Kondraciuk [this message]
2018-07-27 10:06 ` bug#32278: 27.0.50; replace-buffer-contents calls change functions with wrong arguments Eli Zaretskii
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=96205085-151d-5021-d0bc-44b22df363cf@zoho.com \
    --to=k.michal@zoho.com \
    --cc=32278@debbugs.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.