From: Eshel Yaron Date: Thu, 1 Jun 2023 15:46:23 +0000 (+0300) Subject: Avoid using 'string-replace' for Emacs 27 compatibility X-Git-Tag: V9.1.10-sweep-0.18.4~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=40b342bc6800c1e28df46f505cb056fe87e87235;p=sweep.git Avoid using 'string-replace' for Emacs 27 compatibility * sweeprolog.el (sweeprolog-top-level-example-done): Refactor and use 'replace-regexp-in-string' instead of 'string-replace'. --- diff --git a/sweeprolog.el b/sweeprolog.el index 8b57c8b..9511051 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -6502,12 +6502,11 @@ as a comment in the source location where you invoked (unless (buffer-live-p source-buffer) (user-error "Source buffer for this example session no longer alive")) (let ((top-level-buffer (current-buffer)) - (example (replace-regexp-in-string - (rx "?- " eos) "" - (string-replace - "\n\n" "\n" - (buffer-substring-no-properties (point-min) - (point-max))))) + (example + (thread-last (buffer-string) + (substring-no-properties) + (replace-regexp-in-string "\n\n" "\n") + (replace-regexp-in-string (rx "\n?- " eos) ""))) (marker sweeprolog-top-level-example-marker)) (pop-to-buffer source-buffer) (unless (string-empty-p example)