Skip to content

Commit 1c3a462

Browse files
committed
Backport from main: Fix compatibility with Emacs 26
* lisp/org-compat.el (org-replace-buffer-contents): Add compatibility function for `replace-buffer-contents'. * lisp/org-src.el (org-edit-src-save, org-edit-src-exit): Use `org-replace-buffer-contents'.
1 parent a0a0780 commit 1c3a462

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lisp/org-compat.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ the symbol of the calling function, for example."
113113

114114
;;; Emacs < 27.1 compatibility
115115

116+
(if (version< emacs-version "27.1")
117+
(defsubst org-replace-buffer-contents (source &optional _max-secs _max-costs)
118+
(replace-buffer-contents source))
119+
(defalias 'org-replace-buffer-contents #'replace-buffer-contents))
120+
116121
(unless (fboundp 'proper-list-p)
117122
;; `proper-list-p' was added in Emacs 27.1. The function below is
118123
;; taken from Emacs subr.el 200195e824b^.

lisp/org-src.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ Throw an error if there is no such buffer."
12351235
(insert (with-current-buffer write-back-buf (buffer-string))))
12361236
(save-restriction
12371237
(narrow-to-region beg end)
1238-
(replace-buffer-contents write-back-buf 0.1 nil)
1238+
(org-replace-buffer-contents write-back-buf 0.1 nil)
12391239
(goto-char (point-max))))
12401240
(when (and expecting-bol (not (bolp))) (insert "\n")))
12411241
(kill-buffer write-back-buf)
@@ -1283,7 +1283,7 @@ Throw an error if there is no such buffer."
12831283
(buffer-string))))
12841284
(save-restriction
12851285
(narrow-to-region beg end)
1286-
(replace-buffer-contents write-back-buf 0.1 nil)
1286+
(org-replace-buffer-contents write-back-buf 0.1 nil)
12871287
(goto-char (point-max))))
12881288
(when (and expecting-bol (not (bolp))) (insert "\n")))))
12891289
(when write-back-buf (kill-buffer write-back-buf))

0 commit comments

Comments
 (0)