[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 40b342bc68 4/5: Avoid using 'string-replace' fo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 40b342bc68 4/5: Avoid using 'string-replace' for Emacs 27 compatibility |
Date: |
Thu, 1 Jun 2023 16:02:04 -0400 (EDT) |
branch: elpa/sweeprolog
commit 40b342bc6800c1e28df46f505cb056fe87e87235
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
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 8b57c8bde1..9511051766 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)