>From 596835a935222f4625820340bf8d86a487646ace Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Mon, 11 Jul 2022 05:14:57 -0700 Subject: [PATCH 08/10] [POC] Use erc--join-with-callback in URL handler * lisp/erc/erc.el (erc-handle-irc-url): Accept new `on-join' one-off JOIN handler and pass it to `erc--join-with-callback'. * test/lisp/erc/erc-tests.el (erc-handle-irc-url): Use `erc--join-with-callback' instead of `erc-cmd-JOIN'. --- lisp/erc/erc.el | 6 +++--- test/lisp/erc/erc-tests.el | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 371612b085..fd91441828 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -7479,7 +7479,7 @@ erc-get-parsed-vector-type ;;;###autoload (defun erc-handle-irc-url (host port channel nick password - &optional connect-fn) + &optional connect-fn on-join) "Use ERC to IRC on HOST:PORT in CHANNEL. If ERC is already connected to HOST:PORT, simply /join CHANNEL. Otherwise, connect to HOST:PORT as NICK and /join CHANNEL. @@ -7526,10 +7526,10 @@ erc-handle-irc-url (with-current-buffer server-buffer (letrec ((f (lambda (&rest _) (remove-hook 'erc-after-connect f t) - (erc-cmd-JOIN channel key)))) + (erc--join-with-callback channel key on-join)))) (add-hook 'erc-after-connect f nil t))) (with-current-buffer server-buffer - (erc-cmd-JOIN channel key)))))) + (erc--join-with-callback channel key on-join)))))) ;; XXX ERASE ME (possibly use as basis for new section in info doc) ;; diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index f68a7debed..947b45e1dc 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el @@ -968,8 +968,8 @@ erc-handle-irc-url (push r calls) (if (functionp rvbuf) (funcall rvbuf) rvbuf)))) - (cl-letf (((symbol-function 'erc-cmd-JOIN) - (lambda (&rest r) (push r calls)))) + (cl-letf (((symbol-function 'erc--join-with-callback) + (lambda (&rest r) (push (butlast r) calls)))) (with-current-buffer (erc-tests--make-server-buf "foonet") (setq rvbuf (current-buffer))) -- 2.36.1