1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

lisp/erc: Use lexical-binding

Also remove various redundant `:group` arguments.

* lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare`
after the docstring.

* lisp/erc/erc-capab.el: Use lexical-binding.
(erc-capab-identify-activate): Simplify with `member`.

* lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition,
which refers to it.
(erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`.

* lisp/erc/erc-imenu.el: Use lexical-binding.
(erc-create-imenu-index): Remove unused var `prev-pos`.

* lisp/erc/erc-match.el: Use lexical-binding.
(erc-match-message): Remove unused var `old-pt`.
(erc-match-message): Strength-reduce `eval` to `symbol-value`.

* lisp/erc/erc-page.el: Use lexical-binding.
(erc-page): Move Custom group before `erg-page-mode` which refers to it.

* lisp/erc/erc-replace.el: Use lexical-binding.
(erc-replace-insert): Use `functionp`.

* lisp/erc/erc-status-sidebar.el: Use lexical-binding.
(erc-status-sidebar-open): Remove unused var `sidebar-window`.

* lisp/erc/erc.el: Fix header to use the customary 3 semi-colons.
(erc-fill-column): Declare variable.

* lisp/erc/erc-autoaway.el: Use lexical-binding.
* lisp/erc/erc-ezbounce.el: Use lexical-binding.
* lisp/erc/erc-fill.el: Use lexical-binding.
* lisp/erc/erc-goodies.el: Use lexical-binding.
* lisp/erc/erc-ibuffer.el: Use lexical-binding.
* lisp/erc/erc-identd.el: Use lexical-binding.
* lisp/erc/erc-join.el: Use lexical-binding.
* lisp/erc/erc-lang.el: Use lexical-binding.
* lisp/erc/erc-log.el: Use lexical-binding.
* lisp/erc/erc-menu.el: Use lexical-binding.
* lisp/erc/erc-netsplit.el: Use lexical-binding.
* lisp/erc/erc-networks.el: Use lexical-binding.
* lisp/erc/erc-pcomplete.el: Use lexical-binding.
* lisp/erc/erc-ring.el: Use lexical-binding.
* lisp/erc/erc-speedbar.el: Use lexical-binding.
* lisp/erc/erc-spelling.el: Use lexical-binding.
* lisp/erc/erc-truncate.el: Use lexical-binding.
* lisp/erc/erc-xdcc.el: Use lexical-binding.
This commit is contained in:
Stefan Monnier 2021-03-18 23:14:33 -04:00
parent 050b830b69
commit f463633f00
35 changed files with 430 additions and 584 deletions

View File

@ -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))

View File

@ -268,7 +268,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 +275,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 +283,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 +296,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 +326,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 +340,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 +384,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 +408,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")))
@ -1082,9 +1067,6 @@ Finds hooks by looking in the `erc-server-responses' hash table."
(cl-defmacro define-erc-response-handler ((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)))
"Define an ERC handler hook/function pair.
NAME is the response name as sent by the server (see the IRC RFC for
meanings).
@ -1164,6 +1146,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)
@ -1226,8 +1211,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)

View File

@ -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,18 +99,15 @@ 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.
%s is replaced by the number."
:group 'erc-button
:type 'string)
(define-obsolete-variable-alias 'erc-button-google-url
@ -121,7 +117,6 @@ longer than `erc-fill-column'."
"URL used to search for a term.
%s is replaced by the search string."
:version "27.1"
:group 'erc-button
:type 'string)
(defcustom erc-button-alist
@ -179,7 +174,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 +194,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 +236,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 +279,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 +298,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 (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 +475,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)))

View File

@ -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.
@ -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.

View File

@ -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.
@ -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)
@ -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
@ -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)
@ -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)))

View File

@ -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)

View File

@ -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)

View File

@ -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.
@ -47,7 +47,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 +55,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 +93,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 +102,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

View File

@ -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.

View File

@ -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
@ -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)

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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)

View File

@ -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,7 +71,7 @@ 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))
(while (if (bolp)
(> (forward-line -1)
@ -106,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))

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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)))

View File

@ -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.

View File

@ -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 "

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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'."

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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)

View File

@ -1,4 +1,4 @@
;; 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.

View File

@ -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)

View File

@ -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.
@ -443,7 +443,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")
@ -714,7 +713,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 +760,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.

View File

@ -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")

View File

@ -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."

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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.
@ -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)

View File

@ -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.
@ -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)

View File

@ -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.")

View File

@ -91,7 +91,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 +106,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 +122,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 +130,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 +172,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
@ -187,7 +184,6 @@ Example of use:
\\='((freenode ((\"nick-one\" . \"password\")
(\"nick-two\" . \"password\")))
(DALnet ((\"nick\" . \"password\")))))"
:group 'erc-services
:type '(repeat
(list :tag "Network"
(choice :tag "Network name"
@ -305,7 +301,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 +352,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)

View File

@ -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")

View File

@ -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 ()
@ -154,7 +153,7 @@ This will add a speedbar major display mode."
(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
@ -191,7 +190,7 @@ INDENT is the current indentation level."
(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
@ -314,7 +313,7 @@ The update is only done when the channel is actually expanded already."
(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)

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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)

View File

@ -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)
@ -211,7 +201,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 +208,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 +219,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)

View File

@ -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

View File

@ -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,7 +223,6 @@ 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))))
@ -249,7 +234,6 @@ Choices are:
`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)
@ -266,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)
"] " "]"))
""))
@ -289,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.
@ -316,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)
@ -472,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
@ -487,8 +467,7 @@ 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'."
@ -530,17 +509,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)
@ -548,23 +527,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
@ -705,9 +683,9 @@ 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))
(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)
""))

View File

@ -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)

View File

@ -1,4 +1,4 @@
;;; 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.
@ -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)))

View File

@ -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.
@ -1133,31 +1133,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.")
@ -1293,6 +1293,9 @@ 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)
@ -1313,12 +1316,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)
@ -1745,7 +1746,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)
@ -1854,7 +1855,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)
@ -2219,8 +2220,8 @@ be invoked for the values of the other parameters."
(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)
@ -2841,14 +2842,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)
@ -2870,8 +2871,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)
@ -2999,7 +3000,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
@ -3098,7 +3099,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)
@ -3144,8 +3145,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.
@ -3169,7 +3170,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.
@ -3239,7 +3240,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."
@ -3410,7 +3411,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)
@ -3465,7 +3466,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."
@ -3517,7 +3518,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."
@ -3612,9 +3613,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)
@ -3633,7 +3634,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)
@ -3731,7 +3732,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.
@ -3772,7 +3773,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)
@ -3784,7 +3785,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)
@ -3808,6 +3809,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'.
@ -3878,7 +3881,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.
@ -3920,7 +3923,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
@ -4121,7 +4124,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")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@ -5169,7 +5172,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.
@ -6106,11 +6109,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."
@ -6892,7 +6895,3 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL."
(require 'erc-goodies)
;;; erc.el ends here
;;
;; Local Variables:
;; outline-regexp: ";;+"
;; End: