use replace-regexp-in-string instead of string-replace

string-replace is new of emacs 28, while replace-regexp-in-string is
quite old.  This avoids the backport, and should be a tad faster since
it don't have to waste cycle to regexp-quote "\n".

Tested on emacs 27.2

Signed-off-by: Justin Abrahms <justin@abrah.ms>
This commit is contained in:
Omar Polo 2021-08-17 09:04:17 +00:00 committed by Justin Abrahms
parent b6b6f595f2
commit 087359e851

View File

@ -21,15 +21,6 @@
(require 'ox-ascii)
(require 'cl-lib)
;; backport for older emacs verisons
(if (not (fboundp 'string-replace))
(progn
(defun string-replace (from to in)
(replace-regexp-in-string (regexp-quote from) to in nil 'literal))
(declare-function string-replace "ox-gemini")
))
;; TODO:
;; Sublists aren't supported in gemini
;; There's a trailing space after inline code samples
@ -60,7 +51,7 @@
(defun org-gemini-paragraph (_paragraph contents _info)
"CONTENTS is the text of the paragraph."
(concat (string-replace "\n" " " contents)
(concat (replace-regexp-in-string "\n" " " contents)
"\n"))
(defun org-gemini-item (_input contents _info)