From 1967b9c474f639d74a6cbe82e9f8a1909b636799 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 24 Jul 2021 11:19:54 +0200 Subject: [PATCH 01/36] Generate no message when activating rcirc-omit-mode * rcirc.el (rcirc-omit-mode): Remove (message ...) expressions --- lisp/net/rcirc.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index f11f36e8096..a4ed54f6ae5 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -215,11 +215,8 @@ Uninteresting lines are those whose responses are listed in `rcirc-omit-responses'." :lighter " Omit" (if rcirc-omit-mode - (progn - (add-to-invisibility-spec '(rcirc-omit . nil)) - (message "Rcirc-Omit mode enabled")) - (remove-from-invisibility-spec '(rcirc-omit . nil)) - (message "Rcirc-Omit mode disabled")) + (add-to-invisibility-spec '(rcirc-omit . nil)) + (remove-from-invisibility-spec '(rcirc-omit . nil))) (dolist (window (get-buffer-window-list (current-buffer))) (with-selected-window window (recenter (when (> (point) rcirc-prompt-start-marker) -1))))) From 47b5dcdcf5d7929a376337df0da770bc71916648 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 24 Jul 2021 16:57:00 +0200 Subject: [PATCH 02/36] Ensure that rcirc-buffer-alist has no text properties * rcirc.el (rcirc-mode): Remove text properties from rcirc-buffer-alist keys --- lisp/net/rcirc.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index a4ed54f6ae5..3c7ccedceda 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1317,8 +1317,9 @@ This number is independent of the number of lines in the buffer.") (when target ; skip server buffer (let ((buffer (current-buffer))) (with-rcirc-process-buffer process - (setq rcirc-buffer-alist (cons (cons target buffer) - rcirc-buffer-alist)))) + (push (cons (set-text-properties 0 (length target) nil target) + buffer) + rcirc-buffer-alist))) (rcirc-update-short-buffer-names)) (add-hook 'completion-at-point-functions From 262fbe1a47054c1a681e538868cdb68119e79df9 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 27 Jul 2021 10:08:06 +0200 Subject: [PATCH 03/36] Fix TOPIC command * rcirc.el (topic): Add target argument. --- lisp/net/rcirc.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 3c7ccedceda..60751c14e2b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2562,8 +2562,8 @@ With a prefix arg, prompt for new topic." (interactive (list (and current-prefix-arg (read-string "List names in channel: ")))) (if (> (length topic) 0) - (rcirc-send-string process "TOPIC" : topic) - (rcirc-send-string process "TOPIC"))) + (rcirc-send-string process "TOPIC" target : topic) + (rcirc-send-string process "TOPIC" target))) (rcirc-define-command whois (nick) "Request information from server about NICK." From 402385393a3a211c421d6e414d7d1b1f7fdda06c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 27 Jul 2021 17:30:22 +0200 Subject: [PATCH 04/36] Update rcirc-buffer-alist after receiving NICK * rcirc.el (rcirc-handler-NICK): Remove old nick and add new nick --- lisp/net/rcirc.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 60751c14e2b..2c8bf431db6 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -3143,13 +3143,16 @@ PROCESS is the process object for the current connection." ;; print message to nick's channels (dolist (target channels) (rcirc-print process sender "NICK" target new-nick)) - ;; update private chat buffer, if it exists - (let ((chat-buffer (rcirc-get-buffer process old-nick))) - (when chat-buffer - (with-current-buffer chat-buffer - (rcirc-print process sender "NICK" old-nick new-nick) - (setq rcirc-target new-nick) - (rename-buffer (rcirc-generate-new-buffer-name process new-nick))))) + ;; update chat buffer, if it exists + (when-let ((chat-buffer (rcirc-get-buffer process old-nick))) + (with-current-buffer chat-buffer + (rcirc-print process sender "NICK" old-nick new-nick) + (setq rcirc-target new-nick) + (rename-buffer (rcirc-generate-new-buffer-name process new-nick))) + (setf rcirc-buffer-alist + (cons (cons new-nick chat-buffer) + (delq (assoc-string old-nick rcirc-buffer-alist t) + rcirc-buffer-alist)))) ;; remove old nick and add new one (with-rcirc-process-buffer process (let ((v (gethash old-nick rcirc-nick-table))) From fb27708f51fb0fd60cd00cd8ea7bfc9248eb0040 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 27 Jul 2021 17:42:32 +0200 Subject: [PATCH 05/36] Fix checkdoc issues * rcirc.el (rcirc-finished-sasl): Add period. (rcirc-mode): Expand docstring. (rcirc-handler-900): Document sender and process --- lisp/net/rcirc.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 2c8bf431db6..559f579c0a1 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -608,7 +608,7 @@ See `rcirc-connect' for more details on these variables.") (defvar-local rcirc-acked-capabilities nil "A list of capabilities that the server supports.") (defvar-local rcirc-finished-sasl t - "Check whether SASL authentication has completed") + "Check whether SASL authentication has completed.") (defun rcirc-get-server-method (server) "Return authentication method for SERVER." @@ -1255,7 +1255,8 @@ Each element looks like (FILENAME . TEXT).") This number is independent of the number of lines in the buffer.") (defun rcirc-mode (process target) - "Major mode for IRC channel buffers. + "Initialize an IRC buffer for writing with TARGET. +PROCESS is the process object used for communication. \\{rcirc-mode-map}" ;; FIXME: Use define-derived-mode. @@ -3526,7 +3527,9 @@ PROCESS is the process object for the current connection." "\0" (rcirc-get-server-password rcirc-server))))) (defun rcirc-handler-900 (process sender args _text) - "Respond to a successful authentication response." + "Respond to a successful authentication response. +SENDER is passed on to `rcirc-handler-generic'. PROCESS is the +process object for the current connection." (rcirc-handler-generic process "900" sender args nil) (when (not rcirc-finished-sasl) (setq-local rcirc-finished-sasl t) From 7e13bfd4a852bcca39ccb4adfd1c317dde13c947 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 27 Jul 2021 20:01:49 +0200 Subject: [PATCH 06/36] Remove removal of text properties from rcirc-buffer-alist keys * rcirc.el (rcirc-mode): Remove set-text-properties call --- lisp/net/rcirc.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 559f579c0a1..b850ac00648 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1318,9 +1318,7 @@ PROCESS is the process object used for communication. (when target ; skip server buffer (let ((buffer (current-buffer))) (with-rcirc-process-buffer process - (push (cons (set-text-properties 0 (length target) nil target) - buffer) - rcirc-buffer-alist))) + (push (cons target buffer) rcirc-buffer-alist))) (rcirc-update-short-buffer-names)) (add-hook 'completion-at-point-functions From 190ea9cd3eee8910285005cdd54352238af9a558 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 28 Jul 2021 10:31:57 +0200 Subject: [PATCH 07/36] Replace cl-c[ad]+r with regular c[ad]+r * rcirc.el (rcirc-make-trees): Replace cl-cdadr with cdadr (rcirc-handler-333): Replace cl-cadddr with cadddr (rcirc-authenticate): Replace cl-cdddr with cdddr --- lisp/net/rcirc.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index b850ac00648..629b51d7c35 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2405,7 +2405,7 @@ prefix with another element in PAIRS." (when (and (listp x) (listp (cadr x))) (setcdr x (if (> (length (cdr x)) 1) (rcirc-make-trees (cdr x)) - (setcdr x (list (cl-cdadr x))))))) + (setcdr x (list (cdadr x))))))) alist))) ;;; /commands these are called with 3 args: PROCESS, TARGET, which is @@ -3234,7 +3234,7 @@ RFC1459." (with-current-buffer buffer (let ((setter (nth 2 args)) (time (current-time-string - (string-to-number (cl-cadddr args))))) + (string-to-number (cadddr args))))) (rcirc-print process sender "TOPIC" (cadr args) (format "%s (%s on %s)" rcirc-topic setter time)))))) @@ -3344,7 +3344,7 @@ Passwords are stored in `rcirc-authinfo' (which see)." (server (car i)) (nick (nth 2 i)) (method (cadr i)) - (args (cl-cdddr i))) + (args (cdddr i))) (when (and (string-match server rcirc-server)) (if (and (memq method '(nickserv chanserv bitlbee)) (string-match nick rcirc-nick)) From ade9653108a5d89300db25662bc942a643309c46 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 6 Aug 2021 20:01:38 +0200 Subject: [PATCH 08/36] Add new option rcirc-track-abbrevate-flag * rcirc.el (rcirc-track-abbrevate-flag): Add option (rcirc-short-buffer-name): Respect rcirc-track-abbrevate-flag --- lisp/net/rcirc.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 629b51d7c35..378a5e5db7b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2116,6 +2116,11 @@ This function does not alter the INPUT string." map) "Keymap for rcirc track minor mode.") +(defcustom rcirc-track-abbrevate-flag t + "If non-nil, abbreviate names for `rcirc-track-minor-mode'." + :version "28.1" + :type 'boolean) + ;;;###autoload (define-minor-mode rcirc-track-minor-mode "Global minor mode for tracking activity in rcirc buffers." @@ -2296,7 +2301,11 @@ activity. Only run if the buffer is not visible and (defun rcirc-short-buffer-name (buffer) "Return a short name for BUFFER to use in the mode line indicator." (with-current-buffer buffer - (or rcirc-short-buffer-name (buffer-name)))) + (replace-regexp-in-string + "@.*?\\'" "" + (or (and rcirc-track-abbrevate-flag + rcirc-short-buffer-name) + (buffer-name))))) (defun rcirc-visible-buffers () "Return a list of the visible buffers that are in `rcirc-mode'." From c817a34eddd910972488b6d4b47810e7de61581a Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 6 Aug 2021 20:12:04 +0200 Subject: [PATCH 09/36] Add new option rcirc-channel-filter * rcirc.el (rcirc-channel-filter): Add option (rcirc-short-buffer-name): Respect rcirc-channel-filter (rcirc-handler-JOIN): Respect rcirc-channel-filter (rcirc-handler-PART): Respect rcirc-channel-filter (rcirc-handler-KICK): Respect rcirc-channel-filter (rcirc-handler-QUIT): Respect rcirc-channel-filter (rcirc-handler-INVITE): Respect rcirc-channel-filter --- lisp/net/rcirc.el | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 378a5e5db7b..17708592fd5 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -410,6 +410,11 @@ will be killed." :version "28.1" :type 'function) +(defcustom rcirc-channel-filter #'identity + "Function applied to channels before displaying." + :version "28.1" + :type 'function) + (defvar-local rcirc-nick nil "The nickname used for the current connection.") @@ -2301,11 +2306,12 @@ activity. Only run if the buffer is not visible and (defun rcirc-short-buffer-name (buffer) "Return a short name for BUFFER to use in the mode line indicator." (with-current-buffer buffer - (replace-regexp-in-string - "@.*?\\'" "" - (or (and rcirc-track-abbrevate-flag - rcirc-short-buffer-name) - (buffer-name))))) + (funcall rcirc-channel-filter + (replace-regexp-in-string + "@.*?\\'" "" + (or (and rcirc-track-abbrevate-flag + rcirc-short-buffer-name) + (buffer-name)))))) (defun rcirc-visible-buffers () "Return a list of the visible buffers that are in `rcirc-mode'." @@ -3052,11 +3058,11 @@ connection." ;; already open buffer (after getting kicked e.g.) (setq mode-line-process nil)) - (rcirc-print process sender "JOIN" channel "") + (rcirc-print process sender "JOIN" (funcall rcirc-channel-filter channel) "") ;; print in private chat buffer if it exists (when (rcirc-get-buffer (rcirc-buffer-process) sender) - (rcirc-print process sender "JOIN" sender channel)))) + (rcirc-print process sender "JOIN" sender (funcall rcirc-channel-filter channel))))) ;; PART and KICK are handled the same way (defun rcirc-handler-PART-or-KICK (process _response channel _sender nick _args) @@ -3085,10 +3091,10 @@ PROCESS is the process object for the current connection." (let* ((channel (car args)) (reason (cadr args)) (message (concat channel " " reason))) - (rcirc-print process sender "PART" channel message) + (rcirc-print process sender "PART" (funcall rcirc-channel-filter channel) message) ;; print in private chat buffer if it exists (when (rcirc-get-buffer (rcirc-buffer-process) sender) - (rcirc-print process sender "PART" sender message)) + (rcirc-print process sender "PART" (funcall rcirc-channel-filter channel) message)) (rcirc-handler-PART-or-KICK process "PART" channel sender sender reason))) @@ -3100,7 +3106,7 @@ PROCESS is the process object for the current connection." (nick (cadr args)) (reason (nth 2 args)) (message (concat nick " " channel " " reason))) - (rcirc-print process sender "KICK" channel message t) + (rcirc-print process sender "KICK" (funcall rcirc-channel-filter channel) message t) ;; print in private chat buffer if it exists (when (rcirc-get-buffer (rcirc-buffer-process) nick) (rcirc-print process sender "KICK" nick message)) @@ -3130,7 +3136,7 @@ PROCESS is the process object for the current connection." (rcirc-ignore-update-automatic sender) (mapc (lambda (channel) ;; broadcast quit message each channel - (rcirc-print process sender "QUIT" channel (apply 'concat args)) + (rcirc-print process sender "QUIT" (funcall rcirc-channel-filter channel) (apply 'concat args)) ;; record nick in quit table if they recently spoke (rcirc-maybe-remember-nick-quit process sender channel)) (rcirc-nick-channels process sender)) @@ -3390,6 +3396,8 @@ process object for the current connection." (let ((self (buffer-local-value 'rcirc-nick rcirc-process)) (target (car args)) (chan (cadr args))) + ;; `rcirc-channel-filter' is not used here because joining + ;; requires an unfiltered name. (if (string= target self) (rcirc-print process sender "INVITE" nil (format "%s invited you to %s" From 608b2ec9be2a4c388341ac33f0a7b59bdcca2a2c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 5 Sep 2021 01:39:52 +0200 Subject: [PATCH 10/36] Replace with-current-buffer with buffer-local-value where applicable * rcirc.el (rcirc-buffer-process): Use buffer-local-value (rcirc-last-quit-line): Use buffer-local-value (rcirc-bury-buffers): Use buffer-local-value (rcirc-record-activity): Use buffer-local-value --- lisp/net/rcirc.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 17708592fd5..e4649a6ab79 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1056,7 +1056,7 @@ With no argument or nil as argument, use the current buffer." (let ((buffer (or buffer (and (buffer-live-p rcirc-server-buffer) rcirc-server-buffer)))) (if buffer - (with-current-buffer buffer rcirc-process) + (buffer-local-value 'rcirc-process buffer) rcirc-process))) (defun rcirc-server-name (process) @@ -1744,8 +1744,9 @@ Returns nil if the information is not recorded. PROCESS is the process object for the current connection." (let ((chanbuf (rcirc-get-buffer process target))) (when chanbuf - (cdr (assoc-string nick (with-current-buffer chanbuf - rcirc-recent-quit-alist)))))) + (cdr (assoc-string nick (buffer-local-value + 'rcirc-recent-quit-alist + chanbuf)))))) (defun rcirc-last-line (process nick target) "Return the line from the last activity from NICK in TARGET. @@ -2183,7 +2184,7 @@ This function does not alter the INPUT string." "Bury all RCIRC buffers." (interactive) (dolist (buf (buffer-list)) - (when (eq 'rcirc-mode (with-current-buffer buf major-mode)) + (when (eq 'rcirc-mode (buffer-local-value 'major-mode buf)) (bury-buffer buf) ; buffers not shown (quit-windows-on buf)))) ; buffers shown in a window @@ -2228,8 +2229,8 @@ activity. Only run if the buffer is not visible and (sort (if (memq (current-buffer) rcirc-activity) rcirc-activity (cons (current-buffer) rcirc-activity)) (lambda (b1 b2) - (let ((t1 (with-current-buffer b1 rcirc-last-post-time)) - (t2 (with-current-buffer b2 rcirc-last-post-time))) + (let ((t1 (buffer-local-value 'rcirc-last-post-time b1)) + (t2 (buffer-local-value 'rcirc-last-post-time b2))) (time-less-p t2 t1))))) (cl-pushnew type rcirc-activity-types) (unless (and (equal rcirc-activity old-activity) From 008a033bbbb9d4f36cfcfdb36f6551fa3bdd4de8 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 5 Sep 2021 19:13:48 +0200 Subject: [PATCH 11/36] Print value on malformed input * rcirc.el (rcirc-define-command): Unquote argument --- lisp/net/rcirc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index e4649a6ab79..6e4f99b24c7 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2470,7 +2470,7 @@ that, an interactive form can specified." (unless (if (listp ,argument) (<= ,required (length ,argument) ,total) (string-match ,regexp ,argument)) - (user-error "Malformed input (%s): %S" ',command ',argument)) + (user-error "Malformed input (%s): %S" ',command ,argument)) (let ((process (or process (rcirc-buffer-process))) (target (or target rcirc-target))) (ignore target process) From 0f1db3dc2b7344369766da48a85c8f70e0ac0e54 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 5 Sep 2021 20:30:43 +0200 Subject: [PATCH 12/36] Store symbols in rcirc-acked-capabilities * rcirc.el (rcirc-handler-CAP): Use intern and downcase --- lisp/net/rcirc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 6e4f99b24c7..7c08bc43e76 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -3469,7 +3469,7 @@ is the process object for the current connection." (let ((subcmd (cadr args))) (dolist (cap (cddr args)) (cond ((string= subcmd "ACK") - (push cap rcirc-acked-capabilities) + (push (intern (downcase cap)) rcirc-acked-capabilities) (setq rcirc-requested-capabilities (delete cap rcirc-requested-capabilities))) ((string= subcmd "NAK") From e37f3ce3b4c9d091e1b17836a709afc944a61260 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 5 Sep 2021 20:34:18 +0200 Subject: [PATCH 13/36] Fix rcirc-track-abbrevate-flag documentation * rcirc.el (rcirc-track-abbrevate-flag): Rephrase docstring --- lisp/net/rcirc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 7c08bc43e76..be90c56a43a 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2123,7 +2123,7 @@ This function does not alter the INPUT string." "Keymap for rcirc track minor mode.") (defcustom rcirc-track-abbrevate-flag t - "If non-nil, abbreviate names for `rcirc-track-minor-mode'." + "Non-nil means `rcirc-track-minor-mode' should abbreviate names." :version "28.1" :type 'boolean) From 70d459914f25f52b950b41b8fd2717e1687c3776 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 5 Sep 2021 20:42:48 +0200 Subject: [PATCH 14/36] Implement multi-prefix capability * rcirc.el (rcirc-implemented-capabilities): Add capability (rcirc-user-nick): Handle multiple prefixes --- lisp/net/rcirc.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index be90c56a43a..5a6688d5ff8 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -606,6 +606,7 @@ See `rcirc-connect' for more details on these variables.") "message-ids" ;https://ircv3.net/specs/extensions/message-ids "invite-notify" ;https://ircv3.net/specs/extensions/invite-notify "sasl" ;https://ircv3.net/specs/extensions/sasl-3.1 + "multi-prefix" ;https://ircv3.net/specs/extensions/multi-prefix ) "A list of capabilities that rcirc supports.") (defvar-local rcirc-requested-capabilities nil @@ -2011,7 +2012,8 @@ PROCESS is the process object for the current connection." "Return the nick from USER. Remove any non-nick junk." (save-match-data (if (string-match (concat "^[" rcirc-nick-prefix-chars - "]?\\([^! ]+\\)!?") (or user "")) + "]*\\([^! ]+\\)!?") + (or user "")) (match-string 1 user) user))) From 659a77a0eb2b024cdd7f2143a95a178a2174852f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 6 Sep 2021 19:10:46 +0200 Subject: [PATCH 15/36] Connect to server asynchronously * rcirc.el (rcirc-connect): Add :nowait option to open-network-stream (rcirc-sentinel): Handle "open\n" events --- lisp/net/rcirc.el | 155 +++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 72 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 5a6688d5ff8..a819fb87c08 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -647,69 +647,46 @@ that are joined after authentication." (message "Connecting to %s..." (or server-alias server)) (let* ((inhibit-eol-conversion) (port-number (if port - (if (stringp port) - (string-to-number port) - port) - rcirc-default-port)) - (nick (or nick rcirc-default-nick)) - (user-name (or user-name rcirc-default-user-name)) - (full-name (or full-name rcirc-default-full-name)) - (startup-channels startup-channels) - (use-sasl (eq (rcirc-get-server-method server) 'sasl)) + (if (stringp port) + (string-to-number port) + port) + rcirc-default-port)) + (nick (or nick rcirc-default-nick)) + (user-name (or user-name rcirc-default-user-name)) + (full-name (or full-name rcirc-default-full-name)) + (startup-channels startup-channels) + (process (open-network-stream (or server-alias server) nil server port-number - :type (or encryption 'plain)))) + :type (or encryption 'plain) + :nowait t))) ;; set up process (set-process-coding-system process 'raw-text 'raw-text) - (switch-to-buffer (rcirc-generate-new-buffer-name process nil)) - (set-process-buffer process (current-buffer)) - (unless (eq major-mode 'rcirc-mode) - (rcirc-mode process nil)) - (set-process-sentinel process 'rcirc-sentinel) - (set-process-filter process 'rcirc-filter) + (with-current-buffer (get-buffer-create (rcirc-generate-new-buffer-name process nil)) + (set-process-buffer process (current-buffer)) + (unless (eq major-mode 'rcirc-mode) + (rcirc-mode process nil)) + (set-process-sentinel process #'rcirc-sentinel) + (set-process-filter process #'rcirc-filter) - (setq rcirc-connection-info - (list server port nick user-name full-name startup-channels - password encryption server-alias)) - (setq rcirc-process process) - (setq rcirc-server server) - (setq rcirc-server-name (or server-alias server)) ; Update when we get 001 response. - (setq rcirc-nick-table (make-hash-table :test 'equal)) - (setq rcirc-nick nick) - (setq rcirc-startup-channels startup-channels) - (setq rcirc-last-server-message-time (current-time)) + (setq rcirc-connection-info + (list server port nick user-name full-name startup-channels + password encryption server-alias)) + (setq rcirc-process process) + (setq rcirc-server server) + (setq rcirc-server-name (or server-alias server)) ; Update when we get 001 response. + (setq rcirc-nick-table (make-hash-table :test 'equal)) + (setq rcirc-nick nick) + (setq rcirc-startup-channels startup-channels) + (setq rcirc-last-server-message-time (current-time)) - (setq rcirc-connecting t) + (setq mode-line-process ":connecting") + (setq rcirc-connecting t) - (add-hook 'auto-save-hook 'rcirc-log-write) - (when use-sasl - (rcirc-send-string process "CAP REQ sasl")) + (add-hook 'auto-save-hook #'rcirc-log-write) - (when use-sasl - (setq-local rcirc-finished-sasl nil)) - ;; identify - (dolist (cap rcirc-implemented-capabilities) - (rcirc-send-string process "CAP" "REQ" : cap) - (push cap rcirc-requested-capabilities)) - (unless (zerop (length password)) - (rcirc-send-string process "PASS" password)) - (rcirc-send-string process "NICK" nick) - (rcirc-send-string process "USER" user-name "0" "*" : full-name) - ;; Setup sasl, and initiate authentication. - (when (and rcirc-auto-authenticate-flag - use-sasl) - (rcirc-send-string process "AUTHENTICATE" "PLAIN")) - - ;; setup ping timer if necessary - (unless rcirc-keepalive-timer - (setq rcirc-keepalive-timer - (run-at-time 0 (/ rcirc-timeout-seconds 2) 'rcirc-keepalive))) - - (message "Connecting to %s...done" (or server-alias server)) - (setq mode-line-process nil) - - ;; return process object - process))) + ;; return process object + process)))) (defmacro with-rcirc-process-buffer (process &rest body) "Evaluate BODY in the buffer of PROCESS." @@ -806,23 +783,57 @@ When 0, do not auto-reconnect." (let ((sentinel (replace-regexp-in-string "\n" "" sentinel))) (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) (with-rcirc-process-buffer process - (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) - (with-current-buffer (or buffer (current-buffer)) - (rcirc-print process "rcirc.el" "ERROR" rcirc-target - (format "%s: %s (%S)" - (process-name process) - sentinel - (process-status process)) - (not rcirc-target)) - (rcirc-disconnect-buffer))) - (when (and (string= sentinel "deleted") - (< 0 rcirc-reconnect-delay)) - (let ((now (current-time))) - (when (or (null rcirc-last-connect-time) - (time-less-p rcirc-reconnect-delay - (time-subtract now rcirc-last-connect-time))) - (setq rcirc-last-connect-time now) - (rcirc-cmd-reconnect nil)))) + (if (string= sentinel "open") + (let* ((server (nth 0 rcirc-connection-info)) + (user-name (nth 3 rcirc-connection-info)) + (full-name (nth 4 rcirc-connection-info)) + (password (nth 6 rcirc-connection-info)) + (server-alias (nth 8 rcirc-connection-info)) + (use-sasl (eq (rcirc-get-server-method server) 'sasl))) + + ;; prepare SASL authentication + (when use-sasl + (rcirc-send-string process "CAP REQ sasl") + (setq-local rcirc-finished-sasl nil)) + + ;; identify + (dolist (cap rcirc-implemented-capabilities) + (rcirc-send-string process "CAP" "REQ" : cap) + (push cap rcirc-requested-capabilities)) + (unless (zerop (length password)) + (rcirc-send-string process "PASS" password)) + (rcirc-send-string process "NICK" rcirc-nick) + (rcirc-send-string process "USER" user-name "0" "*" : full-name) + + ;; Setup sasl, and initiate authentication. + (when (and rcirc-auto-authenticate-flag + use-sasl) + (rcirc-send-string process "AUTHENTICATE" "PLAIN")) + + ;; setup ping timer if necessary + (unless rcirc-keepalive-timer + (setq rcirc-keepalive-timer + (run-at-time 0 (/ rcirc-timeout-seconds 2) #'rcirc-keepalive))) + + (message "Connecting to %s...done" (or server-alias server)) + (setq mode-line-process nil)) + (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) + (with-current-buffer (or buffer (current-buffer)) + (rcirc-print process "rcirc.el" "ERROR" rcirc-target + (format "%s: %s (%S)" + (process-name process) + sentinel + (process-status process)) + (not rcirc-target)) + (rcirc-disconnect-buffer))) + (when (and (string= sentinel "deleted") + (< 0 rcirc-reconnect-delay)) + (let ((now (current-time))) + (when (or (null rcirc-last-connect-time) + (time-less-p rcirc-reconnect-delay + (time-subtract now rcirc-last-connect-time))) + (setq rcirc-last-connect-time now) + (rcirc-cmd-reconnect nil))))) (run-hook-with-args 'rcirc-sentinel-functions process sentinel)))) (defun rcirc-disconnect-buffer (&optional buffer) From 354929a85a292137256b3abbca6c2983dd93dee3 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 6 Sep 2021 22:37:33 +0200 Subject: [PATCH 16/36] Implement standard-replies capability * rcirc.el (rcirc-implemented-capabilities): Add standard-replies to list (rcirc-response-formats): Add response formats for WARN, FAIL and NOTE (rcirc-handler-FAIL): Add handler (rcirc-handler-WARN): Add handler (rcirc-handler-NOTE): Add handler --- lisp/net/rcirc.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index a819fb87c08..0315d715036 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -607,6 +607,7 @@ See `rcirc-connect' for more details on these variables.") "invite-notify" ;https://ircv3.net/specs/extensions/invite-notify "sasl" ;https://ircv3.net/specs/extensions/sasl-3.1 "multi-prefix" ;https://ircv3.net/specs/extensions/multi-prefix + "standard-replies" ;https://ircv3.net/specs/extensions/standard-replies ) "A list of capabilities that rcirc supports.") (defvar-local rcirc-requested-capabilities nil @@ -1639,6 +1640,9 @@ extracted." ("ACTION" . "[%N %m]") ("COMMAND" . "%m") ("ERROR" . "%fw!!! %m") + ("FAIL" . "(%fwFAIL%f-) %m") + ("WARN" . "(%fwWARN%f-) %m") + ("NOTE" . "(%fwNOTE%f-) %m") (t . "%fp*** %fs%n %r %m")) "An alist of formats used for printing responses. The format is looked up using the response-type as a key; @@ -3565,6 +3569,27 @@ process object for the current connection." (rcirc-send-string process "CAP" "END")) (rcirc-join-channels-post-auth process)) +(defun rcirc-handler-FAIL (process _sender args _text) + "Display a FAIL message, as indicated by ARGS. +PROCESS is the process object for the current connection." + (rcirc-print process nil "FAIL" nil + (mapconcat #'identity args " ") + t)) + +(defun rcirc-handler-WARN (process _sender args _text) + "Display a WARN message, as indicated by ARGS. +PROCESS is the process object for the current connection." + (rcirc-print process nil "WARN" nil + (mapconcat #'identity args " ") + t)) + +(defun rcirc-handler-NOTE (process _sender args _text) + "Display a NOTE message, as indicated by ARGS. +PROCESS is the process object for the current connection." + (rcirc-print process nil "NOTE" nil + (mapconcat #'identity args " ") + t)) + (defgroup rcirc-faces nil "Faces for rcirc." From 8275f0b117dc3caf796138545786e954c53e2b9b Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 6 Sep 2021 23:26:05 +0200 Subject: [PATCH 17/36] Mention list of capabilities that should be implemented * rcirc.el (rcirc-implemented-capabilities): Add comment --- lisp/net/rcirc.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 0315d715036..1637041bb17 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -608,6 +608,14 @@ See `rcirc-connect' for more details on these variables.") "sasl" ;https://ircv3.net/specs/extensions/sasl-3.1 "multi-prefix" ;https://ircv3.net/specs/extensions/multi-prefix "standard-replies" ;https://ircv3.net/specs/extensions/standard-replies + ;; The following capabilities should be implemented as soon as + ;; their specifications are undrafted: + ;; + ;; "reply" ;https://ircv3.net/specs/client-tags/reply + ;; "react" ;https://ircv3.net/specs/client-tags/react + ;; "multiline" ;https://ircv3.net/specs/extensions/multiline + ;; "chathistory" ;https://ircv3.net/specs/extensions/chathistory + ;; "channel-rename" ;https://ircv3.net/specs/extensions/channel-rename ) "A list of capabilities that rcirc supports.") (defvar-local rcirc-requested-capabilities nil From 4a0c0e5606f13ac023a44b2c75f86df055e4864d Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 7 Sep 2021 10:33:51 +0200 Subject: [PATCH 18/36] Allow /reconnect while connecting * rcirc.el (reconnect): Kill previous process and start a new one --- lisp/net/rcirc.el | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 1637041bb17..5236f96b09f 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2572,17 +2572,22 @@ to `rcirc-default-part-reason'." "Reconnect to current server." (interactive "i") (with-rcirc-server-buffer - (cond - (rcirc-connecting (message "Already connecting")) - ((process-live-p process) (message "Server process is alive")) - (t (let ((conn-info rcirc-connection-info)) - (setf (nth 5 conn-info) - (cl-remove-if-not #'rcirc-channel-p - (mapcar #'car rcirc-buffer-alist))) - (dolist (buf (nth 5 conn-info)) - (with-current-buffer (cdr (assoc buf rcirc-buffer-alist)) - (setq rcirc-reconncting t))) - (apply #'rcirc-connect conn-info)))))) + (catch 'exit + (cond + (rcirc-connecting + (when (process-live-p process) + (kill-process process)) + (setq rcirc-connecting nil)) + ((process-live-p process) + (throw 'exit (message "Server process is alive")))) + (let ((conn-info rcirc-connection-info)) + (setf (nth 5 conn-info) + (cl-remove-if-not #'rcirc-channel-p + (mapcar #'car rcirc-buffer-alist))) + (dolist (buf (nth 5 conn-info)) + (with-current-buffer (cdr (assoc buf rcirc-buffer-alist)) + (setq rcirc-reconncting t))) + (apply #'rcirc-connect conn-info))))) (rcirc-define-command nick (nick) "Change nick to NICK." From ec0e46d66b23aa3787b8e2f8ab0dd66e893e77cc Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 7 Sep 2021 11:03:36 +0200 Subject: [PATCH 19/36] Use fresh symbol for argument list * rcirc.el (rcirc-define-command): Use make-symbol instead of gensym --- lisp/net/rcirc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 5236f96b09f..a3f87d43666 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2479,7 +2479,7 @@ that, an interactive form can specified." (insert "\\(.*?\\)") (insert "[[:space:]]*\\'") (buffer-string))) - (argument (gensym)) + (argument (make-symbol "arglist")) documentation interactive-spec) (when (stringp (car body)) From 2ef6691602b9dd93c4fad9cc5e271e0104988a21 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 7 Sep 2021 21:53:22 +0200 Subject: [PATCH 20/36] Add rcirc-track-ignore-server-buffer-flag option * rcirc.el (rcirc-track-ignore-server-buffer-flag): Add option (rcirc-record-activity): Use rcirc-track-ignore-server-buffer-flag --- lisp/net/rcirc.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index a3f87d43666..2bdc3d68c0c 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -415,6 +415,11 @@ will be killed." :version "28.1" :type 'function) +(defcustom rcirc-track-ignore-server-buffer-flag nil + "Non-nil means activities in the server buffer are not traced." + :version "28.1" + :type 'boolean) + (defvar-local rcirc-nick nil "The nickname used for the current connection.") @@ -2249,7 +2254,9 @@ activity. Only run if the buffer is not visible and (with-current-buffer buffer (let ((old-activity rcirc-activity) (old-types rcirc-activity-types)) - (when (not (get-buffer-window (current-buffer) t)) + (when (and (not (get-buffer-window (current-buffer) t)) + (not (and rcirc-track-ignore-server-buffer-flag + (eq rcirc-server-buffer (current-buffer))))) (setq rcirc-activity (sort (if (memq (current-buffer) rcirc-activity) rcirc-activity (cons (current-buffer) rcirc-activity)) From a66fd7bb37d77940b28cfd9f48a2374e1d373245 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 10 Sep 2021 18:57:11 +0200 Subject: [PATCH 21/36] Fix double reconnection bug * rcirc.el (rcirc-sentinel): Don't reconnect if reconnecting (reconnect): Use delete-process instead of kill-process --- lisp/net/rcirc.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 2bdc3d68c0c..eb6703a4927 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -841,7 +841,8 @@ When 0, do not auto-reconnect." (not rcirc-target)) (rcirc-disconnect-buffer))) (when (and (string= sentinel "deleted") - (< 0 rcirc-reconnect-delay)) + (< 0 rcirc-reconnect-delay) + (not rcirc-connecting)) (let ((now (current-time))) (when (or (null rcirc-last-connect-time) (time-less-p rcirc-reconnect-delay @@ -2580,13 +2581,9 @@ to `rcirc-default-part-reason'." (interactive "i") (with-rcirc-server-buffer (catch 'exit - (cond - (rcirc-connecting - (when (process-live-p process) - (kill-process process)) - (setq rcirc-connecting nil)) - ((process-live-p process) - (throw 'exit (message "Server process is alive")))) + (if (eq (process-status process) 'open) + (throw 'exit (message "Server process is alive")) + (delete-process process)) (let ((conn-info rcirc-connection-info)) (setf (nth 5 conn-info) (cl-remove-if-not #'rcirc-channel-p From 7a89e0f822eaf47d4f89aa1e5f80dd0a6b4c6b7d Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 15:32:19 +0200 Subject: [PATCH 22/36] Rename rcirc-omit-after-reconnect to rcirc-omit-after-connect * rcirc.el (rcirc-omit-after-reconnect): Remove variable (rcirc-omit-responses-after-join): Add variable (rcirc-reconncting): Remove variable (rcirc-joined): Add variable (rcirc-get-buffer-create): Set rcirc-joined (rcirc-print): Use rcirc-joined (reconnect): Remove code relating to rcirc-reconncting --- lisp/net/rcirc.el | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 8129be33ab5..d5b3664a405 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -194,16 +194,15 @@ If nil, no maximum is applied." "Responses which will be hidden when `rcirc-omit-mode' is enabled." :type '(repeat string)) -(defcustom rcirc-omit-after-reconnect - '("JOIN" "TOPIC" "NAMES") - "Types of messages to hide right after reconnecting." +(defcustom rcirc-omit-responses-after-join '() + "Types of messages to hide right after joining a channel." :type '(repeat string) :version "28.1") -(defvar-local rcirc-reconncting nil - "Non-nil means we have just reconnected. +(defvar-local rcirc-joined nil + "Non-nil means we have just connected. This is used to hide the message types enumerated in -`rcirc-supress-after-reconnect'.") +`rcirc-omit-responses-after-join'.") (defvar-local rcirc-prompt-start-marker nil "Marker indicating the beginning of the message prompt.") @@ -1493,10 +1492,11 @@ Create the buffer if it doesn't exist." (rcirc-generate-new-buffer-name process target)))) (with-current-buffer new-buffer (unless (eq major-mode 'rcirc-mode) - (rcirc-mode process target))) + (rcirc-mode process target)) (setq mode-line-process nil) - (rcirc-put-nick-channel process (rcirc-nick process) target - rcirc-current-line) + (setq rcirc-joined (current-time))) + (rcirc-put-nick-channel process (rcirc-nick process) target + rcirc-current-line) new-buffer))))) (defun rcirc-send-input () @@ -1891,9 +1891,9 @@ connection." (let ((last-activity-lines (rcirc-elapsed-lines process sender target))) (if (and (not (string= (rcirc-nick process) sender)) (or (member response rcirc-omit-responses) - (if (member response rcirc-omit-after-reconnect) - rcirc-reconncting - (setq rcirc-reconncting nil))) + (and (member response rcirc-omit-responses-after-join) + (< (time-to-seconds (time-since rcirc-joined)) + 1))) (or (not last-activity-lines) (< rcirc-omit-threshold last-activity-lines))) (put-text-property (point-min) (point-max) @@ -2588,9 +2588,6 @@ to `rcirc-default-part-reason'." (setf (nth 5 conn-info) (cl-remove-if-not #'rcirc-channel-p (mapcar #'car rcirc-buffer-alist))) - (dolist (buf (nth 5 conn-info)) - (with-current-buffer (cdr (assoc buf rcirc-buffer-alist)) - (setq rcirc-reconncting t))) (apply #'rcirc-connect conn-info))))) (rcirc-define-command nick (nick) From 550011ca588a09b990d30b4b5083d46481a98836 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 15:56:44 +0200 Subject: [PATCH 23/36] * rcirc.texi: Document rcirc-omit-responses-after-join --- doc/misc/rcirc.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index ae3a3b13e62..f1d82ea12ee 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -807,6 +807,18 @@ active and only omits a message if the nick has not been active. The window @code{rcirc} considers is controlled by the @code{rcirc-omit-threshold} variable. +@vindex rcirc-omit-responses-after-join +Right after connecting to a server, rcirc will also hide all messages +in @code{rcirc-omit-responses-after-join}, next to +@code{rcirc-omit-responses}. For example, + +@example +(setq rcirc-omit-responses-after-join '("TOPIC" "NICK")) +@end example + +would hide the topic message and the list of users in the current +channel right after joining a new channel. + @node Hacking and Tweaking @chapter Hacking and Tweaking @cindex hacking and tweaking From 0d087458067ee7cd84a6b02354a7fdba971a5015 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 16:01:45 +0200 Subject: [PATCH 24/36] * rcirc.texi: Document rcirc-track-ignore-server-buffer-flag --- doc/misc/rcirc.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index f1d82ea12ee..dc08a222d86 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -254,6 +254,10 @@ To make this permanent, add the following to your init file: Use @kbd{C-c C-@key{SPC}} to switch to these buffers. +@vindex rcirc-track-ignore-server-buffer-flag +If the user wishes to ignore events in the server buffer, set +@code{rcirc-track-ignore-server-buffer-flag} to a non-nil value. + @node Reference @chapter Reference @cindex reference From 88b623772b35177ab8e76601e6a040bb317bde4c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 16:37:42 +0200 Subject: [PATCH 25/36] * rcirc.texi: Document rcirc-nick-filter and rcirc-channel-filter --- doc/misc/rcirc.texi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index dc08a222d86..5e157ec57e3 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -935,6 +935,37 @@ because @code{defun-rcirc-command} is not yet available, and without (concat "I use " rcirc-id-string)))) @end smallexample +@node Using rcirc with bouncers +@section Using rcirc with bouncers +@cindex bouncer + +Some bouncers multiplex connections to various servers, but have to +modify nicks and channel names to make this work. The channel +@code{#emacs} on @code{irc.libera.chat} becomes +@code{#emacs/irc.libera.chat}. + +@vindex rcirc-nick-filter +@vindex rcirc-channel-filter +The options @code{rcirc-nick-filter} and @code{rcirc-channel-filter} +can be used to make this feel more natural. When set to functions, +these will be used to change how nicks and channel names are +displayed. A simple configuration to fix the above example might be: + +@smallexample +(defun my/rcirc-remove-suffix (STR) + "Remove suffixes from STR." + (save-match-data + (if (string-match "/[[:alpha:]]+?\\'" str) + (substring str 0 (match-beginning 0)) + str))) + +(setq rcirc-nick-filter #'my/rcirc-remove-suffix + rcirc-channel-filter #'local/rcirc-soju-suffix) +@end smallexample + +The effect is that buffer names, nicks in messages, nick-completion +all strip away the suffix introduced by the bouncer. + @node GNU Free Documentation License @appendix GNU Free Documentation License @include doclicense.texi From 251a9f5fe09bbb94fa9b5c0c23092284ae3f5620 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 16:40:18 +0200 Subject: [PATCH 26/36] * rcirc.texi: Document rcirc-track-abbrevate-flag --- doc/misc/rcirc.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index 5e157ec57e3..865fd197b3c 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -675,6 +675,12 @@ window is showing them), the mode line will now show you the abbreviated channel or nick name. Use @kbd{C-c C-@key{SPC}} to switch to these buffers. +@cindex rcirc-track-abbrevate-flag +By default the channel names are abbreviated, set +@code{rcirc-track-abbrevate-flag} to a non-nil value. This might be +interesting if the IRC activities are not tracked in the mode line, +but somewhere else. + @vindex rcirc-mode-hook If you prefer not to load @code{rcirc} immediately, you can delay the activation of this mode: From 2e24b66079636aec3cae4cf2989242b8c2397f52 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 16:43:56 +0200 Subject: [PATCH 27/36] * rcirc.texi: Replace defun-rcirc-command with rcirc-define-command --- doc/misc/rcirc.texi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index 865fd197b3c..b81d1a42cf0 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -925,20 +925,20 @@ how to include the date in the time stamp: @cindex new commands, defining Here's a simple new command, @code{/sv}. With it, you can boast about -your IRC client. It shows how you can use @code{defun-rcirc-command} to +your IRC client. It shows how you can use @code{rcirc-define-command} to define new commands. +@findex rcirc-define-command We're waiting for the definition of this command until @code{rcirc} is loaded -because @code{defun-rcirc-command} is not yet available, and without +because @code{rcirc-define-command} is not yet available, and without @code{rcirc} loaded, the command wouldn't do us much good anyway. @smallexample (with-eval-after-load 'rcirc - (defun-rcirc-command sv (arg) + (rcirc-define-command sv () "Boast about rcirc." (interactive "i") - (rcirc-send-message process target - (concat "I use " rcirc-id-string)))) + (rcirc-send-message process target "I use " rcirc-id-string))) @end smallexample @node Using rcirc with bouncers From 0712e335887919487bd08084a71b6069bd1d67a8 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 17:55:41 +0200 Subject: [PATCH 28/36] * NEWS: Mention rcirc changes --- etc/NEWS | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f033176e9fe..771e7357503 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2685,6 +2685,43 @@ Variable 'mh-whitelist-preserves-sequences-flag' is renamed Face 'mh-folder-blacklisted' is renamed 'mh-folder-blocklisted'. Face 'mh-folder-whitelisted' is renamed 'mh-folder-allowlisted'. +** Rcirc + ++++ +*** rcirc now supports SASL authentication. + +--- +*** rcirc connects asynchronously + +--- +*** Integrate formatting into rcirc-send-string +The function now accepts a variable number of arguments. + ++++ +*** Deprecate defun-rcirc-command in favour of rcirc-define-command +The new macro handles + +--- +*** Add basic IRCv3 support +This includes support for the capabilities: server-time, batch, +message-ids, invite-notify, multi-prefix and standard-replies. + +--- +*** Add mouse property support to rcirc-track-minor-mode + +--- +*** Improve support for IRC markup codes + +--- +*** Check auth-sources for server passwords + +--- +*** Allow for channels to hide certain message types right after connecting. +Set rcirc-omit-responses-after-join analogously to rcirc-omit-responses. + +--- +*** + ** Miscellaneous --- @@ -2705,9 +2742,6 @@ will now restore the original order. --- *** 'M-left' and 'M-right' now move between columns in 'tabulated-list-mode'. -+++ -*** rcirc now supports SASL authentication. - --- *** New variable 'hl-line-overlay-priority'. This can be used to change the priority of the hl-line overlays. From 0d350402d88073c508033feb2397a936fca11ef9 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 11 Sep 2021 18:16:27 +0200 Subject: [PATCH 29/36] * NEWS: Remove empty entry --- etc/NEWS | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 771e7357503..ed39a4bd1c1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2719,9 +2719,6 @@ message-ids, invite-notify, multi-prefix and standard-replies. *** Allow for channels to hide certain message types right after connecting. Set rcirc-omit-responses-after-join analogously to rcirc-omit-responses. ---- -*** - ** Miscellaneous --- From 767fa9761f5fcf077eafc05739f88336939f72cb Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 13 Sep 2021 17:23:23 +0200 Subject: [PATCH 30/36] * rcirc.el (rcirc-server-alist): Add #emacs to default server list Author: --- lisp/net/rcirc.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index d5b3664a405..a3c427a717d 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -60,9 +60,9 @@ (defcustom rcirc-server-alist (if (gnutls-available-p) - '(("irc.libera.chat" :channels ("#rcirc") + '(("irc.libera.chat" :channels ("#emacs" "#rcirc") :port 6697 :encryption tls)) - '(("irc.libera.chat" :channels ("#rcirc")))) + '(("irc.libera.chat" :channels ("#emacs" "#rcirc")))) "An alist of IRC connections to establish when running `rcirc'. Each element looks like (SERVER-NAME PARAMETERS). From ec50a368d5b7303fe3a05b42ec5d02e37d9565da Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 13 Sep 2021 19:08:28 +0200 Subject: [PATCH 31/36] * rcirc.texi (Hacking and Tweaking): Add missing section to menu --- doc/misc/rcirc.texi | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index b81d1a42cf0..fb90d840305 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -841,6 +841,7 @@ Here are some examples of stuff you can do to configure @code{rcirc}. * Scrolling conservatively:: * Changing the time stamp format:: * Defining a new command:: +* Using rcirc with bouncers:: @end menu @node Skipping /away messages using handlers From 8eb9eb0c41417991432122795522f6db7e1bb7d2 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 14 Sep 2021 19:05:12 +0200 Subject: [PATCH 32/36] Allow for multiple attempts when reconnecting * doc/misc/rcirc.texi (rcirc commands): Mention rcirc-reconnect-attempts * etc/NEWS: Document change (rcirc-connect): Ensure no other process exists (rcirc-reconnect-attempts): Add option (rcirc-failed-attempts): Add local variable (rcirc-reconnection-timer): Add local variable (rcirc-reconnect): Add function (rcirc-sentinel): Manage multiple reconnection attempts (rcirc-process-server-response): Change user for error messages (rcirc-mode): Don't set rcirc-last-connect-time (reconnect): Extract functionality to rcirc-reconnect --- doc/misc/rcirc.texi | 8 ++- etc/NEWS | 6 +- lisp/net/rcirc.el | 172 ++++++++++++++++++++++++++++---------------- 3 files changed, 124 insertions(+), 62 deletions(-) diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi index fb90d840305..47de523737c 100644 --- a/doc/misc/rcirc.texi +++ b/doc/misc/rcirc.texi @@ -430,7 +430,13 @@ lost. The simple solution is to use @kbd{M-x rcirc}. The problem is that this opens an @emph{additional} connection, so you'll have two copies of every channel buffer, one dead and one live. -The real answer, therefore, is the @code{/reconnect} command. +One option therefore, is the @code{/reconnect} command. + +An other approach is to set @code{rcirc-reconnect-delay} to a value +greater than 0, and allow rcirc to reconnect when it detects that the +connection has been closed. By default it will try to do this three +times (as specified by @code{rcirc-reconnect-attempts}), before giving +up. @end table @node Useful IRC commands diff --git a/etc/NEWS b/etc/NEWS index ed39a4bd1c1..8f30a3201b2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2699,7 +2699,7 @@ The function now accepts a variable number of arguments. +++ *** Deprecate defun-rcirc-command in favour of rcirc-define-command -The new macro handles +The new macro handles multiple and optional arguments. --- *** Add basic IRCv3 support @@ -2719,6 +2719,10 @@ message-ids, invite-notify, multi-prefix and standard-replies. *** Allow for channels to hide certain message types right after connecting. Set rcirc-omit-responses-after-join analogously to rcirc-omit-responses. ++++ +*** Implement repeated reconnection strategy +See rcirc-reconnect-attempts. + ** Miscellaneous --- diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index a3c427a717d..6c669564209 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -601,6 +601,8 @@ FULL-NAME STARTUP-CHANNELS PASSWORD ENCRYPTION SERVER-ALIAS). See `rcirc-connect' for more details on these variables.") (defvar-local rcirc-process nil "Network process for the current connection.") +(defvar-local rcirc-last-connect-time nil + "The last time the buffer was connected.") ;;; IRCv3 capability negotiation (https://ircv3.net/specs/extensions/capability-negotiation) (defvar rcirc-implemented-capabilities @@ -669,11 +671,18 @@ that are joined after authentication." (full-name (or full-name rcirc-default-full-name)) (startup-channels startup-channels) - (process (open-network-stream + process) + + ;; Ensure any previous process is killed + (when-let ((old-process (get-process (or server-alias server)))) + (set-process-sentinel old-process #'ignore) + (delete-process process)) + + ;; Set up process + (setq process (open-network-stream (or server-alias server) nil server port-number :type (or encryption 'plain) - :nowait t))) - ;; set up process + :nowait t)) (set-process-coding-system process 'raw-text 'raw-text) (with-current-buffer (get-buffer-create (rcirc-generate-new-buffer-name process nil)) (set-process-buffer process (current-buffer)) @@ -692,9 +701,17 @@ that are joined after authentication." (setq rcirc-nick nick) (setq rcirc-startup-channels startup-channels) (setq rcirc-last-server-message-time (current-time)) + (setq rcirc-last-connect-time (current-time)) - (setq mode-line-process ":connecting") - (setq rcirc-connecting t) + ;; Check if the immediate process state + (sit-for .1) + (cond + ((eq (process-status process) 'failed) + (setq mode-line-process ":disconnected") + (setq rcirc-connecting nil)) + ((eq (process-status process) 'connect) + (setq mode-line-process ":connecting") + (setq rcirc-connecting t))) (add-hook 'auto-save-hook #'rcirc-log-write) @@ -788,66 +805,110 @@ When 0, do not auto-reconnect." :version "25.1" :type 'integer) -(defvar-local rcirc-last-connect-time nil - "The last time the buffer was connected.") +(defcustom rcirc-reconnect-attempts 3 + "Number of times a reconnection should be attempted." + :version "28.1" + :type 'integer) + +(defvar-local rcirc-failed-attempts 0 + "Number of times reconnecting has failed.") + +(defvar-local rcirc-reconnection-timer nil + "Timer used for reconnecting.") + +(defun rcirc-reconnect (process &optional quiet) + "Attempt to reconnect connection to PROCESS. +If QUIET is non-nil, no not emit a message." + (with-rcirc-process-buffer process + (catch 'exit + (if (rcirc--connection-open-p process) + (throw 'exit (or quiet (message "Server process is alive"))) + (delete-process process)) + (let ((conn-info rcirc-connection-info)) + (setf (nth 5 conn-info) + (cl-remove-if-not #'rcirc-channel-p + (mapcar #'car rcirc-buffer-alist))) + (dolist (buffer (mapcar #'cdr rcirc-buffer-alist)) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (setq mode-line-process ":connecting")))) + (let ((nprocess (apply #'rcirc-connect conn-info))) + (when (and (< rcirc-failed-attempts rcirc-reconnect-attempts) + (eq (process-status nprocess) 'failed)) + (setq rcirc-failed-attempts (1+ rcirc-failed-attempts)) + (rcirc-print nprocess "*rcirc*" "ERROR" nil + (format "Failed to reconnect (%d/%d)..." + rcirc-failed-attempts + rcirc-reconnect-attempts)) + (setq rcirc-reconnection-timer + (run-at-time rcirc-timeout-seconds nil + #'rcirc-reconnect process t)))))))) (defun rcirc-sentinel (process sentinel) "Called when PROCESS receives SENTINEL." (let ((sentinel (string-replace "\n" "" sentinel))) (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) (with-rcirc-process-buffer process - (if (string= sentinel "open") - (let* ((server (nth 0 rcirc-connection-info)) - (user-name (nth 3 rcirc-connection-info)) - (full-name (nth 4 rcirc-connection-info)) - (password (nth 6 rcirc-connection-info)) - (server-alias (nth 8 rcirc-connection-info)) - (use-sasl (eq (rcirc-get-server-method server) 'sasl))) + (cond + ((string= sentinel "open") + (let* ((server (nth 0 rcirc-connection-info)) + (user-name (nth 3 rcirc-connection-info)) + (full-name (nth 4 rcirc-connection-info)) + (password (nth 6 rcirc-connection-info)) + (server-alias (nth 8 rcirc-connection-info)) + (use-sasl (eq (rcirc-get-server-method server) 'sasl))) - ;; prepare SASL authentication - (when use-sasl - (rcirc-send-string process "CAP REQ sasl") - (setq-local rcirc-finished-sasl nil)) + ;; Prepare SASL authentication + (when use-sasl + (rcirc-send-string process "CAP REQ sasl") + (setq-local rcirc-finished-sasl nil)) - ;; identify - (dolist (cap rcirc-implemented-capabilities) - (rcirc-send-string process "CAP" "REQ" : cap) - (push cap rcirc-requested-capabilities)) - (unless (zerop (length password)) - (rcirc-send-string process "PASS" password)) - (rcirc-send-string process "NICK" rcirc-nick) - (rcirc-send-string process "USER" user-name "0" "*" : full-name) + ;; Capability negotiation + (dolist (cap rcirc-implemented-capabilities) + (rcirc-send-string process "CAP" "REQ" : cap) + (push cap rcirc-requested-capabilities)) - ;; Setup sasl, and initiate authentication. - (when (and rcirc-auto-authenticate-flag - use-sasl) - (rcirc-send-string process "AUTHENTICATE" "PLAIN")) + ;; Identify user + (unless (zerop (length password)) + (rcirc-send-string process "PASS" password)) + (rcirc-send-string process "NICK" rcirc-nick) + (rcirc-send-string process "USER" user-name "0" "*" : full-name) - ;; setup ping timer if necessary - (unless rcirc-keepalive-timer - (setq rcirc-keepalive-timer - (run-at-time 0 (/ rcirc-timeout-seconds 2) #'rcirc-keepalive))) + ;; Setup sasl, and initiate authentication. + (when (and rcirc-auto-authenticate-flag + use-sasl) + (rcirc-send-string process "AUTHENTICATE" "PLAIN")) - (message "Connecting to %s...done" (or server-alias server)) - (setq mode-line-process nil)) - (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) + ;; Setup ping timer if necessary + (unless rcirc-keepalive-timer + (setq rcirc-keepalive-timer + (run-at-time 0 (/ rcirc-timeout-seconds 2) #'rcirc-keepalive))) + + ;; Reset previous reconnection attempts + (setq rcirc-failed-attempts 0) + (when rcirc-reconnection-timer + (cancel-timer rcirc-reconnection-timer) + (setq rcirc-reconnection-timer nil)) + + (message "Connecting to %s...done" (or server-alias server)) + (setq mode-line-process nil))) + ((string= sentinel "deleted") + (let ((now (current-time))) + (with-rcirc-process-buffer process + (when (and (< 0 rcirc-reconnect-delay) + (time-less-p rcirc-reconnect-delay + (time-subtract now rcirc-last-connect-time))) + (setq rcirc-last-connect-time now) + (rcirc-reconnect process))))) + ((dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) (with-current-buffer (or buffer (current-buffer)) - (rcirc-print process "rcirc.el" "ERROR" rcirc-target + (rcirc-print process "*rcirc*" "ERROR" rcirc-target (format "%s: %s (%S)" (process-name process) sentinel (process-status process)) (not rcirc-target)) - (rcirc-disconnect-buffer))) - (when (and (string= sentinel "deleted") - (< 0 rcirc-reconnect-delay) - (not rcirc-connecting)) - (let ((now (current-time))) - (when (or (null rcirc-last-connect-time) - (time-less-p rcirc-reconnect-delay - (time-subtract now rcirc-last-connect-time))) - (setq rcirc-last-connect-time now) - (rcirc-cmd-reconnect nil))))) + (rcirc-disconnect-buffer))))) (run-hook-with-args 'rcirc-sentinel-functions process sentinel)))) (defun rcirc-disconnect-buffer (&optional buffer) @@ -907,7 +968,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") (condition-case err (rcirc-process-server-response-1 process text) (error - (rcirc-print process "RCIRC" "ERROR" nil + (rcirc-print process "*rcirc*" "ERROR" nil (format "\"%s\" %s" text err) t))) (rcirc-process-server-response-1 process text))) @@ -1310,7 +1371,6 @@ PROCESS is the process object used for communication. (setq rcirc-last-post-time (current-time)) (setq-local fill-paragraph-function 'rcirc-fill-paragraph) (setq rcirc-current-line 0) - (setq rcirc-last-connect-time (current-time)) (use-hard-newlines t) @@ -2579,16 +2639,8 @@ to `rcirc-default-part-reason'." (rcirc-define-command reconnect () "Reconnect to current server." (interactive "i") - (with-rcirc-server-buffer - (catch 'exit - (if (eq (process-status process) 'open) - (throw 'exit (message "Server process is alive")) - (delete-process process)) - (let ((conn-info rcirc-connection-info)) - (setf (nth 5 conn-info) - (cl-remove-if-not #'rcirc-channel-p - (mapcar #'car rcirc-buffer-alist))) - (apply #'rcirc-connect conn-info))))) + (setq rcirc-failed-attempts 0) + (rcirc-reconnect process)) (rcirc-define-command nick (nick) "Change nick to NICK." From 1c3bad8c2e311cce81dc5203cab77f4d65ab3e82 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 14 Sep 2021 19:07:18 +0200 Subject: [PATCH 33/36] Display server buffer after connecting * rcirc.el (rcirc-display-server-buffer): Add new option (rcirc): Respect rcirc-display-server-buffer --- lisp/net/rcirc.el | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 6c669564209..579a350c6a1 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -419,6 +419,11 @@ will be killed." :version "28.1" :type 'boolean) +(defcustom rcirc-display-server-buffer t + "Non-nil means the server buffer should be shown on connecting." + :version "28.1" + :type 'boolean) + (defvar-local rcirc-nick nil "The nickname used for the current connection.") @@ -518,10 +523,12 @@ If ARG is non-nil, instead prompt for connection parameters." :channels) " ")) "[, ]+" t)) - (encryption (rcirc-prompt-for-encryption server-plist))) - (rcirc-connect server port nick user-name - rcirc-default-full-name - channels password encryption)) + (encryption (rcirc-prompt-for-encryption server-plist)) + (process (rcirc-connect server port nick user-name + rcirc-default-full-name + channels password encryption))) + (when rcirc-display-server-buffer + (pop-to-buffer-same-window (process-buffer process)))) ;; connect to servers in `rcirc-server-alist' (let (connected-servers) (dolist (c rcirc-server-alist) @@ -550,9 +557,11 @@ If ARG is non-nil, instead prompt for connection parameters." (setq connected p))) (if (not connected) (condition-case nil - (rcirc-connect server port nick user-name - full-name channels password encryption - server-alias) + (let ((process (rcirc-connect server port nick user-name + full-name channels password encryption + server-alias))) + (when rcirc-display-server-buffer + (pop-to-buffer-same-window (process-buffer process)))) (quit (message "Quit connecting to %s" (or server-alias server)))) (with-current-buffer (process-buffer connected) From 1e1378699c9cc7f2de0fd679149379522bcc3c6d Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 14 Sep 2021 20:32:46 +0200 Subject: [PATCH 34/36] Restore rcirc-target if possible * rcirc.el (rcirc-process-message): Extract target from buffer name --- lisp/net/rcirc.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 579a350c6a1..5537ddca108 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1620,6 +1620,11 @@ The argument JUSTIFY is passed on to `fill-region'." (defun rcirc-process-message (line) "Process LINE as a message to be sent." + (when (and (null rcirc-target) + (string-match + (rx bos (group (+? nonl)) "@" (+ nonl) eos) + (buffer-name))) + (setq rcirc-target (match-string 1 (buffer-name)))) (if (not rcirc-target) (message "Not joined (no target)") (delete-region rcirc-prompt-end-marker (point)) From 3405c85ae402ae53b3b731868e18bd51ea928f37 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 14 Sep 2021 20:41:27 +0200 Subject: [PATCH 35/36] Unset mode-line-process for all buffers on reconnecting * rcirc.el (rcirc-sentinel): Add loop over all managed buffers --- lisp/net/rcirc.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 5537ddca108..b0374a545cd 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -900,7 +900,9 @@ If QUIET is non-nil, no not emit a message." (setq rcirc-reconnection-timer nil)) (message "Connecting to %s...done" (or server-alias server)) - (setq mode-line-process nil))) + (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) + (with-current-buffer (or buffer (current-buffer)) + (setq mode-line-process nil))))) ((string= sentinel "deleted") (let ((now (current-time))) (with-rcirc-process-buffer process From 5ebad79e622e0e645bdcf0a149091698e9bc877f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 14 Sep 2021 22:10:14 +0200 Subject: [PATCH 36/36] Fix interactive forms for rcirc-define-command * rcirc.el (rcirc-define-command): Handle string descriptors correctly --- lisp/net/rcirc.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index b0374a545cd..bc67562d2d3 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2569,13 +2569,13 @@ that, an interactive form can specified." (when (stringp (car body)) (setq documentation (pop body))) (when (eq (car-safe (car-safe body)) 'interactive) - (setq interactive-spec (cdr (pop body)))) + (setq interactive-spec (cadr (pop body)))) `(progn (defun ,fn-name (,argument &optional process target) ,(concat documentation "\n\nNote: If PROCESS or TARGET are nil, the values given" "\nby `rcirc-buffer-process' and `rcirc-target' will be used.") - (interactive (list ,@interactive-spec)) + (interactive ,interactive-spec) (unless (if (listp ,argument) (<= ,required (length ,argument) ,total) (string-match ,regexp ,argument))