summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2021-09-12 14:09:53 -0400
committerAmin Bandali <bandali@gnu.org>2021-09-12 14:32:12 -0400
commite20bae005e9fff0f7f9cdb54a8d797c65e01e7ee (patch)
treebb94e30743960d0361197898caab5b28e3ee3476
parent911043845d8c0a8e67407ac80ded3bf6362bb972 (diff)
downloademacs-e20bae005e9fff0f7f9cdb54a8d797c65e01e7ee.tar.gz
ERC: Use 'string-search' only on Emacs 28 and later
* lisp/erc/erc-backend.el (erc-parse-server-response): * lisp/erc/erc-dcc.el (erc-dcc-member): * lisp/erc/erc-speedbar.el (erc-speedbar-expand-server) (erc-speedbar-expand-channel, erc-speedbar-expand-user): * lisp/erc/erc.el (erc-send-input): Use 'string-search' only on Emacs 28 and later, otherwise use 'string-match' on older Emacsen.
-rw-r--r--lisp/erc/erc-backend.el21
-rw-r--r--lisp/erc/erc-dcc.el4
-rw-r--r--lisp/erc/erc-speedbar.el25
-rw-r--r--lisp/erc/erc.el4
4 files changed, 41 insertions, 13 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 6d84665873e..ad9719380a4 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -950,15 +950,22 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
(unless (string= string "") ;; Ignore empty strings
(save-match-data
(let* ((tag-list (when (eq (aref string 0) ?@)
- (substring string 1 (string-search " " string))))
+ (substring string 1
+ (if (>= emacs-major-version 28)
+ (string-search " " string)
+ (string-match " " string)))))
(msg (make-erc-response :unparsed string :tags (when tag-list
(erc-parse-tags
tag-list))))
(string (if tag-list
- (substring string (+ 1 (string-search " " string)))
+ (substring string (+ 1 (if (>= emacs-major-version 28)
+ (string-search " " string)
+ (string-match " " string))))
string))
(posn (if (eq (aref string 0) ?:)
- (string-search " " string)
+ (if (>= emacs-major-version 28)
+ (string-search " " string)
+ (string-match " " string))
0)))
(setf (erc-response.sender msg)
@@ -968,7 +975,9 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
(setf (erc-response.command msg)
(let* ((bposn (string-match "[^ \n]" string posn))
- (eposn (string-search " " string bposn)))
+ (eposn (if (>= emacs-major-version 28)
+ (string-search " " string bposn)
+ (string-match " " string bposn))))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn)))
@@ -976,7 +985,9 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
(while (and posn
(not (eq (aref string posn) ?:)))
(push (let* ((bposn posn)
- (eposn (string-search " " string bposn)))
+ (eposn (if (>= emacs-major-version 28)
+ (string-search " " string bposn)
+ (string-match " " string bposn))))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn))
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index de72624aaa1..df53270831d 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -187,7 +187,9 @@ compared with `erc-nick-equal-p' which is IRC case-insensitive."
(plist-get elt prop)))
;; if the property exists and is equal, we continue, else, try the
;; next element of the list
- (or (and (eq prop :nick) (string-search "!" val)
+ (or (and (eq prop :nick) (if (>= emacs-major-version 28)
+ (string-search "!" val)
+ (string-match "!" val))
test (string-equal test val))
(and (eq prop :nick)
test val
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index e61e741302d..84854e3be52 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -139,7 +139,9 @@ This will add a speedbar major display mode."
t))))
(defun erc-speedbar-expand-server (text server indent)
- (cond ((string-search "+" text)
+ (cond ((if (>= emacs-major-version 28)
+ (string-search "+" text)
+ (string-match "\\+" text))
(speedbar-change-expand-button-char ?-)
(if (speedbar-with-writable
(save-excursion
@@ -147,7 +149,10 @@ This will add a speedbar major display mode."
(erc-speedbar-channel-buttons nil (1+ indent) server)))
(speedbar-change-expand-button-char ?-)
(speedbar-change-expand-button-char ??)))
- ((string-search "-" text) ;we have to contract this node
+ (;; we have to contract this node
+ (if (>= emacs-major-version 28)
+ (string-search "-" text)
+ (string-match "-" text))
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
@@ -184,7 +189,9 @@ This will add a speedbar major display mode."
"For the line matching TEXT, in CHANNEL, expand or contract a line.
INDENT is the current indentation level."
(cond
- ((string-search "+" text)
+ ((if (>= emacs-major-version 28)
+ (string-search "+" text)
+ (string-match "\\+" text))
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
@@ -233,7 +240,9 @@ INDENT is the current indentation level."
(speedbar-with-writable
(dolist (entry names)
(erc-speedbar-insert-user entry ?+ (1+ indent))))))))))
- ((string-search "-" text)
+ ((if (>= emacs-major-version 28)
+ (string-search "-" text)
+ (string-match "-" text))
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
@@ -284,7 +293,9 @@ The update is only done when the channel is actually expanded already."
(erc-speedbar-expand-channel "+" buffer 1)))))
(defun erc-speedbar-expand-user (text token indent)
- (cond ((string-search "+" text)
+ (cond ((if (>= emacs-major-version 28)
+ (string-search "+" text)
+ (string-match "\\+" text))
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
@@ -307,7 +318,9 @@ The update is only done when the channel is actually expanded already."
nil nil nil nil
info nil nil nil
(1+ indent)))))))
- ((string-search "-" text)
+ ((if (>= emacs-major-version 28)
+ (string-search "-" text)
+ (string-match "-" text))
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index e0fda41f8ed..b18eb0a228a 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -5587,7 +5587,9 @@ This returns non-nil only if we actually send anything."
(when (and (erc-input-sendp state)
erc-send-this)
(let ((string (erc-input-string state)))
- (if (or (string-search "\n" string)
+ (if (or (if (>= emacs-major-version 28)
+ (string-search "\n" string)
+ (string-match "\n" string))
(not (string-match erc-command-regexp string)))
(mapc
(lambda (line)