From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: stardiviner Newsgroups: gmane.emacs.bugs Subject: bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list Date: Thu, 14 May 2020 11:32:56 +0800 Message-ID: <875zcz9onr.fsf@gmail.com> References: <87eez3kebf.fsf@gnus.org> <87v9lbykbp.fsf@stefankangas.se> <87tv0veuyh.fsf@gmail.com> <87eerzyhbi.fsf@stefankangas.se> <87r1vpogto.fsf@gmail.com> <87ftc4ukv1.fsf@gmail.com> <854ksjhpro.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="63451"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4; emacs 28.0.50 Cc: stardiviner , Lars Ingebrigtsen , Stefan Kangas , 29533@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 14 05:34:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZ4dU-000GMP-FZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 05:34:16 +0200 Original-Received: from localhost ([::1]:49786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZ4dS-00028N-WD for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 May 2020 23:34:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ4dG-00027s-Ol for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 23:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZ4dG-00054R-FA for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 23:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZ4dG-0002YO-C9 for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 23:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: stardiviner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 03:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29533 X-GNU-PR-Package: emacs Original-Received: via spool by 29533-submit@debbugs.gnu.org id=B29533.15894271929760 (code B ref 29533); Thu, 14 May 2020 03:34:02 +0000 Original-Received: (at 29533) by debbugs.gnu.org; 14 May 2020 03:33:12 +0000 Original-Received: from localhost ([127.0.0.1]:59948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZ4cR-0002XM-Ss for submit@debbugs.gnu.org; Wed, 13 May 2020 23:33:12 -0400 Original-Received: from [183.249.138.107] (port=9796 helo=dark.localdomain) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZ4cQ-0002Wl-76 for 29533@debbugs.gnu.org; Wed, 13 May 2020 23:33:10 -0400 Original-Received: by dark.localdomain (Postfix, from userid 1000) id BDFD424160B; Thu, 14 May 2020 11:32:56 +0800 (HKT) In-reply-to: <854ksjhpro.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180190 Archived-At: =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Noam Postavsky writes: > stardiviner writes: > >> ;;; original code >> (defun erc-join-channel (channel &optional key) >> "Join CHANNEL. >> >> If `point' is at the beginning of a channel name, use that as default." >> (interactive >> (list [...] > >> (defun erc-join-channel-select (args) >> "Select a channel to join from alist of channels to." >> (let ((channel (completing-read >> "Select a channel: " >> (cdr (assoc >> (completing-read "Select a server: " >> (mapcar 'car erc-join-channels-= alist)) >> erc-join-channels-alist))))) >> (setq args (list channel)))) > >> (advice-add 'erc-join-channel :filter-args 'erc-join-channel-select) > >> When I press [C-c C-j] (erc-join-channel), the advice is added on functi= on, >> but seems not working. Don't know why, do you have any clue? > > I think advice doesn't affect interactive calls the way you expect. I > forget the details of it, but anyway it's probably better to just remap > instead, along the lines of: > > (defun erc-join-channel-select () > "Select a channel to join from alist of channels to." > (erj-join-channel > (completing-read > "Select a channel: " > (cdr (assoc > (completing-read "Select a server: " > (mapcar 'car erc-join-channels-alist)) > erc-join-channels-alist))))) > > (define-key erc-mode-map [remap erc-join-channel] 'erc-join-channel-s= elect) Thanks, I apply you solution, I changed erc's default [C-c C-j] keybinding = to new command. =2D --=20 [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 =20=20=20=20=20=20 =2D----BEGIN PGP SIGNATURE----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68u+gUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsNwvAf8CY1KyFvDnCFl+xXOJmmhKjv+oomo 4M10Vx1bAlCeWH0UYojgydIjEwmjKYcG3GKFCeyIC2B6rx6aZ3t89QmpIr/QQaYD k+4qCpTI9O72eVHGLFCxNf6U6ob5T/BEqe1CwgG9QmTGko4cjQl6rJEnxPYe8KUk lvhdFPwY09dUHbc8k6nd2/MaBucm+g9TiPc8Y8FxXdHb88EZC0WUSzF9FkuQ2FHJ 47ZXOdm/UwPmWZpnIpSJ1XxXSDxB0iejHyKCpFraZLbFWp9IjwJGBA+mKwPu8LII 74+5oQFXB9lxhl9EoQbTzR/qrSrL1ISlynV+wSZomVVAXKLTeJIA8EsYeQ=3D=3D =3DzIfK =2D----END PGP SIGNATURE-----