bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32278: 27.0.50; replace-buffer-contents calls change functions with


From: Michał Kondraciuk
Subject: bug#32278: 27.0.50; replace-buffer-contents calls change functions with wrong arguments
Date: Wed, 25 Jul 2018 18:17:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]