summaryrefslogtreecommitdiff
path: root/lisp/erc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/erc-autoaway.el54
-rw-r--r--lisp/erc/erc-backend.el87
-rw-r--r--lisp/erc/erc-button.el59
-rw-r--r--lisp/erc/erc-capab.el36
-rw-r--r--lisp/erc/erc-dcc.el106
-rw-r--r--lisp/erc/erc-desktop-notifications.el12
-rw-r--r--lisp/erc/erc-ezbounce.el18
-rw-r--r--lisp/erc/erc-fill.el18
-rw-r--r--lisp/erc/erc-goodies.el65
-rw-r--r--lisp/erc/erc-ibuffer.el11
-rw-r--r--lisp/erc/erc-identd.el19
-rw-r--r--lisp/erc/erc-imenu.el9
-rw-r--r--lisp/erc/erc-join.el28
-rw-r--r--lisp/erc/erc-lang.el4
-rw-r--r--lisp/erc/erc-list.el26
-rw-r--r--lisp/erc/erc-log.el59
-rw-r--r--lisp/erc/erc-match.el50
-rw-r--r--lisp/erc/erc-menu.el9
-rw-r--r--lisp/erc/erc-netsplit.el25
-rw-r--r--lisp/erc/erc-networks.el34
-rw-r--r--lisp/erc/erc-notify.el26
-rw-r--r--lisp/erc/erc-page.el18
-rw-r--r--lisp/erc/erc-pcomplete.el20
-rw-r--r--lisp/erc/erc-replace.el15
-rw-r--r--lisp/erc/erc-ring.el32
-rw-r--r--lisp/erc/erc-services.el69
-rw-r--r--lisp/erc/erc-sound.el15
-rw-r--r--lisp/erc/erc-speedbar.el33
-rw-r--r--lisp/erc/erc-spelling.el10
-rw-r--r--lisp/erc/erc-stamp.el66
-rw-r--r--lisp/erc/erc-status-sidebar.el30
-rw-r--r--lisp/erc/erc-track.el85
-rw-r--r--lisp/erc/erc-truncate.el7
-rw-r--r--lisp/erc/erc-xdcc.el16
-rw-r--r--lisp/erc/erc.el350
35 files changed, 725 insertions, 796 deletions
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
index a0085662e22..1a13aa95cd2 100644
--- a/lisp/erc/erc-autoaway.el
+++ b/lisp/erc/erc-autoaway.el
@@ -1,4 +1,4 @@
-;;; erc-autoaway.el --- Provides autoaway for ERC
+;;; erc-autoaway.el --- Provides autoaway for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
@@ -58,7 +58,7 @@ function each time you change `erc-autoaway-idle-seconds'."
(setq erc-autoaway-idletimer
(run-with-idle-timer erc-autoaway-idle-seconds
t
- 'erc-autoaway-set-away
+ #'erc-autoaway-set-away
erc-autoaway-idle-seconds)))
(defun erc-autoaway-some-server-buffer ()
@@ -66,21 +66,21 @@ function each time you change `erc-autoaway-idle-seconds'."
If none is found, return nil."
(car (erc-buffer-list #'erc-open-server-buffer-p)))
-(defun erc-autoaway-insinuate-maybe (&optional server &rest ignored)
+(defun erc-autoaway-insinuate-maybe (&optional server &rest _ignored)
"Add autoaway reset function to `post-command-hook' if at least one
ERC process is alive.
This is used when `erc-autoaway-idle-method' is `user'."
(when (or server (erc-autoaway-some-server-buffer))
- (add-hook 'post-command-hook 'erc-autoaway-reset-idle-user)))
+ (add-hook 'post-command-hook #'erc-autoaway-reset-idle-user)))
-(defun erc-autoaway-remove-maybe (&rest ignored)
+(defun erc-autoaway-remove-maybe (&rest _ignored)
"Remove the autoaway reset function from `post-command-hook' if
no ERC process is alive.
This is used when `erc-autoaway-idle-method' is `user'."
(unless (erc-autoaway-some-server-buffer)
- (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user)))
+ (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user)))
;;;###autoload(autoload 'erc-autoaway-mode "erc-autoaway")
(define-erc-module autoaway nil
@@ -107,36 +107,36 @@ set you no longer away.
Related variables: `erc-public-away-p' and `erc-away-nickname'."
;; Enable:
((when (boundp 'erc-autoaway-idle-method)
- (add-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators)
+ (add-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators)
(setq erc-autoaway-last-sent-time (erc-current-time))
(cond
((eq erc-autoaway-idle-method 'irc)
- (add-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc)
- (add-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc))
+ (add-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc)
+ (add-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc))
((eq erc-autoaway-idle-method 'user)
- (add-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe)
- (add-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe)
+ (add-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe)
+ (add-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe)
(erc-autoaway-insinuate-maybe))
((eq erc-autoaway-idle-method 'emacs)
(erc-autoaway-reestablish-idletimer)))
- (add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)
- (add-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators)))
+ (add-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away)
+ (add-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators)))
;; Disable:
((when (boundp 'erc-autoaway-idle-method)
- (remove-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators)
+ (remove-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators)
(cond
((eq erc-autoaway-idle-method 'irc)
- (remove-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc)
- (remove-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc))
+ (remove-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc)
+ (remove-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc))
((eq erc-autoaway-idle-method 'user)
- (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user)
- (remove-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe)
- (remove-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe))
+ (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user)
+ (remove-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe)
+ (remove-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe))
((eq erc-autoaway-idle-method 'emacs)
(cancel-timer erc-autoaway-idletimer)
(setq erc-autoaway-idletimer nil)))
- (remove-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)
- (remove-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators))))
+ (remove-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away)
+ (remove-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators))))
(defcustom erc-autoaway-idle-method 'user
"The method used to determine how long you have been idle.
@@ -148,7 +148,6 @@ The time itself is specified by `erc-autoaway-idle-seconds'.
See `erc-autoaway-mode' for more information on the various
definitions of being idle."
- :group 'erc-autoaway
:type '(choice (const :tag "User idle time" user)
(const :tag "Emacs idle time" emacs)
(const :tag "Last IRC action" irc))
@@ -166,7 +165,6 @@ ERC autoaway mode can set you away when you idle, and set you no
longer away when you type something. This variable controls whether
you will be set away when you idle. See `erc-auto-discard-away' for
the other half."
- :group 'erc-autoaway
:type 'boolean)
(defcustom erc-auto-discard-away t
@@ -176,20 +174,17 @@ longer away when you type something. This variable controls whether
you will be set no longer away when you type something. See
`erc-auto-set-away' for the other half.
See also `erc-autoaway-no-auto-discard-regexp'."
- :group 'erc-autoaway
:type 'boolean)
(defcustom erc-autoaway-no-auto-discard-regexp "^/g?away.*$"
"Input that matches this will not automatically discard away status.
See `erc-auto-discard-away'."
- :group 'erc-autoaway
:type 'regexp)
(defcustom erc-autoaway-idle-seconds 1800
"Number of seconds after which ERC will set you automatically away.
If you are changing this variable using lisp instead of customizing it,
you have to run `erc-autoaway-reestablish-idletimer' afterwards."
- :group 'erc-autoaway
:set (lambda (sym val)
(set-default sym val)
(when (eq erc-autoaway-idle-method 'emacs)
@@ -201,10 +196,9 @@ you have to run `erc-autoaway-reestablish-idletimer' afterwards."
"Message ERC will use when setting you automatically away.
It is used as a `format' string with the argument of the idletime
in seconds."
- :group 'erc-autoaway
:type 'string)
-(defun erc-autoaway-reset-idle-user (&rest stuff)
+(defun erc-autoaway-reset-idle-user (&rest _stuff)
"Reset the stored user idle time.
This is one global variable since a user talking on one net can
talk on another net too."
@@ -212,7 +206,7 @@ talk on another net too."
(erc-autoaway-set-back #'erc-autoaway-remove-maybe))
(setq erc-autoaway-last-sent-time (erc-current-time)))
-(defun erc-autoaway-reset-idle-irc (line &rest stuff)
+(defun erc-autoaway-reset-idle-irc (line &rest _stuff)
"Reset the stored IRC idle time.
This is one global variable since a user talking on one net can
talk on another net too."
@@ -272,7 +266,7 @@ active server buffer available."
(setq erc-autoaway-caused-away t)
(erc-cmd-GAWAY (format-message erc-autoaway-message idle-time))))
-(defun erc-autoaway-reset-indicators (&rest stuff)
+(defun erc-autoaway-reset-indicators (&rest _stuff)
"Reset indicators used by the erc-autoaway module."
(setq erc-autoaway-last-sent-time (erc-current-time))
(setq erc-autoaway-caused-away nil))
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 4cabd42f532..6d84665873e 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -6,7 +6,7 @@
;; Author: Lawrence Mitchell <wence@gmx.li>
;; Maintainer: Amin Bandali <bandali@gnu.org>
;; Created: 2004-05-7
-;; Keywords: IRC chat client internet
+;; Keywords: comm, IRC, chat, client, internet
;; This file is part of GNU Emacs.
@@ -138,6 +138,13 @@ Use `erc-current-nick' to access this.")
(defvar-local erc-session-port nil
"The port used to connect to.")
+(defvar-local erc-session-client-certificate nil
+ "TLS client certificate used when connecting over TLS.
+If non-nil, should either be a list where the first element is
+the certificate key file name, and the second element is the
+certificate file name itself, or t, which means that
+`auth-source' will be queried for the key and the certificate.")
+
(defvar-local erc-server-announced-name nil
"The name the server announced to use.")
@@ -268,7 +275,6 @@ protection algorithm.")
"Non-nil means that ERC will attempt to reestablish broken connections.
Reconnection will happen automatically for any unexpected disconnection."
- :group 'erc-server
:type 'boolean)
(defcustom erc-server-reconnect-attempts 2
@@ -276,7 +282,6 @@ Reconnection will happen automatically for any unexpected disconnection."
broken connection, or t to always attempt to reconnect.
This only has an effect if `erc-server-auto-reconnect' is non-nil."
- :group 'erc-server
:type '(choice (const :tag "Always reconnect" t)
integer))
@@ -285,7 +290,6 @@ This only has an effect if `erc-server-auto-reconnect' is non-nil."
successive reconnect attempts.
If a key is pressed while ERC is waiting, it will stop waiting."
- :group 'erc-server
:type 'number)
(defcustom erc-split-line-length 440
@@ -299,14 +303,12 @@ And a typical message looks like this:
You can limit here the maximum length of the \"Hello!\" part.
Good luck."
- :type 'integer
- :group 'erc-server)
+ :type 'integer)
(defcustom erc-coding-system-precedence '(utf-8 undecided)
"List of coding systems to be preferred when receiving a string from the server.
This will only be consulted if the coding system in
`erc-server-coding-system' is `undecided'."
- :group 'erc-server
:version "24.1"
:type '(repeat coding-system))
@@ -331,7 +333,6 @@ If you need to send non-ASCII text to people not using a client that
does decoding on its own, you must tell ERC what encoding to use.
Emacs cannot guess it, since it does not know what the people on the
other end of the line are using."
- :group 'erc-server
:type '(choice (const :tag "None" nil)
coding-system
(cons (coding-system :tag "encoding" :value utf-8)
@@ -346,37 +347,32 @@ current target as returned by `erc-default-target'.
Example: If you know that the channel #linux-ru uses the coding-system
`cyrillic-koi8', then add (\"#linux-ru\" . cyrillic-koi8) to the
alist."
- :group 'erc-server
:type '(repeat (cons (regexp :tag "Target")
coding-system)))
(defcustom erc-server-connect-function #'erc-open-network-stream
"Function used to initiate a connection.
It should take same arguments as `open-network-stream' does."
- :group 'erc-server
:type 'function)
(defcustom erc-server-prevent-duplicates '("301")
"Either nil or a list of strings.
Each string is a IRC message type, like PRIVMSG or NOTICE.
All Message types in that list of subjected to duplicate prevention."
- :type '(choice (const nil) (list string))
- :group 'erc-server)
+ :type '(choice (const nil) (list string)))
(defcustom erc-server-duplicate-timeout 60
"The time allowed in seconds between duplicate messages.
If two identical messages arrive within this value of one another, the second
isn't displayed."
- :type 'integer
- :group 'erc-server)
+ :type 'integer)
(defcustom erc-server-timestamp-format "%Y-%m-%d %T"
"Timestamp format used with server response messages.
This string is processed using `format-time-string'."
:version "24.3"
- :type 'string
- :group 'erc-server)
+ :type 'string)
;;; Flood-related
@@ -395,22 +391,19 @@ detailed in RFC 2813, section 5.8 \"Flood control of clients\".
time, send a message, and increase
`erc-server-flood-last-message' by
`erc-server-flood-penalty' for each message."
- :type 'integer
- :group 'erc-server)
+ :type 'integer)
(defcustom erc-server-flood-penalty 3
"How much we penalize a message.
See `erc-server-flood-margin' for an explanation of the flood
protection algorithm."
- :type 'integer
- :group 'erc-server)
+ :type 'integer)
;; Ping handling
(defcustom erc-server-send-ping-interval 30
"Interval of sending pings to the server, in seconds.
If this is set to nil, pinging the server is disabled."
- :group 'erc-server
:type '(choice (const :tag "Disabled" nil)
(integer :tag "Seconds")))
@@ -422,7 +415,6 @@ This must be greater than or equal to the value for
`erc-server-send-ping-interval'.
If this is set to nil, never try to reconnect."
- :group 'erc-server
:type '(choice (const :tag "Disabled" nil)
(integer :tag "Seconds")))
@@ -520,18 +512,23 @@ The current buffer is given by BUFFER."
(memq (process-status erc-server-process) '(run open)))))
;;;; Connecting to a server
-(defun erc-open-network-stream (name buffer host service)
- "As `open-network-stream', but does non-blocking IO"
- (make-network-process :name name :buffer buffer
- :host host :service service :nowait t))
+(defun erc-open-network-stream (name buffer host service &rest parameters)
+ "Like `open-network-stream', but does non-blocking IO."
+ (let ((p (plist-put parameters :nowait t)))
+ (apply #'open-network-stream name buffer host service p)))
-(defun erc-server-connect (server port buffer)
+(defun erc-server-connect (server port buffer &optional client-certificate)
"Perform the connection and login using the specified SERVER and PORT.
-We will store server variables in the buffer given by BUFFER."
- (let ((msg (erc-format-message 'connect ?S server ?p port)) process)
+We will store server variables in the buffer given by BUFFER.
+CLIENT-CERTIFICATE may optionally be used to specify a TLS client
+certificate to use for authentication when connecting over
+TLS (see `erc-session-client-certificate' for more details)."
+ (let ((msg (erc-format-message 'connect ?S server ?p port)) process
+ (args `(,(format "erc-%s-%s" server port) nil ,server ,port)))
+ (when client-certificate
+ (setq args `(,@args :client-certificate ,client-certificate)))
(message "%s" msg)
- (setq process (funcall erc-server-connect-function
- (format "erc-%s-%s" server port) nil server port))
+ (setq process (apply erc-server-connect-function args))
(unless (processp process)
(error "Connection attempt failed"))
;; Misc server variables
@@ -953,15 +950,15 @@ 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-match " " string))))
+ (substring string 1 (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 (string-match " " string)))
+ (substring string (+ 1 (string-search " " string)))
string))
(posn (if (eq (aref string 0) ?:)
- (string-match " " string)
+ (string-search " " string)
0)))
(setf (erc-response.sender msg)
@@ -971,7 +968,7 @@ 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-match " " string bposn)))
+ (eposn (string-search " " string bposn)))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn)))
@@ -979,7 +976,7 @@ 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-match " " string bposn)))
+ (eposn (string-search " " string bposn)))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn))
@@ -1079,14 +1076,9 @@ Finds hooks by looking in the `erc-server-responses' hash table."
(erc-display-message parsed 'notice proc line)))
-(put 'define-erc-response-handler 'edebug-form-spec
- '(&define :name erc-response-handler
- (name &rest name)
- &optional sexp sexp def-body))
-
(cl-defmacro define-erc-response-handler ((name &rest aliases)
- &optional extra-fn-doc extra-var-doc
- &rest fn-body)
+ &optional extra-fn-doc extra-var-doc
+ &rest fn-body)
"Define an ERC handler hook/function pair.
NAME is the response name as sent by the server (see the IRC RFC for
meanings).
@@ -1166,6 +1158,9 @@ Would expand to:
See also `erc-server-311'.\"))
\(fn (NAME &rest ALIASES) &optional EXTRA-FN-DOC EXTRA-VAR-DOC &rest FN-BODY)"
+ (declare (debug (&define [&name "erc-response-handler@"
+ (symbolp &rest symbolp)]
+ &optional sexp sexp def-body)))
(if (numberp name) (setq name (intern (format "%03i" name))))
(setq aliases (mapcar (lambda (a)
(if (numberp a)
@@ -1228,8 +1223,8 @@ add things to `%s' instead."
,@(cl-loop for fn in fn-alternates
for var in var-alternates
for a in aliases
- nconc (list `(defalias ',fn ',fn-name)
- `(defvar ,var ',fn-name ,(format hook-doc a))
+ nconc (list `(defalias ',fn #',fn-name)
+ `(defvar ,var #',fn-name ,(format hook-doc a))
`(put ',var 'definition-name ',hook-name))))))
(define-erc-response-handler (ERROR)
@@ -1766,7 +1761,7 @@ See `erc-display-server-message'." nil
's324 ?c channel ?m modes)))
(define-erc-response-handler (328)
- "Channel URL (on freenode network)." nil
+ "Channel URL." nil
(let ((channel (cadr (erc-response.command-args parsed)))
(url (erc-response.contents parsed)))
(erc-display-message parsed 'notice (erc-get-buffer channel proc)
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 71ff40877a8..5953471ae8e 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -1,10 +1,10 @@
-;; erc-button.el --- A way of buttonizing certain things in ERC buffers -*- lexical-binding:t -*-
+;;; erc-button.el --- A way of buttonizing certain things in ERC buffers -*- lexical-binding:t -*-
;; Copyright (C) 1996-2004, 2006-2021 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: irc, button, url, regexp
+;; Keywords: comm, irc, button, url, regexp
;; URL: https://www.emacswiki.org/emacs/ErcButton
;; This file is part of GNU Emacs.
@@ -52,14 +52,14 @@
;;;###autoload(autoload 'erc-button-mode "erc-button" nil t)
(define-erc-module button nil
"This mode buttonizes all messages according to `erc-button-alist'."
- ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append)
- (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append)
- (add-hook 'erc-complete-functions 'erc-button-next-function)
- (add-hook 'erc-mode-hook 'erc-button-setup))
- ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons)
- (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons)
- (remove-hook 'erc-complete-functions 'erc-button-next-function)
- (remove-hook 'erc-mode-hook 'erc-button-setup)))
+ ((add-hook 'erc-insert-modify-hook #'erc-button-add-buttons 'append)
+ (add-hook 'erc-send-modify-hook #'erc-button-add-buttons 'append)
+ (add-hook 'erc-complete-functions #'erc-button-next-function)
+ (add-hook 'erc-mode-hook #'erc-button-setup))
+ ((remove-hook 'erc-insert-modify-hook #'erc-button-add-buttons)
+ (remove-hook 'erc-send-modify-hook #'erc-button-add-buttons)
+ (remove-hook 'erc-complete-functions #'erc-button-next-function)
+ (remove-hook 'erc-mode-hook #'erc-button-setup)))
;;; Variables
@@ -91,7 +91,6 @@ above them."
(defcustom erc-button-url-regexp browse-url-button-regexp
"Regular expression that matches URLs."
:version "27.1"
- :group 'erc-button
:type 'regexp)
(defcustom erc-button-wrap-long-urls nil
@@ -100,28 +99,25 @@ above them."
If this variable is a number, consider URLs longer than its value to
be \"long\". If t, URLs will be considered \"long\" if they are
longer than `erc-fill-column'."
- :group 'erc-button
:type '(choice integer boolean))
(defcustom erc-button-buttonize-nicks t
"Flag indicating whether nicks should be buttonized or not."
- :group 'erc-button
:type 'boolean)
-(defcustom erc-button-rfc-url "http://www.faqs.org/rfcs/rfc%s.html"
- "URL used to browse rfc references.
+(defcustom erc-button-rfc-url "https://tools.ietf.org/html/rfc%s"
+ "URL used to browse RFC references.
%s is replaced by the number."
- :group 'erc-button
- :type 'string)
+ :type 'string
+ :version "28.1")
(define-obsolete-variable-alias 'erc-button-google-url
'erc-button-search-url "27.1")
-(defcustom erc-button-search-url "http://duckduckgo.com/?q=%s"
+(defcustom erc-button-search-url "https://duckduckgo.com/?q=%s"
"URL used to search for a term.
%s is replaced by the search string."
- :version "27.1"
- :group 'erc-button
+ :version "28.1"
:type 'string)
(defcustom erc-button-alist
@@ -134,7 +130,8 @@ longer than `erc-fill-column'."
("<URL: *\\([^<> ]+\\) *>" 0 t browse-url-button-open-url 1)
;;; ("(\\(\\([^~\n \t@][^\n \t@]*\\)@\\([a-zA-Z0-9.:-]+\\)\\)" 1 t finger 2 3)
;; emacs internal
- ("[`]\\([a-zA-Z][-a-zA-Z_0-9]+\\)[']" 1 t erc-button-describe-symbol 1)
+ ("[`]\\([a-zA-Z][-a-zA-Z_0-9!*<=>+]+\\)[']"
+ 1 t erc-button-describe-symbol 1)
;; pseudo links
("\\bInfo:[\"]\\([^\"]+\\)[\"]" 0 t Info-goto-node 1)
("\\b\\(Ward\\|Wiki\\|WardsWiki\\|TheWiki\\):\\([A-Z][a-z]+\\([A-Z][a-z]+\\)+\\)"
@@ -179,7 +176,6 @@ PAR is a number of a regexp grouping whose text will be passed to
CALLBACK. There can be several PAR arguments. If REGEXP is
\\='nicknames, these are ignored, and CALLBACK will be called with
the nickname matched as the argument."
- :group 'erc-button
:version "24.1" ; remove finger (bug#4443)
:type '(repeat
(list :tag "Button"
@@ -200,20 +196,18 @@ PAR is a number of a regexp grouping whose text will be passed to
(defcustom erc-emacswiki-url "https://www.emacswiki.org/cgi-bin/wiki.pl?"
"URL of the EmacsWiki Homepage."
- :group 'erc-button
:type 'string)
(defcustom erc-emacswiki-lisp-url "https://www.emacswiki.org/elisp/"
"URL of the EmacsWiki ELisp area."
- :group 'erc-button
:type 'string)
(defvar erc-button-keymap
(let ((map (make-sparse-keymap)))
- (define-key map (kbd "RET") 'erc-button-press-button)
- (define-key map (kbd "<mouse-2>") 'erc-button-click-button)
- (define-key map (kbd "TAB") 'erc-button-next)
- (define-key map (kbd "<backtab>") 'erc-button-previous)
+ (define-key map (kbd "RET") #'erc-button-press-button)
+ (define-key map (kbd "<mouse-2>") #'erc-button-click-button)
+ (define-key map (kbd "TAB") #'erc-button-next)
+ (define-key map (kbd "<backtab>") #'erc-button-previous)
(define-key map [follow-link] 'mouse-face)
(set-keymap-parent map erc-mode-map)
map)
@@ -244,7 +238,7 @@ global-level ERC button keys yet.")
"Add ERC mode-level button movement keys. This is only done once."
;; Add keys.
(unless erc-button-keys-added
- (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous)
+ (define-key erc-mode-map (kbd "<backtab>") #'erc-button-previous)
(setq erc-button-keys-added t)))
(defun erc-button-add-buttons ()
@@ -287,7 +281,7 @@ specified by `erc-button-alist'."
(fun (nth 3 entry))
bounds word)
(when (or (eq t form)
- (eval form))
+ (eval form t))
(goto-char (point-min))
(while (erc-forward-word)
(when (setq bounds (erc-bounds-of-word-at-point))
@@ -306,9 +300,9 @@ specified by `erc-button-alist'."
(end (match-end (nth 1 entry)))
(form (nth 2 entry))
(fun (nth 3 entry))
- (data (mapcar 'match-string (nthcdr 4 entry))))
+ (data (mapcar #'match-string-no-properties (nthcdr 4 entry))))
(when (or (eq t form)
- (eval form))
+ (eval form t))
(erc-button-add-button start end fun nil data regexp)))))
(defun erc-button-remove-old-buttons ()
@@ -483,7 +477,6 @@ Examples:
(format
\"ldapsearch -x -P 2 -h db.debian.org -b dc=debian,dc=org ircnick=%s\"
nick)))"
- :group 'erc-button
:type '(repeat (cons (string :tag "Op")
sexp)))
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
index 4e4d012545a..19bc2dbb8ec 100644
--- a/lisp/erc/erc-capab.el
+++ b/lisp/erc/erc-capab.el
@@ -1,4 +1,4 @@
-;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB
+;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB -*- lexical-binding: t; -*-
;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
@@ -40,8 +40,8 @@
;; disable this module, it will continue removing message flags, but the
;; unidentified nickname prefix will not be added to messages.
-;; Visit <http://freenode.net/faq.shtml#spoofing> and
-;; <http://freenode.net/faq.shtml#registering> to find further
+;; Visit <https://freenode.net/kb/answer/cloaks> and
+;; <https://freenode.net/kb/answer/registration> to find further
;; explanations of this capability.
;; From freenode.net's web site (not there anymore) on how to mark
@@ -80,12 +80,10 @@
If you change this from the default \"*\", be sure to use a
character not found in IRC nicknames to avoid confusion."
- :group 'erc-capab
:type '(choice string (const nil)))
(defface erc-capab-identify-unidentified '((t)) ; same as `erc-default-face'
"Face to use for `erc-capab-identify-prefix'."
- :group 'erc-capab
:group 'erc-faces)
;;; Define module:
@@ -94,22 +92,22 @@ character not found in IRC nicknames to avoid confusion."
(define-erc-module capab-identify nil
"Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP."
;; append so that `erc-server-parameters' is already set by `erc-server-005'
- ((add-hook 'erc-server-005-functions 'erc-capab-identify-setup t)
- (add-hook 'erc-server-290-functions 'erc-capab-identify-activate)
+ ((add-hook 'erc-server-005-functions #'erc-capab-identify-setup t)
+ (add-hook 'erc-server-290-functions #'erc-capab-identify-activate)
(add-hook 'erc-server-PRIVMSG-functions
- 'erc-capab-identify-remove/set-identified-flag)
+ #'erc-capab-identify-remove/set-identified-flag)
(add-hook 'erc-server-NOTICE-functions
- 'erc-capab-identify-remove/set-identified-flag)
- (add-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix t)
+ #'erc-capab-identify-remove/set-identified-flag)
+ (add-hook 'erc-insert-modify-hook #'erc-capab-identify-add-prefix t)
(mapc (lambda (buffer)
(when buffer
(with-current-buffer buffer (erc-capab-identify-setup))))
- (erc-buffer-list 'erc-open-server-buffer-p)))
- ((remove-hook 'erc-server-005-functions 'erc-capab-identify-setup)
- (remove-hook 'erc-server-290-functions 'erc-capab-identify-activate)
+ (erc-buffer-list #'erc-open-server-buffer-p)))
+ ((remove-hook 'erc-server-005-functions #'erc-capab-identify-setup)
+ (remove-hook 'erc-server-290-functions #'erc-capab-identify-activate)
;; we don't remove the `erc-capab-identify-remove/set-identified-flag' hooks
;; because there doesn't seem to be a way to tell the server to turn it off
- (remove-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix)))
+ (remove-hook 'erc-insert-modify-hook #'erc-capab-identify-add-prefix)))
;;; Variables:
@@ -121,7 +119,7 @@ character not found in IRC nicknames to avoid confusion."
;;; Functions:
-(defun erc-capab-identify-setup (&optional proc parsed)
+(defun erc-capab-identify-setup (&optional _proc _parsed)
"Set up CAPAB IDENTIFY on the current server.
Optional argument PROC is the current server's process.
@@ -146,19 +144,19 @@ These arguments are sent to this function when called as a hook in
(setq erc-capab-identify-sent t)))
-(defun erc-capab-identify-activate (proc parsed)
+(defun erc-capab-identify-activate (_proc parsed)
"Set `erc-capab-identify-activated' and display an activation message.
PROC is the current server's process.
PARSED is an `erc-parsed' response struct."
- (when (or (string= "IDENTIFY-MSG" (erc-response.contents parsed))
- (string= "IDENTIFY-CTCP" (erc-response.contents parsed)))
+ (when (member (erc-response.contents parsed)
+ '("IDENTIFY-MSG" "IDENTIFY-CTCP"))
(setq erc-capab-identify-activated t)
(erc-display-message
parsed 'notice 'active (format "%s activated"
(erc-response.contents parsed)))))
-(defun erc-capab-identify-remove/set-identified-flag (proc parsed)
+(defun erc-capab-identify-remove/set-identified-flag (_proc parsed)
"Remove PARSED message's id flag and add the `erc-identified' text property.
PROC is the current server's process.
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 9dedd3cda86..de72624aaa1 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -1,4 +1,4 @@
-;;; erc-dcc.el --- CTCP DCC module for ERC
+;;; erc-dcc.el --- CTCP DCC module for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 1993-1995, 1998, 2002-2004, 2006-2021 Free Software
;; Foundation, Inc.
@@ -7,7 +7,7 @@
;; Noah Friedman <friedman@prep.ai.mit.edu>
;; Per Persson <pp@sno.pp.se>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, processes
+;; Keywords: comm
;; Created: 1994-01-23
;; This file is part of GNU Emacs.
@@ -55,12 +55,6 @@
;; Require at run-time too to silence compiler.
(require 'pcomplete)
-;;;###autoload(autoload 'erc-dcc-mode "erc-dcc")
-(define-erc-module dcc nil
- "Provide Direct Client-to-Client support for ERC."
- ((add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick))
- ((remove-hook 'erc-server-401-functions 'erc-dcc-no-such-nick)))
-
(defgroup erc-dcc nil
"DCC stands for Direct Client Communication, where you and your
friend's client programs connect directly to each other,
@@ -71,9 +65,14 @@ Using DCC get and send, you can transfer files directly from and to other
IRC users."
:group 'erc)
+;;;###autoload(autoload 'erc-dcc-mode "erc-dcc")
+(define-erc-module dcc nil
+ "Provide Direct Client-to-Client support for ERC."
+ ((add-hook 'erc-server-401-functions #'erc-dcc-no-such-nick))
+ ((remove-hook 'erc-server-401-functions #'erc-dcc-no-such-nick)))
+
(defcustom erc-dcc-verbose nil
"If non-nil, be verbose about DCC activity reporting."
- :group 'erc-dcc
:type 'boolean)
(defconst erc-dcc-connection-types
@@ -120,7 +119,8 @@ All values of the list must be uppercase strings.")
;; more: the entry data from erc-dcc-list for this particular process.
(defvar erc-dcc-connect-function 'erc-dcc-open-network-stream)
-(defun erc-dcc-open-network-stream (procname buffer addr port entry)
+(defun erc-dcc-open-network-stream (procname buffer addr port _entry)
+ ;; FIXME: Time to try activating this again!?
(if nil; (fboundp 'open-network-stream-nowait) ;; this currently crashes
;; cvs emacs
(open-network-stream-nowait procname buffer addr port)
@@ -187,7 +187,7 @@ 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-match "!" val)
+ (or (and (eq prop :nick) (string-search "!" val)
test (string-equal test val))
(and (eq prop :nick)
test val
@@ -286,7 +286,6 @@ The result is also a string."
"IP address to listen on when offering files.
Should be set to a string or nil. If nil, automatic detection of
the host interface to use will be attempted."
- :group 'erc-dcc
:type (list 'choice (list 'const :tag "Auto-detect" nil)
(list 'string :tag "IP-address"
:valid-regexp erc-dcc-ipv4-regexp)))
@@ -295,7 +294,6 @@ the host interface to use will be attempted."
"IP address to use for outgoing DCC offers.
Should be set to a string or nil. If nil, use the value of
`erc-dcc-listen-host'."
- :group 'erc-dcc
:type (list 'choice (list 'const :tag "Same as erc-dcc-listen-host" nil)
(list 'string :tag "IP-address"
:valid-regexp erc-dcc-ipv4-regexp)))
@@ -306,7 +304,6 @@ Should be set to a string or nil. If nil, use the value of
You might want to set `erc-dcc-auto-masks' for this.
`auto' - Automatically accept the request and begin downloading the file
`ignore' - Ignore incoming DCC Send requests completely."
- :group 'erc-dcc
:type '(choice (const ask) (const auto) (const ignore)))
(defun erc-dcc-get-host (proc)
@@ -323,7 +320,6 @@ If variable `erc-dcc-host' is non-nil, use it. Otherwise call
(defcustom erc-dcc-port-range nil
"If nil, any available user port is used for outgoing DCC connections.
If set to a cons, it specifies a range of ports to use in the form (min . max)"
- :group 'erc-dcc
:type '(choice
(const :tag "Any port" nil)
(cons :tag "Port range"
@@ -335,7 +331,6 @@ If set to a cons, it specifies a range of ports to use in the form (min . max)"
accepted automatically. A user identifier has the form \"nick!login@host\".
For instance, to accept all incoming DCC send offers automatically, add the
string \".*!.*@.*\" to this list."
- :group 'erc-dcc
:type '(repeat regexp))
(defun erc-dcc-server (name filter sentinel)
@@ -391,7 +386,6 @@ the accepted connection."
(defcustom erc-dcc-get-default-directory nil
"Default directory for incoming DCC file transfers.
If this is nil, then the current value of `default-directory' is used."
- :group 'erc-dcc
:type '(choice (const nil :tag "Default directory") directory))
;;;###autoload
@@ -421,33 +415,33 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
(pcase (intern (downcase (pcomplete-arg 1)))
('chat (mapcar (lambda (elt) (plist-get elt :nick))
(cl-remove-if-not
- #'(lambda (elt)
- (eq (plist-get elt :type) 'CHAT))
+ (lambda (elt)
+ (eq (plist-get elt :type) 'CHAT))
erc-dcc-list)))
('close (delete-dups
(mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
erc-dcc-list)))
('get (mapcar #'erc-dcc-nick
(cl-remove-if-not
- #'(lambda (elt)
- (eq (plist-get elt :type) 'GET))
+ (lambda (elt)
+ (eq (plist-get elt :type) 'GET))
erc-dcc-list)))
('send (pcomplete-erc-all-nicks))))
(pcomplete-here
(pcase (intern (downcase (pcomplete-arg 2)))
('get (mapcar (lambda (elt) (plist-get elt :file))
(cl-remove-if-not
- #'(lambda (elt)
- (and (eq (plist-get elt :type) 'GET)
- (erc-nick-equal-p (erc-extract-nick
- (plist-get elt :nick))
- (pcomplete-arg 1))))
+ (lambda (elt)
+ (and (eq (plist-get elt :type) 'GET)
+ (erc-nick-equal-p (erc-extract-nick
+ (plist-get elt :nick))
+ (pcomplete-arg 1))))
erc-dcc-list)))
('close (mapcar #'erc-dcc-nick
(cl-remove-if-not
- #'(lambda (elt)
- (eq (plist-get elt :type)
- (intern (upcase (pcomplete-arg 1)))))
+ (lambda (elt)
+ (eq (plist-get elt :type)
+ (intern (upcase (pcomplete-arg 1)))))
erc-dcc-list)))
('send (pcomplete-entries)))))
@@ -468,7 +462,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
'dcc-chat-offer ?n nick)
t))))
-(defun erc-dcc-do-CLOSE-command (proc &optional type nick)
+(defun erc-dcc-do-CLOSE-command (_proc &optional type nick)
"Close a connection. Usage: /dcc close type nick.
At least one of TYPE and NICK must be provided."
;; disambiguate type and nick if only one is provided
@@ -540,7 +534,7 @@ PROC is the server process."
(defvar-local erc-dcc-byte-count nil)
-(defun erc-dcc-do-LIST-command (proc)
+(defun erc-dcc-do-LIST-command (_proc)
"This is the handler for the /dcc list command.
It lists the current state of `erc-dcc-list' in an easy to read manner."
(let ((alist erc-dcc-list)
@@ -636,8 +630,8 @@ that subcommand."
(define-inline erc-dcc-unquote-filename (filename)
(inline-quote
- (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.
@@ -703,7 +697,6 @@ the matching regexp, or nil if none found."
`ask' - Report the Chat request, and wait for the user to manually accept it
`auto' - Automatically accept the request and open a new chat window
`ignore' - Ignore incoming DCC chat requests completely."
- :group 'erc-dcc
:type '(choice (const ask) (const auto) (const ignore)))
(defun erc-dcc-handle-ctcp-chat (proc query nick login host to)
@@ -757,13 +750,11 @@ the matching regexp, or nil if none found."
(defcustom erc-dcc-block-size 1024
"Block size to use for DCC SEND sessions."
- :group 'erc-dcc
:type 'integer)
(defcustom erc-dcc-pump-bytes nil
"If set to an integer, keep sending until that number of bytes are
unconfirmed."
- :group 'erc-dcc
:type '(choice (const nil) integer))
(define-inline erc-dcc-get-parent (proc)
@@ -837,7 +828,6 @@ bytes sent."
'(erc-dcc-display-send erc-dcc-send-block)
"Hook run whenever the remote end of a DCC SEND offer connected to your
listening port."
- :group 'erc-dcc
:type 'hook)
(defun erc-dcc-nick (plist)
@@ -900,7 +890,6 @@ other client."
(defcustom erc-dcc-receive-cache (* 1024 512)
"Number of bytes to let the receive buffer grow before flushing it."
- :group 'erc-dcc
:type 'integer)
(defvar-local erc-dcc-file-name nil)
@@ -942,12 +931,12 @@ and making the connection."
(set-process-coding-system proc 'binary 'binary)
(set-buffer-file-coding-system 'binary t)
- (set-process-filter proc 'erc-dcc-get-filter)
- (set-process-sentinel proc 'erc-dcc-get-sentinel)
+ (set-process-filter proc #'erc-dcc-get-filter)
+ (set-process-sentinel proc #'erc-dcc-get-sentinel)
(setq entry (plist-put entry :start-time (erc-current-time)))
(setq entry (plist-put entry :peer proc)))))
-(defun erc-dcc-append-contents (buffer file)
+(defun erc-dcc-append-contents (buffer _file)
"Append the contents of BUFFER to FILE.
The contents of the BUFFER will then be erased."
(with-current-buffer buffer
@@ -1000,7 +989,7 @@ rather than every 1024 byte block, but nobody seems to care."
proc (erc-pack-int received-bytes)))))))
-(defun erc-dcc-get-sentinel (proc event)
+(defun erc-dcc-get-sentinel (proc _event)
"This is the process sentinel for CTCP DCC SEND connections.
It shuts down the connection and notifies the user that the
transfer is complete."
@@ -1025,25 +1014,21 @@ transfer is complete."
(defcustom erc-dcc-chat-buffer-name-format "DCC-CHAT-%s"
"Format to use for DCC Chat buffer names."
- :group 'erc-dcc
:type 'string)
(defcustom erc-dcc-chat-mode-hook nil
"Hook calls when `erc-dcc-chat-mode' finished setting up the buffer."
- :group 'erc-dcc
:type 'hook)
(defcustom erc-dcc-chat-connect-hook nil
""
- :group 'erc-dcc
:type 'hook)
(defcustom erc-dcc-chat-exit-hook nil
""
- :group 'erc-dcc
:type 'hook)
-(defun erc-cmd-CREQ (line &optional force)
+(defun erc-cmd-CREQ (line &optional _force)
"Set or get the DCC chat request flag.
Possible values are: ask, auto, ignore."
(when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line)
@@ -1058,7 +1043,7 @@ Possible values are: ask, auto, ignore."
erc-dcc-chat-request)))
t)))
-(defun erc-cmd-SREQ (line &optional force)
+(defun erc-cmd-SREQ (line &optional _force)
"Set or get the DCC send request flag.
Possible values are: ask, auto, ignore."
(when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line)
@@ -1075,7 +1060,7 @@ Possible values are: ask, auto, ignore."
(defun pcomplete/erc-mode/CREQ ()
(pcomplete-here '("auto" "ask" "ignore")))
-(defalias 'pcomplete/erc-mode/SREQ 'pcomplete/erc-mode/CREQ)
+(defalias 'pcomplete/erc-mode/SREQ #'pcomplete/erc-mode/CREQ)
(define-obsolete-variable-alias 'erc-dcc-chat-filter-hook
'erc-dcc-chat-filter-functions "24.3")
@@ -1087,19 +1072,19 @@ the unprocessed output.")
(defvar erc-dcc-chat-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map (kbd "RET") 'erc-send-current-line)
- (define-key map "\t" 'completion-at-point)
+ (define-key map (kbd "RET") #'erc-send-current-line)
+ (define-key map "\t" #'completion-at-point)
map)
"Keymap for `erc-dcc-mode'.")
(define-derived-mode erc-dcc-chat-mode fundamental-mode "DCC-Chat"
"Major mode for wasting time via DCC chat."
(setq mode-line-process '(":%s")
- erc-send-input-line-function 'erc-dcc-chat-send-input-line
+ erc-send-input-line-function #'erc-dcc-chat-send-input-line
erc-default-recipients '(dcc))
- (add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t))
+ (add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t))
-(defun erc-dcc-chat-send-input-line (recipient line &optional force)
+(defun erc-dcc-chat-send-input-line (recipient line &optional _force)
"Send LINE to the remote end.
Argument RECIPIENT should always be the symbol dcc, and force
is ignored."
@@ -1150,14 +1135,14 @@ other client."
(setq erc-input-marker (make-marker))
(erc-display-prompt buffer (point-max))
(set-process-buffer proc buffer)
- (add-hook 'kill-buffer-hook 'erc-dcc-chat-buffer-killed nil t)
+ (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t)
(run-hook-with-args 'erc-dcc-chat-connect-hook proc)
buffer))
(defun erc-dcc-chat-accept (entry parent-proc)
"Accept an incoming DCC connection and open a DCC window."
- (let* ((nick (erc-extract-nick (plist-get entry :nick)))
- buffer proc)
+ (let* (;; (nick (erc-extract-nick (plist-get entry :nick)))
+ proc) ;; buffer
(setq proc
(funcall erc-dcc-connect-function
"dcc-chat" nil
@@ -1167,9 +1152,10 @@ other client."
;; XXX: connected, should we kill the ip/port properties?
(setq entry (plist-put entry :peer proc))
(setq entry (plist-put entry :parent parent-proc))
- (set-process-filter proc 'erc-dcc-chat-filter)
- (set-process-sentinel proc 'erc-dcc-chat-sentinel)
- (setq buffer (erc-dcc-chat-setup entry))))
+ (set-process-filter proc #'erc-dcc-chat-filter)
+ (set-process-sentinel proc #'erc-dcc-chat-sentinel)
+ ;; (setq buffer
+ (erc-dcc-chat-setup entry))) ;; )
(defun erc-dcc-chat-filter (proc str)
(let ((orig-buffer (current-buffer)))
diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el
index 056fb23777f..9838b239537 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -1,4 +1,4 @@
-;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions -*- lexical-binding:t -*-
+;;; erc-desktop-notifications.el --- Send notification on PRIVMSG or mentions -*- lexical-binding:t -*-
;; Copyright (C) 2012-2021 Free Software Foundation, Inc.
@@ -45,13 +45,11 @@
(defcustom erc-notifications-icon nil
"Icon to use for notification."
- :group 'erc-notifications
:type '(choice (const :tag "No icon" nil) file))
(defcustom erc-notifications-bus :session
"D-Bus bus to use for notification."
:version "25.1"
- :group 'erc-notifications
:type '(choice (const :tag "Session bus" :session) string))
(defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors
@@ -99,11 +97,11 @@ This will replace the last notification sent with this function."
(define-erc-module notifications nil
"Send notifications on private message reception and mentions."
;; Enable
- ((add-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG)
- (add-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match))
+ ((add-hook 'erc-server-PRIVMSG-functions #'erc-notifications-PRIVMSG)
+ (add-hook 'erc-text-matched-hook #'erc-notifications-notify-on-match))
;; Disable
- ((remove-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG)
- (remove-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match)))
+ ((remove-hook 'erc-server-PRIVMSG-functions #'erc-notifications-PRIVMSG)
+ (remove-hook 'erc-text-matched-hook #'erc-notifications-notify-on-match)))
(provide 'erc-desktop-notifications)
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
index 8378ff53742..331d29a7b5b 100644
--- a/lisp/erc/erc-ezbounce.el
+++ b/lisp/erc/erc-ezbounce.el
@@ -1,4 +1,4 @@
-;;; erc-ezbounce.el --- Handle EZBounce bouncer commands
+;;; erc-ezbounce.el --- Handle EZBounce bouncer commands -*- lexical-binding: t; -*-
;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
@@ -33,7 +33,6 @@
(defcustom erc-ezb-regexp "^ezbounce!srv$"
"Regexp used by the EZBouncer to identify itself to the user."
- :group 'erc-ezbounce
:type 'regexp)
(defcustom erc-ezb-login-alist '()
@@ -44,7 +43,6 @@ The alist's format is as follows:
(((server . port) . (username . password))
((server . port) . (username . password))
...)"
- :group 'erc-ezbounce
:type '(repeat
(cons (cons :tag "Server"
string
@@ -68,7 +66,7 @@ The alist's format is as follows:
"Indicate whether current notices are expected to be EZB session listings.")
;;;###autoload
-(defun erc-cmd-ezb (line &optional force)
+(defun erc-cmd-ezb (line &optional _force)
"Send EZB commands to the EZBouncer verbatim."
(erc-server-send (concat "EZB " line)))
(put 'erc-cmd-EZB 'do-not-parse-args t)
@@ -102,7 +100,7 @@ in the alist is nil, prompt for the appropriate values."
found))
;;;###autoload
-(defun erc-ezb-notice-autodetect (proc parsed)
+(defun erc-ezb-notice-autodetect (_proc parsed)
"React on an EZBounce NOTICE request."
(let* ((sender (erc-response.sender parsed))
(message (erc-response.contents parsed))
@@ -113,7 +111,7 @@ in the alist is nil, prompt for the appropriate values."
nil)
;;;###autoload
-(defun erc-ezb-identify (message)
+(defun erc-ezb-identify (_message)
"Identify to the EZBouncer server."
(let ((login (erc-ezb-get-login erc-session-server (erc-port-to-string erc-session-port))))
(unless (null login)
@@ -122,13 +120,13 @@ in the alist is nil, prompt for the appropriate values."
(erc-server-send (concat "LOGIN " username " " pass))))))
;;;###autoload
-(defun erc-ezb-init-session-list (message)
+(defun erc-ezb-init-session-list (_message)
"Reset the EZBounce session list to nil."
(setq erc-ezb-session-list nil)
(setq erc-ezb-inside-session-listing t))
;;;###autoload
-(defun erc-ezb-end-of-session-list (message)
+(defun erc-ezb-end-of-session-list (_message)
"Indicate the end of the EZBounce session listing."
(setq erc-ezb-inside-session-listing nil))
@@ -143,7 +141,7 @@ in the alist is nil, prompt for the appropriate values."
(add-to-list 'erc-ezb-session-list (list id nick to)))))
;;;###autoload
-(defun erc-ezb-select (message)
+(defun erc-ezb-select (_message)
"Select an IRC server to use by EZBounce, in ERC style."
(unless (and erc-ezb-session-list
(erc-ezb-select-session))
@@ -169,7 +167,7 @@ in the alist is nil, prompt for the appropriate values."
;;;###autoload
(defun erc-ezb-initialize ()
"Add EZBouncer convenience functions to ERC."
- (add-hook 'erc-server-NOTICE-functions 'erc-ezb-notice-autodetect))
+ (add-hook 'erc-server-NOTICE-functions #'erc-ezb-notice-autodetect))
(provide 'erc-ezbounce)
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
index 83ef5f93fa7..41256682c00 100644
--- a/lisp/erc/erc-fill.el
+++ b/lisp/erc/erc-fill.el
@@ -1,4 +1,4 @@
-;;; erc-fill.el --- Filling IRC messages in various ways
+;;; erc-fill.el --- Filling IRC messages in various ways -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
@@ -46,8 +46,7 @@ the mode if ARG is omitted or nil.
ERC fill mode is a global minor mode. When enabled, messages in
the channel buffers are filled."
- nil nil nil
- :global t :group 'erc-fill
+ :global t
(if erc-fill-mode
(erc-fill-enable)
(erc-fill-disable)))
@@ -55,19 +54,18 @@ the channel buffers are filled."
(defun erc-fill-enable ()
"Setup hooks for `erc-fill-mode'."
(interactive)
- (add-hook 'erc-insert-modify-hook 'erc-fill)
- (add-hook 'erc-send-modify-hook 'erc-fill))
+ (add-hook 'erc-insert-modify-hook #'erc-fill)
+ (add-hook 'erc-send-modify-hook #'erc-fill))
(defun erc-fill-disable ()
"Cleanup hooks, disable `erc-fill-mode'."
(interactive)
- (remove-hook 'erc-insert-modify-hook 'erc-fill)
- (remove-hook 'erc-send-modify-hook 'erc-fill))
+ (remove-hook 'erc-insert-modify-hook #'erc-fill)
+ (remove-hook 'erc-send-modify-hook #'erc-fill))
(defcustom erc-fill-prefix nil
"Values used as `fill-prefix' for `erc-fill-variable'.
nil means fill with space, a string means fill with this string."
- :group 'erc-fill
:type '(choice (const nil) string))
(defcustom erc-fill-function 'erc-fill-variable
@@ -94,7 +92,6 @@ These two styles are implemented using `erc-fill-variable' and
`erc-fill-static'. You can, of course, define your own filling
function. Narrowing to the region in question is in effect while your
function is called."
- :group 'erc-fill
:type '(choice (const :tag "Variable Filling" erc-fill-variable)
(const :tag "Static Filling" erc-fill-static)
function))
@@ -104,18 +101,15 @@ function is called."
centered. This column denotes the point where the ` ' character
between <nickname> and the entered text will be put, thus aligning
nick names right and text left."
- :group 'erc-fill
:type 'integer)
(defcustom erc-fill-variable-maximum-indentation 17
"If we indent a line after a long nick, don't indent more then this
characters. Set to nil to disable."
- :group 'erc-fill
:type 'integer)
(defcustom erc-fill-column 78
"The column at which a filled paragraph is broken."
- :group 'erc-fill
:type 'integer)
;;;###autoload
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index aef68810dfa..fc9a8d39ef4 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -1,4 +1,4 @@
-;; erc-goodies.el --- Collection of ERC modules
+;;; erc-goodies.el --- Collection of ERC modules -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2021 Free Software Foundation, Inc.
@@ -37,7 +37,7 @@
"Setup Imenu support in an ERC buffer."
(setq-local imenu-create-index-function #'erc-create-imenu-index))
-(add-hook 'erc-mode-hook 'erc-imenu-setup)
+(add-hook 'erc-mode-hook #'erc-imenu-setup)
(autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function")
;;; Automatically scroll to bottom
@@ -53,16 +53,16 @@ argument to `recenter'."
(define-erc-module scrolltobottom nil
"This mode causes the prompt to stay at the end of the window."
- ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
- (add-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom)
+ ((add-hook 'erc-mode-hook #'erc-add-scroll-to-bottom)
+ (add-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
(erc-add-scroll-to-bottom))))
- ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
- (remove-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom)
+ ((remove-hook 'erc-mode-hook #'erc-add-scroll-to-bottom)
+ (remove-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
- (remove-hook 'post-command-hook 'erc-scroll-to-bottom t)))))
+ (remove-hook 'post-command-hook #'erc-scroll-to-bottom t)))))
(defun erc-possibly-scroll-to-bottom ()
"Like `erc-add-scroll-to-bottom', but only if window is selected."
@@ -77,7 +77,7 @@ the value of `erc-input-line-position'.
This works whenever scrolling happens, so it's added to
`window-scroll-functions' rather than `erc-insert-post-hook'."
- (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t))
+ (add-hook 'post-command-hook #'erc-scroll-to-bottom nil t))
(defun erc-scroll-to-bottom ()
"Recenter WINDOW so that `point' is on the last line.
@@ -104,10 +104,10 @@ variable `erc-input-line-position'."
;;; Make read only
(define-erc-module readonly nil
"This mode causes all inserted text to be read-only."
- ((add-hook 'erc-insert-post-hook 'erc-make-read-only)
- (add-hook 'erc-send-post-hook 'erc-make-read-only))
- ((remove-hook 'erc-insert-post-hook 'erc-make-read-only)
- (remove-hook 'erc-send-post-hook 'erc-make-read-only)))
+ ((add-hook 'erc-insert-post-hook #'erc-make-read-only)
+ (add-hook 'erc-send-post-hook #'erc-make-read-only))
+ ((remove-hook 'erc-insert-post-hook #'erc-make-read-only)
+ (remove-hook 'erc-send-post-hook #'erc-make-read-only)))
(defun erc-make-read-only ()
"Make all the text in the current buffer read-only.
@@ -119,14 +119,14 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
;;; Move to prompt when typing text
(define-erc-module move-to-prompt nil
"This mode causes the point to be moved to the prompt when typing text."
- ((add-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
+ ((add-hook 'erc-mode-hook #'erc-move-to-prompt-setup)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
(erc-move-to-prompt-setup))))
- ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup)
+ ((remove-hook 'erc-mode-hook #'erc-move-to-prompt-setup)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer
- (remove-hook 'pre-command-hook 'erc-move-to-prompt t)))))
+ (remove-hook 'pre-command-hook #'erc-move-to-prompt t)))))
(defun erc-move-to-prompt ()
"Move the point to the ERC prompt if this is a self-inserting command."
@@ -138,15 +138,15 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
(defun erc-move-to-prompt-setup ()
"Initialize the move-to-prompt module for XEmacs."
- (add-hook 'pre-command-hook 'erc-move-to-prompt nil t))
+ (add-hook 'pre-command-hook #'erc-move-to-prompt nil t))
;;; Keep place in unvisited channels
(define-erc-module keep-place nil
"Leave point above un-viewed text in other channels."
- ((add-hook 'erc-insert-pre-hook 'erc-keep-place))
- ((remove-hook 'erc-insert-pre-hook 'erc-keep-place)))
+ ((add-hook 'erc-insert-pre-hook #'erc-keep-place))
+ ((remove-hook 'erc-insert-pre-hook #'erc-keep-place)))
-(defun erc-keep-place (ignored)
+(defun erc-keep-place (_ignored)
"Move point away from the last line in a non-selected ERC buffer."
(when (and (not (eq (window-buffer (selected-window))
(current-buffer)))
@@ -183,8 +183,8 @@ does not appear in the ERC buffer after the user presses ENTER.")
"This mode distinguishes non-commands.
Commands listed in `erc-insert-this' know how to display
themselves."
- ((add-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands))
- ((remove-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands)))
+ ((add-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands))
+ ((remove-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands)))
(defun erc-send-distinguish-noncommands (state)
"If STR is an ERC non-command, set `insertp' in STATE to nil."
@@ -211,20 +211,17 @@ highlighting effects. When this variable is non-nil, it can cause Emacs to run
slowly on systems lacking sufficient CPU speed. In chatty channels, or in an
emergency (message flood) it can be turned off to save processing time. See
`erc-toggle-interpret-controls'."
- :group 'erc-control-characters
:type '(choice (const :tag "Highlight control characters" t)
(const :tag "Remove control characters" remove)
(const :tag "Display raw control characters" nil)))
(defcustom erc-interpret-mirc-color nil
"If non-nil, ERC will interpret mIRC color codes."
- :group 'erc-control-characters
:type 'boolean)
(defcustom erc-beep-p nil
"Beep if C-g is in the server message.
The value `erc-interpret-controls-p' must also be t for this to work."
- :group 'erc-control-characters
:type 'boolean)
(defface erc-bold-face '((t :weight bold))
@@ -372,10 +369,10 @@ The value `erc-interpret-controls-p' must also be t for this to work."
(define-erc-module irccontrols nil
"This mode enables the interpretation of IRC control chars."
- ((add-hook 'erc-insert-modify-hook 'erc-controls-highlight)
- (add-hook 'erc-send-modify-hook 'erc-controls-highlight))
- ((remove-hook 'erc-insert-modify-hook 'erc-controls-highlight)
- (remove-hook 'erc-send-modify-hook 'erc-controls-highlight)))
+ ((add-hook 'erc-insert-modify-hook #'erc-controls-highlight)
+ (add-hook 'erc-send-modify-hook #'erc-controls-highlight))
+ ((remove-hook 'erc-insert-modify-hook #'erc-controls-highlight)
+ (remove-hook 'erc-send-modify-hook #'erc-controls-highlight)))
(defun erc-controls-interpret (str)
"Return a copy of STR after dealing with IRC control characters.
@@ -546,10 +543,10 @@ Else interpretation is turned off."
"This mode translates text-smileys such as :-) into pictures.
This requires the function `smiley-region', which is defined in
smiley.el, which is part of Gnus."
- ((add-hook 'erc-insert-modify-hook 'erc-smiley)
- (add-hook 'erc-send-modify-hook 'erc-smiley))
- ((remove-hook 'erc-insert-modify-hook 'erc-smiley)
- (remove-hook 'erc-send-modify-hook 'erc-smiley)))
+ ((add-hook 'erc-insert-modify-hook #'erc-smiley)
+ (add-hook 'erc-send-modify-hook #'erc-smiley))
+ ((remove-hook 'erc-insert-modify-hook #'erc-smiley)
+ (remove-hook 'erc-send-modify-hook #'erc-smiley)))
(defun erc-smiley ()
"Smilify a region.
@@ -560,8 +557,8 @@ This function should be used with `erc-insert-modify-hook'."
;; Unmorse
(define-erc-module unmorse nil
"This mode causes morse code in the current channel to be unmorsed."
- ((add-hook 'erc-insert-modify-hook 'erc-unmorse))
- ((remove-hook 'erc-insert-modify-hook 'erc-unmorse)))
+ ((add-hook 'erc-insert-modify-hook #'erc-unmorse))
+ ((remove-hook 'erc-insert-modify-hook #'erc-unmorse)))
(defun erc-unmorse ()
"Unmorse some text.
diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el
index 5a002ccae3e..31e59a6d3e4 100644
--- a/lisp/erc/erc-ibuffer.el
+++ b/lisp/erc/erc-ibuffer.el
@@ -1,4 +1,4 @@
-;;; erc-ibuffer.el --- ibuffer integration with ERC
+;;; erc-ibuffer.el --- ibuffer integration with ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
@@ -39,20 +39,16 @@
(defcustom erc-ibuffer-keyword-char ?k
"Char used to indicate a channel which had keyword traffic lately (hidden)."
- :group 'erc-ibuffer
:type 'character)
(defcustom erc-ibuffer-pal-char ?p
"Char used to indicate a channel which had pal traffic lately (hidden)."
- :group 'erc-ibuffer
:type 'character)
(defcustom erc-ibuffer-fool-char ?f
"Char used to indicate a channel which had fool traffic lately (hidden)."
- :group 'erc-ibuffer
:type 'character)
(defcustom erc-ibuffer-dangerous-host-char ?d
"Char used to indicate a channel which had dangerous-host traffic lately
\(hidden)."
- :group 'erc-ibuffer
:type 'character)
(define-ibuffer-filter erc-server
@@ -77,7 +73,7 @@
erc-track-mode)
(let ((entry (assq (current-buffer) erc-modified-channels-alist)))
(if entry
- (if (> (length entry) 1)
+ (if (cdr entry)
(cond ((eq 'pal (nth 1 entry))
(string erc-ibuffer-pal-char))
((eq 'fool (nth 1 entry))
@@ -153,7 +149,7 @@
(if (and (eq major-mode 'erc-mode)
(or (> (length erc-channel-modes) 0)
erc-channel-user-limit))
- (concat (apply 'concat
+ (concat (apply #'concat
"(+" erc-channel-modes)
(if erc-channel-user-limit
(format "l %d" erc-channel-user-limit)
@@ -181,6 +177,7 @@
(defvar erc-ibuffer-limit-map nil
"Prefix keymap to use for ERC related limiting.")
(define-prefix-command 'erc-ibuffer-limit-map)
+;; FIXME: Where is `ibuffer-limit-by-erc-server' defined?
(define-key 'erc-ibuffer-limit-map (kbd "s") 'ibuffer-limit-by-erc-server)
(define-key ibuffer-mode-map (kbd "/ \C-e") 'erc-ibuffer-limit-map)
diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el
index 5f1aab1784b..3821e298cda 100644
--- a/lisp/erc/erc-identd.el
+++ b/lisp/erc/erc-identd.el
@@ -1,10 +1,10 @@
-;;; erc-identd.el --- RFC1413 (identd authentication protocol) server
+;;; erc-identd.el --- RFC1413 (identd authentication protocol) server -*- lexical-binding: t; -*-
;; Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, processes
+;; Keywords: comm
;; This file is part of GNU Emacs.
@@ -50,7 +50,6 @@
`erc-identd-start'.
This can be either a string or a number."
- :group 'erc-identd
:type '(choice (const :tag "None" nil)
(integer :tag "Port number")
(string :tag "Port string")))
@@ -58,10 +57,10 @@ This can be either a string or a number."
;;;###autoload(autoload 'erc-identd-mode "erc-identd")
(define-erc-module identd nil
"This mode launches an identd server on port 8113."
- ((add-hook 'erc-connect-pre-hook 'erc-identd-quickstart)
- (add-hook 'erc-disconnected-hook 'erc-identd-stop))
- ((remove-hook 'erc-connect-pre-hook 'erc-identd-quickstart)
- (remove-hook 'erc-disconnected-hook 'erc-identd-stop)))
+ ((add-hook 'erc-connect-pre-hook #'erc-identd-quickstart)
+ (add-hook 'erc-disconnected-hook #'erc-identd-stop))
+ ((remove-hook 'erc-connect-pre-hook #'erc-identd-quickstart)
+ (remove-hook 'erc-disconnected-hook #'erc-identd-stop)))
(defun erc-identd-filter (proc string)
"This filter implements RFC1413 (identd authentication protocol)."
@@ -95,16 +94,16 @@ system."
:buffer nil
:host 'local :service port
:server t :noquery t :nowait t
- :filter 'erc-identd-filter))
+ :filter #'erc-identd-filter))
(set-process-query-on-exit-flag erc-identd-process nil))
-(defun erc-identd-quickstart (&rest ignored)
+(defun erc-identd-quickstart (&rest _ignored)
"Start the identd server with the default port.
The default port is specified by `erc-identd-port'."
(erc-identd-start))
;;;###autoload
-(defun erc-identd-stop (&rest ignore)
+(defun erc-identd-stop (&rest _ignore)
(interactive)
(when erc-identd-process
(delete-process erc-identd-process)
diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el
index 1a2d8e2755f..dcf6db7407a 100644
--- a/lisp/erc/erc-imenu.el
+++ b/lisp/erc/erc-imenu.el
@@ -1,4 +1,4 @@
-;;; erc-imenu.el -- Imenu support for ERC
+;;; erc-imenu.el --- Imenu support for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation,
;; Inc.
@@ -71,15 +71,13 @@ Don't rely on this function, read it first!"
(message-alist '())
(mode-change-alist '())
(topic-change-alist '())
- prev-pos)
+ ) ;; prev-pos
(goto-char (point-max))
- (imenu-progress-message prev-pos 0)
(while (if (bolp)
(> (forward-line -1)
-1)
(progn (forward-line 0)
t))
- (imenu-progress-message prev-pos nil t)
(save-match-data
(when (looking-at (concat (regexp-quote erc-notice-prefix)
"\\(.+\\)$"))
@@ -108,7 +106,8 @@ Don't rely on this function, read it first!"
"^\\(\\S-+\\) (.+) has set the topic for \\S-+: \\(.*\\)$"
notice-text)
(push (cons (concat (match-string 1 notice-text) ": "
- (match-string 2 notice-text)) pos)
+ (match-string 2 notice-text))
+ pos)
topic-change-alist)))))
(when (looking-at "<\\(\\S-+\\)> \\(.+\\)$")
(let ((from (match-string 1))
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index e6e50707830..2ad9c8bd941 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -1,10 +1,10 @@
-;;; erc-join.el --- autojoin channels on connect and reconnects
+;;; erc-join.el --- autojoin channels on connect and reconnects -*- lexical-binding: t; -*-
;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
;; Author: Alex Schroeder <alex@gnu.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: irc
+;; Keywords: comm, irc
;; URL: https://www.emacswiki.org/emacs/ErcAutoJoin
;; This file is part of GNU Emacs.
@@ -42,14 +42,14 @@
;;;###autoload(autoload 'erc-autojoin-mode "erc-join" nil t)
(define-erc-module autojoin nil
"Makes ERC autojoin on connects and reconnects."
- ((add-hook 'erc-after-connect 'erc-autojoin-channels)
- (add-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident)
- (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
- (add-hook 'erc-server-PART-functions 'erc-autojoin-remove))
- ((remove-hook 'erc-after-connect 'erc-autojoin-channels)
- (remove-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident)
- (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add)
- (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove)))
+ ((add-hook 'erc-after-connect #'erc-autojoin-channels)
+ (add-hook 'erc-nickserv-identified-hook #'erc-autojoin-after-ident)
+ (add-hook 'erc-server-JOIN-functions #'erc-autojoin-add)
+ (add-hook 'erc-server-PART-functions #'erc-autojoin-remove))
+ ((remove-hook 'erc-after-connect #'erc-autojoin-channels)
+ (remove-hook 'erc-nickserv-identified-hook #'erc-autojoin-after-ident)
+ (remove-hook 'erc-server-JOIN-functions #'erc-autojoin-add)
+ (remove-hook 'erc-server-PART-functions #'erc-autojoin-remove)))
(defcustom erc-autojoin-channels-alist nil
"Alist of channels to autojoin on IRC networks.
@@ -70,7 +70,6 @@ keeps track of what channels you are on, and will join them
again when you get disconnected. When you restart Emacs, however,
those changes are lost, and the customization you saved the last
time is used again."
- :group 'erc-autojoin
:type '(repeat (cons :tag "Server"
(regexp :tag "Name")
(repeat :tag "Channels"
@@ -82,7 +81,6 @@ If the value is `connect', autojoin immediately on connecting.
If the value is `ident', autojoin after successful NickServ
identification, or after `erc-autojoin-delay' seconds.
Any other value means the same as `connect'."
- :group 'erc-autojoin
:version "24.1"
:type '(choice (const :tag "On Connection" connect)
(const :tag "When Identified" ident)))
@@ -92,7 +90,6 @@ Any other value means the same as `connect'."
This only takes effect if `erc-autojoin-timing' is `ident'.
If NickServ identification occurs before this delay expires, ERC
autojoins immediately at that time."
- :group 'erc-autojoin
:version "24.1"
:type 'integer)
@@ -102,7 +99,6 @@ If non-nil, and a channel on the server a.b.c is joined, then
only b.c is used as the server for `erc-autojoin-channels-alist'.
This is important for networks that redirect you to other
servers, presumably in the same domain."
- :group 'erc-autojoin
:type 'boolean)
(defvar-local erc--autojoin-timer nil)
@@ -121,7 +117,7 @@ This is called from a timer set up by `erc-autojoin-channels'."
(erc-log "Delayed autojoin started (no ident success detected yet)")
(erc-autojoin-channels server nick))))
-(defun erc-autojoin-after-ident (network nick)
+(defun erc-autojoin-after-ident (_network _nick)
"Autojoin channels in `erc-autojoin-channels-alist'.
This function is run from `erc-nickserv-identified-hook'."
(if erc--autojoin-timer
@@ -149,7 +145,7 @@ This function is run from `erc-nickserv-identified-hook'."
(when (> erc-autojoin-delay 0)
(setq erc--autojoin-timer
(run-with-timer erc-autojoin-delay nil
- 'erc-autojoin-channels-delayed
+ #'erc-autojoin-channels-delayed
server nick (current-buffer))))
;; `erc-autojoin-timing' is `connect':
(let ((server (or erc-session-server erc-server-announced-name)))
diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el
index b86a8d0be2b..136131ca36b 100644
--- a/lisp/erc/erc-lang.el
+++ b/lisp/erc/erc-lang.el
@@ -1,4 +1,4 @@
-;;; erc-lang.el --- provide the LANG command to ERC
+;;; erc-lang.el --- provide the LANG command to ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
@@ -6,7 +6,7 @@
;; Maintainer: Amin Bandali <bandali@gnu.org>
;; Old-Version: 1.0.0
;; URL: https://www.emacswiki.org/emacs/ErcLang
-;; Keywords: comm languages processes
+;; Keywords: comm
;; This file is part of GNU Emacs.
diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el
index cf150e74ab5..31693a7b77a 100644
--- a/lisp/erc/erc-list.el
+++ b/lisp/erc/erc-list.el
@@ -59,13 +59,13 @@
;;;###autoload(autoload 'erc-list-mode "erc-list")
(define-erc-module list nil
"List channels nicely in a separate buffer."
- ((remove-hook 'erc-server-321-functions 'erc-server-321-message)
- (remove-hook 'erc-server-322-functions 'erc-server-322-message))
+ ((remove-hook 'erc-server-321-functions #'erc-server-321-message)
+ (remove-hook 'erc-server-322-functions #'erc-server-322-message))
((erc-with-all-buffers-of-server nil
#'erc-open-server-buffer-p
- (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t))
- (add-hook 'erc-server-321-functions 'erc-server-321-message t)
- (add-hook 'erc-server-322-functions 'erc-server-322-message t)))
+ (remove-hook 'erc-server-322-functions #'erc-list-handle-322 t))
+ (add-hook 'erc-server-321-functions #'erc-server-321-message t)
+ (add-hook 'erc-server-322-functions #'erc-server-322-message t)))
;; Format a record for display.
(defun erc-list-make-string (channel users topic)
@@ -126,17 +126,17 @@
(defvar erc-list-menu-mode-map
(let ((map (make-keymap)))
(set-keymap-parent map special-mode-map)
- (define-key map "k" 'erc-list-kill)
- (define-key map "j" 'erc-list-join)
- (define-key map "g" 'erc-list-revert)
- (define-key map "n" 'next-line)
- (define-key map "p" 'previous-line)
+ (define-key map "k" #'erc-list-kill)
+ (define-key map "j" #'erc-list-join)
+ (define-key map "g" #'erc-list-revert)
+ (define-key map "n" #'next-line)
+ (define-key map "p" #'previous-line)
map)
"Local keymap for `erc-list-mode' buffers.")
(defvar erc-list-menu-sort-button-map
(let ((map (make-sparse-keymap)))
- (define-key map [header-line mouse-1] 'erc-list-menu-sort-by-column)
+ (define-key map [header-line mouse-1] #'erc-list-menu-sort-by-column)
(define-key map [follow-link] 'mouse-face)
map)
"Local keymap for ERC list menu mode sorting buttons.")
@@ -181,12 +181,12 @@
(defun erc-list-install-322-handler (server-buffer)
(with-current-buffer server-buffer
;; Arrange for 322 responses to insert into our buffer.
- (add-hook 'erc-server-322-functions 'erc-list-handle-322 t t)
+ (add-hook 'erc-server-322-functions #'erc-list-handle-322 t t)
;; Arrange for 323 (end of list) to end this.
(erc-once-with-server-event
323
(lambda (_proc _parsed)
- (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t)))
+ (remove-hook 'erc-server-322-functions #'erc-list-handle-322 t)))
;; Find the list buffer, empty it, and display it.
(setq-local erc-list-buffer
(get-buffer-create (concat "*Channels of "
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 4540ec6808f..ddd00afd73b 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -1,11 +1,11 @@
-;;; erc-log.el --- Logging facilities for ERC.
+;;; erc-log.el --- Logging facilities for ERC. -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
;; Author: Lawrence Mitchell <wence@gmx.li>
;; Maintainer: Amin Bandali <bandali@gnu.org>
;; URL: https://www.emacswiki.org/emacs/ErcLogging
-;; Keywords: IRC, chat, client, Internet, logging
+;; Keywords: comm, IRC, chat, client, Internet, logging
;; Created 2003-04-26
;; Logging code taken from erc.el and modified to use markers.
@@ -112,7 +112,6 @@ SERVER and PORT are the parameters that were used to connect to BUFFERs
If you want to write logs into different directories, make a
custom function which returns the directory part and set
`erc-log-channels-directory' to its name."
- :group 'erc-log
:type '(choice (const :tag "#channel!nick@server:port.txt"
erc-generate-log-file-name-long)
(const :tag "#channel!nick@network.txt"
@@ -124,7 +123,6 @@ custom function which returns the directory part and set
(defcustom erc-truncate-buffer-on-save nil
"Erase the contents of any ERC (channel, query, server) buffer when it is saved."
- :group 'erc-log
:type 'boolean)
(defcustom erc-enable-logging t
@@ -138,7 +136,6 @@ This variable is buffer local. Setting it via \\[customize] sets the
default value.
Log files are stored in `erc-log-channels-directory'."
- :group 'erc-log
:type '(choice boolean
function))
(make-variable-buffer-local 'erc-enable-logging)
@@ -153,14 +150,12 @@ If this is the name of a function, the function will be called
with the buffer, target, nick, server, and port arguments. See
`erc-generate-log-file-name-function' for a description of these
arguments."
- :group 'erc-log
:type '(choice directory
(function "Function")
(const :tag "Disable logging" nil)))
(defcustom erc-log-insert-log-on-open nil
"Insert log file contents into the buffer if a log file exists."
- :group 'erc-log
:type 'boolean)
(defcustom erc-save-buffer-on-part t
@@ -168,7 +163,6 @@ arguments."
If you set this to nil, you may want to enable both
`erc-log-write-after-send' and `erc-log-write-after-insert'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-save-queries-on-quit t
@@ -176,7 +170,6 @@ If you set this to nil, you may want to enable both
If you set this to nil, you may want to enable both
`erc-log-write-after-send' and `erc-log-write-after-insert'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-log-write-after-send nil
@@ -184,7 +177,6 @@ If you set this to nil, you may want to enable both
If you set this to nil, you may want to enable both
`erc-save-buffer-on-part' and `erc-save-queries-on-quit'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-log-write-after-insert nil
@@ -193,7 +185,6 @@ logged ERC buffer.
If you set this to nil, you may want to enable both
`erc-save-buffer-on-part' and `erc-save-queries-on-quit'."
- :group 'erc-log
:type 'boolean)
(defcustom erc-log-file-coding-system 'emacs-mule
@@ -201,15 +192,13 @@ If you set this to nil, you may want to enable both
This should ideally, be a \"catch-all\" coding system, like
`emacs-mule', or `iso-2022-7bit'."
- :type 'coding-system
- :group 'erc-log)
+ :type 'coding-system)
(defcustom erc-log-filter-function nil
"If non-nil, pass text through the given function before writing it to
a log file.
The function should take one argument, which is the text to filter."
- :group 'erc-log
:type '(choice (function "Function")
(const :tag "No filtering" nil)))
@@ -232,31 +221,31 @@ also be a predicate function. To only log when you are not set away, use:
(null (erc-away-time)))))"
;; enable
((when erc-log-write-after-insert
- (add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs))
+ (add-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs))
(when erc-log-write-after-send
- (add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs))
- (add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
- (add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
- (add-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
- (add-hook 'erc-quit-hook 'erc-conditional-save-queries)
- (add-hook 'erc-part-hook 'erc-conditional-save-buffer)
+ (add-hook 'erc-send-post-hook #'erc-save-buffer-in-logs))
+ (add-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs)
+ (add-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs)
+ (add-hook 'kill-emacs-hook #'erc-log-save-all-buffers)
+ (add-hook 'erc-quit-hook #'erc-conditional-save-queries)
+ (add-hook 'erc-part-hook #'erc-conditional-save-buffer)
;; append, so that 'erc-initialize-log-marker runs first
- (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)
+ (add-hook 'erc-connect-pre-hook #'erc-log-setup-logging 'append)
(dolist (buffer (erc-buffer-list))
(erc-log-setup-logging buffer)))
;; disable
- ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)
- (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)
- (remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs)
- (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs)
- (remove-hook 'kill-emacs-hook 'erc-log-save-all-buffers)
- (remove-hook 'erc-quit-hook 'erc-conditional-save-queries)
- (remove-hook 'erc-part-hook 'erc-conditional-save-buffer)
- (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging)
+ ((remove-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'erc-send-post-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs)
+ (remove-hook 'kill-emacs-hook #'erc-log-save-all-buffers)
+ (remove-hook 'erc-quit-hook #'erc-conditional-save-queries)
+ (remove-hook 'erc-part-hook #'erc-conditional-save-buffer)
+ (remove-hook 'erc-connect-pre-hook #'erc-log-setup-logging)
(dolist (buffer (erc-buffer-list))
(erc-log-disable-logging buffer))))
-(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs)
+(define-key erc-mode-map "\C-c\C-l" #'erc-save-buffer-in-logs)
;;; functionality referenced from erc.el
(defun erc-log-setup-logging (buffer)
@@ -357,13 +346,13 @@ The result is converted to lowercase, as IRC is case-insensitive."
buffer target nick server port)
erc-log-channels-directory)))))
-(defun erc-generate-log-file-name-with-date (buffer &rest ignore)
+(defun erc-generate-log-file-name-with-date (buffer &rest _ignore)
"This function computes a short log file name.
The name of the log file is composed of BUFFER and the current date.
This function is a possible value for `erc-generate-log-file-name-function'."
(concat (buffer-name buffer) "-" (format-time-string "%Y-%m-%d") ".txt"))
-(defun erc-generate-log-file-name-short (buffer &rest ignore)
+(defun erc-generate-log-file-name-short (buffer &rest _ignore)
"This function computes a short log file name.
In fact, it only uses the buffer name of the BUFFER argument, so
you can affect that using `rename-buffer' and the-like. This
@@ -371,7 +360,7 @@ function is a possible value for
`erc-generate-log-file-name-function'."
(concat (buffer-name buffer) ".txt"))
-(defun erc-generate-log-file-name-long (buffer target nick server port)
+(defun erc-generate-log-file-name-long (_buffer target nick server port)
"Generates a log-file name in the way ERC always did it.
This results in a file name of the form #channel!nick@server:port.txt.
This function is a possible value for `erc-generate-log-file-name-function'."
@@ -385,7 +374,7 @@ This function is a possible value for `erc-generate-log-file-name-function'."
(declare-function erc-network-name "erc-networks" ())
-(defun erc-generate-log-file-name-network (buffer target nick server port)
+(defun erc-generate-log-file-name-network (buffer target nick server _port)
"Generates a log-file name using the network name rather than server name.
This results in a file name of the form #channel!nick@network.txt.
This function is a possible value for `erc-generate-log-file-name-function'."
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 153742a6706..43fbca3e666 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -1,10 +1,10 @@
-;;; erc-match.el --- Highlight messages matching certain regexps
+;;; erc-match.el --- Highlight messages matching certain regexps -*- lexical-binding: t; -*-
;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
;; Author: Andreas Fuchs <asf@void.at>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, faces
+;; Keywords: comm
;; URL: https://www.emacswiki.org/emacs/ErcMatch
;; This file is part of GNU Emacs.
@@ -52,19 +52,17 @@ they are hidden or highlighted. This is controlled via the variables
`erc-current-nick-highlight-type'. For all these highlighting types,
you can decide whether the entire message or only the sending nick is
highlighted."
- ((add-hook 'erc-insert-modify-hook 'erc-match-message 'append))
- ((remove-hook 'erc-insert-modify-hook 'erc-match-message)))
+ ((add-hook 'erc-insert-modify-hook #'erc-match-message 'append))
+ ((remove-hook 'erc-insert-modify-hook #'erc-match-message)))
;; Remaining customizations
(defcustom erc-pals nil
"List of pals on IRC."
- :group 'erc-match
:type '(repeat regexp))
(defcustom erc-fools nil
"List of fools on IRC."
- :group 'erc-match
:type '(repeat regexp))
(defcustom erc-keywords nil
@@ -72,14 +70,12 @@ highlighted."
Each entry in the list is either a regexp, or a cons cell with the
regexp in the car and the face to use in the cdr. If no face is
specified, `erc-keyword-face' is used."
- :group 'erc-match
:type '(repeat (choice regexp
(list regexp face))))
(defcustom erc-dangerous-hosts nil
"List of regexps for hosts to highlight.
Useful to mark nicks from dangerous hosts."
- :group 'erc-match
:type '(repeat regexp))
(defcustom erc-current-nick-highlight-type 'keyword
@@ -99,7 +95,6 @@ The following values are allowed:
current nickname occurs
Any other value disables highlighting of current nickname altogether."
- :group 'erc-match
:type '(choice (const nil)
(const nick)
(const keyword)
@@ -120,7 +115,6 @@ The following values are allowed:
from pal
Any other value disables pal highlighting altogether."
- :group 'erc-match
:type '(choice (const nil)
(const nick)
(const message)
@@ -139,7 +133,6 @@ The following values are allowed:
from fool
Any other value disables fool highlighting altogether."
- :group 'erc-match
:type '(choice (const nil)
(const nick)
(const message)
@@ -157,7 +150,6 @@ The following values are allowed:
containing keyword
Any other value disables keyword highlighting altogether."
- :group 'erc-match
:type '(choice (const nil)
(const keyword)
(const message)
@@ -175,7 +167,6 @@ The following values are allowed:
from dangerous-host
Any other value disables dangerous-host highlighting altogether."
- :group 'erc-match
:type '(choice (const nil)
(const nick)
(const message)
@@ -193,7 +184,6 @@ Valid match type keys are:
The other element of each cons pair in this list is the buffer name to
use for the logged message."
- :group 'erc-match
:type '(repeat (cons (choice :tag "Key"
(const keyword)
(const pal)
@@ -207,7 +197,6 @@ use for the logged message."
When nil, don't log any matched messages.
When t, log messages.
When `away', log messages only when away."
- :group 'erc-match
:type '(choice (const nil)
(const away)
(const t)))
@@ -222,14 +211,12 @@ will be formatted. The various format specs are:
%u Nickname!user@host of sender
%c Channel in which this was received
%m Message"
- :group 'erc-match
:type 'string)
(defcustom erc-beep-match-types '(current-nick)
"Types of matches to beep for when a match occurs.
The function `erc-beep-on-match' needs to be added to `erc-text-matched-hook'
for beeping to work."
- :group 'erc-match
:type '(choice (repeat :tag "Beep on match" (choice
(const current-nick)
(const keyword)
@@ -244,14 +231,12 @@ Functions in this hook are passed as arguments:
\(match-type nick!user@host message) where MATCH-TYPE is a symbol of:
current-nick, keyword, pal, dangerous-host, fool."
:options '(erc-log-matches erc-hide-fools erc-beep-on-match)
- :group 'erc-match
:type 'hook)
(defcustom erc-match-exclude-server-buffer nil
"If true, don't perform match on the server buffer; this is
useful for excluding all the things like MOTDs from the server
and other miscellaneous functions."
- :group 'erc-match
:version "24.3"
:type 'boolean)
@@ -390,7 +375,7 @@ car is the string."
(interactive)
(erc-remove-entry-from-list 'erc-dangerous-hosts "Delete dangerous-host: "))
-(defun erc-match-current-nick-p (nickuserhost msg)
+(defun erc-match-current-nick-p (_nickuserhost msg)
"Check whether the current nickname is in MSG.
NICKUSERHOST will be ignored."
(with-syntax-table erc-match-syntax-table
@@ -400,7 +385,7 @@ NICKUSERHOST will be ignored."
"\\b")
msg))))
-(defun erc-match-pal-p (nickuserhost msg)
+(defun erc-match-pal-p (nickuserhost _msg)
"Check whether NICKUSERHOST is in `erc-pals'.
MSG will be ignored."
(and nickuserhost
@@ -412,7 +397,7 @@ MSG will be ignored."
(or (erc-list-match erc-fools nickuserhost)
(erc-match-directed-at-fool-p msg))))
-(defun erc-match-keyword-p (nickuserhost msg)
+(defun erc-match-keyword-p (_nickuserhost msg)
"Check whether any keyword of `erc-keywords' matches for MSG.
NICKUSERHOST will be ignored."
(and msg
@@ -424,7 +409,7 @@ NICKUSERHOST will be ignored."
erc-keywords)
msg)))
-(defun erc-match-dangerous-host-p (nickuserhost msg)
+(defun erc-match-dangerous-host-p (nickuserhost _msg)
"Check whether NICKUSERHOST is in `erc-dangerous-hosts'.
MSG will be ignored."
(and nickuserhost
@@ -457,7 +442,7 @@ Use this defun with `erc-insert-modify-hook'."
(nickuserhost (erc-get-parsed-vector-nick vector))
(nickname (and nickuserhost
(nth 0 (erc-parse-user nickuserhost))))
- (old-pt (point))
+ ;; (old-pt (point))
(nick-beg (and nickname
(re-search-forward (regexp-quote nickname)
(point-max) t)
@@ -484,11 +469,12 @@ Use this defun with `erc-insert-modify-hook'."
(goto-char (point-min))
(let* ((match-prefix (concat "erc-" match-type))
(match-pred (intern (concat "erc-match-" match-type "-p")))
- (match-htype (eval (intern (concat match-prefix
- "-highlight-type"))))
+ (match-htype (symbol-value (intern (concat match-prefix
+ "-highlight-type"))))
(match-regex (if (string= match-type "current-nick")
(regexp-quote (erc-current-nick))
- (eval (intern (concat match-prefix "s")))))
+ (symbol-value
+ (intern (concat match-prefix "s")))))
(match-face (intern (concat match-prefix "-face"))))
(when (funcall match-pred nickuserhost message)
(cond
@@ -601,7 +587,7 @@ See `erc-log-match-format'."
(kill-buffer buffer)))))
buffer)))
-(defun erc-log-matches-come-back (proc parsed)
+(defun erc-log-matches-come-back (_proc _parsed)
"Display a notice that messages were logged while away."
(when (and (erc-away-time)
(eq erc-log-matches-flag 'away))
@@ -629,7 +615,7 @@ See `erc-log-match-format'."
nil)
; This handler must be run _before_ erc-process-away is.
-(add-hook 'erc-server-305-functions 'erc-log-matches-come-back nil)
+(add-hook 'erc-server-305-functions #'erc-log-matches-come-back nil)
(defun erc-go-to-log-matches-buffer ()
"Interactively open an erc-log-matches buffer."
@@ -642,9 +628,9 @@ See `erc-log-match-format'."
(get-buffer (car buffer-cons))))))
(switch-to-buffer buffer-name)))
-(define-key erc-mode-map "\C-c\C-k" 'erc-go-to-log-matches-buffer)
+(define-key erc-mode-map "\C-c\C-k" #'erc-go-to-log-matches-buffer)
-(defun erc-hide-fools (match-type nickuserhost message)
+(defun erc-hide-fools (match-type _nickuserhost _message)
"Hide foolish comments.
This function should be called from `erc-text-matched-hook'."
(when (eq match-type 'fool)
@@ -652,7 +638,7 @@ This function should be called from `erc-text-matched-hook'."
'(invisible intangible)
(current-buffer))))
-(defun erc-beep-on-match (match-type nickuserhost message)
+(defun erc-beep-on-match (match-type _nickuserhost _message)
"Beep when text matches.
This function is meant to be called from `erc-text-matched-hook'."
(when (member match-type erc-beep-match-types)
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index 4c092c834bc..1bee6ff2a67 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -1,10 +1,10 @@
-;; erc-menu.el -- Menu-bar definitions for ERC
+;;; erc-menu.el --- Menu-bar definitions for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, processes, menu
+;; Keywords: comm, menu
;; This file is part of GNU Emacs.
@@ -28,7 +28,6 @@
;;; Code:
(require 'erc)
-(require 'easymenu)
(defgroup erc-menu nil
"ERC menu support."
@@ -111,11 +110,11 @@ ERC menu yet.")
(define-erc-module menu nil
"Enable a menu in ERC buffers."
((unless erc-menu-defined
- ;; make sure the menu only gets defined once, since Emacs 22
+ ;; make sure the menu only gets defined once, since Emacs
;; activates it immediately
(easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
(setq erc-menu-defined t)))
- (;; `easy-menu-remove' is a no-op in Emacs 22
+ (;; `easy-menu-remove' is a no-op in Emacs
(message "You might have to restart Emacs to remove the ERC menu")))
(defun erc-menu-add ()
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index 37fc4cf16c1..9cfb947003c 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -1,4 +1,4 @@
-;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits
+;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits -*- lexical-binding: t; -*-
;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
@@ -42,30 +42,27 @@ netsplits, so that it can filter the JOIN messages on a netjoin too."
(define-erc-module netsplit nil
"This mode hides quit/join messages if a netsplit occurs."
((erc-netsplit-install-message-catalogs)
- (add-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN)
- (add-hook 'erc-server-MODE-functions 'erc-netsplit-MODE)
- (add-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT)
- (add-hook 'erc-timer-hook 'erc-netsplit-timer))
- ((remove-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN)
- (remove-hook 'erc-server-MODE-functions 'erc-netsplit-MODE)
- (remove-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT)
- (remove-hook 'erc-timer-hook 'erc-netsplit-timer)))
+ (add-hook 'erc-server-JOIN-functions #'erc-netsplit-JOIN)
+ (add-hook 'erc-server-MODE-functions #'erc-netsplit-MODE)
+ (add-hook 'erc-server-QUIT-functions #'erc-netsplit-QUIT)
+ (add-hook 'erc-timer-hook #'erc-netsplit-timer))
+ ((remove-hook 'erc-server-JOIN-functions #'erc-netsplit-JOIN)
+ (remove-hook 'erc-server-MODE-functions #'erc-netsplit-MODE)
+ (remove-hook 'erc-server-QUIT-functions #'erc-netsplit-QUIT)
+ (remove-hook 'erc-timer-hook #'erc-netsplit-timer)))
(defcustom erc-netsplit-show-server-mode-changes-flag nil
"Set to t to enable display of server mode changes."
- :group 'erc-netsplit
:type 'boolean)
(defcustom erc-netsplit-debug nil
"If non-nil, debug messages will be shown in the sever buffer."
- :group 'erc-netsplit
:type 'boolean)
(defcustom erc-netsplit-regexp
"^[^ @!\"\n]+\\.[^ @!\n]+ [^ @!\n]+\\.[^ @!\"\n]+$"
"This regular expression should match quit reasons produced
by netsplits."
- :group 'erc-netsplit
:type 'regexp)
(defcustom erc-netsplit-hook nil
@@ -190,13 +187,13 @@ join from that split has been detected or not.")
(erc-display-message
nil 'notice 'active
'netsplit-wholeft ?s (car elt)
- ?n (mapconcat 'erc-extract-nick (nthcdr 3 elt) " ")
+ ?n (mapconcat #'erc-extract-nick (nthcdr 3 elt) " ")
?t (if (nth 2 elt)
"(joining)"
"")))))
t)
-(defalias 'erc-cmd-WL 'erc-cmd-WHOLEFT)
+(defalias 'erc-cmd-WL #'erc-cmd-WHOLEFT)
(provide 'erc-netsplit)
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index 9926255e3aa..54502b2df05 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -1,4 +1,4 @@
-;;; erc-networks.el --- IRC networks
+;;; erc-networks.el --- IRC networks -*- lexical-binding: t; -*-
;; Copyright (C) 2002, 2004-2021 Free Software Foundation, Inc.
@@ -290,6 +290,13 @@
("LagNet: Random server" LagNet "irc.lagnet.org.za" 6667)
("LagNet: AF, ZA, Cape Town" LagNet "reaper.lagnet.org.za" 6667)
("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667)
+ ("Libera.Chat: Random server" Libera.Chat "irc.libera.chat" 6667)
+ ("Libera.Chat: Random Europe server" Libera.Chat "irc.eu.libera.chat" 6667)
+ ("Libera.Chat: Random US & Canada server" Libera.Chat "irc.us.libera.chat" 6667)
+ ("Libera.Chat: Random Australia & New Zealand server" Libera.Chat "irc.au.libera.chat" 6667)
+ ("Libera.Chat: Random East Asia server" Libera.Chat "irc.ea.libera.chat" 6667)
+ ("Libera.Chat: IPv4 only server" Libera.Chat "irc.ipv4.libera.chat" 6667)
+ ("Libera.Chat: IPv6 only server" Libera.Chat "irc.ipv6.libera.chat" 6667)
("Librenet: Random server" Librenet "irc.librenet.net" 6667)
("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669)))
("LinuxChix: Random server" LinuxChix "irc.linuxchix.org" 6667)
@@ -443,7 +450,6 @@ NET is a symbol indicating to which network from `erc-networks-alist'
this server corresponds,
HOST is the servers hostname and
PORTS is either a number, a list of numbers, or a list of port ranges."
- :group 'erc-networks
:type '(alist :key-type (string :tag "Name")
:value-type
(group symbol (string :tag "Hostname")
@@ -595,6 +601,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges."
(Krono "krono.net")
(Krushnet "krushnet.org")
(LagNet "lagnet.org.za")
+ (Libera.Chat "libera.chat")
(Librenet "librenet.net")
(LinkNet "link-net.org")
(LinuxChix "cats\\.meow\\.at\\|linuxchix\\.org")
@@ -714,7 +721,6 @@ MATCHER is used to find a corresponding network to a server while
connected to it. If it is regexp, it's used to match against
`erc-server-announced-name'. It can also be a function (predicate).
Then it is executed with the server buffer as current-buffer."
- :group 'erc-networks
:type '(repeat
(list :tag "Network"
(symbol :tag "Network name")
@@ -762,25 +768,25 @@ Return the name of this server's network as a symbol."
"Return the name of the current network as a string."
(erc-with-server-buffer (symbol-name erc-network)))
-(defun erc-set-network-name (proc parsed)
+(defun erc-set-network-name (_proc _parsed)
"Set `erc-network' to the value returned by `erc-determine-network'."
(unless erc-server-connected
(setq erc-network (erc-determine-network)))
nil)
-(defun erc-unset-network-name (nick ip reason)
+(defun erc-unset-network-name (_nick _ip _reason)
"Set `erc-network' to nil."
(setq erc-network nil)
nil)
(define-erc-module networks nil
"Provide data about IRC networks."
- ((add-hook 'erc-server-375-functions 'erc-set-network-name)
- (add-hook 'erc-server-422-functions 'erc-set-network-name)
- (add-hook 'erc-disconnected-hook 'erc-unset-network-name))
- ((remove-hook 'erc-server-375-functions 'erc-set-network-name)
- (remove-hook 'erc-server-422-functions 'erc-set-network-name)
- (remove-hook 'erc-disconnected-hook 'erc-unset-network-name)))
+ ((add-hook 'erc-server-375-functions #'erc-set-network-name)
+ (add-hook 'erc-server-422-functions #'erc-set-network-name)
+ (add-hook 'erc-disconnected-hook #'erc-unset-network-name))
+ ((remove-hook 'erc-server-375-functions #'erc-set-network-name)
+ (remove-hook 'erc-server-422-functions #'erc-set-network-name)
+ (remove-hook 'erc-disconnected-hook #'erc-unset-network-name)))
(defun erc-ports-list (ports)
"Return a list of PORTS.
@@ -835,8 +841,8 @@ As an example:
;; think it is worth the effort.
(defvar erc-settings
- '((pals freenode ("kensanata" "shapr" "anti\\(fuchs\\|gone\\)"))
- (format-nick-function (freenode "#emacs") erc-format-@nick))
+ '((pals Libera.Chat ("kensanata" "shapr" "anti\\(fuchs\\|gone\\)"))
+ (format-nick-function (Libera.Chat "#emacs") erc-format-@nick))
"Experimental: Alist of configuration options.
The format is (VARNAME SCOPE VALUE) where
VARNAME is a symbol identifying the configuration option,
@@ -865,7 +871,7 @@ VALUE is the options value.")
items nil)))))
val))
-(erc-get 'pals 'freenode)
+(erc-get 'pals 'Libera.Chat)
(provide 'erc-networks)
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index e133e05a7d3..1ed056c277d 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -42,20 +42,17 @@
(defcustom erc-notify-list nil
"List of nicknames you want to be notified about online/offline
status change."
- :group 'erc-notify
:type '(repeat string))
(defcustom erc-notify-interval 60
"Time interval (in seconds) for checking online status of notified
people."
- :group 'erc-notify
:type 'integer)
(defcustom erc-notify-signon-hook nil
"Hook run after someone on `erc-notify-list' has signed on.
Two arguments are passed to the function, SERVER and NICK, both
strings."
- :group 'erc-notify
:type 'hook
:options '(erc-notify-signon))
@@ -63,7 +60,6 @@ strings."
"Hook run after someone on `erc-notify-list' has signed off.
Two arguments are passed to the function, SERVER and NICK, both
strings."
- :group 'erc-notify
:type 'hook
:options '(erc-notify-signoff))
@@ -95,14 +91,14 @@ strings."
(define-erc-module notify nil
"Periodically check for the online status of certain users and report
changes."
- ((add-hook 'erc-timer-hook 'erc-notify-timer)
- (add-hook 'erc-server-JOIN-functions 'erc-notify-JOIN)
- (add-hook 'erc-server-NICK-functions 'erc-notify-NICK)
- (add-hook 'erc-server-QUIT-functions 'erc-notify-QUIT))
- ((remove-hook 'erc-timer-hook 'erc-notify-timer)
- (remove-hook 'erc-server-JOIN-functions 'erc-notify-JOIN)
- (remove-hook 'erc-server-NICK-functions 'erc-notify-NICK)
- (remove-hook 'erc-server-QUIT-functions 'erc-notify-QUIT)))
+ ((add-hook 'erc-timer-hook #'erc-notify-timer)
+ (add-hook 'erc-server-JOIN-functions #'erc-notify-JOIN)
+ (add-hook 'erc-server-NICK-functions #'erc-notify-NICK)
+ (add-hook 'erc-server-QUIT-functions #'erc-notify-QUIT))
+ ((remove-hook 'erc-timer-hook #'erc-notify-timer)
+ (remove-hook 'erc-server-JOIN-functions #'erc-notify-JOIN)
+ (remove-hook 'erc-server-NICK-functions #'erc-notify-NICK)
+ (remove-hook 'erc-server-QUIT-functions #'erc-notify-QUIT)))
;;;; Timer handler
@@ -137,7 +133,7 @@ changes."
(setq erc-last-ison ison-list)
t)))
(erc-server-send
- (concat "ISON " (mapconcat 'identity erc-notify-list " ")))
+ (concat "ISON " (mapconcat #'identity erc-notify-list " ")))
(setq erc-last-ison-time now)))
(defun erc-notify-JOIN (proc parsed)
@@ -211,7 +207,7 @@ with args, toggle notify status of people."
'notify_current ?l ison))))
((string= (car args) "-l")
(erc-display-message nil 'notice 'active
- 'notify_list ?l (mapconcat 'identity erc-notify-list
+ 'notify_list ?l (mapconcat #'identity erc-notify-list
" ")))
(t
(while args
@@ -231,7 +227,7 @@ with args, toggle notify status of people."
(setq args (cdr args)))
(erc-display-message
nil 'notice 'active
- 'notify_list ?l (mapconcat 'identity erc-notify-list " "))))
+ 'notify_list ?l (mapconcat #'identity erc-notify-list " "))))
t)
(autoload 'pcomplete-erc-all-nicks "erc-pcomplete")
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index 0cb60f5efa0..457e8cd4684 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -1,4 +1,4 @@
-;; erc-page.el - CTCP PAGE support for ERC
+;;; erc-page.el --- CTCP PAGE support for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc.
@@ -30,6 +30,10 @@
(require 'erc)
+(defgroup erc-page nil
+ "React to CTCP PAGE messages."
+ :group 'erc)
+
;;;###autoload(autoload 'erc-page-mode "erc-page")
(define-erc-module page ctcp-page
"Process CTCP PAGE requests from IRC."
@@ -37,10 +41,6 @@
(erc-define-catalog-entry 'english 'CTCP-PAGE "Page from %n (%u@%h): %m")
-(defgroup erc-page nil
- "React to CTCP PAGE messages."
- :group 'erc)
-
(defcustom erc-page-function nil
"A function to process a \"page\" request.
If nil, this prints the page message in the minibuffer and calls
@@ -53,20 +53,18 @@ Example for your init file:
(lambda (sender msg)
(play-sound-file \"/home/alex/elisp/erc/sounds/ni.wav\")
(message \"IRC Page from %s: %s\" sender msg)))"
- :group 'erc-page
:type '(choice (const nil)
(function)))
-(defcustom erc-ctcp-query-PAGE-hook '(erc-ctcp-query-PAGE)
+(defcustom erc-ctcp-query-PAGE-hook (list #'erc-ctcp-query-PAGE)
"List of functions to be called when a CTCP PAGE is received.
This is called from `erc-process-ctcp-query'. The functions are called
with six arguments: PROC NICK LOGIN HOST TO MSG. Note that you can
also set `erc-page-function' to a function, which only gets two arguments,
SENDER and MSG, so that might be easier to use."
- :group 'erc-page
:type '(repeat function))
-(defun erc-ctcp-query-PAGE (proc nick login host to msg)
+(defun erc-ctcp-query-PAGE (_proc nick login host _to msg)
"Deal with an CTCP PAGE query, if `erc-page-mode' is non-nil.
This will call `erc-page-function', if defined, or it will just print
a message and `beep'. In addition to that, the page message is also
@@ -91,7 +89,7 @@ inserted into the server buffer."
nil 'notice nil text)))
nil)
-(defun erc-cmd-PAGE (line &optional force)
+(defun erc-cmd-PAGE (line &optional _force)
"Send a CTCP page to the user given as the first word in LINE.
The rest of LINE is the message to send. Note that you will only
receive pages if `erc-page-mode' is on."
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
index ab4c7c580c6..8ea37c7f290 100644
--- a/lisp/erc/erc-pcomplete.el
+++ b/lisp/erc/erc-pcomplete.el
@@ -1,10 +1,10 @@
-;;; erc-pcomplete.el --- Provides programmable completion for ERC
+;;; erc-pcomplete.el --- Provides programmable completion for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc.
;; Author: Sacha Chua <sacha@free.net.ph>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, convenience
+;; Keywords: comm
;; URL: https://www.emacswiki.org/emacs/ErcCompletion
;; This file is part of GNU Emacs.
@@ -50,23 +50,21 @@
(defcustom erc-pcomplete-nick-postfix ":"
"When `pcomplete' is used in the first word after the prompt,
add this string to nicks completed."
- :group 'erc-pcomplete
:type 'string)
(defcustom erc-pcomplete-order-nickname-completions t
"If t, channel nickname completions will be ordered such that
the most recent speakers are listed first."
- :group 'erc-pcomplete
:type 'boolean)
;;;###autoload(autoload 'erc-completion-mode "erc-pcomplete" nil t)
(define-erc-module pcomplete Completion
"In ERC Completion mode, the TAB key does completion whenever possible."
- ((add-hook 'erc-mode-hook 'pcomplete-erc-setup)
- (add-hook 'erc-complete-functions 'erc-pcompletions-at-point)
+ ((add-hook 'erc-mode-hook #'pcomplete-erc-setup)
+ (add-hook 'erc-complete-functions #'erc-pcompletions-at-point)
(erc-buffer-list #'pcomplete-erc-setup))
- ((remove-hook 'erc-mode-hook 'pcomplete-erc-setup)
- (remove-hook 'erc-complete-functions 'erc-pcompletions-at-point)))
+ ((remove-hook 'erc-mode-hook #'pcomplete-erc-setup)
+ (remove-hook 'erc-complete-functions #'erc-pcompletions-at-point)))
(defun erc-pcompletions-at-point ()
"ERC completion data from pcomplete.
@@ -89,7 +87,7 @@ for use on `completion-at-point-function'."
(defun pcomplete-erc-setup ()
"Setup `erc-mode' to use pcomplete."
- (setq-local pcomplete-ignore-case t)
+ (setq-local completion-ignore-case t)
(setq-local pcomplete-use-paring nil)
(setq-local pcomplete-parse-arguments-function
#'pcomplete-erc-parse-arguments)
@@ -154,7 +152,7 @@ for use on `completion-at-point-function'."
(defun pcomplete/erc-mode/NAMES ()
(while (pcomplete-here (pcomplete-erc-channels))))
-(defalias 'pcomplete/erc-mode/NOTICE 'pcomplete/erc-mode/MSG)
+(defalias 'pcomplete/erc-mode/NOTICE #'pcomplete/erc-mode/MSG)
(defun pcomplete/erc-mode/OP ()
(while (pcomplete-here (pcomplete-erc-not-ops))))
@@ -162,7 +160,7 @@ for use on `completion-at-point-function'."
(defun pcomplete/erc-mode/PART ()
(pcomplete-here (pcomplete-erc-channels)))
-(defalias 'pcomplete/erc-mode/LEAVE 'pcomplete/erc-mode/PART)
+(defalias 'pcomplete/erc-mode/LEAVE #'pcomplete/erc-mode/PART)
(defun pcomplete/erc-mode/QUERY ()
(pcomplete-here (append (pcomplete-erc-all-nicks)
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index 91fafbb6308..3f69c4cb9cc 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -1,4 +1,4 @@
-;; erc-replace.el -- wash and massage messages inserted into the buffer
+;;; erc-replace.el --- wash and massage messages inserted into the buffer -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation,
;; Inc.
@@ -6,7 +6,7 @@
;; Author: Andreas Fuchs <asf@void.at>
;; Maintainer: Amin Bandali <bandali@gnu.org>
;; URL: https://www.emacswiki.org/emacs/ErcReplace
-;; Keywords: IRC, client, Internet
+;; Keywords: comm, IRC, client, Internet
;; This file is part of GNU Emacs.
@@ -49,7 +49,6 @@ expression or a variable, or any sexp, TO can be a string or a
function to call, or any sexp. If a function, it will be called with
one argument, the string to be replaced, and it should return a
replacement string."
- :group 'erc-replace
:type '(repeat (cons :tag "Search & Replace"
(choice :tag "From"
regexp
@@ -68,23 +67,23 @@ It replaces text according to `erc-replace-alist'."
(let ((from (car elt))
(to (cdr elt)))
(unless (stringp from)
- (setq from (eval from)))
+ (setq from (eval from t)))
(while (re-search-forward from nil t)
(cond ((stringp to)
(replace-match to))
- ((and (symbolp to) (fboundp to))
+ ((functionp to)
(replace-match (funcall to (match-string 0))))
(t
- (eval to))))))
+ (eval to t))))))
erc-replace-alist))
;;;###autoload(autoload 'erc-replace-mode "erc-replace")
(define-erc-module replace nil
"This mode replaces incoming text according to `erc-replace-alist'."
((add-hook 'erc-insert-modify-hook
- 'erc-replace-insert))
+ #'erc-replace-insert))
((remove-hook 'erc-insert-modify-hook
- 'erc-replace-insert)))
+ #'erc-replace-insert)))
(provide 'erc-replace)
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el
index 71a9f8ef3da..666fd585926 100644
--- a/lisp/erc/erc-ring.el
+++ b/lisp/erc/erc-ring.el
@@ -1,4 +1,4 @@
-;; erc-ring.el -- Command history handling for erc using ring.el
+;;; erc-ring.el --- Command history handling for erc using ring.el -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
@@ -46,12 +46,12 @@
(define-erc-module ring nil
"Stores input in a ring so that previous commands and messages can
be recalled using M-p and M-n."
- ((add-hook 'erc-pre-send-functions 'erc-add-to-input-ring)
- (define-key erc-mode-map "\M-p" 'erc-previous-command)
- (define-key erc-mode-map "\M-n" 'erc-next-command))
- ((remove-hook 'erc-pre-send-functions 'erc-add-to-input-ring)
- (define-key erc-mode-map "\M-p" 'undefined)
- (define-key erc-mode-map "\M-n" 'undefined)))
+ ((add-hook 'erc-pre-send-functions #'erc-add-to-input-ring)
+ (define-key erc-mode-map "\M-p" #'erc-previous-command)
+ (define-key erc-mode-map "\M-n" #'erc-next-command))
+ ((remove-hook 'erc-pre-send-functions #'erc-add-to-input-ring)
+ (define-key erc-mode-map "\M-p" #'undefined)
+ (define-key erc-mode-map "\M-n" #'undefined)))
(defvar-local erc-input-ring nil "Input ring for erc.")
@@ -69,10 +69,13 @@ Call this function when setting up the mode."
(setq erc-input-ring (make-ring comint-input-ring-size)))
(setq erc-input-ring-index nil))
-(defun erc-add-to-input-ring (state)
- "Add string S to the input ring and reset history position."
+(defun erc-add-to-input-ring (state-or-string)
+ "Add STATE-OR-STRING to input ring and reset history position.
+STATE-OR-STRING should be a string or an erc-input object."
(unless erc-input-ring (erc-input-ring-setup))
- (ring-insert erc-input-ring (erc-input-string state))
+ (ring-insert erc-input-ring (if (erc-input-p state-or-string)
+ (erc-input-string state-or-string)
+ state-or-string)) ; string
(setq erc-input-ring-index nil))
(defun erc-clear-input-ring ()
@@ -101,11 +104,10 @@ containing a password."
;; area, push it on the history ring before moving back through
;; the input history, so it will be there when we return to the
;; front.
- (if (null erc-input-ring-index)
- (when (> (point-max) erc-input-marker)
- (erc-add-to-input-ring (buffer-substring erc-input-marker
- (point-max)))
- (setq erc-input-ring-index 0)))
+ (when (and (null erc-input-ring-index)
+ (> (point-max) erc-input-marker))
+ (erc-add-to-input-ring (erc-user-input))
+ (setq erc-input-ring-index 0))
(setq erc-input-ring-index (if erc-input-ring-index
(ring-plus1 erc-input-ring-index
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index 9ef8b7f46ab..61006e0c028 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -30,10 +30,10 @@
;; are made to test if NickServ is the real NickServ for a given network or
;; server.
-;; As a default, ERC has the data for the official nickname services on
-;; the networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet, GRnet,
-;; and Slashnet. You can add more by using M-x customize-variable RET
-;; erc-nickserv-alist.
+;; As a default, ERC has the data for the official nickname services
+;; on the networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet,
+;; GRnet, Libera.Chat, and Slashnet. You can add more by using
+;; M-x customize-variable RET erc-nickserv-alist.
;; Usage:
;;
@@ -43,9 +43,10 @@
;; (erc-services-mode 1)
;;
;; Add your nickname and NickServ password to `erc-nickserv-passwords'.
-;; Using the freenode network as an example:
+;; Using the Libera.Chat network as an example:
;;
-;; (setq erc-nickserv-passwords '((freenode (("nickname" "password")))))
+;; (setq erc-nickserv-passwords
+;; '((Libera.Chat (("nickname" "password")))))
;;
;; The default automatic identification mode is autodetection of NickServ
;; identify requests. Set the variable `erc-nickserv-identify-mode' if
@@ -91,7 +92,6 @@ Possible settings are:.
nil - Disables automatic Nickserv identification.
You can also use \\[erc-nickserv-identify-mode] to change modes."
- :group 'erc-services
:type '(choice (const autodetect)
(const nick-change)
(const both)
@@ -107,13 +107,13 @@ You can also use \\[erc-nickserv-identify-mode] to change modes."
"This mode automates communication with services."
((erc-nickserv-identify-mode erc-nickserv-identify-mode))
((remove-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identify-autodetect)
+ #'erc-nickserv-identify-autodetect)
(remove-hook 'erc-after-connect
- 'erc-nickserv-identify-on-connect)
+ #'erc-nickserv-identify-on-connect)
(remove-hook 'erc-nick-changed-functions
- 'erc-nickserv-identify-on-nick-change)
+ #'erc-nickserv-identify-on-nick-change)
(remove-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identification-autodetect)))
+ #'erc-nickserv-identification-autodetect)))
;;;###autoload
(defun erc-nickserv-identify-mode (mode)
@@ -123,7 +123,7 @@ You can also use \\[erc-nickserv-identify-mode] to change modes."
"Choose Nickserv identify mode (RET to disable): "
'(("autodetect") ("nick-change") ("both")) nil t))))
(add-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identification-autodetect)
+ #'erc-nickserv-identification-autodetect)
(unless erc-networks-mode
;; Force-enable networks module, because we need it to set
;; erc-network for us.
@@ -131,41 +131,40 @@ You can also use \\[erc-nickserv-identify-mode] to change modes."
(cond ((eq mode 'autodetect)
(setq erc-nickserv-identify-mode 'autodetect)
(add-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identify-autodetect)
+ #'erc-nickserv-identify-autodetect)
(remove-hook 'erc-nick-changed-functions
- 'erc-nickserv-identify-on-nick-change)
+ #'erc-nickserv-identify-on-nick-change)
(remove-hook 'erc-after-connect
- 'erc-nickserv-identify-on-connect))
+ #'erc-nickserv-identify-on-connect))
((eq mode 'nick-change)
(setq erc-nickserv-identify-mode 'nick-change)
(add-hook 'erc-after-connect
- 'erc-nickserv-identify-on-connect)
+ #'erc-nickserv-identify-on-connect)
(add-hook 'erc-nick-changed-functions
- 'erc-nickserv-identify-on-nick-change)
+ #'erc-nickserv-identify-on-nick-change)
(remove-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identify-autodetect))
+ #'erc-nickserv-identify-autodetect))
((eq mode 'both)
(setq erc-nickserv-identify-mode 'both)
(add-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identify-autodetect)
+ #'erc-nickserv-identify-autodetect)
(add-hook 'erc-after-connect
- 'erc-nickserv-identify-on-connect)
+ #'erc-nickserv-identify-on-connect)
(add-hook 'erc-nick-changed-functions
- 'erc-nickserv-identify-on-nick-change))
+ #'erc-nickserv-identify-on-nick-change))
(t
(setq erc-nickserv-identify-mode nil)
(remove-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identify-autodetect)
+ #'erc-nickserv-identify-autodetect)
(remove-hook 'erc-after-connect
- 'erc-nickserv-identify-on-connect)
+ #'erc-nickserv-identify-on-connect)
(remove-hook 'erc-nick-changed-functions
- 'erc-nickserv-identify-on-nick-change)
+ #'erc-nickserv-identify-on-nick-change)
(remove-hook 'erc-server-NOTICE-functions
- 'erc-nickserv-identification-autodetect))))
+ #'erc-nickserv-identification-autodetect))))
(defcustom erc-prompt-for-nickserv-password t
"Ask for the password when identifying to NickServ."
- :group 'erc-services
:type 'boolean)
(defcustom erc-use-auth-source-for-nickserv-password nil
@@ -174,7 +173,6 @@ This option has an no effect if `erc-prompt-for-nickserv-password'
is non-nil, and passwords from `erc-nickserv-passwords' take
precedence."
:version "28.1"
- :group 'erc-services
:type 'boolean)
(defcustom erc-nickserv-passwords nil
@@ -184,10 +182,9 @@ passwords to be used.
Example of use:
(setq erc-nickserv-passwords
- \\='((freenode ((\"nick-one\" . \"password\")
- (\"nick-two\" . \"password\")))
+ \\='((Libera.Chat ((\"nick-one\" . \"password\")
+ (\"nick-two\" . \"password\")))
(DALnet ((\"nick\" . \"password\")))))"
- :group 'erc-services
:type '(repeat
(list :tag "Network"
(choice :tag "Network name"
@@ -201,6 +198,7 @@ Example of use:
(const GalaxyNet)
(const GRnet)
(const iip)
+ (const Libera.Chat)
(const OFTC)
(const QuakeNet)
(const Rizon)
@@ -268,6 +266,15 @@ Example of use:
"type\\s-/squery\\s-Trent\\s-identify\\s-<password>"
"Trent@anon.iip"
"IDENTIFY" nil "SQUERY" nil)
+ (Libera.Chat
+ "NickServ!NickServ@services.libera.chat"
+ ;; Libera.Chat also accepts a password at login, see the `erc'
+ ;; :password argument.
+ "This\\s-nickname\\s-is\\s-registered.\\s-Please\\s-choose"
+ "NickServ"
+ "IDENTIFY" nil nil
+ ;; See also the 901 response code message.
+ "You\\s-are\\s-now\\s-identified\\s-for\\s-")
(OFTC
"NickServ!services@services.oftc.net"
;; OFTC's NickServ doesn't ask you to identify anymore.
@@ -305,7 +312,6 @@ ANSWER is the command to use for the answer. The default is `privmsg'.
SUCCESS-REGEXP is a regular expression matching the message nickserv
sends when you've successfully identified.
The last two elements are optional."
- :group 'erc-services
:type '(repeat
(list :tag "Nickserv data"
(symbol :tag "Network name")
@@ -357,7 +363,6 @@ The last two elements are optional."
(defcustom erc-nickserv-identified-hook nil
"Run this hook when NickServ acknowledged successful identification.
Hooks are called with arguments (NETWORK NICK)."
- :group 'erc-services
:type 'hook)
(defun erc-nickserv-identification-autodetect (_proc parsed)
diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el
index edde9737ff9..92759d206a3 100644
--- a/lisp/erc/erc-sound.el
+++ b/lisp/erc/erc-sound.el
@@ -1,4 +1,4 @@
-;;; erc-sound.el --- CTCP SOUND support for ERC
+;;; erc-sound.el --- CTCP SOUND support for ERC -*- lexical-binding: t -*-
;; Copyright (C) 2002-2003, 2006-2021 Free Software Foundation, Inc.
@@ -52,11 +52,11 @@
"In ERC sound mode, the client will respond to CTCP SOUND requests
and play sound files as requested."
;; Enable:
- ((add-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND)
- (define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound))
+ ((add-hook 'erc-ctcp-query-SOUND-hook #'erc-ctcp-query-SOUND)
+ (define-key erc-mode-map "\C-c\C-s" #'erc-toggle-sound))
;; Disable:
- ((remove-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND)
- (define-key erc-mode-map "\C-c\C-s" 'undefined)))
+ ((remove-hook 'erc-ctcp-query-SOUND-hook #'erc-ctcp-query-SOUND)
+ (define-key erc-mode-map "\C-c\C-s" #'undefined)))
(erc-define-catalog-entry 'english 'CTCP-SOUND "%n (%u@%h) plays %s:%m")
@@ -66,18 +66,15 @@ and play sound files as requested."
(defcustom erc-play-sound t
"Play sounds when you receive CTCP SOUND requests."
- :group 'erc-sound
:type 'boolean)
(defcustom erc-sound-path nil
"List of directories that contain sound samples to play on SOUND events."
- :group 'erc-sound
:type '(repeat directory))
(defcustom erc-default-sound nil
"Play this sound if the requested file was not found.
If this is set to nil or the file doesn't exist a beep will sound."
- :group 'erc-sound
:type '(choice (const nil)
file))
@@ -108,7 +105,7 @@ LINE is the text entered, including the command."
t))
(t nil)))
-(defun erc-ctcp-query-SOUND (proc nick login host to msg)
+(defun erc-ctcp-query-SOUND (_proc nick login host _to msg)
"Display a CTCP SOUND message and play sound if `erc-play-sound' is non-nil."
(when (string-match "^SOUND\\s-+\\(\\S-+\\)\\(\\(\\s-+.*\\)\\|\\(\\s-*\\)\\)$" msg)
(let ((sound (match-string 1 msg))
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index c2be23990f1..e61e741302d 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -1,4 +1,4 @@
-;;; erc-speedbar.el --- Speedbar support for ERC
+;;; erc-speedbar.el --- Speedbar support for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc.
@@ -52,7 +52,6 @@
`activity' - Sort users by channel activity
`alphabetical' - Sort users alphabetically
nil - Do not sort users"
- :group 'erc-speedbar
:type '(choice (const :tag "Sort users by channel activity" activity)
(const :tag "Sort users alphabetically" alphabetical)
(const :tag "Do not sort users" nil)))
@@ -67,11 +66,11 @@ nil - Do not sort users"
(setq erc-speedbar-key-map (speedbar-make-specialized-keymap))
;; Basic tree features
- (define-key erc-speedbar-key-map "e" 'speedbar-edit-line)
- (define-key erc-speedbar-key-map "\C-m" 'speedbar-edit-line)
- (define-key erc-speedbar-key-map "+" 'speedbar-expand-line)
- (define-key erc-speedbar-key-map "=" 'speedbar-expand-line)
- (define-key erc-speedbar-key-map "-" 'speedbar-contract-line))
+ (define-key erc-speedbar-key-map "e" #'speedbar-edit-line)
+ (define-key erc-speedbar-key-map "\C-m" #'speedbar-edit-line)
+ (define-key erc-speedbar-key-map "+" #'speedbar-expand-line)
+ (define-key erc-speedbar-key-map "=" #'speedbar-expand-line)
+ (define-key erc-speedbar-key-map "-" #'speedbar-contract-line))
(speedbar-add-expansion-list '("ERC" erc-speedbar-menu-items
erc-speedbar-key-map
@@ -124,7 +123,7 @@ This will add a speedbar major display mode."
(erc-speedbar-insert-target buffer 0))
(t (ignore)))))
-(defun erc-speedbar-server-buttons (directory depth)
+(defun erc-speedbar-server-buttons (_directory depth)
"Insert the initial list of servers you are connected to."
(let ((servers (erc-buffer-list
(lambda ()
@@ -140,7 +139,7 @@ This will add a speedbar major display mode."
t))))
(defun erc-speedbar-expand-server (text server indent)
- (cond ((string-match "\\+" text)
+ (cond ((string-search "+" text)
(speedbar-change-expand-button-char ?-)
(if (speedbar-with-writable
(save-excursion
@@ -148,13 +147,13 @@ 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-match "-" text) ;we have to contract this node
+ ((string-search "-" text) ;we have to contract this node
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
(speedbar-center-buffer-smartly))
-(defun erc-speedbar-channel-buttons (directory depth server-buffer)
+(defun erc-speedbar-channel-buttons (_directory depth server-buffer)
(when (get-buffer server-buffer)
(let* ((proc (with-current-buffer server-buffer erc-server-process))
(targets (erc-buffer-list
@@ -185,13 +184,13 @@ 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-match "\\+" text)
+ ((string-search "+" text)
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
(end-of-line) (forward-char 1)
(let ((modes (with-current-buffer channel
- (concat (apply 'concat
+ (concat (apply #'concat
erc-channel-modes)
(cond
((and erc-channel-user-limit
@@ -234,7 +233,7 @@ INDENT is the current indentation level."
(speedbar-with-writable
(dolist (entry names)
(erc-speedbar-insert-user entry ?+ (1+ indent))))))))))
- ((string-match "-" text)
+ ((string-search "-" text)
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
@@ -285,7 +284,7 @@ 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-match "\\+" text)
+ (cond ((string-search "+" text)
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
@@ -308,13 +307,13 @@ The update is only done when the channel is actually expanded already."
nil nil nil nil
info nil nil nil
(1+ indent)))))))
- ((string-match "-" text)
+ ((string-search "-" text)
(speedbar-change-expand-button-char ?+)
(speedbar-delete-subblock indent))
(t (error "Ooops... not sure what to do")))
(speedbar-center-buffer-smartly))
-(defun erc-speedbar-goto-buffer (text buffer indent)
+(defun erc-speedbar-goto-buffer (_text buffer _indent)
"When user clicks on TEXT, goto an ERC buffer.
The INDENT level is ignored."
(if (featurep 'dframe)
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
index 44a3e358812..950a821e3c4 100644
--- a/lisp/erc/erc-spelling.el
+++ b/lisp/erc/erc-spelling.el
@@ -1,10 +1,10 @@
-;;; erc-spelling.el --- use flyspell in ERC
+;;; erc-spelling.el --- use flyspell in ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
;; Author: Jorgen Schaefer <forcer@forcix.cx>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: irc
+;; Keywords: comm, irc
;; URL: https://www.emacswiki.org/emacs/ErcSpelling
;; This file is part of GNU Emacs.
@@ -38,10 +38,10 @@
"Enable flyspell mode in ERC buffers."
;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is
;; called AFTER the server buffer is initialized.
- ((add-hook 'erc-connect-pre-hook 'erc-spelling-init)
+ ((add-hook 'erc-connect-pre-hook #'erc-spelling-init)
(dolist (buffer (erc-buffer-list))
(erc-spelling-init buffer)))
- ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init)
+ ((remove-hook 'erc-connect-pre-hook #'erc-spelling-init)
(dolist (buffer (erc-buffer-list))
(with-current-buffer buffer (flyspell-mode 0)))))
@@ -104,7 +104,7 @@ The cadr is the beginning and the caddr is the end."
(put 'erc-mode
'flyspell-mode-predicate
- 'erc-spelling-flyspell-verify)
+ #'erc-spelling-flyspell-verify)
(provide 'erc-spelling)
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 2c42a18081e..dde2556ddb7 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -4,7 +4,7 @@
;; Author: Mario Lang <mlang@delysid.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, processes, timestamp
+;; Keywords: comm, timestamp
;; URL: https://www.emacswiki.org/emacs/ErcStamp
;; This file is part of GNU Emacs.
@@ -52,7 +52,6 @@ This string is processed using `format-time-string'.
Good examples are \"%T\" and \"%H:%M\".
If nil, timestamping is turned off."
- :group 'erc-stamp
:type '(choice (const nil)
(string)))
@@ -66,7 +65,6 @@ screen when `erc-insert-timestamp-function' is set to
`erc-insert-timestamp-left-and-right'.
If nil, timestamping is turned off."
- :group 'erc-stamp
:type '(choice (const nil)
(string)))
@@ -80,7 +78,6 @@ screen when `erc-insert-timestamp-function' is set to
`erc-insert-timestamp-left-and-right'.
If nil, timestamping is turned off."
- :group 'erc-stamp
:type '(choice (const nil)
(string)))
@@ -95,7 +92,6 @@ operate on.
You will probably want to set
`erc-insert-away-timestamp-function' to the same value."
- :group 'erc-stamp
:type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right)
(const :tag "Right" erc-insert-timestamp-right)
(const :tag "Left" erc-insert-timestamp-left)
@@ -108,7 +104,6 @@ If nil, timestamping is turned off when away unless `erc-timestamp-format'
is set.
If `erc-timestamp-format' is set, this will not be used."
- :group 'erc-stamp
:type '(choice (const nil)
(string)))
@@ -117,7 +112,6 @@ If `erc-timestamp-format' is set, this will not be used."
"Function to use to insert the away timestamp.
See `erc-insert-timestamp-function' for details."
- :group 'erc-stamp
:type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right)
(const :tag "Right" erc-insert-timestamp-right)
(const :tag "Left" erc-insert-timestamp-left)
@@ -128,7 +122,6 @@ See `erc-insert-timestamp-function' for details."
This is useful for logging, because, although timestamps will be
hidden, they will still be present in the logs."
- :group 'erc-stamp
:type 'boolean)
(defcustom erc-echo-timestamps nil
@@ -136,20 +129,17 @@ hidden, they will still be present in the logs."
Using this variable, you can turn off normal timestamping,
and simply move point to an irc message to see its timestamp
printed in the minibuffer."
- :group 'erc-stamp
:type 'boolean)
(defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S"
"Format string to be used when `erc-echo-timestamps' is non-nil.
This string specifies the format of the timestamp being echoed in
the minibuffer."
- :group 'erc-stamp
:type 'string)
(defcustom erc-timestamp-intangible nil
"Whether the timestamps should be intangible, i.e. prevent the point
from entering them and instead jump over them."
- :group 'erc-stamp
:version "24.5"
:type 'boolean)
@@ -191,6 +181,11 @@ or `erc-send-modify-hook'."
(list (lambda (_window _before dir)
(erc-echo-timestamp dir ct))))))))
+(defvar-local erc-timestamp-last-window-width nil
+ "Stores the width of the last window that showed the current
+buffer. This is used by `erc-insert-timestamp-right' when the
+current buffer is not shown in any window.")
+
(defvar-local erc-timestamp-last-inserted nil
"Last timestamp inserted into the buffer.")
@@ -211,7 +206,6 @@ string of spaces which is the same size as the timestamp is added to
the beginning of the line in its place. If you use
`erc-insert-timestamp-right', nothing gets inserted in place of the
timestamp."
- :group 'erc-stamp
:type 'boolean)
(defcustom erc-timestamp-right-column nil
@@ -219,7 +213,6 @@ timestamp."
if the timestamp is to be printed to the right. If nil,
`erc-insert-timestamp-right' will use other means to determine
the correct column."
- :group 'erc-stamp
:type '(choice
(integer :tag "Column number")
(const :tag "Unspecified" nil)))
@@ -231,7 +224,6 @@ Asian language characters and math symbols) precede a timestamp.
A side effect of enabling this is that there will only be one
space before a right timestamp in any saved logs."
- :group 'erc-stamp
:type 'boolean)
(defun erc-insert-timestamp-left (string)
@@ -263,27 +255,32 @@ property to get to the POSth column."
(defun erc-insert-timestamp-right (string)
"Insert timestamp on the right side of the screen.
-STRING is the timestamp to insert. The function is a possible value
-for `erc-insert-timestamp-function'.
-
-If `erc-timestamp-only-if-changed-flag' is nil, a timestamp is always
-printed. If this variable is non-nil, a timestamp is only printed if
-it is different from the last.
-
-If `erc-timestamp-right-column' is set, its value will be used as the
-column at which the timestamp is to be printed. If it is nil, and
-`erc-fill-mode' is active, then the timestamp will be printed just
-before `erc-fill-column'. Otherwise, if the current buffer is
-shown in a window, that window's width is used. If the buffer is
-not shown, and `fill-column' is set, then the timestamp will be
-printed just `fill-column'. As a last resort, the timestamp will
-be printed just before the window-width."
+STRING is the timestamp to insert. This function is a possible
+value for `erc-insert-timestamp-function'.
+
+If `erc-timestamp-only-if-changed-flag' is nil, a timestamp is
+always printed. If this variable is non-nil, a timestamp is only
+printed if it is different from the last.
+
+If `erc-timestamp-right-column' is set, its value will be used as
+the column at which the timestamp is to be printed. If it is
+nil, and `erc-fill-mode' is active, then the timestamp will be
+printed just before `erc-fill-column'. Otherwise, if the current
+buffer is shown in a window, that window's width is used as the
+right boundary. In case multiple windows show the buffer, the
+width of the most recently selected one is used. If the buffer
+is not shown, the timestamp will be printed just before the
+window width of the last window that showed it. If the buffer
+was never shown, and `fill-column' is set, it will be printed
+just before `fill-column'. As a last resort, timestamp will be
+printed just after each line's text (no alignment)."
(unless (and erc-timestamp-only-if-changed-flag
(string-equal string erc-timestamp-last-inserted))
(setq erc-timestamp-last-inserted string)
(goto-char (point-max))
- (forward-char -1);; before the last newline
+ (forward-char -1) ; before the last newline
(let* ((str-width (string-width string))
+ window ; used in computation of `pos' only
(pos (cond
(erc-timestamp-right-column erc-timestamp-right-column)
((and (boundp 'erc-fill-mode)
@@ -291,10 +288,15 @@ be printed just before the window-width."
(boundp 'erc-fill-column)
erc-fill-column)
(1+ (- erc-fill-column str-width)))
+ ((setq window (get-buffer-window nil t))
+ (setq erc-timestamp-last-window-width
+ (window-width window))
+ (- erc-timestamp-last-window-width str-width))
+ (erc-timestamp-last-window-width
+ (- erc-timestamp-last-window-width str-width))
(fill-column
(1+ (- fill-column str-width)))
- (t
- (- (window-width) str-width 1))))
+ (t (current-column))))
(from (point))
(col (current-column)))
;; The following is a kludge used to calculate whether to move
diff --git a/lisp/erc/erc-status-sidebar.el b/lisp/erc/erc-status-sidebar.el
index ff51026088a..a75a74bb6fd 100644
--- a/lisp/erc/erc-status-sidebar.el
+++ b/lisp/erc/erc-status-sidebar.el
@@ -1,4 +1,4 @@
-;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC
+;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2017, 2020-2021 Free Software Foundation, Inc.
@@ -58,36 +58,30 @@
(defcustom erc-status-sidebar-buffer-name "*ERC Status*"
"Name of the sidebar buffer."
- :type 'string
- :group 'erc-status-sidebar)
+ :type 'string)
(defcustom erc-status-sidebar-mode-line-format "ERC Status"
"Mode line format for the status sidebar."
- :type 'string
- :group 'erc-status-sidebar)
+ :type 'string)
(defcustom erc-status-sidebar-header-line-format nil
"Header line format for the status sidebar."
:type '(choice (const :tag "No header line" nil)
- string)
- :group 'erc-status-sidebar)
+ string))
(defcustom erc-status-sidebar-width 15
"Default width of the sidebar (in columns)."
- :type 'number
- :group 'erc-status-sidebar)
+ :type 'number)
(defcustom erc-status-sidebar-channel-sort
'erc-status-sidebar-default-chansort
"Sorting function used to determine order of channels in the sidebar."
- :type 'function
- :group 'erc-status-sidebar)
+ :type 'function)
(defcustom erc-status-sidebar-channel-format
'erc-status-sidebar-default-chan-format
"Function used to format channel names for display in the sidebar."
- :type 'function
- :group 'erc-status-sidebar)
+ :type 'function)
(defun erc-status-sidebar-display-window ()
"Display the status buffer in a side window. Return the new window."
@@ -152,7 +146,8 @@ containing it on the current frame is closed. See
(save-excursion
(let ((sidebar-exists (erc-status-sidebar-buffer-exists-p))
(sidebar-buffer (erc-status-sidebar-get-buffer))
- (sidebar-window (erc-status-sidebar-get-window)))
+ ;; (sidebar-window (erc-status-sidebar-get-window))
+ )
(unless sidebar-exists
(with-current-buffer sidebar-buffer
(erc-status-sidebar-mode)
@@ -253,7 +248,7 @@ name stand out."
erc-disconnected-hook
erc-quit-hook))
-(defun erc-status-sidebar--post-refresh (&rest ignore)
+(defun erc-status-sidebar--post-refresh (&rest _ignore)
"Schedule sidebar refresh for execution after command stack is cleared.
Ignore arguments in IGNORE, allowing this function to be added to
@@ -276,7 +271,7 @@ to the `window-configuration-change-hook'."
(when (and (eq (selected-window) (erc-status-sidebar-get-window))
(fboundp 'window-preserve-size))
(unless (eq (window-total-width) (window-min-size nil t))
- (apply 'window-preserve-size (selected-window) t t nil))))
+ (apply #'window-preserve-size (selected-window) t t nil))))
(define-derived-mode erc-status-sidebar-mode special-mode "ERC Sidebar"
"Major mode for ERC status sidebar"
@@ -298,8 +293,7 @@ to the `window-configuration-change-hook'."
;; erc-status-sidebar-mode initialization code, so it won't undo the
;; add-hook's we did in the previous expressions.
(add-hook 'change-major-mode-hook #'erc-status-sidebar-mode--unhook nil t)
- (add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t)
- :group 'erc-status-sidebar)
+ (add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t))
(provide 'erc-status-sidebar)
;;; erc-status-sidebar.el ends here
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index d6ad847c5b9..2364d45d6f3 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -4,7 +4,7 @@
;; Author: Mario Lang <mlang@delysid.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, faces
+;; Keywords: comm
;; URL: https://www.emacswiki.org/emacs/ErcChannelTracking
;; This file is part of GNU Emacs.
@@ -60,7 +60,6 @@ The reason for using this default value is to both (1) adhere to
the Emacs development guidelines which say not to touch keys of
the form C-c C-<something> and also (2) to meet the expectations
of long-time ERC users, many of whom rely on these keybindings."
- :group 'erc-track
:type '(choice (const :tag "Ask, if used already" ask)
(const :tag "Enable" t)
(const :tag "Disable" nil)))
@@ -80,7 +79,6 @@ nil - only the selected frame
selected-visible - only the selected frame if it is visible
Activity means that there was no user input in the last 10 seconds."
- :group 'erc-track
:type '(choice (const :tag "All frames" t)
(const :tag "All visible frames" visible)
(const :tag "Only the selected frame" nil)
@@ -89,13 +87,11 @@ Activity means that there was no user input in the last 10 seconds."
(defcustom erc-track-exclude nil
"A list targets (channel names or query targets) which should not be tracked."
- :group 'erc-track
:type '(repeat string))
(defcustom erc-track-remove-disconnected-buffers nil
"If true, remove buffers associated with a server that is
disconnected from `erc-modified-channels-alist'."
- :group 'erc-track
:type 'boolean)
(defcustom erc-track-exclude-types '("NICK" "333" "353")
@@ -105,25 +101,21 @@ This list could look like (\"JOIN\" \"PART\").
By default, exclude changes of nicknames (NICK), display of who
set the channel topic (333), and listing of users on the current
channel (353)."
- :group 'erc-track
:type 'erc-message-type)
(defcustom erc-track-exclude-server-buffer nil
"If true, don't perform tracking on the server buffer; this is
useful for excluding all the things like MOTDs from the server and
other miscellaneous functions."
- :group 'erc-track
:type 'boolean)
(defcustom erc-track-shorten-start 1
"This number specifies the minimum number of characters a channel name in
the mode-line should be reduced to."
- :group 'erc-track
:type 'number)
(defcustom erc-track-shorten-cutoff 4
"All channel names longer than this value will be shortened."
- :group 'erc-track
:type 'number)
(defcustom erc-track-shorten-aggressively nil
@@ -144,7 +136,6 @@ not compared to #electronica -- only to #vi, therefore it can be shortened
even more and the result is #e and #v.
This setting is used by `erc-track-shorten-names'."
- :group 'erc-track
:type '(choice (const :tag "No" nil)
(const :tag "Yes" t)
(const :tag "Max" max)))
@@ -154,7 +145,6 @@ This setting is used by `erc-track-shorten-names'."
It takes one argument, CHANNEL-NAMES which is a list of strings.
It should return a list of strings of the same number of elements.
If nil instead of a function, shortening is disabled."
- :group 'erc-track
:type '(choice (const :tag "Disabled")
function))
@@ -165,14 +155,12 @@ If nil instead of a function, shortening is disabled."
This is useful for people that don't use the default mode-line
notification but instead use a separate mechanism to provide
notification of channel activity."
- :group 'erc-track
:type 'hook)
(defcustom erc-track-use-faces t
"Use faces in the mode-line.
The faces used are the same as used for text in the buffers.
\(e.g. `erc-pal-face' is used if a pal sent a message to that channel.)"
- :group 'erc-track
:type 'boolean)
(defcustom erc-track-faces-priority-list
@@ -199,7 +187,6 @@ The faces used are the same as used for text in the buffers.
"A list of faces used to highlight active buffer names in the mode line.
If a message contains one of the faces in this list, the buffer name will
be highlighted using that face. The first matching face is used."
- :group 'erc-track
:type '(repeat (choice face
(repeat :tag "Combination" face))))
@@ -214,7 +201,6 @@ this feature.
Note: If you have a lot of faces listed in `erc-track-faces-priority-list',
setting this variable might not be very useful."
- :group 'erc-track
:type '(choice (const nil)
(repeat string)
(const all)))
@@ -237,21 +223,17 @@ message. This gives a rough indication that active conversations
are occurring in these channels.
The effect may be disabled by setting this variable to nil."
- :group 'erc-track
:type '(repeat (choice face
(repeat :tag "Combination" face))))
(defcustom erc-track-position-in-mode-line 'before-modes
"Where to show modified channel information in the mode-line.
-Setting this variable only has effect in GNU Emacs versions above 21.3.
-
Choices are:
`before-modes' - add to the beginning of `mode-line-modes',
`after-modes' - add to the end of `mode-line-modes',
t - add to the end of `global-mode-string',
nil - don't add to mode line."
- :group 'erc-track
:type '(choice (const :tag "Just before mode information" before-modes)
(const :tag "Just after mode information" after-modes)
(const :tag "After all other information" t)
@@ -268,7 +250,7 @@ nil - don't add to mode line."
(if strings
(concat (if (eq erc-track-position-in-mode-line 'after-modes)
"[" " [")
- (mapconcat 'identity (nreverse strings) ",")
+ (mapconcat #'identity (nreverse strings) ",")
(if (eq erc-track-position-in-mode-line 'before-modes)
"] " "]"))
""))
@@ -291,20 +273,17 @@ while the buffer was not visible.")
(defcustom erc-track-showcount nil
"If non-nil, count of unseen messages will be shown for each channel."
- :type 'boolean
- :group 'erc-track)
+ :type 'boolean)
(defcustom erc-track-showcount-string ":"
"The string to display between buffer name and the count in the mode line.
The default is a colon, resulting in \"#emacs:9\"."
- :type 'string
- :group 'erc-track)
+ :type 'string)
(defcustom erc-track-switch-from-erc t
"If non-nil, `erc-track-switch-buffer' will return to the last non-erc buffer
when there are no more active channels."
- :type 'boolean
- :group 'erc-track)
+ :type 'boolean)
(defcustom erc-track-switch-direction 'oldest
"Direction `erc-track-switch-buffer' should switch.
@@ -318,7 +297,6 @@ when there are no more active channels."
If set to `importance', the importance is determined by position
in `erc-track-faces-priority-list', where first is most
important."
- :group 'erc-track
:type '(choice (const importance)
(const oldest)
(const newest)
@@ -474,9 +452,9 @@ START is the minimum length of the name used."
(defvar erc-track-minor-mode-map (make-sparse-keymap)
"Keymap for rcirc track minor mode.")
-(define-key erc-track-minor-mode-map (kbd "C-c C-@") 'erc-track-switch-buffer)
+(define-key erc-track-minor-mode-map (kbd "C-c C-@") #'erc-track-switch-buffer)
(define-key erc-track-minor-mode-map (kbd "C-c C-SPC")
- 'erc-track-switch-buffer)
+ #'erc-track-switch-buffer)
;;;###autoload
(define-minor-mode erc-track-minor-mode
@@ -486,11 +464,7 @@ ERC Track minor mode is a global minor mode. It exists for the
sole purpose of providing the C-c C-SPC and C-c C-@ keybindings.
Make sure that you have enabled the track module, otherwise the
keybindings will not do anything useful."
- :init-value nil
- :lighter ""
- :keymap erc-track-minor-mode-map
- :global t
- :group 'erc-track)
+ :global t)
(defun erc-track-minor-mode-maybe (&optional buffer)
"Enable `erc-track-minor-mode', depending on `erc-track-enable-keybindings'."
@@ -532,17 +506,17 @@ keybindings will not do anything useful."
((when (boundp 'erc-track-when-inactive)
(if erc-track-when-inactive
(progn
- (add-hook 'window-configuration-change-hook 'erc-user-is-active)
- (add-hook 'erc-send-completed-hook 'erc-user-is-active)
- (add-hook 'erc-server-001-functions 'erc-user-is-active))
+ (add-hook 'window-configuration-change-hook #'erc-user-is-active)
+ (add-hook 'erc-send-completed-hook #'erc-user-is-active)
+ (add-hook 'erc-server-001-functions #'erc-user-is-active))
(erc-track-add-to-mode-line erc-track-position-in-mode-line)
(erc-update-mode-line)
(add-hook 'window-configuration-change-hook
- 'erc-window-configuration-change)
- (add-hook 'erc-insert-post-hook 'erc-track-modified-channels)
- (add-hook 'erc-disconnected-hook 'erc-modified-channels-update))
+ #'erc-window-configuration-change)
+ (add-hook 'erc-insert-post-hook #'erc-track-modified-channels)
+ (add-hook 'erc-disconnected-hook #'erc-modified-channels-update))
;; enable the tracking keybindings
- (add-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe)
+ (add-hook 'erc-connect-pre-hook #'erc-track-minor-mode-maybe)
(erc-track-minor-mode-maybe)))
;; Disable:
((when (boundp 'erc-track-when-inactive)
@@ -550,23 +524,22 @@ keybindings will not do anything useful."
(if erc-track-when-inactive
(progn
(remove-hook 'window-configuration-change-hook
- 'erc-user-is-active)
- (remove-hook 'erc-send-completed-hook 'erc-user-is-active)
- (remove-hook 'erc-server-001-functions 'erc-user-is-active)
- (remove-hook 'erc-timer-hook 'erc-user-is-active))
+ #'erc-user-is-active)
+ (remove-hook 'erc-send-completed-hook #'erc-user-is-active)
+ (remove-hook 'erc-server-001-functions #'erc-user-is-active)
+ (remove-hook 'erc-timer-hook #'erc-user-is-active))
(remove-hook 'window-configuration-change-hook
- 'erc-window-configuration-change)
- (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update)
- (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels))
+ #'erc-window-configuration-change)
+ (remove-hook 'erc-disconnected-hook #'erc-modified-channels-update)
+ (remove-hook 'erc-insert-post-hook #'erc-track-modified-channels))
;; disable the tracking keybindings
- (remove-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe)
+ (remove-hook 'erc-connect-pre-hook #'erc-track-minor-mode-maybe)
(when erc-track-minor-mode
(erc-track-minor-mode -1)))))
(defcustom erc-track-when-inactive nil
"Enable channel tracking even for visible buffers, if you are
inactive."
- :group 'erc-track
:type 'boolean
:set (lambda (sym val)
(if erc-track-mode
@@ -707,12 +680,12 @@ Use `erc-make-mode-line-buffer-name' to create buttons."
;; four lists we use to create a new
;; `erc-modified-channels-object' using
;; `erc-make-mode-line-buffer-name'.
- (let* ((buffers (mapcar 'car erc-modified-channels-alist))
- (counts (mapcar 'cadr erc-modified-channels-alist))
- (faces (mapcar 'cddr erc-modified-channels-alist))
- (long-names (mapcar #'(lambda (buf)
- (or (buffer-name buf)
- ""))
+ (let* ((buffers (mapcar #'car erc-modified-channels-alist))
+ (counts (mapcar #'cadr erc-modified-channels-alist))
+ (faces (mapcar #'cddr erc-modified-channels-alist))
+ (long-names (mapcar (lambda (buf)
+ (or (buffer-name buf)
+ ""))
buffers))
(short-names (if (functionp erc-track-shorten-function)
(funcall erc-track-shorten-function
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el
index f4514ca1371..ff33fbc5570 100644
--- a/lisp/erc/erc-truncate.el
+++ b/lisp/erc/erc-truncate.el
@@ -1,4 +1,4 @@
-;;; erc-truncate.el --- Functions for truncating ERC buffers
+;;; erc-truncate.el --- Functions for truncating ERC buffers -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc.
@@ -41,7 +41,6 @@
"Maximum size in chars of each ERC buffer.
Used only when auto-truncation is enabled.
\(see `erc-truncate-buffer' and `erc-insert-post-hook')."
- :group 'erc-truncate
:type 'integer)
;;;###autoload(autoload 'erc-truncate-mode "erc-truncate" nil t)
@@ -51,9 +50,9 @@ This prevents the query buffer from getting too large, which can
bring any grown Emacs to its knees after a few days worth of
tracking heavy-traffic channels."
;;enable
- ((add-hook 'erc-insert-post-hook 'erc-truncate-buffer))
+ ((add-hook 'erc-insert-post-hook #'erc-truncate-buffer))
;; disable
- ((remove-hook 'erc-insert-post-hook 'erc-truncate-buffer)))
+ ((remove-hook 'erc-insert-post-hook #'erc-truncate-buffer)))
;;;###autoload
(defun erc-truncate-buffer-to-size (size &optional buffer)
diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el
index 6808f24911d..e1b9f0de3a7 100644
--- a/lisp/erc/erc-xdcc.el
+++ b/lisp/erc/erc-xdcc.el
@@ -1,10 +1,10 @@
-;;; erc-xdcc.el --- XDCC file-server support for ERC
+;;; erc-xdcc.el --- XDCC file-server support for ERC -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>
-;; Keywords: comm, processes
+;; Keywords: comm
;; This file is part of GNU Emacs.
@@ -51,7 +51,7 @@ Your friends should issue \"/ctcp yournick XDCC list\" to see this."
(defcustom erc-xdcc-help-text
'(("Hey " nick ", wondering how this works? Pretty easy.")
("Available commands: XDCC ["
- (mapconcat 'car erc-xdcc-handler-alist "|") "]")
+ (mapconcat #'car erc-xdcc-handler-alist "|") "]")
("Type \"/ctcp " (erc-current-nick)
" XDCC list\" to see the list of offered files, then type \"/ctcp "
(erc-current-nick) " XDCC send #\" to get a particular file number."))
@@ -82,7 +82,7 @@ being evaluated and should return strings."
(defvar erc-ctcp-query-XDCC-hook '(erc-xdcc)
"Hook called whenever a CTCP XDCC message is received.")
-(defun erc-xdcc (proc nick login host to query)
+(defun erc-xdcc (proc nick login host _to query)
"Handle incoming CTCP XDCC queries."
(when erc-xdcc-verbose-flag
(erc-display-message nil 'notice proc
@@ -96,15 +96,15 @@ being evaluated and should return strings."
(format "Unknown XDCC sub-command, try \"/ctcp %s XDCC help\""
(erc-current-nick))))))
-(defun erc-xdcc-help (proc nick login host args)
+(defun erc-xdcc-help (proc nick _login _host _args)
"Send basic help information to NICK."
(mapc
(lambda (msg)
(erc-xdcc-reply proc nick
- (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt))) msg "")))
+ (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt t))) msg "")))
erc-xdcc-help-text))
-(defun erc-xdcc-list (proc nick login host args)
+(defun erc-xdcc-list (proc nick _login _host _args)
"Show the contents of `erc-xdcc-files' via privmsg to NICK."
(if (null erc-xdcc-files)
(erc-xdcc-reply proc nick "No files offered, sorry")
@@ -117,7 +117,7 @@ being evaluated and should return strings."
(setq n (1+ n))
(erc-dcc-file-to-name file)))))))
-(defun erc-xdcc-send (proc nick login host args)
+(defun erc-xdcc-send (proc nick _login _host args)
"Send a file to NICK."
(let ((n (string-to-number (car args)))
(len (length erc-xdcc-files)))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index dd7f50fb381..73202016ba7 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1,4 +1,4 @@
-;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*-
+;;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -9,6 +9,7 @@
;; Andreas Fuchs (afs@void.at)
;; Gergely Nagy (algernon@midgard.debian.net)
;; David Edmondson (dme@dme.org)
+;; Michael Olson (mwolson@gnu.org)
;; Kelvin White (kwhite@gnu.org)
;; Maintainer: Amin Bandali <bandali@gnu.org>
;; Keywords: IRC, chat, client, Internet
@@ -47,11 +48,12 @@
;;
;; M-x erc RET
;;
-;; After you are connected to a server, you can use C-h m or have a look at
-;; the ERC menu.
-
-;;; History:
+;; or
+;;
+;; M-x erc-tls RET
;;
+;; to connect over TLS (encrypted). Once you are connected to a
+;; server, you can use C-h m or have a look at the ERC menu.
;;; Code:
@@ -114,17 +116,6 @@
"Running scripts at startup and with /LOAD"
:group 'erc)
-;; compatibility with older ERC releases
-
-(define-obsolete-variable-alias 'erc-announced-server-name
- 'erc-server-announced-name "ERC 5.1")
-(define-obsolete-variable-alias 'erc-process 'erc-server-process "ERC 5.1")
-(define-obsolete-variable-alias 'erc-default-coding-system
- 'erc-server-coding-system "ERC 5.1")
-
-(define-obsolete-function-alias 'erc-send-command
- 'erc-server-send "ERC 5.1")
-
(require 'erc-backend)
;; tunable connection and authentication parameters
@@ -256,7 +247,7 @@ A typical value would be \(\"JOIN\" \"PART\" \"QUIT\")."
(defcustom erc-network-hide-list nil
"A list of IRC networks to hide message types from.
-A typical value would be \((\"freenode\" \"MODE\")
+A typical value would be \((\"Libera.Chat\" \"MODE\")
\(\"OFTC\" \"JOIN\" \"QUIT\"))."
:version "25.1"
:group 'erc-ignore
@@ -1144,31 +1135,31 @@ which the local user typed."
(defvar erc-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-m" 'erc-send-current-line)
- (define-key map "\C-a" 'erc-bol)
- (define-key map [home] 'erc-bol)
- (define-key map "\C-c\C-a" 'erc-bol)
- (define-key map "\C-c\C-b" 'erc-switch-to-buffer)
- (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls)
- (define-key map "\C-c\C-d" 'erc-input-action)
- (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse)
- (define-key map "\C-c\C-f" 'erc-toggle-flood-control)
- (define-key map "\C-c\C-i" 'erc-invite-only-mode)
- (define-key map "\C-c\C-j" 'erc-join-channel)
- (define-key map "\C-c\C-n" 'erc-channel-names)
- (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress)
- (define-key map "\C-c\C-p" 'erc-part-from-channel)
- (define-key map "\C-c\C-q" 'erc-quit-server)
- (define-key map "\C-c\C-r" 'erc-remove-text-properties-region)
- (define-key map "\C-c\C-t" 'erc-set-topic)
- (define-key map "\C-c\C-u" 'erc-kill-input)
- (define-key map "\C-c\C-x" 'erc-quit-server)
- (define-key map "\M-\t" 'ispell-complete-word)
- (define-key map "\t" 'completion-at-point)
+ (define-key map "\C-m" #'erc-send-current-line)
+ (define-key map "\C-a" #'erc-bol)
+ (define-key map [home] #'erc-bol)
+ (define-key map "\C-c\C-a" #'erc-bol)
+ (define-key map "\C-c\C-b" #'erc-switch-to-buffer)
+ (define-key map "\C-c\C-c" #'erc-toggle-interpret-controls)
+ (define-key map "\C-c\C-d" #'erc-input-action)
+ (define-key map "\C-c\C-e" #'erc-toggle-ctcp-autoresponse)
+ (define-key map "\C-c\C-f" #'erc-toggle-flood-control)
+ (define-key map "\C-c\C-i" #'erc-invite-only-mode)
+ (define-key map "\C-c\C-j" #'erc-join-channel)
+ (define-key map "\C-c\C-n" #'erc-channel-names)
+ (define-key map "\C-c\C-o" #'erc-get-channel-mode-from-keypress)
+ (define-key map "\C-c\C-p" #'erc-part-from-channel)
+ (define-key map "\C-c\C-q" #'erc-quit-server)
+ (define-key map "\C-c\C-r" #'erc-remove-text-properties-region)
+ (define-key map "\C-c\C-t" #'erc-set-topic)
+ (define-key map "\C-c\C-u" #'erc-kill-input)
+ (define-key map "\C-c\C-x" #'erc-quit-server)
+ (define-key map "\M-\t" #'ispell-complete-word)
+ (define-key map "\t" #'completion-at-point)
;; Suppress `font-lock-fontify-block' key binding since it
;; destroys face properties.
- (define-key map [remap font-lock-fontify-block] 'undefined)
+ (define-key map [remap font-lock-fontify-block] #'undefined)
map)
"ERC keymap.")
@@ -1303,7 +1294,9 @@ With a prefix argument ARG, enable %s if ARG is positive,
and disable it otherwise. If called from Lisp, enable the mode
if ARG is omitted or nil.
%s" name name doc)
- nil nil nil
+ ;; FIXME: We don't know if this group exists, so this `:group' may
+ ;; actually just silence a valid warning about the fact that the var
+ ;; is not associated with any group.
:global ,(not local-p) :group (quote ,group)
(if ,mode
(,enable)
@@ -1324,12 +1317,10 @@ if ARG is omitted or nil.
,@disable-body)
,(when (and alias (not (eq name alias)))
`(defalias
- (quote
- ,(intern
+ ',(intern
(format "erc-%s-mode"
- (downcase (symbol-name alias)))))
- (quote
- ,mode)))
+ (downcase (symbol-name alias))))
+ #',mode))
;; For find-function and find-variable.
(put ',mode 'definition-name ',name)
(put ',enable 'definition-name ',name)
@@ -1489,7 +1480,7 @@ Defaults to the server buffer."
;; activation
-(defconst erc-default-server "chat.freenode.net"
+(defconst erc-default-server "irc.libera.chat"
"IRC server to use if it cannot be detected otherwise.")
(defconst erc-default-port 6667
@@ -1756,7 +1747,7 @@ nil."
(ignore res)
res)))
-(define-obsolete-function-alias 'erc-iswitchb 'erc-switch-to-buffer "25.1")
+(define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1")
(defun erc--switch-to-buffer (&optional arg)
(read-buffer "Switch to ERC buffer: "
(when (boundp 'erc-modified-channels-alist)
@@ -1865,7 +1856,7 @@ removed from the list will be disabled."
:get (lambda (sym)
;; replace outdated names with their newer equivalents
(erc-migrate-modules (symbol-value sym)))
- :initialize 'custom-initialize-default
+ :initialize #'custom-initialize-default
:set (lambda (sym val)
;; disable modules which have just been removed
(when (and (boundp 'erc-modules) erc-modules val)
@@ -1981,7 +1972,8 @@ removed from the list will be disabled."
(switch-to-buffer buffer)))))
(defun erc-open (&optional server port nick full-name
- connect passwd tgt-list channel process)
+ connect passwd tgt-list channel process
+ client-certificate)
"Connect to SERVER on PORT as NICK with FULL-NAME.
If CONNECT is non-nil, connect to the server. Otherwise assume
@@ -1991,6 +1983,13 @@ target CHANNEL.
Use PASSWD as user password on the server. If TGT-LIST is
non-nil, use it to initialize `erc-default-recipients'.
+CLIENT-CERTIFICATE, if non-nil, should either be a list where the
+first element is the file name of the private key corresponding
+to a client certificate and the second element is the file name
+of the client certificate itself to use when connecting over TLS,
+or t, which means that `auth-source' will be queried for the
+private key and the certificate.
+
Returns the buffer for the given server or channel."
(let ((server-announced-name (when (and (boundp 'erc-session-server)
(string= server erc-session-server))
@@ -2073,6 +2072,8 @@ Returns the buffer for the given server or channel."
(if (functionp secret)
(funcall secret)
secret))))
+ ;; client certificate (only useful if connecting over TLS)
+ (setq erc-session-client-certificate client-certificate)
;; debug output buffer
(setq erc-dbuf
(when erc-log-p
@@ -2093,7 +2094,10 @@ Returns the buffer for the given server or channel."
(run-hook-with-args 'erc-connect-pre-hook buffer)
(when connect
- (erc-server-connect erc-session-server erc-session-port buffer))
+ (erc-server-connect erc-session-server
+ erc-session-port
+ buffer
+ erc-session-client-certificate))
(erc-update-mode-line)
;; Now display the buffer in a window as per user wishes.
@@ -2136,33 +2140,34 @@ If no buffer matches, return nil."
(erc-current-nick-p nick)))))
(defcustom erc-before-connect nil
- "Hook called before connecting to a server.
-This hook gets executed before `erc' actually invokes `erc-mode'
-with your input data. The functions in here get called with three
-parameters, SERVER, PORT and NICK."
+ "Functions called before connecting to a server.
+The functions in this variable gets executed before `erc'
+actually invokes `erc-mode' with your input data. The functions
+in here get called with three parameters, SERVER, PORT and NICK."
:group 'erc-hooks
- :type 'hook)
+ :type '(repeat function))
(defcustom erc-after-connect nil
- "Hook called after connecting to a server.
-This hook gets executed when an end of MOTD has been received. All
-functions in here get called with the parameters SERVER and NICK."
+ "Functions called after connecting to a server.
+This functions in this variable gets executed when an end of MOTD
+has been received. All functions in here get called with the
+parameters SERVER and NICK."
:group 'erc-hooks
- :type 'hook)
+ :type '(repeat function))
;;;###autoload
(defun erc-select-read-args ()
"Prompt the user for values of nick, server, port, and password."
(let (user-input server port nick passwd)
- (setq user-input (read-from-minibuffer
+ (setq user-input (read-string
"IRC server: "
- (erc-compute-server) nil nil 'erc-server-history-list))
+ (erc-compute-server) 'erc-server-history-list))
(if (string-match "\\(.*\\):\\(.*\\)\\'" user-input)
(setq port (erc-string-to-port (match-string 2 user-input))
user-input (match-string 1 user-input))
(setq port
- (erc-string-to-port (read-from-minibuffer
+ (erc-string-to-port (read-string
"IRC port: " (erc-port-to-string
(erc-compute-port))))))
@@ -2171,13 +2176,12 @@ functions in here get called with the parameters SERVER and NICK."
user-input (match-string 2 user-input))
(setq nick
(if (erc-already-logged-in server port nick)
- (read-from-minibuffer
+ (read-string
(erc-format-message 'nick-in-use ?n nick)
- nick
- nil nil 'erc-nick-history-list)
- (read-from-minibuffer
+ nick 'erc-nick-history-list)
+ (read-string
"Nickname: " (erc-compute-nick nick)
- nil nil 'erc-nick-history-list))))
+ 'erc-nick-history-list))))
(setq server user-input)
@@ -2196,10 +2200,9 @@ functions in here get called with the parameters SERVER and NICK."
;; bnc with the same nick. actually it would be nice to have
;; bncs transparent, so that erc-compute-buffer-name displays
;; the server one is connected to.
- (setq nick (read-from-minibuffer
+ (setq nick (read-string
(erc-format-message 'nick-in-use ?n nick)
- nick
- nil nil 'erc-nick-history-list)))
+ nick 'erc-nick-history-list)))
(list :server server :port port :nick nick :password passwd)))
;;;###autoload
@@ -2211,45 +2214,90 @@ functions in here get called with the parameters SERVER and NICK."
"ERC is a powerful, modular, and extensible IRC client.
This function is the main entry point for ERC.
-It permits you to select connection parameters, and then starts ERC.
+It allows selecting connection parameters, and then starts ERC.
Non-interactively, it takes the keyword arguments
(server (erc-compute-server))
(port (erc-compute-port))
(nick (erc-compute-nick))
password
- (full-name (erc-compute-full-name)))
+ (full-name (erc-compute-full-name))
That is, if called with
- (erc :server \"chat.freenode.net\" :full-name \"Harry S Truman\")
+ (erc :server \"irc.libera.chat\" :full-name \"J. Random Hacker\")
-then the server and full-name will be set to those values, whereas
-`erc-compute-port', `erc-compute-nick' and `erc-compute-full-name' will
-be invoked for the values of the other parameters."
+then the server and full-name will be set to those values,
+whereas `erc-compute-port' and `erc-compute-nick' will be invoked
+for the values of the other parameters."
(interactive (erc-select-read-args))
(erc-open server port nick full-name t password))
;;;###autoload
-(defalias 'erc-select 'erc)
-(defalias 'erc-ssl 'erc-tls)
+(defalias 'erc-select #'erc)
+(defalias 'erc-ssl #'erc-tls)
;;;###autoload
-(defun erc-tls (&rest r)
- "Interactively select TLS connection parameters and run ERC.
-Arguments are the same as for `erc'."
+(cl-defun erc-tls (&key (server (erc-compute-server))
+ (port (erc-compute-port))
+ (nick (erc-compute-nick))
+ password
+ (full-name (erc-compute-full-name))
+ client-certificate)
+ "ERC is a powerful, modular, and extensible IRC client.
+This function is the main entry point for ERC over TLS.
+
+It allows selecting connection parameters, and then starts ERC
+over TLS.
+
+Non-interactively, it takes the keyword arguments
+ (server (erc-compute-server))
+ (port (erc-compute-port))
+ (nick (erc-compute-nick))
+ password
+ (full-name (erc-compute-full-name))
+ client-certificate
+
+That is, if called with
+
+ (erc-tls :server \"irc.libera.chat\" :full-name \"J. Random Hacker\")
+
+then the server and full-name will be set to those values,
+whereas `erc-compute-port' and `erc-compute-nick' will be invoked
+for the values of their respective parameters.
+
+CLIENT-CERTIFICATE, if non-nil, should either be a list where the
+first element is the certificate key file name, and the second
+element is the certificate file name itself, or t, which means
+that `auth-source' will be queried for the key and the
+certificate. Authenticating using a TLS client certificate is
+also refered to as \"CertFP\" (Certificate Fingerprint)
+authentication by various IRC networks.
+
+Example usage:
+
+ (erc-tls :server \"irc.libera.chat\" :port 6697
+ :client-certificate
+ '(\"/home/bandali/my-cert.key\"
+ \"/home/bandali/my-cert.crt\"))"
(interactive (let ((erc-default-port erc-default-port-tls))
(erc-select-read-args)))
(let ((erc-server-connect-function 'erc-open-tls-stream))
- (apply #'erc r)))
+ (erc-open server port nick full-name t password
+ nil nil nil client-certificate)))
-(defun erc-open-tls-stream (name buffer host port)
+(defun erc-open-tls-stream (name buffer host port &rest parameters)
"Open an TLS stream to an IRC server.
-The process will be given the name NAME, its target buffer will be
-BUFFER. HOST and PORT specify the connection target."
- (open-network-stream name buffer host port
- :nowait t
- :type 'tls))
+The process will be given the name NAME, its target buffer will
+be BUFFER. HOST and PORT specify the connection target.
+PARAMETERS should be a sequence of keywords and values, per
+`open-network-stream'."
+ (let ((p (plist-put parameters :type 'tls))
+ args)
+ (unless (plist-member p :nowait)
+ (setq p (plist-put p :nowait t)))
+ (setq args `(,name ,buffer ,host ,port ,@p))
+ (apply #'open-network-stream args)))
;;; Displaying error messages
@@ -2335,7 +2383,7 @@ If ARG is non-nil, show the *erc-protocol* buffer."
(use-local-map (make-sparse-keymap))
(local-set-key (kbd "t") 'erc-toggle-debug-irc-protocol))
(add-hook 'kill-buffer-hook
- #'(lambda () (setq erc-debug-irc-protocol nil))
+ (lambda () (setq erc-debug-irc-protocol nil))
nil 'local)
(goto-char (point-max))
(let ((inhibit-read-only t))
@@ -2853,14 +2901,14 @@ VALUE is computed by evaluating the rest of LINE in Lisp."
(val (read (match-string 2 line))))
(if (boundp var)
(progn
- (set var (eval val))
+ (set var (eval val t))
(erc-display-message
nil nil 'active (format "Set %S to %S" var val))
t)
(setq var (read (match-string 1 line)))
(if (boundp var)
(progn
- (set var (eval val))
+ (set var (eval val t))
(erc-display-message
nil nil 'active (format "Set %S to %S" var val))
t)
@@ -2882,8 +2930,8 @@ VALUE is computed by evaluating the rest of LINE in Lisp."
(current-buffer))
t)
(t nil)))
-(defalias 'erc-cmd-VAR 'erc-cmd-SET)
-(defalias 'erc-cmd-VARIABLE 'erc-cmd-SET)
+(defalias 'erc-cmd-VAR #'erc-cmd-SET)
+(defalias 'erc-cmd-VARIABLE #'erc-cmd-SET)
(put 'erc-cmd-SET 'do-not-parse-args t)
(put 'erc-cmd-SET 'process-not-needed t)
@@ -2959,9 +3007,9 @@ If no USER argument is specified, list the contents of `erc-ignore-list'."
(if (null (erc-with-server-buffer erc-ignore-list))
(erc-display-line (erc-make-notice "Ignore list is empty") 'active)
(erc-display-line (erc-make-notice "Ignore list:") 'active)
- (mapc #'(lambda (item)
- (erc-display-line (erc-make-notice item)
- 'active))
+ (mapc (lambda (item)
+ (erc-display-line (erc-make-notice item)
+ 'active))
(erc-with-server-buffer erc-ignore-list))))
t)
@@ -3011,7 +3059,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'."
(car user-data))
ops)))))
erc-channel-users))
- (setq ops (sort ops 'string-lessp))
+ (setq ops (sort ops #'string-lessp))
(if ops
(erc-display-message
nil 'notice (current-buffer) 'ops
@@ -3110,7 +3158,7 @@ For a list of user commands (/join /part, ...):
(message "Type C-h m to get additional information about keybindings.")
t))
-(defalias 'erc-cmd-H 'erc-cmd-HELP)
+(defalias 'erc-cmd-H #'erc-cmd-HELP)
(put 'erc-cmd-HELP 'process-not-needed t)
(defun erc-server-join-channel (server channel &optional secret)
@@ -3143,8 +3191,8 @@ were most recently invited. See also `invitation'."
(when chnl
;; Prevent double joining of same channel on same server.
(let* ((joined-channels
- (mapcar #'(lambda (chanbuf)
- (with-current-buffer chanbuf (erc-default-target)))
+ (mapcar (lambda (chanbuf)
+ (with-current-buffer chanbuf (erc-default-target)))
(erc-channel-list erc-server-process)))
(server (with-current-buffer (process-buffer erc-server-process)
(or erc-session-server erc-server-announced-name)))
@@ -3156,8 +3204,8 @@ were most recently invited. See also `invitation'."
(erc-server-join-channel server chnl key)))))
t)
-(defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN)
-(defalias 'erc-cmd-J 'erc-cmd-JOIN)
+(defalias 'erc-cmd-CHANNEL #'erc-cmd-JOIN)
+(defalias 'erc-cmd-J #'erc-cmd-JOIN)
(defvar-local erc-channel-new-member-names nil
"If non-nil, a names list is currently being received.
@@ -3181,7 +3229,7 @@ command."
(erc-server-send (concat "NAMES " tgt)))
(erc-display-message nil 'error (current-buffer) 'no-default-channel)))
t)
-(defalias 'erc-cmd-N 'erc-cmd-NAMES)
+(defalias 'erc-cmd-N #'erc-cmd-NAMES)
(defun erc-cmd-KICK (target &optional reason-or-nick &rest reasonwords)
"Kick the user indicated in LINE from the current channel.
@@ -3251,7 +3299,7 @@ If SERVER is non-nil, use that, rather than the current server."
(erc-log (format "cmd: %s" send))
(erc-server-send send)
t))
-(defalias 'erc-cmd-WI 'erc-cmd-WHOIS)
+(defalias 'erc-cmd-WI #'erc-cmd-WHOIS)
(defun erc-cmd-WHOAMI ()
"Display whois information about yourself."
@@ -3399,8 +3447,9 @@ to send.
If only one word is given, display the mode of that target.
-A list of valid mode strings for Freenode may be found at
-URL `http://freenode.net/using_the_network.shtml'."
+A list of valid mode strings for Libera.Chat may be found at
+`https://libera.chat/guides/channelmodes' and
+`https://libera.chat/guides/usermodes'."
(cond
((string-match "^\\s-\\(.*\\)$" line)
(let ((s (match-string 1 line)))
@@ -3422,7 +3471,7 @@ The rest is the message to send."
The rest of LINE is the message to send."
(erc-message "PRIVMSG" line))
-(defalias 'erc-cmd-M 'erc-cmd-MSG)
+(defalias 'erc-cmd-M #'erc-cmd-MSG)
(put 'erc-cmd-MSG 'do-not-parse-args t)
(defun erc-cmd-SQUERY (line)
@@ -3477,7 +3526,7 @@ Otherwise leave the channel indicated by LINE."
(t nil)))
(put 'erc-cmd-PART 'do-not-parse-args t)
-(defalias 'erc-cmd-LEAVE 'erc-cmd-PART)
+(defalias 'erc-cmd-LEAVE #'erc-cmd-PART)
(defun erc-cmd-PING (recipient)
"Ping RECIPIENT."
@@ -3521,7 +3570,7 @@ The type of query window/frame/etc will depend on the value of
If USER is omitted, close the current query buffer if one exists
- except this is broken now ;-)"
(interactive
- (list (read-from-minibuffer "Start a query with: " nil)))
+ (list (read-string "Start a query with: ")))
(let ((session-buffer (erc-server-buffer))
(erc-join-buffer erc-query-display))
(if user
@@ -3529,7 +3578,7 @@ If USER is omitted, close the current query buffer if one exists
;; currently broken, evil hack to display help anyway
;(erc-delete-query))))
(signal 'wrong-number-of-arguments ""))))
-(defalias 'erc-cmd-Q 'erc-cmd-QUERY)
+(defalias 'erc-cmd-Q #'erc-cmd-QUERY)
(defun erc-quit/part-reason-default ()
"Default quit/part message."
@@ -3548,7 +3597,7 @@ If S is non-nil, it will be used as the quit reason."
If S is non-nil, it will be used as the quit reason."
(or s
(if (fboundp 'yow)
- (replace-regexp-in-string "\n" "" (yow))
+ (string-replace "\n" "" (yow))
(erc-quit/part-reason-default))))
(make-obsolete 'erc-quit-reason-zippy "it will be removed." "24.4")
@@ -3575,7 +3624,7 @@ If S is non-nil, it will be used as the part reason."
If S is non-nil, it will be used as the quit reason."
(or s
(if (fboundp 'yow)
- (replace-regexp-in-string "\n" "" (yow))
+ (string-replace "\n" "" (yow))
(erc-quit/part-reason-default))))
(make-obsolete 'erc-part-reason-zippy "it will be removed." "24.4")
@@ -3624,9 +3673,9 @@ the message given by REASON."
t)
(t nil)))
-(defalias 'erc-cmd-BYE 'erc-cmd-QUIT)
-(defalias 'erc-cmd-EXIT 'erc-cmd-QUIT)
-(defalias 'erc-cmd-SIGNOFF 'erc-cmd-QUIT)
+(defalias 'erc-cmd-BYE #'erc-cmd-QUIT)
+(defalias 'erc-cmd-EXIT #'erc-cmd-QUIT)
+(defalias 'erc-cmd-SIGNOFF #'erc-cmd-QUIT)
(put 'erc-cmd-QUIT 'do-not-parse-args t)
(put 'erc-cmd-QUIT 'process-not-needed t)
@@ -3645,7 +3694,7 @@ the message given by REASON."
(kill-buffer buffer)))))
t)
-(defalias 'erc-cmd-GQ 'erc-cmd-GQUIT)
+(defalias 'erc-cmd-GQ #'erc-cmd-GQUIT)
(put 'erc-cmd-GQUIT 'do-not-parse-args t)
(put 'erc-cmd-GQUIT 'process-not-needed t)
@@ -3743,7 +3792,7 @@ the message given by REASON."
(erc-server-send (concat "TIME " args)))
t)
(t (erc-server-send "TIME"))))
-(defalias 'erc-cmd-DATE 'erc-cmd-TIME)
+(defalias 'erc-cmd-DATE #'erc-cmd-TIME)
(defun erc-cmd-TOPIC (topic)
"Set or request the topic for a channel.
@@ -3784,7 +3833,7 @@ be displayed."
(erc-display-message nil 'error (current-buffer) 'no-target)))
t)
(t nil)))
-(defalias 'erc-cmd-T 'erc-cmd-TOPIC)
+(defalias 'erc-cmd-T #'erc-cmd-TOPIC)
(put 'erc-cmd-TOPIC 'do-not-parse-args t)
(defun erc-cmd-APPENDTOPIC (topic)
@@ -3796,7 +3845,7 @@ be displayed."
;; strip trailing ^O
(when (string-match "\\(.*\\)\C-o" oldtopic)
(erc-cmd-TOPIC (concat (match-string 1 oldtopic) topic)))))
-(defalias 'erc-cmd-AT 'erc-cmd-APPENDTOPIC)
+(defalias 'erc-cmd-AT #'erc-cmd-APPENDTOPIC)
(put 'erc-cmd-APPENDTOPIC 'do-not-parse-args t)
(defun erc-cmd-CLEARTOPIC (&optional channel)
@@ -3820,6 +3869,8 @@ The property `received-from-server' indicates whether
or not the ban list has been requested from the server.")
(put 'erc-channel-banlist 'received-from-server nil)
+(defvar erc-fill-column)
+
(defun erc-cmd-BANLIST ()
"Pretty-print the contents of `erc-channel-banlist'.
@@ -3890,7 +3941,7 @@ The ban list is fetched from the server if necessary."
(put 'erc-channel-banlist 'received-from-server nil)))))
t)
-(defalias 'erc-cmd-BL 'erc-cmd-BANLIST)
+(defalias 'erc-cmd-BL #'erc-cmd-BANLIST)
(defun erc-cmd-MASSUNBAN ()
"Mass Unban.
@@ -3932,7 +3983,7 @@ Unban all currently banned users in the current channel."
(erc-group-list bans 3))))
t))))
-(defalias 'erc-cmd-MUB 'erc-cmd-MASSUNBAN)
+(defalias 'erc-cmd-MUB #'erc-cmd-MASSUNBAN)
;;;; End of IRC commands
@@ -4033,8 +4084,7 @@ If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
"Interactively input a user action and send it to IRC."
(interactive "")
(erc-set-active-buffer (current-buffer))
- (let ((action (read-from-minibuffer
- "Action: " nil nil nil 'erc-action-history-list)))
+ (let ((action (read-string "Action: " nil 'erc-action-history-list)))
(if (not (string-match "^\\s-*$" action))
(erc-send-action (erc-default-target) action))))
@@ -4051,24 +4101,25 @@ If `point' is at the beginning of a channel name, use that as default."
(completing-read (format-prompt "Join channel" chnl)
table nil nil nil nil chnl))
(when (or current-prefix-arg erc-prompt-for-channel-key)
- (read-from-minibuffer "Channel key (RET for none): " nil))))
+ (read-string "Channel key (RET for none): "))))
(erc-cmd-JOIN channel (when (>= (length key) 1) key)))
(defun erc-part-from-channel (reason)
"Part from the current channel and prompt for a REASON."
(interactive
+ ;; FIXME: Has this ever worked? We're in the interactive-spec, so the
+ ;; argument `reason' can't be in scope yet!
+ ;;(if (and (boundp 'reason) (stringp reason) (not (string= reason "")))
+ ;; reason
(list
- (if (and (boundp 'reason) (stringp reason) (not (string= reason "")))
- reason
- (read-from-minibuffer (concat "Reason for leaving " (erc-default-target)
- ": ")))))
+ (read-string (concat "Reason for leaving " (erc-default-target) ": "))))
(erc-cmd-PART (concat (erc-default-target)" " reason)))
(defun erc-set-topic (topic)
"Prompt for a TOPIC for the current channel."
(interactive
(list
- (read-from-minibuffer
+ (read-string
(concat "Set topic of " (erc-default-target) ": ")
(when erc-channel-topic
(let ((ss (split-string erc-channel-topic "\C-o")))
@@ -4080,7 +4131,7 @@ If `point' is at the beginning of a channel name, use that as default."
(defun erc-set-channel-limit (&optional limit)
"Set a LIMIT for the current channel. Remove limit if nil.
Prompt for one if called interactively."
- (interactive (list (read-from-minibuffer
+ (interactive (list (read-string
(format "Limit for %s (RET to remove limit): "
(erc-default-target)))))
(let ((tgt (erc-default-target)))
@@ -4091,7 +4142,7 @@ Prompt for one if called interactively."
(defun erc-set-channel-key (&optional key)
"Set a KEY for the current channel. Remove key if nil.
Prompt for one if called interactively."
- (interactive (list (read-from-minibuffer
+ (interactive (list (read-string
(format "Key for %s (RET to remove key): "
(erc-default-target)))))
(let ((tgt (erc-default-target)))
@@ -4102,7 +4153,7 @@ Prompt for one if called interactively."
(defun erc-quit-server (reason)
"Disconnect from current server after prompting for REASON.
`erc-quit-reason' works with this just like with `erc-cmd-QUIT'."
- (interactive (list (read-from-minibuffer
+ (interactive (list (read-string
(format "Reason for quitting %s: "
(or erc-server-announced-name
erc-session-server)))))
@@ -4133,7 +4184,7 @@ This places `point' just after the prompt, or at the beginning of the line."
(defun erc-complete-word-at-point ()
(run-hook-with-args-until-success 'erc-complete-functions))
-(define-obsolete-function-alias 'erc-complete-word 'completion-at-point "24.1")
+(define-obsolete-function-alias 'erc-complete-word #'completion-at-point "24.1")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@@ -4161,9 +4212,9 @@ Displays PROC and PARSED appropriately using `erc-display-message'."
(mapconcat
#'identity
(let (res)
- (mapc #'(lambda (x)
- (if (stringp x)
- (setq res (append res (list x)))))
+ (mapc (lambda (x)
+ (if (stringp x)
+ (setq res (append res (list x)))))
parsed)
res)
" ")))
@@ -4551,10 +4602,10 @@ See also: `erc-echo-notice-in-user-buffers',
;; Remove the unbanned masks from the ban list
(setq erc-channel-banlist
(cl-delete-if
- #'(lambda (y)
- (member (upcase (cdr y))
- (mapcar #'upcase
- (cdr (split-string mode)))))
+ (lambda (y)
+ (member (upcase (cdr y))
+ (mapcar #'upcase
+ (cdr (split-string mode)))))
erc-channel-banlist)))
((string-match "^\\+" mode)
;; Add the banned mask(s) to the ban list
@@ -5181,7 +5232,7 @@ TOPIC string to the current topic."
"Sort LIST-OF-STRINGS in lexicographic order.
Side-effect free."
- (sort (copy-sequence list-of-strings) 'string<))
+ (sort (copy-sequence list-of-strings) #'string<))
(defun erc-parse-modes (mode-string)
"Parse MODE-STRING into a list.
@@ -5536,7 +5587,7 @@ 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-match "\n" string)
+ (if (or (string-search "\n" string)
(not (string-match erc-command-regexp string)))
(mapc
(lambda (line)
@@ -6118,11 +6169,11 @@ non-nil value is found.
;; time routines
-(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number
+(define-obsolete-function-alias 'erc-string-to-emacs-time #'string-to-number
"27.1")
-(defalias 'erc-emacs-time-to-erc-time 'float-time)
-(defalias 'erc-current-time 'float-time)
+(defalias 'erc-emacs-time-to-erc-time #'float-time)
+(defalias 'erc-current-time #'float-time)
(defun erc-time-diff (t1 t2)
"Return the absolute value of the difference in seconds between T1 and T2."
@@ -6289,7 +6340,6 @@ The following characters are replaced:
(defcustom erc-header-line-format "%n on %t (%m,%l) %o"
"A string to be formatted and shown in the header-line in `erc-mode'.
-Only used starting in Emacs 21.
Set this to nil if you do not want the header line to be
displayed.
@@ -6478,7 +6528,7 @@ if `erc-away' is non-nil."
(fill-region (point-min) (point-max))
(buffer-string))))
(setq header-line-format
- (replace-regexp-in-string
+ (string-replace
"%"
"%%"
(if face
@@ -6754,7 +6804,7 @@ functions."
nick user host channel
(if (not (string= reason ""))
(format ": %s"
- (replace-regexp-in-string "%" "%%" reason))
+ (string-replace "%" "%%" reason))
"")))))
@@ -6905,7 +6955,3 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL."
(require 'erc-goodies)
;;; erc.el ends here
-;;
-;; Local Variables:
-;; outline-regexp: ";;+"
-;; End: