Michael Gauland writes:
This is all the*trace-output* buffer shows:
======================================================================
1 -> (replace-buffer-contents #<buffer*org-src-write-back*>)
1 <- replace-buffer-contents: nil
Indeed, the `replace-buffer-contents` call is failing.
I've been able to reproduce with earlier versions of emacs 26.1. With
later versions of emacs 26, the problem goes away.
It seems earlier versions of `replace-buffer-contents` are not quite
reliable. It was patched prior to 27.1 and the new documentation
string makes some guarantees of correctness, so let's just change the
minimal version to 27.1.
Thank you for the report.
Regards,
--
Sébastien Miquel
X-Woof-Bug: confirmed
>From 8ebdbc5eca92de4429d3994a3663d8aa3b9877fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miq...@posteo.eu>
Date: Tue, 1 Jun 2021 08:56:48 +0200
Subject: [PATCH] org-src.el: Use `replace-buffer-contents' only for emacs >=
27
* lisp/org-src.el: Use `replace-buffer-contents' only for emacs >= 27.
It was introduced in emacs 26.1, but earlier versions made no
guarantees of correctness.
---
lisp/org-src.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 79f002e56..4698c6dd2 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -1199,12 +1199,12 @@ Throw an error if there is no such buffer."
;; insert new contents.
(delete-overlay overlay)
(let ((expecting-bol (bolp)))
- (if (version< emacs-version "26.1")
+ (if (version< emacs-version "27.1")
(progn (delete-region beg end)
(insert (with-current-buffer write-back-buf (buffer-string))))
(save-restriction
(narrow-to-region beg end)
- (replace-buffer-contents write-back-buf)
+ (replace-buffer-contents write-back-buf 0.1 nil)
(goto-char (point-max))))
(when (and expecting-bol (not (bolp))) (insert "\n")))
(kill-buffer write-back-buf)
@@ -1246,13 +1246,13 @@ Throw an error if there is no such buffer."
(undo-boundary)
(goto-char beg)
(let ((expecting-bol (bolp)))
- (if (version< emacs-version "26.1")
+ (if (version< emacs-version "27.1")
(progn (delete-region beg end)
(insert (with-current-buffer write-back-buf
(buffer-string))))
(save-restriction
(narrow-to-region beg end)
- (replace-buffer-contents write-back-buf)
+ (replace-buffer-contents write-back-buf 0.1 nil)
(goto-char (point-max))))
(when (and expecting-bol (not (bolp))) (insert "\n")))))
(when write-back-buf (kill-buffer write-back-buf))
--
2.31.1