summaryrefslogtreecommitdiff
path: root/lisp/erc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/erc-autoaway.el3
-rw-r--r--lisp/erc/erc-backend.el72
-rw-r--r--lisp/erc/erc-button.el38
-rw-r--r--lisp/erc/erc-capab.el6
-rw-r--r--lisp/erc/erc-compat.el9
-rw-r--r--lisp/erc/erc-dcc.el77
-rw-r--r--lisp/erc/erc-desktop-notifications.el26
-rw-r--r--lisp/erc/erc-ezbounce.el4
-rw-r--r--lisp/erc/erc-fill.el3
-rw-r--r--lisp/erc/erc-goodies.el18
-rw-r--r--lisp/erc/erc-identd.el3
-rw-r--r--lisp/erc/erc-imenu.el1
-rw-r--r--lisp/erc/erc-join.el7
-rw-r--r--lisp/erc/erc-list.el3
-rw-r--r--lisp/erc/erc-log.el34
-rw-r--r--lisp/erc/erc-match.el5
-rw-r--r--lisp/erc/erc-menu.el23
-rw-r--r--lisp/erc/erc-netsplit.el3
-rw-r--r--lisp/erc/erc-notify.el3
-rw-r--r--lisp/erc/erc-page.el3
-rw-r--r--lisp/erc/erc-pcomplete.el3
-rw-r--r--lisp/erc/erc-replace.el3
-rw-r--r--lisp/erc/erc-ring.el11
-rw-r--r--lisp/erc/erc-services.el66
-rw-r--r--lisp/erc/erc-sound.el3
-rw-r--r--lisp/erc/erc-speedbar.el9
-rw-r--r--lisp/erc/erc-spelling.el6
-rw-r--r--lisp/erc/erc-stamp.el9
-rw-r--r--lisp/erc/erc-track.el79
-rw-r--r--lisp/erc/erc-truncate.el3
-rw-r--r--lisp/erc/erc-xdcc.el3
-rw-r--r--lisp/erc/erc.el289
32 files changed, 418 insertions, 407 deletions
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
index d4fda5c7589..9e224e0b828 100644
--- a/lisp/erc/erc-autoaway.el
+++ b/lisp/erc/erc-autoaway.el
@@ -82,7 +82,7 @@ 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)))
-;;;###autoload (autoload 'erc-autoaway-mode "erc-autoaway")
+;;;###autoload(autoload 'erc-autoaway-mode "erc-autoaway")
(define-erc-module autoaway nil
"In ERC autoaway mode, you can be set away automatically.
If `erc-auto-set-away' is set, then you will be set away after
@@ -282,6 +282,7 @@ active server buffer available."
;;; erc-autoaway.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 3e2a9bc4e56..210830a2b49 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -466,14 +466,18 @@ If this is set to nil, never try to reconnect."
The length is specified in `erc-split-line-length'.
Currently this is called by `erc-send-input'."
- (if (< (length longline)
- erc-split-line-length)
- (list longline)
+ (let ((charset (car (erc-coding-system-for-target nil))))
(with-temp-buffer
(insert longline)
+ ;; The line lengths are in octets, not characters (because these
+ ;; are server protocol limits), so we have to first make the
+ ;; text into bytes, then fold the bytes on "word" boundaries,
+ ;; and then make the bytes into text again.
+ (encode-coding-region (point-min) (point-max) charset)
(let ((fill-column erc-split-line-length))
(fill-region (point-min) (point-max)
nil t))
+ (decode-coding-region (point-min) (point-max) charset)
(split-string (buffer-string) "\n"))))
(defun erc-forward-word ()
@@ -644,22 +648,24 @@ Make sure you are in an ERC buffer when running this."
(erc-log-irc-protocol line nil)
(erc-parse-server-response process line)))))))
-(defsubst erc-server-reconnect-p (event)
+(define-inline erc-server-reconnect-p (event)
"Return non-nil if ERC should attempt to reconnect automatically.
EVENT is the message received from the closed connection process."
- (or erc-server-reconnecting
- (and erc-server-auto-reconnect
- (not erc-server-banned)
- ;; make sure we don't infinitely try to reconnect, unless the
- ;; user wants that
- (or (eq erc-server-reconnect-attempts t)
- (and (integerp erc-server-reconnect-attempts)
- (< erc-server-reconnect-count
- erc-server-reconnect-attempts)))
- (or erc-server-timed-out
- (not (string-match "^deleted" event)))
- ;; open-network-stream-nowait error for connection refused
- (if (string-match "^failed with code 111" event) 'nonblocking t))))
+ (inline-letevals (event)
+ (inline-quote
+ (or erc-server-reconnecting
+ (and erc-server-auto-reconnect
+ (not erc-server-banned)
+ ;; make sure we don't infinitely try to reconnect, unless the
+ ;; user wants that
+ (or (eq erc-server-reconnect-attempts t)
+ (and (integerp erc-server-reconnect-attempts)
+ (< erc-server-reconnect-count
+ erc-server-reconnect-attempts)))
+ (or erc-server-timed-out
+ (not (string-match "^deleted" ,event)))
+ ;; open-network-stream-nowait error for connection refused
+ (if (string-match "^failed with code 111" ,event) 'nonblocking t))))))
(defun erc-process-sentinel-2 (event buffer)
"Called when `erc-process-sentinel-1' has detected an unexpected disconnect."
@@ -838,10 +844,9 @@ Additionally, detect whether the IRC process has hung."
erc-server-last-received-time))
(with-current-buffer buf
(if (and erc-server-send-ping-timeout
- (>
- (erc-time-diff (erc-current-time)
- erc-server-last-received-time)
- erc-server-send-ping-timeout))
+ (time-less-p
+ erc-server-send-ping-timeout
+ (time-since erc-server-last-received-time)))
(progn
;; if the process is hung, kill it
(setq erc-server-timed-out t)
@@ -859,16 +864,15 @@ Additionally, detect whether the IRC process has hung."
See `erc-server-flood-margin' for an explanation of the flood
protection algorithm."
(with-current-buffer buffer
- (let ((now (erc-current-time)))
+ (let ((now (current-time)))
(when erc-server-flood-timer
(erc-cancel-timer erc-server-flood-timer)
(setq erc-server-flood-timer nil))
- (when (< erc-server-flood-last-message
- now)
- (setq erc-server-flood-last-message now))
+ (when (time-less-p erc-server-flood-last-message now)
+ (setq erc-server-flood-last-message (erc-emacs-time-to-erc-time now)))
(while (and erc-server-flood-queue
- (< erc-server-flood-last-message
- (+ now erc-server-flood-margin)))
+ (time-less-p erc-server-flood-last-message
+ (time-add now erc-server-flood-margin)))
(let ((msg (caar erc-server-flood-queue))
(encoding (cdar erc-server-flood-queue)))
(setq erc-server-flood-queue (cdr erc-server-flood-queue)
@@ -1064,8 +1068,8 @@ Hands off to helper functions via `erc-call-hooks'."
erc-server-prevent-duplicates)
(let ((m (erc-response.unparsed parsed-response)))
;; duplicate suppression
- (if (< (or (gethash m erc-server-duplicates) 0)
- (- (erc-current-time) erc-server-duplicate-timeout))
+ (if (time-less-p (or (gethash m erc-server-duplicates) 0)
+ (time-since erc-server-duplicate-timeout))
(erc-call-hooks process parsed-response))
(puthash m (erc-current-time) erc-server-duplicates))
;; Hand off to the relevant handler.
@@ -1281,7 +1285,7 @@ add things to `%s' instead."
(pcase-let ((`(,nick ,login ,host)
(erc-parse-user (erc-response.sender parsed))))
;; strip the stupid combined JOIN facility (IRC 2.9)
- (if (string-match "^\\(.*\\)?\^g.*$" chnl)
+ (if (string-match "^\\(.*\\)\^g.*$" chnl)
(setq chnl (match-string 1 chnl)))
(save-excursion
(let* ((str (cond
@@ -1441,7 +1445,7 @@ add things to `%s' instead."
"Handle pong messages." nil
(let ((time (string-to-number (erc-response.contents parsed))))
(when (> time 0)
- (setq erc-server-lag (erc-time-diff time (erc-current-time)))
+ (setq erc-server-lag (erc-time-diff time nil))
(when erc-verbose-server-ping
(erc-display-message
parsed 'notice proc 'PONG
@@ -1724,7 +1728,7 @@ See `erc-display-server-message'." nil
(cdr (erc-response.command-args parsed))))
(setq time (when on-since
(format-time-string erc-server-timestamp-format
- (erc-string-to-emacs-time on-since))))
+ (string-to-number on-since))))
(erc-update-user-nick nick nick nil nil nil
(and time (format "on since %s" time)))
(if time
@@ -1796,7 +1800,7 @@ See `erc-display-server-message'." nil
(define-erc-response-handler (329)
"Channel creation date." nil
(let ((channel (cadr (erc-response.command-args parsed)))
- (time (erc-string-to-emacs-time
+ (time (string-to-number
(nth 2 (erc-response.command-args parsed)))))
(erc-display-message
parsed 'notice (erc-get-buffer channel proc)
@@ -1838,7 +1842,7 @@ See `erc-display-server-message'." nil
(pcase-let ((`(,channel ,nick ,time)
(cdr (erc-response.command-args parsed))))
(setq time (format-time-string erc-server-timestamp-format
- (erc-string-to-emacs-time time)))
+ (string-to-number time)))
(erc-update-channel-topic channel
(format "\C-o (%s, %s)" nick time)
'append)
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index a381464b8cd..c2702081daf 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -49,7 +49,7 @@
"Define how text can be turned into clickable buttons."
:group 'erc)
-;;;###autoload (autoload 'erc-button-mode "erc-button" nil t)
+;;;###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)
@@ -59,11 +59,7 @@
((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)
- (when (featurep 'xemacs)
- (dolist (buffer (erc-buffer-list))
- (with-current-buffer buffer
- (kill-local-variable 'widget-button-face))))))
+ (remove-hook 'erc-mode-hook 'erc-button-setup)))
;;; Variables
@@ -121,9 +117,13 @@ longer than `erc-fill-column'."
:group 'erc-button
:type 'string)
-(defcustom erc-button-google-url "http://www.google.com/search?q=%s"
- "URL used to browse Google search references.
+(define-obsolete-variable-alias 'erc-button-google-url
+ 'erc-button-search-url "27.1")
+
+(defcustom erc-button-search-url "http://duckduckgo.com/?q=%s"
+ "URL used to search for a term.
%s is replaced by the search string."
+ :version "27.1"
:group 'erc-button
:type 'string)
@@ -148,7 +148,7 @@ longer than `erc-fill-column'."
("Lisp:\\([a-zA-Z.+-]+\\)" 0 t erc-browse-emacswiki-lisp 1)
("\\bGoogle:\\([^ \t\n\r\f]+\\)"
0 t (lambda (keywords)
- (browse-url (format erc-button-google-url keywords)))
+ (browse-url (format erc-button-search-url keywords)))
1)
("\\brfc[#: ]?\\([0-9]+\\)"
0 t (lambda (num)
@@ -214,9 +214,7 @@ PAR is a number of a regexp grouping whose text will be passed to
(defvar erc-button-keymap
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") 'erc-button-press-button)
- (if (featurep 'xemacs)
- (define-key map (kbd "<button2>") 'erc-button-click-button)
- (define-key map (kbd "<mouse-2>") 'erc-button-click-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)
@@ -251,8 +249,6 @@ global-level ERC button keys yet.")
(defun erc-button-setup ()
"Add ERC mode-level button movement keys. This is only done once."
;; Make XEmacs use `erc-button-face'.
- (when (featurep 'xemacs)
- (set (make-local-variable 'widget-button-face) nil))
;; Add keys.
(unless erc-button-keys-added
(define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous)
@@ -370,18 +366,7 @@ REGEXP is the regular expression which matched for this button."
(list 'erc-callback fun)
(list 'keymap erc-button-keymap)
(list 'rear-nonsticky t)
- (and data (list 'erc-data data))))
- (when (featurep 'xemacs)
- (widget-convert-button 'link from to :action 'erc-button-press-button
- :suppress-face t
- ;; Make XEmacs use our faces.
- :button-face (if nick-p
- erc-button-nickname-face
- erc-button-face)
- ;; Make XEmacs behave with mouse-clicks, for
- ;; some reason, widget stuff overrides the
- ;; 'keymap text-property.
- :mouse-down-action 'erc-button-click-button)))
+ (and data (list 'erc-data data)))))
(defun erc-button-add-face (from to face)
"Add FACE to the region between FROM and TO."
@@ -545,5 +530,6 @@ and `apropos' for other symbols."
;;; erc-button.el ends here
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: nil
;; End:
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
index fa7c83a194c..210a7736cc0 100644
--- a/lisp/erc/erc-capab.el
+++ b/lisp/erc/erc-capab.el
@@ -90,7 +90,7 @@ character not found in IRC nicknames to avoid confusion."
;;; Define module:
-;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t)
+;;;###autoload(autoload 'erc-capab-identify-mode "erc-capab" nil t)
(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'
@@ -207,3 +207,7 @@ PARSED is an `erc-parsed' response struct."
(provide 'erc-capab)
;;; erc-capab.el ends here
+
+;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
+;; End:
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index 243816d4c4d..aae0f09a2c5 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -29,7 +29,7 @@
(require 'format-spec)
-;;;###autoload (autoload 'erc-define-minor-mode "erc-compat")
+;;;###autoload(autoload 'erc-define-minor-mode "erc-compat")
(defalias 'erc-define-minor-mode 'define-minor-mode)
(put 'erc-define-minor-mode 'edebug-form-spec 'define-minor-mode)
@@ -71,17 +71,13 @@ See `erc-encoding-coding-alist'."
are placed.
Note that this should end with a directory separator.")
-;; XEmacs's `replace-match' does not replace matching subexpressions in strings.
(defun erc-replace-match-subexpression-in-string
(newtext string match subexp start &optional fixedcase literal)
"Replace the subexpression SUBEXP of the last match in STRING with NEWTEXT.
MATCH is the text which matched the subexpression (see `match-string').
START is the beginning position of the last match (see `match-beginning').
See `replace-match' for explanations of FIXEDCASE and LITERAL."
- (cond ((featurep 'xemacs)
- (string-match match string start)
- (replace-match newtext fixedcase literal string))
- (t (replace-match newtext fixedcase literal string subexp))))
+ (replace-match newtext fixedcase literal string subexp))
(defalias 'erc-with-selected-window 'with-selected-window)
(defalias 'erc-cancel-timer 'cancel-timer)
@@ -161,6 +157,7 @@ If START or END is negative, it counts from the end."
;;; erc-compat.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 2b41c8c705b..526add1a61f 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -47,16 +47,15 @@
;; /dcc get nick [file] - Accept DCC offer from nick
;; /dcc list - List all DCC offers/connections
;; /dcc send nick file - Offer DCC SEND to nick
-;;
-;; Please note that offering DCC connections (offering chats and sending
-;; files) is only supported with Emacs 22.
;;; Code:
(require 'erc)
-(eval-when-compile (require 'pcomplete))
+;; Strictly speaking, should only be needed at compile time.
+;; Require at run-time too to silence compiler.
+(require 'pcomplete)
-;;;###autoload (autoload 'erc-dcc-mode "erc-dcc")
+;;;###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))
@@ -222,14 +221,6 @@ which is big-endian."
(setq i (1- i)))
str))
-(defconst erc-most-positive-int-bytes
- (ceiling (/ (ceiling (/ (log most-positive-fixnum) (log 2))) 8.0))
- "Maximum number of bytes for a fixnum.")
-
-(defconst erc-most-positive-int-msb
- (lsh most-positive-fixnum (- 0 (* 8 (1- erc-most-positive-int-bytes))))
- "Content of the most significant byte of most-positive-fixnum.")
-
(defun erc-unpack-int (str)
"Unpack a packed string into an integer."
(let ((len (length str)))
@@ -240,16 +231,11 @@ which is big-endian."
(when (> start 0)
(setq str (substring str start))
(setq len (- len start))))
- ;; make sure size is not larger than Emacs can handle
- (when (or (> len (min 4 erc-most-positive-int-bytes))
- (and (eq len erc-most-positive-int-bytes)
- (> (aref str 0) erc-most-positive-int-msb)))
- (error "ERC-DCC (erc-unpack-int): packet to send is too large"))
;; unpack
(let ((num 0)
(count 0))
(while (< count len)
- (setq num (+ num (lsh (aref str (- len count 1)) (* 8 count))))
+ (setq num (+ num (ash (aref str (- len count 1)) (* 8 count))))
(setq count (1+ count)))
num)))
@@ -365,7 +351,6 @@ created subprocess, or nil."
:buffer nil
:host (erc-dcc-host)
:service port
- :nowait t
:noquery nil
:filter filter
:sentinel sentinel
@@ -433,23 +418,23 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
(when (fboundp 'make-network-process) '("send"))))
(pcomplete-here
(pcase (intern (downcase (pcomplete-arg 1)))
- (`chat (mapcar (lambda (elt) (plist-get elt :nick))
+ ('chat (mapcar (lambda (elt) (plist-get elt :nick))
(erc-remove-if-not
#'(lambda (elt)
(eq (plist-get elt :type) 'CHAT))
erc-dcc-list)))
- (`close (erc-delete-dups
+ ('close (erc-delete-dups
(mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
erc-dcc-list)))
- (`get (mapcar #'erc-dcc-nick
+ ('get (mapcar #'erc-dcc-nick
(erc-remove-if-not
#'(lambda (elt)
(eq (plist-get elt :type) 'GET))
erc-dcc-list)))
- (`send (pcomplete-erc-all-nicks))))
+ ('send (pcomplete-erc-all-nicks))))
(pcomplete-here
(pcase (intern (downcase (pcomplete-arg 2)))
- (`get (mapcar (lambda (elt) (plist-get elt :file))
+ ('get (mapcar (lambda (elt) (plist-get elt :file))
(erc-remove-if-not
#'(lambda (elt)
(and (eq (plist-get elt :type) 'GET)
@@ -457,13 +442,13 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
(plist-get elt :nick))
(pcomplete-arg 1))))
erc-dcc-list)))
- (`close (mapcar #'erc-dcc-nick
+ ('close (mapcar #'erc-dcc-nick
(erc-remove-if-not
#'(lambda (elt)
(eq (plist-get elt :type)
(intern (upcase (pcomplete-arg 1)))))
erc-dcc-list)))
- (`send (pcomplete-entries)))))
+ ('send (pcomplete-entries)))))
(defun erc-dcc-do-CHAT-command (proc &optional nick)
(when nick
@@ -649,9 +634,10 @@ that subcommand."
"\"\\(\\(.*?\\(\\\\\"\\)?\\)+?\\)\"\\|\\([^ ]+\\)"
"\\) \\([0-9]+\\) \\([0-9]+\\) *\\([0-9]*\\)"))
-(defsubst erc-dcc-unquote-filename (filename)
- (erc-replace-regexp-in-string "\\\\\\\\" "\\"
- (erc-replace-regexp-in-string "\\\\\"" "\"" filename t t) t t))
+(define-inline erc-dcc-unquote-filename (filename)
+ (inline-quote
+ (erc-replace-regexp-in-string "\\\\\\\\" "\\"
+ (erc-replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t)))
(defun erc-dcc-handle-ctcp-send (proc query nick login host to)
"This is called if a CTCP DCC SEND subcommand is sent to the client.
@@ -780,8 +766,8 @@ unconfirmed."
:group 'erc-dcc
:type '(choice (const nil) integer))
-(defsubst erc-dcc-get-parent (proc)
- (plist-get (erc-dcc-member :peer proc) :parent))
+(define-inline erc-dcc-get-parent (proc)
+ (inline-quote (plist-get (erc-dcc-member :peer ,proc) :parent)))
(defun erc-dcc-send-block (proc)
"Send one block of data.
@@ -824,8 +810,8 @@ bytes sent."
?s (number-to-string (- sent-marker (point-min))))
(setq erc-dcc-list (delete elt erc-dcc-list))
(set-buffer-modified-p nil)
- (kill-buffer (current-buffer))
- (delete-process proc))
+ (delete-process proc)
+ (kill-buffer (current-buffer)))
((<= confirmed-marker sent-marker)
(while (and (< (- sent-marker confirmed-marker)
(or erc-dcc-pump-bytes
@@ -838,8 +824,8 @@ bytes sent."
(marker-position confirmed-marker)
(marker-position sent-marker)))
(set-buffer-modified-p nil)
- (kill-buffer (current-buffer))
- (delete-process proc))))))
+ (delete-process proc)
+ (kill-buffer (current-buffer)))))))
(defun erc-dcc-display-send (proc)
(erc-display-message
@@ -931,10 +917,7 @@ filter and a process sentinel, and making the connection."
(buffer-disable-undo (current-buffer))
;; This is necessary to have the buffer saved as-is in GNU
;; Emacs.
- ;; XEmacs change: We don't have `set-buffer-multibyte', setting
- ;; coding system to 'binary below takes care of us.
- (when (fboundp 'set-buffer-multibyte)
- (set-buffer-multibyte nil))
+ (set-buffer-multibyte nil)
(setq mode-line-process '(":%s")
buffer-read-only t)
@@ -989,8 +972,9 @@ rather than every 1024 byte block, but nobody seems to care."
(let ((inhibit-read-only t)
received-bytes)
(goto-char (point-max))
- (if str
- (insert (string-make-unibyte str)))
+ (when str
+ (cl-assert (not (multibyte-string-p str)))
+ (insert str))
(when (> (point-max) erc-dcc-receive-cache)
(erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
@@ -1034,7 +1018,7 @@ transfer is complete."
?s (number-to-string erc-dcc-byte-count)
?t (format "%.0f"
(erc-time-diff (plist-get erc-dcc-entry-data :start-time)
- (erc-current-time)))))
+ nil))))
(kill-buffer (process-buffer proc))
(delete-process proc))
@@ -1094,14 +1078,14 @@ Possible values are: ask, auto, ignore."
(pcomplete-here '("auto" "ask" "ignore")))
(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")
+
(defvar erc-dcc-chat-filter-functions '(erc-dcc-chat-parse-output)
"Abnormal hook run after parsing (and maybe inserting) a DCC message.
Each function is called with two arguments: the ERC process and
the unprocessed output.")
-(define-obsolete-variable-alias 'erc-dcc-chat-filter-hook
- 'erc-dcc-chat-filter-functions "24.3")
-
(defvar erc-dcc-chat-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") 'erc-send-current-line)
@@ -1260,5 +1244,6 @@ other client."
;;; erc-dcc.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: nil
;; End:
diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el
index 66f27d92ebb..41b7420320c 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -1,4 +1,4 @@
-;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions
+;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions -*- lexical-binding:t -*-
;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
@@ -59,13 +59,19 @@
This will replace the last notification sent with this function."
(dbus-ignore-errors
(setq erc-notifications-last-notification
- (notifications-notify :bus erc-notifications-bus
- :title (xml-escape-string nick)
- :body (xml-escape-string msg)
- :replaces-id erc-notifications-last-notification
- :app-icon erc-notifications-icon))))
-
-(defun erc-notifications-PRIVMSG (proc parsed)
+ (let ((channel (current-buffer)))
+ (notifications-notify :bus erc-notifications-bus
+ :title (format "%s in %s"
+ (xml-escape-string nick)
+ channel)
+ :body (xml-escape-string msg)
+ :replaces-id erc-notifications-last-notification
+ :app-icon erc-notifications-icon
+ :actions '("default" "Switch to buffer")
+ :on-action (lambda (&rest _)
+ (pop-to-buffer channel)))))))
+
+(defun erc-notifications-PRIVMSG (_proc parsed)
(let ((nick (car (erc-parse-user (erc-response.sender parsed))))
(target (car (erc-response.command-args parsed)))
(msg (erc-response.contents parsed)))
@@ -98,3 +104,7 @@ This will replace the last notification sent with this function."
(provide 'erc-desktop-notifications)
;;; erc-desktop-notifications.el ends here
+
+;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
+;; End:
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
index 520ee2ddf17..a2c9336826a 100644
--- a/lisp/erc/erc-ezbounce.el
+++ b/lisp/erc/erc-ezbounce.el
@@ -175,3 +175,7 @@ in the alist is nil, prompt for the appropriate values."
(provide 'erc-ezbounce)
;;; erc-ezbounce.el ends here
+
+;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
+;; End:
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
index 36187256dc7..934b52a938c 100644
--- a/lisp/erc/erc-fill.el
+++ b/lisp/erc/erc-fill.el
@@ -37,7 +37,7 @@
"Filling means to reformat long lines in different ways."
:group 'erc)
-;;;###autoload (autoload 'erc-fill-mode "erc-fill" nil t)
+;;;###autoload(autoload 'erc-fill-mode "erc-fill" nil t)
(erc-define-minor-mode erc-fill-mode
"Toggle ERC fill mode.
With a prefix argument ARG, enable ERC fill mode if ARG is
@@ -193,5 +193,6 @@ You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
;;; erc-fill.el ends here
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: nil
;; End:
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 117b6783b8d..5e7946810be 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -177,18 +177,20 @@ 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-send-pre-hook 'erc-send-distinguish-noncommands))
- ((remove-hook 'erc-send-pre-hook '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 (str)
- "If STR is an ERC non-command, set `erc-insert-this' to nil."
- (let* ((command (erc-extract-command-from-line str))
+(defun erc-send-distinguish-noncommands (state)
+ "If STR is an ERC non-command, set `insertp' in STATE to nil."
+ (let* ((string (erc-input-string state))
+ (command (erc-extract-command-from-line string))
(cmd-fun (and command
(car command))))
(when (and cmd-fun
- (not (string-match "\n.+$" str))
+ (not (string-match "\n.+$" string))
(memq cmd-fun erc-noncommands-list))
- (setq erc-insert-this nil))))
+ ;; Inhibit sending this string.
+ (setf (erc-input-insertp state) nil))))
;;; IRC control character processing.
(defgroup erc-control-characters nil
@@ -548,7 +550,7 @@ channel that has weird people talking in morse to each other.
See also `unmorse-region'."
(goto-char (point-min))
- (when (re-search-forward "[.-]+\\([.-]*/? *\\)+[.-]+/?" nil t)
+ (when (re-search-forward "[.-]+[./ -]*[.-]/?" nil t)
(save-restriction
(narrow-to-region (match-beginning 0) (match-end 0))
;; Turn " / " into " "
diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el
index 385410496a5..d95e0eac0c7 100644
--- a/lisp/erc/erc-identd.el
+++ b/lisp/erc/erc-identd.el
@@ -55,7 +55,7 @@ This can be either a string or a number."
(integer :tag "Port number")
(string :tag "Port string")))
-;;;###autoload (autoload 'erc-identd-mode "erc-identd")
+;;;###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)
@@ -115,6 +115,7 @@ The default port is specified by `erc-identd-port'."
;;; erc-identd.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el
index be8e0b07235..08f52f13647 100644
--- a/lisp/erc/erc-imenu.el
+++ b/lisp/erc/erc-imenu.el
@@ -131,6 +131,7 @@ Don't rely on this function, read it first!"
;;; erc-imenu.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 83f7a045575..c292fdbd797 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -39,7 +39,7 @@
"Enable autojoining."
:group 'erc)
-;;;###autoload (autoload 'erc-autojoin-mode "erc-join" nil t)
+;;;###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)
@@ -161,6 +161,10 @@ This function is run from `erc-nickserv-identified-hook'."
;; Only auto-join the channels that we aren't already in
;; using a different nick.
(when (or (not buffer)
+ ;; If the same channel is joined on another
+ ;; server the best-effort is to just join
+ (not (string-match (car l)
+ (process-name erc-server-process)))
(not (with-current-buffer buffer
(erc-server-process-alive))))
(erc-server-join-channel server chan))))))))
@@ -215,6 +219,7 @@ This function is run from `erc-nickserv-identified-hook'."
;;; erc-join.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el
index f354ff5ae09..d8d9e17c95a 100644
--- a/lisp/erc/erc-list.el
+++ b/lisp/erc/erc-list.el
@@ -55,7 +55,7 @@
(defvar erc-list-server-buffer nil)
;; Define module:
-;;;###autoload (autoload 'erc-list-mode "erc-list")
+;;;###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)
@@ -225,6 +225,7 @@ to RFC and send the LIST header (#321) at start of list transmission."
;;; erc-list.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 59d157576dc..1c046fe20cb 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -122,7 +122,7 @@ custom function which returns the directory part and set
(function :tag "Other function")))
(defcustom erc-truncate-buffer-on-save nil
- "Truncate any ERC (channel, query, server) buffer when it is saved."
+ "Erase the contents of any ERC (channel, query, server) buffer when it is saved."
:group 'erc-log
:type 'boolean)
@@ -195,9 +195,7 @@ If you set this to nil, you may want to enable both
:group 'erc-log
:type 'boolean)
-(defcustom erc-log-file-coding-system (if (featurep 'xemacs)
- 'binary
- 'emacs-mule)
+(defcustom erc-log-file-coding-system 'emacs-mule
"The coding system ERC should use for writing log files.
This should ideally, be a \"catch-all\" coding system, like
@@ -215,7 +213,7 @@ The function should take one argument, which is the text to filter."
(const :tag "No filtering" nil)))
-;;;###autoload (autoload 'erc-log-mode "erc-log" nil t)
+;;;###autoload(autoload 'erc-log-mode "erc-log" nil t)
(define-erc-module log nil
"Automatically logs things you receive on IRC into files.
Files are stored in `erc-log-channels-directory'; file name
@@ -344,18 +342,19 @@ If BUFFER is nil, the value of `current-buffer' is used.
This is determined by `erc-generate-log-file-name-function'.
The result is converted to lowercase, as IRC is case-insensitive"
(unless buffer (setq buffer (current-buffer)))
- (let ((target (or (buffer-name buffer) (erc-default-target)))
- (nick (erc-current-nick))
- (server erc-session-server)
- (port erc-session-port))
- (expand-file-name
- (erc-log-standardize-name
- (funcall erc-generate-log-file-name-function
- buffer target nick server port))
- (if (functionp erc-log-channels-directory)
- (funcall erc-log-channels-directory
- buffer target nick server port)
- erc-log-channels-directory))))
+ (with-current-buffer buffer
+ (let ((target (or (buffer-name buffer) (erc-default-target)))
+ (nick (erc-current-nick))
+ (server erc-session-server)
+ (port erc-session-port))
+ (expand-file-name
+ (erc-log-standardize-name
+ (funcall erc-generate-log-file-name-function
+ buffer target nick server port))
+ (if (functionp erc-log-channels-directory)
+ (funcall erc-log-channels-directory
+ buffer target nick server port)
+ erc-log-channels-directory)))))
(defun erc-generate-log-file-name-with-date (buffer &rest ignore)
"This function computes a short log file name.
@@ -456,6 +455,7 @@ You can save every individual message by putting this function on
;;; erc-log.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 250266c82e6..cc4b4a88f11 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -44,7 +44,7 @@ Group containing all things concerning pattern matching in ERC
messages."
:group 'erc)
-;;;###autoload (autoload 'erc-match-mode "erc-match")
+;;;###autoload(autoload 'erc-match-mode "erc-match")
(define-erc-module match nil
"This mode checks whether messages match certain patterns. If so,
they are hidden or highlighted. This is controlled via the variables
@@ -601,7 +601,7 @@ See `erc-log-match-format'."
'timestamp))))
(away-time (erc-emacs-time-to-erc-time (erc-away-time))))
(when (and away-time last-msg-time
- (erc-time-gt last-msg-time away-time))
+ (time-less-p away-time last-msg-time))
(erc-display-message
nil 'notice 'active
(format "You have logged messages waiting in \"%s\"."
@@ -648,6 +648,7 @@ This function is meant to be called from `erc-text-matched-hook'."
;;; erc-match.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index 5696306342c..17e36984ea6 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -107,7 +107,7 @@
"Internal variable used to keep track of whether we've defined the
ERC menu yet.")
-;;;###autoload (autoload 'erc-menu-mode "erc-menu" nil t)
+;;;###autoload(autoload 'erc-menu-mode "erc-menu" nil t)
(define-erc-module menu nil
"Enable a menu in ERC buffers."
((unless erc-menu-defined
@@ -115,22 +115,10 @@ ERC menu yet.")
;; activates it immediately
(easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
(setq erc-menu-defined t))
- (if (featurep 'xemacs)
- (progn
- ;; the menu isn't automatically added to the menu bar in
- ;; XEmacs
- (add-hook 'erc-mode-hook 'erc-menu-add)
- (dolist (buffer (erc-buffer-list))
- (with-current-buffer buffer (erc-menu-add))))
- (erc-menu-add)))
- ((if (featurep 'xemacs)
- (progn
- (remove-hook 'erc-mode-hook 'erc-menu-add)
- (dolist (buffer (erc-buffer-list))
- (with-current-buffer buffer (erc-menu-remove))))
- (erc-menu-remove)
- ;; `easy-menu-remove' is a no-op in Emacs 22
- (message "You might have to restart Emacs to remove the ERC menu"))))
+ (erc-menu-add))
+ ((erc-menu-remove)
+ ;; `easy-menu-remove' is a no-op in Emacs 22
+ (message "You might have to restart Emacs to remove the ERC menu")))
;; silence byte-compiler warning
(defvar erc-menu)
@@ -148,6 +136,7 @@ ERC menu yet.")
;;; erc-menu.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index a2f271f2f4b..87c3a61b663 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -38,7 +38,7 @@ netsplit happens, and filters the QUIT messages. It also keeps
track of netsplits, so that it can filter the JOIN messages on a netjoin too."
:group 'erc)
-;;;###autoload (autoload 'erc-netsplit-mode "erc-netsplit")
+;;;###autoload(autoload 'erc-netsplit-mode "erc-netsplit")
(define-erc-module netsplit nil
"This mode hides quit/join messages if a netsplit occurs."
((erc-netsplit-install-message-catalogs)
@@ -205,6 +205,7 @@ join from that split has been detected or not.")
;;; erc-netsplit.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index 19045a6d1bf..45dae899900 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -92,7 +92,7 @@ strings."
(notify_on . "Detected %n on IRC network %m")
(notify_off . "%n has left IRC network %m"))))
-;;;###autoload (autoload 'erc-notify-mode "erc-notify" nil t)
+;;;###autoload(autoload 'erc-notify-mode "erc-notify" nil t)
(define-erc-module notify nil
"Periodically check for the online status of certain users and report
changes."
@@ -253,6 +253,7 @@ with args, toggle notify status of people."
;;; erc-notify.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index 7f1378c7243..cb57883ae6f 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -30,7 +30,7 @@
(require 'erc)
-;;;###autoload (autoload 'erc-page-mode "erc-page")
+;;;###autoload(autoload 'erc-page-mode "erc-page")
(define-erc-module page ctcp-page
"Process CTCP PAGE requests from IRC."
nil nil)
@@ -107,6 +107,7 @@ receive pages if `erc-page-mode' is on."
;;; erc-page.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
index a67787fb6f9..dd2da85d0e8 100644
--- a/lisp/erc/erc-pcomplete.el
+++ b/lisp/erc/erc-pcomplete.el
@@ -60,7 +60,7 @@ the most recent speakers are listed first."
:group 'erc-pcomplete
:type 'boolean)
-;;;###autoload (autoload 'erc-completion-mode "erc-pcomplete" nil t)
+;;;###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)
@@ -284,5 +284,6 @@ up to where point is right now."
;;; erc-pcomplete.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: nil
;; End:
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index 80ff99cc975..2e0e54a030f 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -77,7 +77,7 @@ It replaces text according to `erc-replace-alist'."
(eval to))))))
erc-replace-alist))
-;;;###autoload (autoload 'erc-replace-mode "erc-replace")
+;;;###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
@@ -90,6 +90,7 @@ It replaces text according to `erc-replace-alist'."
;;; erc-replace.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el
index 8ec9f8ffa25..453e234a37a 100644
--- a/lisp/erc/erc-ring.el
+++ b/lisp/erc/erc-ring.el
@@ -42,14 +42,14 @@
"An input ring for ERC."
:group 'erc)
-;;;###autoload (autoload 'erc-ring-mode "erc-ring" nil t)
+;;;###autoload(autoload 'erc-ring-mode "erc-ring" nil t)
(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-send-pre-hook 'erc-add-to-input-ring)
+ ((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-send-pre-hook 'erc-add-to-input-ring)
+ ((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)))
@@ -71,10 +71,10 @@ Call this function when setting up the mode."
(setq erc-input-ring (make-ring comint-input-ring-size)))
(setq erc-input-ring-index nil))
-(defun erc-add-to-input-ring (s)
+(defun erc-add-to-input-ring (state)
"Add string S to the input ring and reset history position."
(unless erc-input-ring (erc-input-ring-setup))
- (ring-insert erc-input-ring s)
+ (ring-insert erc-input-ring (erc-input-string state))
(setq erc-input-ring-index nil))
(defun erc-clear-input-ring ()
@@ -146,5 +146,6 @@ containing a password."
;;; erc-ring.el ends here
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: nil
;; End:
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index b6bceff205c..886ba60eb47 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -1,4 +1,4 @@
-;;; erc-services.el --- Identify to NickServ
+;;; erc-services.el --- Identify to NickServ -*- lexical-binding:t -*-
;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
@@ -89,7 +89,7 @@ Possible settings are:.
latter.
nil - Disables automatic Nickserv identification.
-You can also use M-x erc-nickserv-identify-mode to change modes."
+You can also use \\[erc-nickserv-identify-mode] to change modes."
:group 'erc-services
:type '(choice (const autodetect)
(const nick-change)
@@ -101,7 +101,7 @@ You can also use M-x erc-nickserv-identify-mode to change modes."
(when (featurep 'erc-services)
(erc-nickserv-identify-mode val))))
-;;;###autoload (autoload 'erc-services-mode "erc-services" nil t)
+;;;###autoload(autoload 'erc-services-mode "erc-services" nil t)
(define-erc-module services nickserv
"This mode automates communication with services."
((erc-nickserv-identify-mode erc-nickserv-identify-mode))
@@ -214,7 +214,7 @@ Example of use:
"identify" nil nil nil)
(Azzurra
"NickServ!service@azzurra.org"
- "/ns\\s-IDENTIFY\\s-password"
+ "\^B/ns\\s-IDENTIFY\\s-password\^B"
"NickServ"
"IDENTIFY" nil nil nil)
(BitlBee
@@ -223,7 +223,7 @@ Example of use:
"identify" nil nil nil)
(BRASnet
"NickServ!services@brasnet.org"
- "/NickServ\\s-IDENTIFY\\s-senha"
+ "\^B/NickServ\\s-IDENTIFY\\s-\^_senha\^_\^B"
"NickServ"
"IDENTIFY" nil "" nil)
(DALnet
@@ -262,7 +262,7 @@ Example of use:
nil
"NickServ"
"IDENTIFY" nil nil
- "You\\s-are\\s-successfully\\s-identified\\s-as\\s-")
+ "You\\s-are\\s-successfully\\s-identified\\s-as\\s-\^B")
(Rizon
"NickServ!service@rizon.net"
"This\\s-nickname\\s-is\\s-registered\\s-and\\s-protected."
@@ -275,7 +275,7 @@ Example of use:
"auth" t nil nil)
(SlashNET
"NickServ!services@services.slashnet.org"
- "/msg\\s-NickServ\\s-IDENTIFY\\s-password"
+ "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
"NickServ@services.slashnet.org"
"IDENTIFY" nil nil nil))
"Alist of NickServer details, sorted by network.
@@ -312,26 +312,33 @@ The last two elements are optional."
(const :tag "Do not try to detect success" nil)))))
-(defsubst erc-nickserv-alist-sender (network &optional entry)
- (nth 1 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-sender (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 1 (or ,entry (assoc ,network erc-nickserv-alist))))))
-(defsubst erc-nickserv-alist-regexp (network &optional entry)
- (nth 2 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-regexp (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 2 (or ,entry (assoc ,network erc-nickserv-alist))))))
-(defsubst erc-nickserv-alist-nickserv (network &optional entry)
- (nth 3 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-nickserv (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 3 (or ,entry (assoc ,network erc-nickserv-alist))))))
-(defsubst erc-nickserv-alist-ident-keyword (network &optional entry)
- (nth 4 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-ident-keyword (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 4 (or ,entry (assoc ,network erc-nickserv-alist))))))
-(defsubst erc-nickserv-alist-use-nick-p (network &optional entry)
- (nth 5 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-use-nick-p (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 5 (or ,entry (assoc ,network erc-nickserv-alist))))))
-(defsubst erc-nickserv-alist-ident-command (network &optional entry)
- (nth 6 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-ident-command (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 6 (or ,entry (assoc ,network erc-nickserv-alist))))))
-(defsubst erc-nickserv-alist-identified-regexp (network &optional entry)
- (nth 7 (or entry (assoc network erc-nickserv-alist))))
+(define-inline erc-nickserv-alist-identified-regexp (network &optional entry)
+ (inline-letevals (network entry)
+ (inline-quote (nth 7 (or ,entry (assoc ,network erc-nickserv-alist))))))
;; Functions:
@@ -341,7 +348,7 @@ Hooks are called with arguments (NETWORK NICK)."
:group 'erc-services
:type 'hook)
-(defun erc-nickserv-identification-autodetect (proc parsed)
+(defun erc-nickserv-identification-autodetect (_proc parsed)
"Check for NickServ's successful identification notice.
Make sure it is the real NickServ for this network and that it has
specifically confirmed a successful identification attempt.
@@ -361,7 +368,7 @@ If this is the case, run `erc-nickserv-identified-hook'."
(run-hook-with-args 'erc-nickserv-identified-hook network nick)
nil)))
-(defun erc-nickserv-identify-autodetect (proc parsed)
+(defun erc-nickserv-identify-autodetect (_proc parsed)
"Identify to NickServ when an identify request is received.
Make sure it is the real NickServ for this network.
If `erc-prompt-for-nickserv-password' is non-nil, prompt the user for the
@@ -383,7 +390,7 @@ password for this nickname, otherwise try to send it automatically."
(erc-nickserv-call-identify-function nick)
nil))))
-(defun erc-nickserv-identify-on-connect (server nick)
+(defun erc-nickserv-identify-on-connect (_server nick)
"Identify to Nickserv after the connection to the server is established."
(unless (or (and (null erc-nickserv-passwords)
(null erc-prompt-for-nickserv-password))
@@ -391,7 +398,7 @@ password for this nickname, otherwise try to send it automatically."
(erc-nickserv-alist-regexp (erc-network))))
(erc-nickserv-call-identify-function nick)))
-(defun erc-nickserv-identify-on-nick-change (nick old-nick)
+(defun erc-nickserv-identify-on-nick-change (nick _old-nick)
"Identify to Nickserv whenever your nick changes."
(unless (or (and (null erc-nickserv-passwords)
(null erc-prompt-for-nickserv-password))
@@ -400,9 +407,9 @@ password for this nickname, otherwise try to send it automatically."
(erc-nickserv-call-identify-function nick)))
(defun erc-nickserv-call-identify-function (nickname)
- "Call `erc-nickserv-identify' interactively or run it with NICKNAME's
-password.
-The action is determined by the value of `erc-prompt-for-nickserv-password'."
+ "Call `erc-nickserv-identify'.
+Either call it interactively or run it with NICKNAME's password,
+depending on the value of `erc-prompt-for-nickserv-password'."
(if erc-prompt-for-nickserv-password
(call-interactively 'erc-nickserv-identify)
(when erc-nickserv-passwords
@@ -411,6 +418,8 @@ The action is determined by the value of `erc-prompt-for-nickserv-password'."
(nth 1 (assoc (erc-network)
erc-nickserv-passwords))))))))
+(defvar erc-auto-discard-away)
+
;;;###autoload
(defun erc-nickserv-identify (password)
"Send an \"identify <PASSWORD>\" message to NickServ.
@@ -444,6 +453,7 @@ When called interactively, read the password using `read-passwd'."
;;; erc-services.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el
index 984ff49d43f..34f7ce62c74 100644
--- a/lisp/erc/erc-sound.el
+++ b/lisp/erc/erc-sound.el
@@ -46,7 +46,7 @@
(require 'erc)
-;;;###autoload (autoload 'erc-sound-mode "erc-sound")
+;;;###autoload(autoload 'erc-sound-mode "erc-sound")
(define-erc-module sound ctcp-sound
"In ERC sound mode, the client will respond to CTCP SOUND requests
and play sound files as requested."
@@ -145,6 +145,7 @@ See also `play-sound-file'."
;;; erc-sound.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index 0324383300b..8d56c85bec4 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@delysid.org>
-;; Contributor: Eric M. Ludlam <eric@siege-engine.com>
+;; Contributor: Eric M. Ludlam <zappo@gnu.org>
;; Maintainer: emacs-devel@gnu.org
;; This file is part of GNU Emacs.
@@ -140,7 +140,7 @@ This will add a speedbar major display mode."
t))))
(defun erc-speedbar-expand-server (text server indent)
- (cond ((string-match "+" text)
+ (cond ((string-match "\\+" text)
(speedbar-change-expand-button-char ?-)
(if (speedbar-with-writable
(save-excursion
@@ -185,7 +185,7 @@ This will add a speedbar major display mode."
"For the line matching TEXT, in CHANNEL, expand or contract a line.
INDENT is the current indentation level."
(cond
- ((string-match "+" text)
+ ((string-match "\\+" text)
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
@@ -285,7 +285,7 @@ is only done when the channel is actually expanded already."
(erc-speedbar-expand-channel "+" buffer 1)))))
(defun erc-speedbar-expand-user (text token indent)
- (cond ((string-match "+" text)
+ (cond ((string-match "\\+" text)
(speedbar-change-expand-button-char ?-)
(speedbar-with-writable
(save-excursion
@@ -361,6 +361,7 @@ The INDENT level is ignored."
;;; erc-speedbar.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
index cc519b28da5..69a83fa032b 100644
--- a/lisp/erc/erc-spelling.el
+++ b/lisp/erc/erc-spelling.el
@@ -33,7 +33,7 @@
(require 'erc)
(require 'flyspell)
-;;;###autoload (autoload 'erc-spelling-mode "erc-spelling" nil t)
+;;;###autoload(autoload 'erc-spelling-mode "erc-spelling" nil t)
(define-erc-module spelling nil
"Enable flyspell mode in ERC buffers."
;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is
@@ -109,3 +109,7 @@ The cadr is the beginning and the caddr is the end."
(provide 'erc-spelling)
;;; erc-spelling.el ends here
+
+;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
+;; End:
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 4495883734f..b48803452a2 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -158,7 +158,7 @@ from entering them and instead jump over them."
"ERC timestamp face."
:group 'erc-faces)
-;;;###autoload (autoload 'erc-timestamp-mode "erc-stamp" nil t)
+;;;###autoload(autoload 'erc-timestamp-mode "erc-stamp" nil t)
(define-erc-module stamp timestamp
"This mode timestamps messages in the channel buffers."
((add-hook 'erc-mode-hook #'erc-munge-invisibility-spec)
@@ -227,14 +227,10 @@ the correct column."
(integer :tag "Column number")
(const :tag "Unspecified" nil)))
-(defcustom erc-timestamp-use-align-to (and (not (featurep 'xemacs))
- (>= emacs-major-version 22)
- (eq window-system 'x))
+(defcustom erc-timestamp-use-align-to (eq window-system 'x)
"If non-nil, use the :align-to display property to align the stamp.
This gives better results when variable-width characters (like
Asian language characters and math symbols) precede a timestamp.
-Unfortunately, it only works in Emacs 22 and when using the X
-Window System.
A side effect of enabling this is that there will only be one
space before a right timestamp in any saved logs."
@@ -417,6 +413,7 @@ enabled when the message was inserted."
;;; erc-stamp.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index d53668e2666..53a59207839 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -267,22 +267,12 @@ nil - don't add to mode line."
(defun erc-modified-channels-object (strings)
"Generate a new `erc-modified-channels-object' based on STRINGS."
(if strings
- (if (featurep 'xemacs)
- (let ((e-m-c-s '("[")))
- (push (cons (extent-at 0 (car strings)) (car strings))
- e-m-c-s)
- (dolist (string (cdr strings))
- (push "," e-m-c-s)
- (push (cons (extent-at 0 string) string)
- e-m-c-s))
- (push "] " e-m-c-s)
- (reverse e-m-c-s))
- (concat (if (eq erc-track-position-in-mode-line 'after-modes)
- "[" " [")
- (mapconcat 'identity (nreverse strings) ",")
- (if (eq erc-track-position-in-mode-line 'before-modes)
- "] " "]")))
- (if (featurep 'xemacs) '() "")))
+ (concat (if (eq erc-track-position-in-mode-line 'after-modes)
+ "[" " [")
+ (mapconcat 'identity (nreverse strings) ",")
+ (if (eq erc-track-position-in-mode-line 'before-modes)
+ "] " "]"))
+ ""))
(defvar erc-modified-channels-object (erc-modified-channels-object nil)
"Internal object used for displaying modified channels in the mode line.")
@@ -495,9 +485,6 @@ START is the minimum length of the name used."
;;;###autoload
(define-minor-mode erc-track-minor-mode
"Toggle mode line display of ERC activity (ERC Track minor mode).
-With a prefix argument ARG, enable ERC Track minor mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
ERC Track minor mode is a global minor mode. It exists for the
sole purpose of providing the C-c C-SPC and C-c C-@ keybindings.
@@ -542,27 +529,20 @@ keybindings will not do anything useful."
;;; Module
-;;;###autoload (autoload 'erc-track-mode "erc-track" nil t)
+;;;###autoload(autoload 'erc-track-mode "erc-track" nil t)
(define-erc-module track nil
"This mode tracks ERC channel buffers with activity."
;; Enable:
((when (boundp 'erc-track-when-inactive)
(if erc-track-when-inactive
(progn
- (if (featurep 'xemacs)
- (defadvice switch-to-buffer (after erc-update-when-inactive
- (&rest args) activate)
- (erc-user-is-active))
- (add-hook 'window-configuration-change-hook '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)
- (if (featurep 'xemacs)
- (defadvice switch-to-buffer (after erc-update (&rest args) activate)
- (erc-modified-channels-update))
- (add-hook 'window-configuration-change-hook
- 'erc-window-configuration-change))
+ (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))
;; enable the tracking keybindings
@@ -573,18 +553,13 @@ keybindings will not do anything useful."
(erc-track-remove-from-mode-line)
(if erc-track-when-inactive
(progn
- (if (featurep 'xemacs)
- (ad-disable-advice 'switch-to-buffer 'after
- 'erc-update-when-inactive)
- (remove-hook 'window-configuration-change-hook
- 'erc-user-is-active))
+ (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))
- (if (featurep 'xemacs)
- (ad-disable-advice 'switch-to-buffer 'after 'erc-update)
- (remove-hook 'window-configuration-change-hook
- 'erc-window-configuration-change))
+ (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))
;; disable the tracking keybindings
@@ -633,8 +608,8 @@ only consider active buffers visible.")
(if erc-track-when-inactive
(when erc-buffer-activity; could be nil
(and (erc-track-get-buffer-window buffer erc-track-visibility)
- (<= (erc-time-diff erc-buffer-activity (erc-current-time))
- erc-buffer-activity-timeout)))
+ (not (time-less-p erc-buffer-activity-timeout
+ (erc-time-diff erc-buffer-activity nil)))))
(erc-track-get-buffer-window buffer erc-track-visibility)))
;;; Tracking the channel modifications
@@ -643,7 +618,7 @@ only consider active buffers visible.")
(unless (minibuffer-window-active-p (minibuffer-window))
;; delay this until command has finished to make sure window is
;; actually visible before clearing activity
- (add-hook 'post-command-hook 'erc-modified-channels-update)))
+ (erc-modified-channels-update)))
(defvar erc-modified-channels-update-inside nil
"Variable to prevent running `erc-modified-channels-update' multiple
@@ -672,12 +647,9 @@ ARGS are ignored."
(erc-modified-channels-remove-buffer buffer))))
erc-modified-channels-alist)
(when removed-channel
- (erc-modified-channels-display)))
- (remove-hook 'post-command-hook 'erc-modified-channels-update)))
+ (erc-modified-channels-display)))))
-(defvar erc-track-mouse-face (if (featurep 'xemacs)
- 'modeline-mousable
- 'mode-line-highlight)
+(defvar erc-track-mouse-face 'mode-line-highlight
"The face to use when mouse is over channel names in the mode line.")
(defun erc-make-mode-line-buffer-name (string buffer &optional faces count)
@@ -932,14 +904,14 @@ relative to `erc-track-switch-direction'"
offset)
(when (< arg 0)
(setq dir (pcase dir
- (`oldest 'newest)
- (`newest 'oldest)
- (`mostactive 'leastactive)
- (`leastactive 'mostactive)
- (`importance 'oldest)))
+ ('oldest 'newest)
+ ('newest 'oldest)
+ ('mostactive 'leastactive)
+ ('leastactive 'mostactive)
+ ('importance 'oldest)))
(setq arg (- arg)))
(setq offset (pcase dir
- ((or `oldest `leastactive)
+ ((or 'oldest 'leastactive)
(- (length erc-modified-channels-alist) arg))
(_ (1- arg))))
;; normalize out of range user input
@@ -974,6 +946,7 @@ switch back to the last non-ERC buffer visited. Next is defined by
;;; erc-track.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el
index 7ff99c8dc4f..04174295520 100644
--- a/lisp/erc/erc-truncate.el
+++ b/lisp/erc/erc-truncate.el
@@ -43,7 +43,7 @@ Used only when auto-truncation is enabled.
:group 'erc-truncate
:type 'integer)
-;;;###autoload (autoload 'erc-truncate-mode "erc-truncate" nil t)
+;;;###autoload(autoload 'erc-truncate-mode "erc-truncate" nil t)
(define-erc-module truncate nil
"Truncate a query buffer if it gets too large.
This prevents the query buffer from getting too large, which can
@@ -112,6 +112,7 @@ Meant to be used in hooks, like `erc-insert-post-hook'."
;;; erc-truncate.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el
index 07e7ac1be16..162b22e15c6 100644
--- a/lisp/erc/erc-xdcc.el
+++ b/lisp/erc/erc-xdcc.el
@@ -61,7 +61,7 @@ being evaluated and should return strings."
:group 'erc-dcc
:type '(repeat (repeat :tag "Message" (choice string sexp))))
-;;;###autoload (autoload 'erc-xdcc-mode "erc-xdcc")
+;;;###autoload(autoload 'erc-xdcc-mode "erc-xdcc")
(define-erc-module xdcc nil
"Act as an XDCC file-server."
nil nil)
@@ -133,6 +133,7 @@ being evaluated and should return strings."
;;; erc-xdcc.el ends here
;;
;; Local Variables:
+;; generated-autoload-file: "erc-loaddefs.el"
;; indent-tabs-mode: t
;; tab-width: 8
;; End:
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index feee89d7fea..f5c9decc3a2 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -62,17 +62,17 @@
;;; History:
;;
-(defconst erc-version-string (format "\C-bERC\C-b (IRC client for Emacs %s)" emacs-version)
- "ERC version. This is used by function `erc-version'.")
-
;;; Code:
+(load "erc-loaddefs" nil t)
+
(eval-when-compile (require 'cl-lib))
(require 'font-lock)
(require 'pp)
(require 'thingatpt)
(require 'auth-source)
(require 'erc-compat)
+(eval-when-compile (require 'subr-x))
(defvar erc-official-location
"https://www.emacswiki.org/emacs/ERC (mailing list: erc-discuss@gnu.org)"
@@ -399,25 +399,28 @@ If no server buffer exists, return nil."
;; This is useful for ordered name completion.
(last-message-time nil))
-(defsubst erc-get-channel-user (nick)
+(define-inline erc-get-channel-user (nick)
"Find the (USER . CHANNEL-DATA) element corresponding to NICK
in the current buffer's `erc-channel-users' hash table."
- (gethash (erc-downcase nick) erc-channel-users))
+ (inline-quote (gethash (erc-downcase ,nick) erc-channel-users)))
-(defsubst erc-get-server-user (nick)
+(define-inline erc-get-server-user (nick)
"Find the USER corresponding to NICK in the current server's
`erc-server-users' hash table."
- (erc-with-server-buffer
- (gethash (erc-downcase nick) erc-server-users)))
+ (inline-letevals (nick)
+ (inline-quote (erc-with-server-buffer
+ (gethash (erc-downcase ,nick) erc-server-users)))))
-(defsubst erc-add-server-user (nick user)
+(define-inline erc-add-server-user (nick user)
"This function is for internal use only.
Adds USER with nickname NICK to the `erc-server-users' hash table."
- (erc-with-server-buffer
- (puthash (erc-downcase nick) user erc-server-users)))
+ (inline-letevals (nick user)
+ (inline-quote
+ (erc-with-server-buffer
+ (puthash (erc-downcase ,nick) ,user erc-server-users)))))
-(defsubst erc-remove-server-user (nick)
+(define-inline erc-remove-server-user (nick)
"This function is for internal use only.
Removes the user with nickname NICK from the `erc-server-users'
@@ -425,8 +428,10 @@ hash table. This user is not removed from the
`erc-channel-users' lists of other buffers.
See also: `erc-remove-user'."
- (erc-with-server-buffer
- (remhash (erc-downcase nick) erc-server-users)))
+ (inline-letevals (nick)
+ (inline-quote
+ (erc-with-server-buffer
+ (remhash (erc-downcase ,nick) erc-server-users)))))
(defun erc-change-user-nickname (user new-nick)
"This function is for internal use only.
@@ -497,45 +502,55 @@ Removes all users in the current channel. This is called by
erc-channel-users)
(clrhash erc-channel-users)))
-(defsubst erc-channel-user-owner-p (nick)
+(define-inline erc-channel-user-owner-p (nick)
"Return non-nil if NICK is an owner of the current channel."
- (and nick
- (hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
- (and cdata (cdr cdata)
- (erc-channel-user-owner (cdr cdata))))))
-
-(defsubst erc-channel-user-admin-p (nick)
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
+ (hash-table-p erc-channel-users)
+ (let ((cdata (erc-get-channel-user ,nick)))
+ (and cdata (cdr cdata)
+ (erc-channel-user-owner (cdr cdata))))))))
+
+(define-inline erc-channel-user-admin-p (nick)
"Return non-nil if NICK is an admin in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-admin (cdr cdata))))))
+ (erc-channel-user-admin (cdr cdata))))))))
-(defsubst erc-channel-user-op-p (nick)
+(define-inline erc-channel-user-op-p (nick)
"Return non-nil if NICK is an operator in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-op (cdr cdata))))))
+ (erc-channel-user-op (cdr cdata))))))))
-(defsubst erc-channel-user-halfop-p (nick)
+(define-inline erc-channel-user-halfop-p (nick)
"Return non-nil if NICK is a half-operator in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-halfop (cdr cdata))))))
+ (erc-channel-user-halfop (cdr cdata))))))))
-(defsubst erc-channel-user-voice-p (nick)
+(define-inline erc-channel-user-voice-p (nick)
"Return non-nil if NICK has voice in the current channel."
- (and nick
+ (inline-letevals (nick)
+ (inline-quote
+ (and ,nick
(hash-table-p erc-channel-users)
- (let ((cdata (erc-get-channel-user nick)))
+ (let ((cdata (erc-get-channel-user ,nick)))
(and cdata (cdr cdata)
- (erc-channel-user-voice (cdr cdata))))))
+ (erc-channel-user-voice (cdr cdata))))))))
(defun erc-get-channel-user-list ()
"Return a list of users in the current channel. Each element
@@ -1036,6 +1051,21 @@ Note that it's useless to set `erc-send-this' to nil and
anyway."
:group 'erc-hooks
:type 'hook)
+(make-obsolete-variable 'erc-send-pre-hook 'erc-pre-send-functions "27.1")
+
+(defcustom erc-pre-send-functions nil
+ "List of functions called to possibly alter the string that is sent.
+The functions are called with one argument, a `erc-input' struct,
+and should alter that struct.
+
+The struct has three slots:
+
+ `string': The current input string.
+ `insertp': Whether the string should be inserted into the erc buffer.
+ `sendp': Whether the string should be sent to the irc server."
+ :group 'erc
+ :type '(repeat function)
+ :version "27.1")
(defvar erc-insert-this t
"Insert the text into the target buffer or not.
@@ -1046,6 +1076,7 @@ if they wish to avoid insertion of a particular string.")
"Send the text to the target or not.
Functions on `erc-send-pre-hook' can set this variable to nil
if they wish to avoid sending of a particular string.")
+(make-obsolete-variable 'erc-send-this 'erc-pre-send-functions "27.1")
(defcustom erc-insert-modify-hook ()
"Insertion hook for functions that will change the text's appearance.
@@ -1260,7 +1291,7 @@ erc-NAME-enable, and erc-NAME-disable.
Example:
- ;;;###autoload (autoload \\='erc-replace-mode \"erc-replace\")
+ ;;;###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
@@ -1343,10 +1374,11 @@ capabilities."
(add-hook hook fun nil t)
fun))
-(defsubst erc-log (string)
+(define-inline erc-log (string)
"Logs STRING if logging is on (see `erc-log-p')."
- (when erc-log-p
- (erc-log-aux string)))
+ (inline-quote
+ (when erc-log-p
+ (erc-log-aux ,string))))
(defun erc-server-buffer ()
"Return the server buffer for the current buffer's process.
@@ -1590,18 +1622,18 @@ symbol, it may have these values:
(dolist (candidate (list buf-name (concat buf-name "/" server)))
(if (and (not buffer-name)
erc-reuse-buffers
- (get-buffer candidate)
- (or target
+ (or (not (get-buffer candidate))
+ (or target
+ (with-current-buffer (get-buffer candidate)
+ (and (erc-server-buffer-p)
+ (not (erc-server-process-alive)))))
(with-current-buffer (get-buffer candidate)
- (and (erc-server-buffer-p)
- (not (erc-server-process-alive)))))
- (with-current-buffer (get-buffer candidate)
- (and (string= erc-session-server server)
- (erc-port-equal erc-session-port port))))
+ (and (string= erc-session-server server)
+ (erc-port-equal erc-session-port port)))))
(setq buffer-name candidate)))
;; if buffer-name is unset, neither candidate worked out for us,
;; fallback to the old <N> uniquification method:
- (or buffer-name (generate-new-buffer-name buf-name)) ))
+ (or buffer-name (generate-new-buffer-name (concat buf-name "/" server)))))
(defun erc-get-buffer-create (server port target)
"Create a new buffer based on the arguments."
@@ -1924,15 +1956,15 @@ removed from the list will be disabled."
(defun erc-setup-buffer (buffer)
"Consults `erc-join-buffer' to find out how to display `BUFFER'."
(pcase erc-join-buffer
- (`window
+ ('window
(if (active-minibuffer-window)
(display-buffer buffer)
(switch-to-buffer-other-window buffer)))
- (`window-noselect
+ ('window-noselect
(display-buffer buffer))
- (`bury
+ ('bury
nil)
- (`frame
+ ('frame
(when (or (not erc-reuse-frames)
(not (get-buffer-window buffer t)))
(let ((frame (make-frame (or erc-frame-alist
@@ -2411,11 +2443,7 @@ If STRING is nil, the function does nothing."
((null (car elt)) ; (nil PROPERTY VALUE BEG . END)
(let ((cons (nthcdr 3 elt)))
(cl-incf (car cons) shift)
- (cl-incf (cdr cons) shift)))
- ((and (featurep 'xemacs)
- (extentp (car elt))) ; (EXTENT START END)
- (cl-incf (nth 1 elt) shift)
- (cl-incf (nth 2 elt) shift)))
+ (cl-incf (cdr cons) shift))))
(setq list (cdr list))))))
(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
@@ -2506,10 +2534,7 @@ Returns NICK unmodified unless `erc-lurker-trim-nicks' is
non-nil."
(if erc-lurker-trim-nicks
(replace-regexp-in-string
- (format "[%s]"
- (mapconcat (lambda (char)
- (regexp-quote (char-to-string char)))
- erc-lurker-ignore-chars ""))
+ (regexp-opt-charset (string-to-list erc-lurker-ignore-chars))
"" nick)
nick))
@@ -2549,10 +2574,8 @@ consumption for long-lived IRC or Emacs sessions."
(maphash
(lambda (nick last-PRIVMSG-time)
(when
- (> (float-time (time-subtract
- (current-time)
- last-PRIVMSG-time))
- erc-lurker-threshold-time)
+ (time-less-p erc-lurker-threshold-time
+ (time-since last-PRIVMSG-time))
(remhash nick hash)))
hash)
(if (zerop (hash-table-count hash))
@@ -2617,9 +2640,8 @@ server within `erc-lurker-threshold-time'. See also
(gethash (erc-lurker-maybe-trim nick)
(gethash server erc-lurker-state (make-hash-table)))))
(or (null last-PRIVMSG-time)
- (> (float-time
- (time-subtract (current-time) last-PRIVMSG-time))
- erc-lurker-threshold-time))))
+ (time-less-p erc-lurker-threshold-time
+ (time-since last-PRIVMSG-time)))))
(defcustom erc-common-server-suffixes
'(("openprojects.net\\'" . "OPN")
@@ -3398,7 +3420,7 @@ Otherwise leave the channel indicated by LINE."
(defun erc-cmd-PING (recipient)
"Ping RECIPIENT."
- (let ((time (format "%f" (erc-current-time))))
+ (let ((time (format-time-string "%s.%6N")))
(erc-log (format "cmd: PING: %s" time))
(erc-cmd-CTCP recipient "PING" time)))
@@ -3472,7 +3494,6 @@ If S is non-nil, it will be used as the quit reason."
(defun erc-quit-reason-various (s)
"Choose a quit reason based on S (a string)."
- (when (featurep 'xemacs) (require 'poe))
(let ((res (car (assoc-default (or s "")
erc-quit-reason-various-alist 'string-match))))
(cond
@@ -3500,7 +3521,6 @@ If S is non-nil, it will be used as the quit reason."
(defun erc-part-reason-various (s)
"Choose a part reason based on S (a string)."
- (when (featurep 'xemacs) (require 'poe))
(let ((res (car (assoc-default (or s "")
erc-part-reason-various-alist 'string-match))))
(cond
@@ -3601,8 +3621,7 @@ the message given by REASON."
(defun erc-cmd-SV ()
"Say the current ERC and Emacs version into channel."
- (erc-send-message (format "I'm using ERC with %s %s (%s%s)%s."
- (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
+ (erc-send-message (format "I'm using ERC with GNU Emacs %s (%s%s)%s."
emacs-version
system-configuration
(concat
@@ -3677,8 +3696,10 @@ be displayed."
((string-match "^\\s-*\\([&#+!]\\S-+\\)\\s-\\(.*\\)$" topic)
(let ((ch (match-string 1 topic))
(topic (match-string 2 topic)))
- (erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
- (erc-server-send (format "TOPIC %s :%s" ch topic) nil ch))
+ ;; Ignore all-whitespace topics.
+ (unless (equal (string-trim topic) "")
+ (erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
+ (erc-server-send (format "TOPIC %s :%s" ch topic) nil ch)))
t)
;; /topic #channel
((string-match "^\\s-*\\([&#+!]\\S-+\\)" topic)
@@ -3941,9 +3962,7 @@ If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
(let ((minibuffer-allow-text-properties t)
(read-map minibuffer-local-map))
(insert (read-from-minibuffer "Message: "
- (string (if (featurep 'xemacs)
- last-command-char
- last-command-event))
+ (string last-command-event)
read-map))
(erc-send-current-line)))
@@ -4270,7 +4289,7 @@ and as second argument the event parsed as a vector."
(defun erc-is-message-ctcp-and-not-action-p (message)
"Check if MESSAGE is a CTCP message or not."
(and (erc-is-message-ctcp-p message)
- (not (string-match "^\C-a\\ACTION.*\C-a$" message))))
+ (not (string-match "^\C-aACTION.*\C-a$" message))))
(defun erc-format-privmessage (nick msg privp msgp)
"Format a PRIVMSG in an insertable fashion."
@@ -4476,7 +4495,7 @@ See also: `erc-echo-notice-in-user-buffers',
(mapcar #'upcase
(cdr (split-string mode)))))
erc-channel-banlist)))
- ((string-match "^+" mode)
+ ((string-match "^\\+" mode)
;; Add the banned mask(s) to the ban list
(mapc
(lambda (mask)
@@ -4624,7 +4643,7 @@ See also `erc-display-message'."
(user-full-name)
(user-login-name)
(system-name))))
- (ns (erc-time-diff erc-server-last-sent-time (erc-current-time))))
+ (ns (erc-time-diff erc-server-last-sent-time nil)))
(when (> ns 0)
(setq s (concat s " Idle for " (erc-sec-to-time ns))))
(erc-send-ctcp-notice nick s)))
@@ -4713,8 +4732,7 @@ See also `erc-display-message'."
nil
(let ((time (match-string 1 msg)))
(condition-case nil
- (let ((delta (erc-time-diff (string-to-number time)
- (erc-current-time))))
+ (let ((delta (erc-time-diff (string-to-number time) nil)))
(erc-display-message
nil 'notice 'active
'CTCP-PING ?n nick
@@ -4772,10 +4790,7 @@ If non-nil, return from being away."
(erc-default-target)
(if away-time
(format "is back (gone for %s)"
- (erc-sec-to-time
- (erc-time-diff
- (erc-emacs-time-to-erc-time away-time)
- (erc-current-time))))
+ (erc-sec-to-time (erc-time-diff away-time nil)))
"is back")))))))))
(erc-update-mode-line)))
@@ -5367,10 +5382,10 @@ submitted line to be intentional."
(defun erc-send-current-line ()
"Parse current line and send it to IRC."
(interactive)
- (let ((now (float-time)))
+ (let ((now (current-time)))
(if (or (not erc-accidental-paste-threshold-seconds)
- (< erc-accidental-paste-threshold-seconds
- (- now erc-last-input-time)))
+ (time-less-p erc-accidental-paste-threshold-seconds
+ (time-subtract now erc-last-input-time)))
(save-restriction
(widen)
(if (< (point) (erc-beg-of-input-line))
@@ -5416,6 +5431,9 @@ submitted line to be intentional."
(defvar erc-command-regexp "^/\\([A-Za-z']+\\)\\(\\s-+.*\\|\\s-*\\)$"
"Regular expression used for matching commands in ERC.")
+(cl-defstruct erc-input
+ string insertp sendp)
+
(defun erc-send-input (input)
"Treat INPUT as typed in by the user. It is assumed that the input
and the prompt is already deleted.
@@ -5431,27 +5449,46 @@ This returns non-nil only if we actually send anything."
(beep))
nil)
(t
- (defvar str) ;; FIXME: Make it obey the "erc-" prefix convention.
+ ;; This dynamic variable is used by `erc-send-pre-hook'. It's
+ ;; obsolete, and when it's finally removed, this binding should
+ ;; also be removed.
+ (with-suppressed-warnings ((lexical str))
+ (defvar str))
(let ((str input)
- (erc-insert-this t))
- (setq erc-send-this t)
+ (erc-insert-this t)
+ (erc-send-this t)
+ state)
+ ;; The calling convention of `erc-send-pre-hook' is that it
+ ;; should change the dynamic variable `str' or set
+ ;; `erc-send-this' to nil. This has now been deprecated:
+ ;; Instead `erc-pre-send-functions' is used as a filter to do
+ ;; allow both changing and suppressing the string.
(run-hook-with-args 'erc-send-pre-hook input)
- (when erc-send-this
- (if (or (string-match "\n" str)
- (not (string-match erc-command-regexp str)))
- (mapc
- (lambda (line)
- (mapc
- (lambda (line)
- ;; Insert what has to be inserted for this.
- (erc-display-msg line)
- (erc-process-input-line (concat line "\n")
- (null erc-flood-protect) t))
- (or (and erc-flood-protect (erc-split-line line))
- (list line))))
- (split-string str "\n"))
- (erc-process-input-line (concat str "\n") t nil))
- t)))))
+ (setq state (make-erc-input :string str
+ :insertp erc-insert-this
+ :sendp erc-send-this))
+ (dolist (func erc-pre-send-functions)
+ ;; The functions can return nil to inhibit sending.
+ (funcall func state))
+ (when (and (erc-input-sendp state)
+ erc-send-this)
+ (let ((string (erc-input-string state)))
+ (if (or (string-match "\n" string)
+ (not (string-match erc-command-regexp string)))
+ (mapc
+ (lambda (line)
+ (mapc
+ (lambda (line)
+ ;; Insert what has to be inserted for this.
+ (when (erc-input-insertp state)
+ (erc-display-msg line))
+ (erc-process-input-line (concat line "\n")
+ (null erc-flood-protect) t))
+ (or (and erc-flood-protect (erc-split-line line))
+ (list line))))
+ (split-string string "\n"))
+ (erc-process-input-line (concat string "\n") t nil))
+ t))))))
(defun erc-display-command (line)
(when erc-insert-this
@@ -5720,8 +5757,6 @@ If \"l\" is pressed, `erc-set-channel-limit' gets called.
If \"k\" is pressed, `erc-set-channel-key' gets called.
Anything else will be sent to `erc-toggle-channel-mode'."
(interactive "kChannel mode (RET to set more than one): ")
- (when (featurep 'xemacs)
- (setq key (char-to-string (event-to-character (aref key 0)))))
(cond ((equal key "\C-g")
(keyboard-quit))
((equal key "\C-m")
@@ -6020,23 +6055,20 @@ non-nil value is found.
;; time routines
-(defun erc-string-to-emacs-time (string)
- "Convert the long number represented by STRING into an Emacs format.
-Returns a list of the form (HIGH LOW), compatible with Emacs time format."
- (let* ((n (string-to-number (concat string ".0"))))
- (list (truncate (/ n 65536))
- (truncate (mod n 65536)))))
+(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)
(defun erc-time-diff (t1 t2)
- "Return the time difference in seconds between T1 and T2."
- (abs (- t2 t1)))
+ "Return the absolute value of the difference in seconds between T1 and T2."
+ (abs (float-time (time-subtract t1 t2))))
(defun erc-time-gt (t1 t2)
"Check whether T1 > T2."
- (> t1 t2))
+ (declare (obsolete time-less-p "27.1"))
+ (time-less-p t2 t1))
(defun erc-sec-to-time (ns)
"Convert NS to a time string HH:MM.SS."
@@ -6368,14 +6400,9 @@ if `erc-away' is non-nil."
(funcall erc-header-line-face-method))
(t
'erc-header-line))))
- (cond ((featurep 'xemacs)
- (setq modeline-buffer-identification
- (list (format-spec erc-mode-line-format spec)))
- (setq modeline-process (list process-status)))
- (t
- (setq mode-line-buffer-identification
- (list (format-spec erc-mode-line-format spec)))
- (setq mode-line-process (list process-status))))
+ (setq mode-line-buffer-identification
+ (list (format-spec erc-mode-line-format spec)))
+ (setq mode-line-process (list process-status))
(when (boundp 'header-line-format)
(let ((header (if erc-header-line-format
(format-spec erc-header-line-format spec)
@@ -6403,9 +6430,7 @@ if `erc-away' is non-nil."
(if face
(erc-propertize header 'face face)
header)))))))
- (if (featurep 'xemacs)
- (redraw-modeline)
- (force-mode-line-update))))
+ (force-mode-line-update)))
(defun erc-update-mode-line (&optional buffer)
"Update the mode line in BUFFER.