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: Mon, 18 May 2020 20:21:10 +0800 Message-ID: <87lflpcu2x.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> <8736839odz.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="61538"; 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 Mon May 18 14:23:34 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 1jaent-000FuK-6F for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 May 2020 14:23:33 +0200 Original-Received: from localhost ([::1]:57410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaens-0000MR-4b for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 May 2020 08:23:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaemQ-0006jm-M0 for bug-gnu-emacs@gnu.org; Mon, 18 May 2020 08:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaemQ-0007Rm-Ai for bug-gnu-emacs@gnu.org; Mon, 18 May 2020 08:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jaemQ-0000KN-2q for bug-gnu-emacs@gnu.org; Mon, 18 May 2020 08:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: stardiviner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 May 2020 12:22: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.15898044891219 (code B ref 29533); Mon, 18 May 2020 12:22:01 +0000 Original-Received: (at 29533) by debbugs.gnu.org; 18 May 2020 12:21:29 +0000 Original-Received: from localhost ([127.0.0.1]:46173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaels-0000Jb-OM for submit@debbugs.gnu.org; Mon, 18 May 2020 08:21:29 -0400 Original-Received: from [183.249.132.153] (port=1122 helo=dark.localdomain) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaelq-0000JE-BZ for 29533@debbugs.gnu.org; Mon, 18 May 2020 08:21:27 -0400 Original-Received: by dark.localdomain (Postfix, from userid 1000) id 78D7C241A7E; Mon, 18 May 2020 20:21:10 +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:180536 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Stefan Kangas writes: > stardiviner writes: > >> + (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? > > Yes, you should prefer indenting with spaces for the most part. I figured why, I'm using Magit, and it seems enabled verify hooks by defaul= t. > > Maybe there is something in your local git configuration that is causing > this? > >> And here is my patch diff. How should I submit this patch to Emacs/erc ? > > You should ideally send the patch as an attached file produced by: > > git format-patch -1 HEAD > > Also, we have some requirements for contributions, such as including a > ChangeLog entry. This is described in the CONTRIBUTE file, and you can > also see examples in the git log. (You can use `C-x 4 a' so you don't > have to type as much.) > > Are there any changes that needs doing in the manual? Should this be > announced in etc/NEWS? No need to be announced in etc/NEWS. It's still original keybinding. And no= t a big difference. At last, I attached my generated commit in attachment. =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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Join-channel-smartly-from-alist-of-stored-channels.patch Content-Transfer-Encoding: quoted-printable From=2026f73fe065196ab8759f6c7f046587e47672ad47 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Mon, 18 May 2020 20:16:21 +0800 Subject: [PATCH] Join channel smartly from alist of stored channels * lisp/erc/erc.el (erc-mode-map): Add an option to store your frequently joined channels. And replace original `erc-join-channel' with `erc-join-channel-select'. =2D-- lisp/erc/erc.el | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index cfde84e19a..be59b4203f 100644 =2D-- a/lisp/erc/erc.el +++ b/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 =2D-=20 2.26.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7CfbYUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsNDrAf+Ok2iMyg7vNMIs/SR47PKr6M/7D9d 8dNS24CNZU09RIUMD//MFvRFawIXxMl7PNhcaMQx6IZI8CzycNKeP8LwBkLz9OLx 2R6naf+DIzlYd+Y+OFeF91BTxWgzvMJ/OdmPo6gRh5BAJraU0vhNEx6lbylS+CDB zAOn9/J/FcAHVNCeLEyh+Fs9gGpQ+JoY5ATvXOK0KOxg09CsE1Rq+vFauUZJ8QGB UNs6ej7qgPLLBemDI0Oh7My5bLkYqWqwsTtz5xaTLKp/o/eVkV/BV84OlyxQwpSK 5C9xKqbH7Fn8GQaJylv2HVv5TAjpGGcmwaskswPjmEgKTi02+nOznFPOkQ== =8PDE -----END PGP SIGNATURE----- --==-=-=--