Subject: 27.0.50; Function in before-change-functions is called with first argument greater than the second

From: Michał Kondraciuk <[email-masked]>
Date: Sat, 21 Jul 2018 18:39:26 +0200

If I eveluate the sexp below with M-: in emacs -Q, I get the message
"before change 4 1", which is unexpected.  The second argument should be
greater than the first one, according to the documentation.

(with-current-buffer "*scratch*"
   (erase-buffer)
   (insert "foo")
   (add-hook 'before-change-functions
             (lambda (beg end)
               (message "before change %d %d" beg end))
             nil t)
   (with-temp-buffer
     (insert "foo")
     (let ((temp (current-buffer)))
       (with-current-buffer "*scratch*"
         (replace-buffer-contents temp)))))

Repository revision: 2c242cb1a2956ecfa894d0110b837d4ecc43a69c