(save-match-data
(let* ((tag-list (when (eq (aref string 0) ?@)
(substring string 1
- (if (>= emacs-major-version 28)
- (string-search " " string)
- (string-match " " string)))))
+ (string-search " " string))))
(msg (make-erc-response :unparsed string :tags (when tag-list
(erc-parse-tags
tag-list))))
(string (if tag-list
- (substring string (+ 1 (if (>= emacs-major-version 28)
- (string-search " " string)
- (string-match " " string))))
+ (substring string (+ 1 (string-search " " string)))
string))
(posn (if (eq (aref string 0) ?:)
- (if (>= emacs-major-version 28)
- (string-search " " string)
- (string-match " " string))
+ (string-search " " string)
0)))
(setf (erc-response.sender msg)
(setf (erc-response.command msg)
(let* ((bposn (string-match "[^ \n]" string posn))
- (eposn (if (>= emacs-major-version 28)
- (string-search " " string bposn)
- (string-match " " string bposn))))
+ (eposn (string-search " " string bposn)))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn)))
(while (and posn
(not (eq (aref string posn) ?:)))
(push (let* ((bposn posn)
- (eposn (if (>= emacs-major-version 28)
- (string-search " " string bposn)
- (string-match " " string bposn))))
+ (eposn (string-search " " string bposn)))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn))
start (- (match-end 0) 3))
(setq start (match-end 0))))
v))
- (if (if (>= emacs-major-version 28)
- (string-search "," value)
- (string-match-p "," value))
+ (if (string-search "," value)
(split-string value ",")
(list value)))))
;; This mostly defines stuff that cannot be worked around easily.
+;; ERC depends on the `compat' library from GNU ELPA for supporting
+;; older versions of Emacs. See this discussion for additional info:
+;; https://lists.gnu.org/archive/html/emacs-devel/2022-07/msg00512.html
+
;;; Code:
+(require 'compat nil 'noerror)
+
;;;###autoload(autoload 'erc-define-minor-mode "erc-compat")
(define-obsolete-function-alias 'erc-define-minor-mode
#'define-minor-mode "28.1")
test (cadr (plist-member elt prop)))
;; if the property exists and is equal, we continue, else, try the
;; next element of the list
- (or (and (eq prop :nick) (if (>= emacs-major-version 28)
- (string-search "!" val)
- (string-match "!" val))
+ (or (and (eq prop :nick) (string-search "!" val)
test (string-equal test val))
(and (eq prop :nick)
test val
(define-inline erc-dcc-unquote-filename (filename)
(inline-quote
- (if (>= emacs-major-version 28)
- (string-replace
- "\\\\" "\\"
- (string-replace "\\\"" "\"" ,filename))
- (replace-regexp-in-string
- "\\\\\\\\" "\\"
- (replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t))))
+ (string-replace "\\\\" "\\" (string-replace "\\\"" "\"" ,filename))))
(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.
t))))
(defun erc-speedbar-expand-server (text server indent)
- (cond ((if (>= emacs-major-version 28)
- (string-search "+" text)
- (string-match "\\+" text))
+ (cond ((string-search "+" text)
(speedbar-change-expand-button-char ?-)
(if (speedbar-with-writable
(save-excursion
(speedbar-change-expand-button-char ?-)
(speedbar-change-expand-button-char ??)))
(;; we have to contract this node
- (if (>= emacs-major-version 28)
- (string-search "-" text)
- (string-match "-" text))
+ (string-search "-" text)
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
"For the line matching TEXT, in CHANNEL, expand or contract a line.
INDENT is the current indentation level."
(cond
- ((if (>= emacs-major-version 28)
- (string-search "+" text)
- (string-match "\\+" text))
+ ((string-search "+" text)
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
(speedbar-with-writable
(dolist (entry names)
(erc-speedbar-insert-user entry ?+ (1+ indent))))))))))
- ((if (>= emacs-major-version 28)
- (string-search "-" text)
- (string-match "-" text))
+ ((string-search "-" text)
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
(erc-speedbar-expand-channel "+" buffer 1)))))
(defun erc-speedbar-expand-user (text token indent)
- (cond ((if (>= emacs-major-version 28)
- (string-search "+" text)
- (string-match "\\+" text))
+ (cond ((string-search "+" text)
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
nil nil nil nil
info nil nil nil
(1+ indent)))))))
- ((if (>= emacs-major-version 28)
- (string-search "-" text)
- (string-match "-" text))
+ ((string-search "-" text)
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
;; Michael Olson (mwolson@gnu.org)
;; Kelvin White (kwhite@gnu.org)
;; Version: 5.4.1
-;; Package-Requires: ((emacs "27.1"))
+;; Package-Requires: ((emacs "27.1") (compat "28.1.2.0"))
;; Keywords: IRC, chat, client, Internet
;; URL: https://www.gnu.org/software/emacs/erc.html
(require 'iso8601)
(eval-when-compile (require 'subr-x))
+(require 'erc-compat)
+
(defconst erc-version "5.4.1"
"This version of ERC.")
"Non-nil when channel is server-local on a network that allows them."
(and-let* (((eq ?& (aref channel 0)))
(chan-types (erc--get-isupport-entry 'CHANTYPES 'single))
- ((if (>= emacs-major-version 28)
- (string-search "&" chan-types)
- (string-match-p "&" chan-types))))))
+ ((string-search "&" chan-types)))))
(defun erc-cmd-JOIN (channel &optional key)
"Join the channel given in CHANNEL, optionally with KEY.
(fill-region (point-min) (point-max))
(buffer-string))))
(setq header-line-format
- (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)))))))
+ (string-replace
+ "%"
+ "%%"
+ (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)
nick user host channel
(if (not (string= reason ""))
(format ": %s"
- (if (>= emacs-major-version 28)
- (string-replace "%" "%%" reason)
- (replace-regexp-in-string "%" "%%" reason)))
+ (string-replace "%" "%%" reason))
"")))))