From 40b342bc6800c1e28df46f505cb056fe87e87235 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Thu, 1 Jun 2023 18:46:23 +0300 Subject: [PATCH] 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'. --- sweeprolog.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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) -- 2.39.5