aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/erc
diff options
context:
space:
mode:
authorAmin Bandali2021-09-12 14:09:53 -0400
committerAmin Bandali2021-09-12 14:32:12 -0400
commite20bae005e9fff0f7f9cdb54a8d797c65e01e7ee (patch)
treebb94e30743960d0361197898caab5b28e3ee3476 /lisp/erc
parent911043845d8c0a8e67407ac80ded3bf6362bb972 (diff)
downloademacs-e20bae005e9fff0f7f9cdb54a8d797c65e01e7ee.tar.gz
emacs-e20bae005e9fff0f7f9cdb54a8d797c65e01e7ee.zip
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.
Diffstat (limited to 'lisp/erc')
-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."
950 (unless (string= string "") ;; Ignore empty strings 950 (unless (string= string "") ;; Ignore empty strings
951 (save-match-data 951 (save-match-data
952 (let* ((tag-list (when (eq (aref string 0) ?@) 952 (let* ((tag-list (when (eq (aref string 0) ?@)
953 (substring string 1 (string-search " " string)))) 953 (substring string 1
954 (if (>= emacs-major-version 28)
955 (string-search " " string)
956 (string-match " " string)))))
954 (msg (make-erc-response :unparsed string :tags (when tag-list 957 (msg (make-erc-response :unparsed string :tags (when tag-list
955 (erc-parse-tags 958 (erc-parse-tags
956 tag-list)))) 959 tag-list))))
957 (string (if tag-list 960 (string (if tag-list
958 (substring string (+ 1 (string-search " " string))) 961 (substring string (+ 1 (if (>= emacs-major-version 28)
962 (string-search " " string)
963 (string-match " " string))))
959 string)) 964 string))
960 (posn (if (eq (aref string 0) ?:) 965 (posn (if (eq (aref string 0) ?:)
961 (string-search " " string) 966 (if (>= emacs-major-version 28)
967 (string-search " " string)
968 (string-match " " string))
962 0))) 969 0)))
963 970
964 (setf (erc-response.sender msg) 971 (setf (erc-response.sender msg)
@@ -968,7 +975,9 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
968 975
969 (setf (erc-response.command msg) 976 (setf (erc-response.command msg)
970 (let* ((bposn (string-match "[^ \n]" string posn)) 977 (let* ((bposn (string-match "[^ \n]" string posn))
971 (eposn (string-search " " string bposn))) 978 (eposn (if (>= emacs-major-version 28)
979 (string-search " " string bposn)
980 (string-match " " string bposn))))
972 (setq posn (and eposn 981 (setq posn (and eposn
973 (string-match "[^ \n]" string eposn))) 982 (string-match "[^ \n]" string eposn)))
974 (substring string bposn eposn))) 983 (substring string bposn eposn)))
@@ -976,7 +985,9 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
976 (while (and posn 985 (while (and posn
977 (not (eq (aref string posn) ?:))) 986 (not (eq (aref string posn) ?:)))
978 (push (let* ((bposn posn) 987 (push (let* ((bposn posn)
979 (eposn (string-search " " string bposn))) 988 (eposn (if (>= emacs-major-version 28)
989 (string-search " " string bposn)
990 (string-match " " string bposn))))
980 (setq posn (and eposn 991 (setq posn (and eposn
981 (string-match "[^ \n]" string eposn))) 992 (string-match "[^ \n]" string eposn)))
982 (substring string bposn eposn)) 993 (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."
187 (plist-get elt prop))) 187 (plist-get elt prop)))
188 ;; if the property exists and is equal, we continue, else, try the 188 ;; if the property exists and is equal, we continue, else, try the
189 ;; next element of the list 189 ;; next element of the list
190 (or (and (eq prop :nick) (string-search "!" val) 190 (or (and (eq prop :nick) (if (>= emacs-major-version 28)
191 (string-search "!" val)
192 (string-match "!" val))
191 test (string-equal test val)) 193 test (string-equal test val))
192 (and (eq prop :nick) 194 (and (eq prop :nick)
193 test val 195 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."
139 t)))) 139 t))))
140 140
141(defun erc-speedbar-expand-server (text server indent) 141(defun erc-speedbar-expand-server (text server indent)
142 (cond ((string-search "+" text) 142 (cond ((if (>= emacs-major-version 28)
143 (string-search "+" text)
144 (string-match "\\+" text))
143 (speedbar-change-expand-button-char ?-) 145 (speedbar-change-expand-button-char ?-)
144 (if (speedbar-with-writable 146 (if (speedbar-with-writable
145 (save-excursion 147 (save-excursion
@@ -147,7 +149,10 @@ This will add a speedbar major display mode."
147 (erc-speedbar-channel-buttons nil (1+ indent) server))) 149 (erc-speedbar-channel-buttons nil (1+ indent) server)))
148 (speedbar-change-expand-button-char ?-) 150 (speedbar-change-expand-button-char ?-)
149 (speedbar-change-expand-button-char ??))) 151 (speedbar-change-expand-button-char ??)))
150 ((string-search "-" text) ;we have to contract this node 152 (;; we have to contract this node
153 (if (>= emacs-major-version 28)
154 (string-search "-" text)
155 (string-match "-" text))
151 (speedbar-change-expand-button-char ?+) 156 (speedbar-change-expand-button-char ?+)
152 (speedbar-delete-subblock indent)) 157 (speedbar-delete-subblock indent))
153 (t (error "Ooops... not sure what to do"))) 158 (t (error "Ooops... not sure what to do")))
@@ -184,7 +189,9 @@ This will add a speedbar major display mode."
184 "For the line matching TEXT, in CHANNEL, expand or contract a line. 189 "For the line matching TEXT, in CHANNEL, expand or contract a line.
185INDENT is the current indentation level." 190INDENT is the current indentation level."
186 (cond 191 (cond
187 ((string-search "+" text) 192 ((if (>= emacs-major-version 28)
193 (string-search "+" text)
194 (string-match "\\+" text))
188 (speedbar-change-expand-button-char ?-) 195 (speedbar-change-expand-button-char ?-)
189 (speedbar-with-writable 196 (speedbar-with-writable
190 (save-excursion 197 (save-excursion
@@ -233,7 +240,9 @@ INDENT is the current indentation level."
233 (speedbar-with-writable 240 (speedbar-with-writable
234 (dolist (entry names) 241 (dolist (entry names)
235 (erc-speedbar-insert-user entry ?+ (1+ indent)))))))))) 242 (erc-speedbar-insert-user entry ?+ (1+ indent))))))))))
236 ((string-search "-" text) 243 ((if (>= emacs-major-version 28)
244 (string-search "-" text)
245 (string-match "-" text))
237 (speedbar-change-expand-button-char ?+) 246 (speedbar-change-expand-button-char ?+)
238 (speedbar-delete-subblock indent)) 247 (speedbar-delete-subblock indent))
239 (t (error "Ooops... not sure what to do"))) 248 (t (error "Ooops... not sure what to do")))
@@ -284,7 +293,9 @@ The update is only done when the channel is actually expanded already."
284 (erc-speedbar-expand-channel "+" buffer 1))))) 293 (erc-speedbar-expand-channel "+" buffer 1)))))
285 294
286(defun erc-speedbar-expand-user (text token indent) 295(defun erc-speedbar-expand-user (text token indent)
287 (cond ((string-search "+" text) 296 (cond ((if (>= emacs-major-version 28)
297 (string-search "+" text)
298 (string-match "\\+" text))
288 (speedbar-change-expand-button-char ?-) 299 (speedbar-change-expand-button-char ?-)
289 (speedbar-with-writable 300 (speedbar-with-writable
290 (save-excursion 301 (save-excursion
@@ -307,7 +318,9 @@ The update is only done when the channel is actually expanded already."
307 nil nil nil nil 318 nil nil nil nil
308 info nil nil nil 319 info nil nil nil
309 (1+ indent))))))) 320 (1+ indent)))))))
310 ((string-search "-" text) 321 ((if (>= emacs-major-version 28)
322 (string-search "-" text)
323 (string-match "-" text))
311 (speedbar-change-expand-button-char ?+) 324 (speedbar-change-expand-button-char ?+)
312 (speedbar-delete-subblock indent)) 325 (speedbar-delete-subblock indent))
313 (t (error "Ooops... not sure what to do"))) 326 (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."
5587 (when (and (erc-input-sendp state) 5587 (when (and (erc-input-sendp state)
5588 erc-send-this) 5588 erc-send-this)
5589 (let ((string (erc-input-string state))) 5589 (let ((string (erc-input-string state)))
5590 (if (or (string-search "\n" string) 5590 (if (or (if (>= emacs-major-version 28)
5591 (string-search "\n" string)
5592 (string-match "\n" string))
5591 (not (string-match erc-command-regexp string))) 5593 (not (string-match erc-command-regexp string)))
5592 (mapc 5594 (mapc
5593 (lambda (line) 5595 (lambda (line)