forked from mirrors/org-mode
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'.
This commit is contained in:
parent
a0a078049b
commit
1c3a46268f
|
@ -113,6 +113,11 @@ the symbol of the calling function, for example."
|
||||||
|
|
||||||
;;; Emacs < 27.1 compatibility
|
;;; Emacs < 27.1 compatibility
|
||||||
|
|
||||||
|
(if (version< emacs-version "27.1")
|
||||||
|
(defsubst org-replace-buffer-contents (source &optional _max-secs _max-costs)
|
||||||
|
(replace-buffer-contents source))
|
||||||
|
(defalias 'org-replace-buffer-contents #'replace-buffer-contents))
|
||||||
|
|
||||||
(unless (fboundp 'proper-list-p)
|
(unless (fboundp 'proper-list-p)
|
||||||
;; `proper-list-p' was added in Emacs 27.1. The function below is
|
;; `proper-list-p' was added in Emacs 27.1. The function below is
|
||||||
;; taken from Emacs subr.el 200195e824b^.
|
;; taken from Emacs subr.el 200195e824b^.
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ Throw an error if there is no such buffer."
|
||||||
(insert (with-current-buffer write-back-buf (buffer-string))))
|
(insert (with-current-buffer write-back-buf (buffer-string))))
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(narrow-to-region beg end)
|
(narrow-to-region beg end)
|
||||||
(replace-buffer-contents write-back-buf 0.1 nil)
|
(org-replace-buffer-contents write-back-buf 0.1 nil)
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
(when (and expecting-bol (not (bolp))) (insert "\n")))
|
(when (and expecting-bol (not (bolp))) (insert "\n")))
|
||||||
(kill-buffer write-back-buf)
|
(kill-buffer write-back-buf)
|
||||||
|
@ -1283,7 +1283,7 @@ Throw an error if there is no such buffer."
|
||||||
(buffer-string))))
|
(buffer-string))))
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(narrow-to-region beg end)
|
(narrow-to-region beg end)
|
||||||
(replace-buffer-contents write-back-buf 0.1 nil)
|
(org-replace-buffer-contents write-back-buf 0.1 nil)
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
(when (and expecting-bol (not (bolp))) (insert "\n")))))
|
(when (and expecting-bol (not (bolp))) (insert "\n")))))
|
||||||
(when write-back-buf (kill-buffer write-back-buf))
|
(when write-back-buf (kill-buffer write-back-buf))
|
||||||
|
|
Loading…
Reference in New Issue