Skip to content

Commit

Permalink
[fix] Do not use string-replace
Browse files Browse the repository at this point in the history
Because there is no `string-replace` in the Emacs27
Fixes https://t.me/emacs_telega/44040
  • Loading branch information
zevlg committed Feb 5, 2024
1 parent e316af7 commit 21f5e2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion telega-ins.el
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Activates box button if cursor enter, deactivates if leaves."
;; NOTE: buttons must not be breakable by filling logic, so we use
;; non-breakable spaces instead of regular
(apply #'telega-ins--text-button
(string-replace " " telega-symbol-nbsp label) props))
(replace-regexp-in-string " " telega-symbol-nbsp label) props))

(defun telega-ins--image (img &optional slice-num &rest props)
"Insert image IMG generated by telega.
Expand Down
7 changes: 7 additions & 0 deletions test.el
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ Have Stoploss 690 Satoshi." :entities []))))
:text)))
)

(ert-deftest telega-inserters-old-emacs ()
;; NOTE: `telega-ins--text-button' has been in use of
;; `string-replace' that is not in emacs27
;; ref: https://t.me/emacs_telega/44040
(should (equal (progn (telega-ins--box-button "test here") 'aa)
'aa)))

;; Local Variables:
;; no-byte-compile: t
;; End:
Expand Down

0 comments on commit 21f5e2c

Please sign in to comment.