1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

ERC: Use 'string-replace' only on Emacs 28 and later

* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART): Use
'string-replace' only on Emacs 28 and later, otherwise use
'replace-regexp-in-string' on older Emacsen.
This commit is contained in:
Amin Bandali 2021-09-12 14:12:50 -04:00
parent e20bae005e
commit 85d0ed097e
No known key found for this signature in database
GPG Key ID: 8B44A0CDC7B956F2
2 changed files with 31 additions and 12 deletions

View File

@ -632,8 +632,13 @@ that subcommand."
(define-inline erc-dcc-unquote-filename (filename)
(inline-quote
(string-replace "\\\\" "\\"
(string-replace "\\\"" "\"" ,filename))))
(if (>= emacs-major-version 28)
(string-replace
"\\\\" "\\"
(string-replace "\\\"" "\"" ,filename))
(replace-regexp-in-string
"\\\\\\\\" "\\"
(replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t))))
(defun erc-dcc-handle-ctcp-send (proc query nick login host to)
"This is called if a CTCP DCC SEND subcommand is sent to the client.

View File

@ -3597,7 +3597,9 @@ If S is non-nil, it will be used as the quit reason."
If S is non-nil, it will be used as the quit reason."
(or s
(if (fboundp 'yow)
(string-replace "\n" "" (yow))
(if (>= emacs-major-version 28)
(string-replace "\n" "" (yow))
(replace-regexp-in-string "\n" "" (yow)))
(erc-quit/part-reason-default))))
(make-obsolete 'erc-quit-reason-zippy "it will be removed." "24.4")
@ -3624,7 +3626,9 @@ If S is non-nil, it will be used as the part reason."
If S is non-nil, it will be used as the quit reason."
(or s
(if (fboundp 'yow)
(string-replace "\n" "" (yow))
(if (>= emacs-major-version 28)
(string-replace "\n" "" (yow))
(replace-regexp-in-string "\n" "" (yow)))
(erc-quit/part-reason-default))))
(make-obsolete 'erc-part-reason-zippy "it will be removed." "24.4")
@ -6530,13 +6534,21 @@ if `erc-away' is non-nil."
(fill-region (point-min) (point-max))
(buffer-string))))
(setq header-line-format
(string-replace
"%"
"%%"
(if face
(propertize header 'help-echo help-echo
'face face)
(propertize header 'help-echo help-echo))))))
(if (>= emacs-major-version 28)
(string-replace
"%"
"%%"
(if face
(propertize header 'help-echo help-echo
'face face)
(propertize header 'help-echo help-echo)))
(replace-regexp-in-string
"%"
"%%"
(if face
(propertize header 'help-echo help-echo
'face face)
(propertize header 'help-echo help-echo)))))))
(t (setq header-line-format
(if face
(propertize header 'face face)
@ -6806,7 +6818,9 @@ functions."
nick user host channel
(if (not (string= reason ""))
(format ": %s"
(string-replace "%" "%%" reason))
(if (>= emacs-major-version 28)
(string-replace "%" "%%" reason)
(replace-regexp-in-string "%" "%%" reason)))
"")))))