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:38:48 +0800 Message-ID: <8736839odz.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> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="82003"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4; emacs 28.0.50 Cc: stardiviner , Lars Ingebrigtsen , 29533@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 14 05:39:08 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 1jZ4iC-000LF0-JN for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 05:39:08 +0200 Original-Received: from localhost ([::1]:52512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZ4iB-0004r2-Kz for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 May 2020 23:39:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ4i5-0004pb-UP for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 23:39:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZ4i5-0006Fr-LX for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 23:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZ4i5-0002fB-JX for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 23:39:01 -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:39:01 +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.158942753910228 (code B ref 29533); Thu, 14 May 2020 03:39:01 +0000 Original-Received: (at 29533) by debbugs.gnu.org; 14 May 2020 03:38:59 +0000 Original-Received: from localhost ([127.0.0.1]:59952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZ4i2-0002et-Lb for submit@debbugs.gnu.org; Wed, 13 May 2020 23:38:59 -0400 Original-Received: from [183.249.138.107] (port=9216 helo=dark.localdomain) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZ4i0-0002ef-2a for 29533@debbugs.gnu.org; Wed, 13 May 2020 23:38:57 -0400 Original-Received: by dark.localdomain (Postfix, from userid 1000) id AF66B24160B; Thu, 14 May 2020 11:38:48 +0800 (HKT) In-reply-to: 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:180191 Archived-At: =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Stefan Kangas writes: > stardiviner writes: > >> 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 don't usually use erc, so I'll have to leave that for someone else. > > Best regards, > Stefan Kangas Ok, I applied changes on Emacs source code, but when I try to commit, I got following warning which stops me creating commit. ``` 1 git =E2=80=A6 commit -- lisp/erc/erc.el:4018: indent with spaces. + (regexp :tag "Name") lisp/erc/erc.el:4019: indent with spaces. + (repeat :tag "Channels" lisp/erc/erc.el:4020: indent with spaces. + (string :tag "Name"))))) lisp/erc/erc.el:4046: indent with spaces. + (completing-read "Select a server: " lisp/erc/erc.el:4047: indent with spaces. + (mapcar 'car erc-join-channels-alist)) lisp/erc/erc.el:4048: indent with spaces. + erc-join-channels-alist))))) ``` I didi an google search, but still don't know how to set this. Shouldn't it= be space-indented? And here is my patch diff. How should I submit this patch to Emacs/erc ? #+begin_src diff Staged changes (1) modified lisp/erc/erc.el @@ -1161,7 +1161,7 @@ erc-mode-map (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse) (define-key map "\C-c\C-f" 'erc-toggle-flood-control) (define-key map "\C-c\C-i" 'erc-invite-only-mode) =2D - (define-key map "\C-c\C-j" 'erc-join-channel) + (define-key map "\C-c\C-j" 'erc-join-channel-select) (define-key map "\C-c\C-n" 'erc-channel-names) (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress) (define-key map "\C-c\C-p" 'erc-part-from-channel) @@ -3993,6 +3993,34 @@ erc-input-action (if (not (string-match "^\\s-*$" action)) (erc-send-action (erc-default-target) action)))) =20 +(defcustom erc-join-channels-alist nil + "Alist of channels to select when you join channels. + +Every element in the alist has the form (SERVER . CHANNELS). +SERVER is a regexp matching the server, and channels is the +list of channels to join. + +If the channel(s) require channel keys for joining, the passwords +are found via auth-source. For instance, if you use ~/.authinfo +as your auth-source backend, then put something like the +following in that file: + +machine irc.example.net login \"#fsf\" password sEcReT + +Customize this variable to set the value for your first connect. +Once you are connected and join and part channels, this alist +keeps track of what channels you are on, and will join them +again when you get disconnected. When you restart Emacs, however, +those changes are lost, and the customization you saved the last +time is used again." + :group 'erc-join + :type '(repeat (cons :tag "Server" + (regexp :tag "Name") + (repeat :tag "Channels" + (string :tag "Name"))))) + +(setq erc-join-channels-alist '(("*.freenode.net" "#emacs" "#org-mode"))) + (defun erc-join-channel (channel &optional key) "Join CHANNEL. =20 @@ -4008,6 +4036,17 @@ erc-join-channel (read-from-minibuffer "Channel key (RET for none): " nil)))) (erc-cmd-JOIN channel (when (>=3D (length key) 1) key))) =20 +(defun erc-join-channel-select () + "Select a channel to join from alist of channels to." + (interactive) + (erc-join-channel + (completing-read + "Select a channel: " + (cdr (assoc + (completing-read "Select a server: " + (mapcar 'car erc-join-channels-alist)) + erc-join-channels-alist))))) + (defun erc-part-from-channel (reason) "Part from the current channel and prompt for a REASON." (interactive #+end_src =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----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68vUgUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsOj+QgApWTHBQZttqcuSdM2V0S3voKFVpKi uN9rqFjPsko7KMeoqTh3Usw7ixHcjmgDyhbzMOfRZ0wBhUk1mugRtoZ6JLIeLVt+ PecrqLukLXygPaSUDDRnRysZLaol1SThGQdX1Lv4F85Qa8ijPHBeMZITx6hlQSvb /a9nuHm8R4FurEstf1iVUJOhb7Oe4ikBb+Q+ER3gWCQDaBZyvm5J0nDSlwJb44Zs 4MB4I3vTCxDBh69WGi7iZBggygpfhf+pM/0vwAY0w/IiBd6/1j4KuxX48WQkwtjQ BgP0dwOWOSA6wTAtdaSlW5m3qWAIKSd/5j2gVMwalmK4702QvzDcc6/mDA=3D=3D =3Dk6Jw =2D----END PGP SIGNATURE-----