aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/erc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/erc-backend.el3
-rw-r--r--lisp/erc/erc-compat.el163
-rw-r--r--lisp/erc/erc-dcc.el8
-rw-r--r--lisp/erc/erc-fill.el2
-rw-r--r--lisp/erc/erc-goodies.el3
-rw-r--r--lisp/erc/erc-log.el2
-rw-r--r--lisp/erc/erc-match.el67
-rw-r--r--lisp/erc/erc-notify.el2
-rw-r--r--lisp/erc/erc-pcomplete.el1
-rw-r--r--lisp/erc/erc-stamp.el1
-rw-r--r--lisp/erc/erc-track.el12
-rw-r--r--lisp/erc/erc.el27
12 files changed, 69 insertions, 222 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 4f3d85ba3c8..1cf0bb49217 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -98,7 +98,6 @@
98 98
99;;; Code: 99;;; Code:
100 100
101(require 'erc-compat)
102(eval-when-compile (require 'cl-lib)) 101(eval-when-compile (require 'cl-lib))
103;; There's a fairly strong mutual dependency between erc.el and erc-backend.el. 102;; There's a fairly strong mutual dependency between erc.el and erc-backend.el.
104;; Luckily, erc.el does not need erc-backend.el for macroexpansion whereas the 103;; Luckily, erc.el does not need erc-backend.el for macroexpansion whereas the
@@ -782,7 +781,7 @@ value of `erc-server-coding-system'."
782 (pop precedence)) 781 (pop precedence))
783 (when precedence 782 (when precedence
784 (setq coding (car precedence))))) 783 (setq coding (car precedence)))))
785 (erc-decode-coding-string str coding))) 784 (decode-coding-string str coding t)))
786 785
787;; proposed name, not used by anything yet 786;; proposed name, not used by anything yet
788(defun erc-send-line (text display-fn) 787(defun erc-send-line (text display-fn)
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
deleted file mode 100644
index d71221b2674..00000000000
--- a/lisp/erc/erc-compat.el
+++ /dev/null
@@ -1,163 +0,0 @@
1;;; erc-compat.el --- ERC compatibility code for XEmacs
2
3;; Copyright (C) 2002-2003, 2005-2020 Free Software Foundation, Inc.
4
5;; Author: Alex Schroeder <alex@gnu.org>
6;; Maintainer: Amin Bandali <bandali@gnu.org>
7;; URL: https://www.emacswiki.org/emacs/ERC
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;; This mostly defines stuff that cannot be worked around easily.
27
28;;; Code:
29
30(require 'format-spec)
31
32;;;###autoload(autoload 'erc-define-minor-mode "erc-compat")
33(defalias 'erc-define-minor-mode 'define-minor-mode)
34(put 'erc-define-minor-mode 'edebug-form-spec 'define-minor-mode)
35
36(defun erc-decode-coding-string (s coding-system)
37 "Decode S using CODING-SYSTEM."
38 (decode-coding-string s coding-system t))
39
40(defun erc-encode-coding-string (s coding-system)
41 "Encode S using CODING-SYSTEM.
42Return the same string, if the encoding operation is trivial.
43See `erc-encoding-coding-alist'."
44 (encode-coding-string s coding-system t))
45
46(define-obsolete-function-alias 'erc-propertize #'propertize "28.1")
47(define-obsolete-function-alias 'erc-view-mode-enter #'view-mode-enter "28.1")
48(autoload 'help-function-arglist "help-fns")
49(define-obsolete-function-alias 'erc-function-arglist #'help-function-arglist "28.1")
50(define-obsolete-function-alias 'erc-delete-dups #'delete-dups "28.1")
51(define-obsolete-function-alias 'erc-replace-regexp-in-string #'replace-regexp-in-string "28.1")
52
53(defun erc-set-write-file-functions (new-val)
54 (set (make-local-variable 'write-file-functions) new-val))
55
56(defvar erc-emacs-build-time
57 (if (or (stringp emacs-build-time) (not emacs-build-time))
58 emacs-build-time
59 (format-time-string "%Y-%m-%d" emacs-build-time))
60 "Time at which Emacs was dumped out, or nil if not available.")
61
62;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs
63;; has user-init-directory.
64(defvar erc-user-emacs-directory
65 (cond ((boundp 'user-emacs-directory)
66 user-emacs-directory)
67 ((boundp 'user-init-directory)
68 user-init-directory)
69 (t "~/.emacs.d/"))
70 "Directory beneath which additional per-user Emacs-specific files
71are placed.
72Note that this should end with a directory separator.")
73
74(defun erc-replace-match-subexpression-in-string
75 (newtext string match subexp start &optional fixedcase literal)
76 "Replace the subexpression SUBEXP of the last match in STRING with NEWTEXT.
77MATCH is the text which matched the subexpression (see `match-string').
78START is the beginning position of the last match (see `match-beginning').
79See `replace-match' for explanations of FIXEDCASE and LITERAL."
80 (replace-match newtext fixedcase literal string subexp))
81
82(define-obsolete-function-alias 'erc-with-selected-window
83 #'with-selected-window "28.1")
84(define-obsolete-function-alias 'erc-cancel-timer #'cancel-timer "28.1")
85(define-obsolete-function-alias 'erc-make-obsolete #'make-obsolete "28.1")
86(define-obsolete-function-alias 'erc-make-obsolete-variable
87 #'make-obsolete-variable "28.1")
88
89;; Provide a simpler replacement for `member-if'
90(defun erc-member-if (predicate list)
91 "Find the first item satisfying PREDICATE in LIST.
92Return the sublist of LIST whose car matches."
93 (let ((ptr list))
94 (catch 'found
95 (while ptr
96 (when (funcall predicate (car ptr))
97 (throw 'found ptr))
98 (setq ptr (cdr ptr))))))
99
100;; Provide a simpler replacement for `delete-if'
101(defun erc-delete-if (predicate seq)
102 "Remove all items satisfying PREDICATE in SEQ.
103This is a destructive function: it reuses the storage of SEQ
104whenever possible."
105 ;; remove from car
106 (while (when (funcall predicate (car seq))
107 (setq seq (cdr seq))))
108 ;; remove from cdr
109 (let ((ptr seq)
110 (next (cdr seq)))
111 (while next
112 (when (funcall predicate (car next))
113 (setcdr ptr (if (consp next)
114 (cdr next)
115 nil)))
116 (setq ptr (cdr ptr))
117 (setq next (cdr ptr))))
118 seq)
119
120;; Provide a simpler replacement for `remove-if-not'
121(defun erc-remove-if-not (predicate seq)
122 "Remove all items not satisfying PREDICATE in SEQ.
123This is a non-destructive function; it makes a copy of SEQ to
124avoid corrupting the original SEQ."
125 (let (newseq)
126 (dolist (el seq)
127 (when (funcall predicate el)
128 (setq newseq (cons el newseq))))
129 (nreverse newseq)))
130
131;; Copied from cl-extra.el
132(defun erc-subseq (seq start &optional end)
133 "Return the subsequence of SEQ from START to END.
134If END is omitted, it defaults to the length of the sequence.
135If START or END is negative, it counts from the end."
136 (if (stringp seq) (substring seq start end)
137 (let (len)
138 (and end (< end 0) (setq end (+ end (setq len (length seq)))))
139 (if (< start 0) (setq start (+ start (or len (setq len (length seq))))))
140 (cond ((listp seq)
141 (if (> start 0) (setq seq (nthcdr start seq)))
142 (if end
143 (let ((res nil))
144 (while (>= (setq end (1- end)) start)
145 (push (pop seq) res))
146 (nreverse res))
147 (copy-sequence seq)))
148 (t
149 (or end (setq end (or len (length seq))))
150 (let ((res (make-vector (max (- end start) 0) nil))
151 (i 0))
152 (while (< start end)
153 (aset res i (aref seq start))
154 (setq i (1+ i) start (1+ start)))
155 res))))))
156
157(provide 'erc-compat)
158
159;;; erc-compat.el ends here
160;;
161;; Local Variables:
162;; generated-autoload-file: "erc-loaddefs.el"
163;; End:
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index bf98eb818f3..477f148197b 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -419,7 +419,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
419 (pcomplete-here 419 (pcomplete-here
420 (pcase (intern (downcase (pcomplete-arg 1))) 420 (pcase (intern (downcase (pcomplete-arg 1)))
421 ('chat (mapcar (lambda (elt) (plist-get elt :nick)) 421 ('chat (mapcar (lambda (elt) (plist-get elt :nick))
422 (erc-remove-if-not 422 (cl-remove-if-not
423 #'(lambda (elt) 423 #'(lambda (elt)
424 (eq (plist-get elt :type) 'CHAT)) 424 (eq (plist-get elt :type) 'CHAT))
425 erc-dcc-list))) 425 erc-dcc-list)))
@@ -427,7 +427,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
427 (mapcar (lambda (elt) (symbol-name (plist-get elt :type))) 427 (mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
428 erc-dcc-list))) 428 erc-dcc-list)))
429 ('get (mapcar #'erc-dcc-nick 429 ('get (mapcar #'erc-dcc-nick
430 (erc-remove-if-not 430 (cl-remove-if-not
431 #'(lambda (elt) 431 #'(lambda (elt)
432 (eq (plist-get elt :type) 'GET)) 432 (eq (plist-get elt :type) 'GET))
433 erc-dcc-list))) 433 erc-dcc-list)))
@@ -435,7 +435,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
435 (pcomplete-here 435 (pcomplete-here
436 (pcase (intern (downcase (pcomplete-arg 2))) 436 (pcase (intern (downcase (pcomplete-arg 2)))
437 ('get (mapcar (lambda (elt) (plist-get elt :file)) 437 ('get (mapcar (lambda (elt) (plist-get elt :file))
438 (erc-remove-if-not 438 (cl-remove-if-not
439 #'(lambda (elt) 439 #'(lambda (elt)
440 (and (eq (plist-get elt :type) 'GET) 440 (and (eq (plist-get elt :type) 'GET)
441 (erc-nick-equal-p (erc-extract-nick 441 (erc-nick-equal-p (erc-extract-nick
@@ -443,7 +443,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
443 (pcomplete-arg 1)))) 443 (pcomplete-arg 1))))
444 erc-dcc-list))) 444 erc-dcc-list)))
445 ('close (mapcar #'erc-dcc-nick 445 ('close (mapcar #'erc-dcc-nick
446 (erc-remove-if-not 446 (cl-remove-if-not
447 #'(lambda (elt) 447 #'(lambda (elt)
448 (eq (plist-get elt :type) 448 (eq (plist-get elt :type)
449 (intern (upcase (pcomplete-arg 1))))) 449 (intern (upcase (pcomplete-arg 1)))))
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
index 39a8be5e0cf..d09caf7aa12 100644
--- a/lisp/erc/erc-fill.el
+++ b/lisp/erc/erc-fill.el
@@ -38,7 +38,7 @@
38 :group 'erc) 38 :group 'erc)
39 39
40;;;###autoload(autoload 'erc-fill-mode "erc-fill" nil t) 40;;;###autoload(autoload 'erc-fill-mode "erc-fill" nil t)
41(erc-define-minor-mode erc-fill-mode 41(define-minor-mode erc-fill-mode
42 "Toggle ERC fill mode. 42 "Toggle ERC fill mode.
43With a prefix argument ARG, enable ERC fill mode if ARG is 43With a prefix argument ARG, enable ERC fill mode if ARG is
44positive, and disable it otherwise. If called from Lisp, enable 44positive, and disable it otherwise. If called from Lisp, enable
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index ff7a77f1265..a475f0a1770 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -399,8 +399,7 @@ See `erc-interpret-controls-p' and `erc-interpret-mirc-color' for options."
399 (start (match-beginning 0)) 399 (start (match-beginning 0))
400 (end (+ (match-beginning 0) 400 (end (+ (match-beginning 0)
401 (length (match-string 5 s))))) 401 (length (match-string 5 s)))))
402 (setq s (erc-replace-match-subexpression-in-string 402 (setq s (replace-match "" nil nil s 1))
403 "" s control 1 start))
404 (cond ((and erc-interpret-mirc-color (or fg-color bg-color)) 403 (cond ((and erc-interpret-mirc-color (or fg-color bg-color))
405 (setq fg fg-color) 404 (setq fg fg-color)
406 (setq bg bg-color)) 405 (setq bg bg-color))
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index e2c066da9b1..2166123e674 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -267,7 +267,7 @@ The current buffer is given by BUFFER."
267 (with-current-buffer buffer 267 (with-current-buffer buffer
268 (auto-save-mode -1) 268 (auto-save-mode -1)
269 (setq buffer-file-name nil) 269 (setq buffer-file-name nil)
270 (erc-set-write-file-functions '(erc-save-buffer-in-logs)) 270 (set (make-local-variable 'write-file-functions) '(erc-save-buffer-in-logs))
271 (when erc-log-insert-log-on-open 271 (when erc-log-insert-log-on-open
272 (ignore-errors 272 (ignore-errors
273 (save-excursion 273 (save-excursion
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 6e87a183fc1..b3145674f29 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -94,7 +94,9 @@ The following values are allowed:
94 `nick-or-keyword' - highlight the nick of the user who typed your nickname, 94 `nick-or-keyword' - highlight the nick of the user who typed your nickname,
95 or all instances of the current nickname if there was 95 or all instances of the current nickname if there was
96 no sending user 96 no sending user
97 `all' - highlight the entire message where current nickname occurs 97 `message' - highlight the entire message where current nickname occurs
98 `all' - highlight the entire message (including the nick) where
99 current nickname occurs
98 100
99Any other value disables highlighting of current nickname altogether." 101Any other value disables highlighting of current nickname altogether."
100 :group 'erc-match 102 :group 'erc-match
@@ -102,6 +104,7 @@ Any other value disables highlighting of current nickname altogether."
102 (const nick) 104 (const nick)
103 (const keyword) 105 (const keyword)
104 (const nick-or-keyword) 106 (const nick-or-keyword)
107 (const message)
105 (const all))) 108 (const all)))
106 109
107(defcustom erc-pal-highlight-type 'nick 110(defcustom erc-pal-highlight-type 'nick
@@ -110,14 +113,17 @@ See `erc-pals'.
110 113
111The following values are allowed: 114The following values are allowed:
112 115
113 nil - do not highlight the message at all 116 nil - do not highlight the message at all
114 `nick' - highlight pal's nickname only 117 `nick' - highlight pal's nickname only
115 `all' - highlight the entire message from pal 118 `message' - highlight the entire message from pal
119 `all' - highlight the entire message (including the nick)
120 from pal
116 121
117Any other value disables pal highlighting altogether." 122Any other value disables pal highlighting altogether."
118 :group 'erc-match 123 :group 'erc-match
119 :type '(choice (const nil) 124 :type '(choice (const nil)
120 (const nick) 125 (const nick)
126 (const message)
121 (const all))) 127 (const all)))
122 128
123(defcustom erc-fool-highlight-type 'nick 129(defcustom erc-fool-highlight-type 'nick
@@ -126,14 +132,17 @@ See `erc-fools'.
126 132
127The following values are allowed: 133The following values are allowed:
128 134
129 nil - do not highlight the message at all 135 nil - do not highlight the message at all
130 `nick' - highlight fool's nickname only 136 `nick' - highlight fool's nickname only
131 `all' - highlight the entire message from fool 137 `message' - highlight the entire message from fool
138 `all' - highlight the entire message (including the nick)
139 from fool
132 140
133Any other value disables fool highlighting altogether." 141Any other value disables fool highlighting altogether."
134 :group 'erc-match 142 :group 'erc-match
135 :type '(choice (const nil) 143 :type '(choice (const nil)
136 (const nick) 144 (const nick)
145 (const message)
137 (const all))) 146 (const all)))
138 147
139(defcustom erc-keyword-highlight-type 'keyword 148(defcustom erc-keyword-highlight-type 'keyword
@@ -143,12 +152,15 @@ See variable `erc-keywords'.
143The following values are allowed: 152The following values are allowed:
144 153
145 `keyword' - highlight keyword only 154 `keyword' - highlight keyword only
146 `all' - highlight the entire message containing keyword 155 `message' - highlight the entire message containing keyword
156 `all' - highlight the entire message (including the nick)
157 containing keyword
147 158
148Any other value disables keyword highlighting altogether." 159Any other value disables keyword highlighting altogether."
149 :group 'erc-match 160 :group 'erc-match
150 :type '(choice (const nil) 161 :type '(choice (const nil)
151 (const keyword) 162 (const keyword)
163 (const message)
152 (const all))) 164 (const all)))
153 165
154(defcustom erc-dangerous-host-highlight-type 'nick 166(defcustom erc-dangerous-host-highlight-type 'nick
@@ -157,13 +169,16 @@ See `erc-dangerous-hosts'.
157 169
158The following values are allowed: 170The following values are allowed:
159 171
160 `nick' - highlight nick from dangerous-host only 172 `nick' - highlight nick from dangerous-host only
161 `all' - highlight the entire message from dangerous-host 173 `message' - highlight the entire message from dangerous-host
174 `all' - highlight the entire message (including the nick)
175 from dangerous-host
162 176
163Any other value disables dangerous-host highlighting altogether." 177Any other value disables dangerous-host highlighting altogether."
164 :group 'erc-match 178 :group 'erc-match
165 :type '(choice (const nil) 179 :type '(choice (const nil)
166 (const nick) 180 (const nick)
181 (const message)
167 (const all))) 182 (const all)))
168 183
169 184
@@ -449,19 +464,18 @@ Use this defun with `erc-insert-modify-hook'."
449 (match-beginning 0))) 464 (match-beginning 0)))
450 (nick-end (when nick-beg 465 (nick-end (when nick-beg
451 (match-end 0))) 466 (match-end 0)))
452 (message (buffer-substring 467 (message-beg (if (and nick-end
453 (if (and nick-end 468 (<= (+ 2 nick-end) (point-max)))
454 (<= (+ 2 nick-end) (point-max))) 469 ;; Message starts 2 characters after the
455 ;; Message starts 2 characters after the nick 470 ;; nick except for CTCP ACTION messages.
456 ;; except for CTCP ACTION messages. Nick 471 ;; Nick surrounded by angle brackets only in
457 ;; surrounded by angle brackets only in normal 472 ;; normal messages.
458 ;; messages. 473 (+ nick-end
459 (+ nick-end 474 (if (eq ?> (char-after nick-end))
460 (if (eq ?> (char-after nick-end)) 475 2
461 2 476 1))
462 1)) 477 (point-min)))
463 (point-min)) 478 (message (buffer-substring message-beg (point-max))))
464 (point-max))))
465 (when (and vector 479 (when (and vector
466 (not (and erc-match-exclude-server-buffer 480 (not (and erc-match-exclude-server-buffer
467 (erc-server-buffer-p)))) 481 (erc-server-buffer-p))))
@@ -498,7 +512,12 @@ Use this defun with `erc-insert-modify-hook'."
498 (while (re-search-forward match-regex nil t) 512 (while (re-search-forward match-regex nil t)
499 (erc-put-text-property (match-beginning 0) (match-end 0) 513 (erc-put-text-property (match-beginning 0) (match-end 0)
500 'font-lock-face match-face)))) 514 'font-lock-face match-face))))
501 ;; Highlight the whole message 515 ;; Highlight the whole message (not including the nick)
516 ((eq match-htype 'message)
517 (erc-put-text-property
518 message-beg (point-max)
519 'font-lock-face match-face (current-buffer)))
520 ;; Highlight the whole message (including the nick)
502 ((eq match-htype 'all) 521 ((eq match-htype 'all)
503 (erc-put-text-property 522 (erc-put-text-property
504 (point-min) (point-max) 523 (point-min) (point-max)
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index 1b092c8a6a9..144a981f832 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -181,7 +181,7 @@ nick from `erc-last-ison' to prevent any further notifications."
181 (let ((nick (erc-extract-nick (erc-response.sender parsed)))) 181 (let ((nick (erc-extract-nick (erc-response.sender parsed))))
182 (when (and (erc-member-ignore-case nick erc-notify-list) 182 (when (and (erc-member-ignore-case nick erc-notify-list)
183 (erc-member-ignore-case nick erc-last-ison)) 183 (erc-member-ignore-case nick erc-last-ison))
184 (setq erc-last-ison (erc-delete-if 184 (setq erc-last-ison (cl-delete-if
185 (let ((nick-down (erc-downcase nick))) 185 (let ((nick-down (erc-downcase nick)))
186 (lambda (el) 186 (lambda (el)
187 (string= nick-down (erc-downcase el)))) 187 (string= nick-down (erc-downcase el))))
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
index 7643fa85b96..f8b7e13be02 100644
--- a/lisp/erc/erc-pcomplete.el
+++ b/lisp/erc/erc-pcomplete.el
@@ -41,7 +41,6 @@
41 41
42(require 'pcomplete) 42(require 'pcomplete)
43(require 'erc) 43(require 'erc)
44(require 'erc-compat)
45(require 'time-date) 44(require 'time-date)
46 45
47(defgroup erc-pcomplete nil 46(defgroup erc-pcomplete nil
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index cbab2f9da2b..08970f2d70e 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -35,7 +35,6 @@
35;;; Code: 35;;; Code:
36 36
37(require 'erc) 37(require 'erc)
38(require 'erc-compat)
39 38
40(defgroup erc-stamp nil 39(defgroup erc-stamp nil
41 "For long conversation on IRC it is sometimes quite 40 "For long conversation on IRC it is sometimes quite
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 41d8fc1a98f..3398c8b9d0c 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -36,7 +36,6 @@
36 36
37(eval-when-compile (require 'cl-lib)) 37(eval-when-compile (require 'cl-lib))
38(require 'erc) 38(require 'erc)
39(require 'erc-compat)
40(require 'erc-match) 39(require 'erc-match)
41 40
42;;; Code: 41;;; Code:
@@ -329,9 +328,8 @@ important."
329 328
330(defun erc-track-remove-from-mode-line () 329(defun erc-track-remove-from-mode-line ()
331 "Remove `erc-track-modified-channels' from the mode-line." 330 "Remove `erc-track-modified-channels' from the mode-line."
332 (when (boundp 'mode-line-modes) 331 (setq mode-line-modes
333 (setq mode-line-modes 332 (remove '(t erc-modified-channels-object) mode-line-modes))
334 (remove '(t erc-modified-channels-object) mode-line-modes)))
335 (when (consp global-mode-string) 333 (when (consp global-mode-string)
336 (setq global-mode-string 334 (setq global-mode-string
337 (delq 'erc-modified-channels-object global-mode-string)))) 335 (delq 'erc-modified-channels-object global-mode-string))))
@@ -341,12 +339,10 @@ important."
341See `erc-track-position-in-mode-line' for possible values." 339See `erc-track-position-in-mode-line' for possible values."
342 ;; CVS Emacs has a new format string, and global-mode-string 340 ;; CVS Emacs has a new format string, and global-mode-string
343 ;; is very far to the right. 341 ;; is very far to the right.
344 (cond ((and (eq position 'before-modes) 342 (cond ((eq position 'before-modes)
345 (boundp 'mode-line-modes))
346 (add-to-list 'mode-line-modes 343 (add-to-list 'mode-line-modes
347 '(t erc-modified-channels-object))) 344 '(t erc-modified-channels-object)))
348 ((and (eq position 'after-modes) 345 ((eq position 'after-modes)
349 (boundp 'mode-line-modes))
350 (add-to-list 'mode-line-modes 346 (add-to-list 'mode-line-modes
351 '(t erc-modified-channels-object) t)) 347 '(t erc-modified-channels-object) t))
352 ((eq position t) 348 ((eq position t)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 41d7516fbb4..8712113790b 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -57,12 +57,12 @@
57 57
58(load "erc-loaddefs" nil t) 58(load "erc-loaddefs" nil t)
59 59
60(eval-when-compile (require 'cl-lib)) 60(require 'cl-lib)
61(require 'font-lock) 61(require 'font-lock)
62(require 'format-spec)
62(require 'pp) 63(require 'pp)
63(require 'thingatpt) 64(require 'thingatpt)
64(require 'auth-source) 65(require 'auth-source)
65(require 'erc-compat)
66(require 'time-date) 66(require 'time-date)
67(require 'iso8601) 67(require 'iso8601)
68(eval-when-compile (require 'subr-x)) 68(eval-when-compile (require 'subr-x))
@@ -877,8 +877,8 @@ See `erc-server-flood-margin' for other flood-related parameters.")
877;; Script parameters 877;; Script parameters
878 878
879(defcustom erc-startup-file-list 879(defcustom erc-startup-file-list
880 (list (concat erc-user-emacs-directory ".ercrc.el") 880 (list (concat user-emacs-directory ".ercrc.el")
881 (concat erc-user-emacs-directory ".ercrc") 881 (concat user-emacs-directory ".ercrc")
882 "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc") 882 "~/.ercrc.el" "~/.ercrc" ".ercrc.el" ".ercrc")
883 "List of files to try for a startup script. 883 "List of files to try for a startup script.
884The first existent and readable one will get executed. 884The first existent and readable one will get executed.
@@ -1306,7 +1306,7 @@ Example:
1306 (enable (intern (format "erc-%s-enable" (downcase sn)))) 1306 (enable (intern (format "erc-%s-enable" (downcase sn))))
1307 (disable (intern (format "erc-%s-disable" (downcase sn))))) 1307 (disable (intern (format "erc-%s-disable" (downcase sn)))))
1308 `(progn 1308 `(progn
1309 (erc-define-minor-mode 1309 (define-minor-mode
1310 ,mode 1310 ,mode
1311 ,(format "Toggle ERC %S mode. 1311 ,(format "Toggle ERC %S mode.
1312With a prefix argument ARG, enable %s if ARG is positive, 1312With a prefix argument ARG, enable %s if ARG is positive,
@@ -1489,8 +1489,7 @@ Defaults to the server buffer."
1489(define-derived-mode erc-mode fundamental-mode "ERC" 1489(define-derived-mode erc-mode fundamental-mode "ERC"
1490 "Major mode for Emacs IRC." 1490 "Major mode for Emacs IRC."
1491 (setq local-abbrev-table erc-mode-abbrev-table) 1491 (setq local-abbrev-table erc-mode-abbrev-table)
1492 (when (boundp 'next-line-add-newlines) 1492 (set (make-local-variable 'next-line-add-newlines) nil)
1493 (set (make-local-variable 'next-line-add-newlines) nil))
1494 (setq line-move-ignore-invisible t) 1493 (setq line-move-ignore-invisible t)
1495 (set (make-local-variable 'paragraph-separate) 1494 (set (make-local-variable 'paragraph-separate)
1496 (concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)")) 1495 (concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)"))
@@ -2688,7 +2687,7 @@ displayed hostnames."
2688otherwise `erc-server-announced-name'. SERVER is matched against 2687otherwise `erc-server-announced-name'. SERVER is matched against
2689`erc-common-server-suffixes'." 2688`erc-common-server-suffixes'."
2690 (when server 2689 (when server
2691 (or (cdar (erc-remove-if-not 2690 (or (cdar (cl-remove-if-not
2692 (lambda (net) (string-match (car net) server)) 2691 (lambda (net) (string-match (car net) server))
2693 erc-common-server-suffixes)) 2692 erc-common-server-suffixes))
2694 erc-server-announced-name))) 2693 erc-server-announced-name)))
@@ -3725,8 +3724,9 @@ the message given by REASON."
3725 x-toolkit-scroll-bars))) 3724 x-toolkit-scroll-bars)))
3726 "") 3725 "")
3727 (if (featurep 'multi-tty) ", multi-tty" "")) 3726 (if (featurep 'multi-tty) ", multi-tty" ""))
3728 (if erc-emacs-build-time 3727 (if emacs-build-time
3729 (concat " of " erc-emacs-build-time) 3728 (concat " of " (format-time-string
3729 "%Y-%m-%d" emacs-build-time))
3730 ""))) 3730 "")))
3731 t) 3731 t)
3732 3732
@@ -4573,7 +4573,7 @@ See also: `erc-echo-notice-in-user-buffers',
4573 ((string-match "^-" mode) 4573 ((string-match "^-" mode)
4574 ;; Remove the unbanned masks from the ban list 4574 ;; Remove the unbanned masks from the ban list
4575 (setq erc-channel-banlist 4575 (setq erc-channel-banlist
4576 (erc-delete-if 4576 (cl-delete-if
4577 #'(lambda (y) 4577 #'(lambda (y)
4578 (member (upcase (cdr y)) 4578 (member (upcase (cdr y))
4579 (mapcar #'upcase 4579 (mapcar #'upcase
@@ -4594,7 +4594,7 @@ See also: `erc-echo-notice-in-user-buffers',
4594 "Group LIST into sublists of length N." 4594 "Group LIST into sublists of length N."
4595 (cond ((null list) nil) 4595 (cond ((null list) nil)
4596 ((null (nthcdr n list)) (list list)) 4596 ((null (nthcdr n list)) (list list))
4597 (t (cons (erc-subseq list 0 n) (erc-group-list (nthcdr n list) n))))) 4597 (t (cons (cl-subseq list 0 n) (erc-group-list (nthcdr n list) n)))))
4598 4598
4599 4599
4600;;; MOTD numreplies 4600;;; MOTD numreplies
@@ -6183,8 +6183,7 @@ non-nil value is found.
6183 output (apply #'format format-args)) 6183 output (apply #'format format-args))
6184 ;; Change all "1 units" to "1 unit". 6184 ;; Change all "1 units" to "1 unit".
6185 (while (string-match "\\([^0-9]\\|^\\)1 \\S-+\\(s\\)" output) 6185 (while (string-match "\\([^0-9]\\|^\\)1 \\S-+\\(s\\)" output)
6186 (setq output (erc-replace-match-subexpression-in-string 6186 (setq output (replace-match "" nil nil output 2)))
6187 "" output (match-string 2 output) 2 (match-beginning 2))))
6188 output)) 6187 output))
6189 6188
6190 6189