mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-20 18:17:20 +00:00
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.
This commit is contained in:
parent
911043845d
commit
e20bae005e
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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")))
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user