From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen 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, 03 Aug 2020 10:51:41 +0200 Message-ID: <87o8nsun6q.fsf@gnus.org> 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> <87lflpcu2x.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10850"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Stefan Kangas , 29533@debbugs.gnu.org To: stardiviner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 03 10:53:11 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 1k2WDW-0002ir-Nx for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Aug 2020 10:53:10 +0200 Original-Received: from localhost ([::1]:36676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2WDV-0002d9-La for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Aug 2020 04:53:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2WDN-0002cb-VU for bug-gnu-emacs@gnu.org; Mon, 03 Aug 2020 04:53:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k2WDN-0000au-LM for bug-gnu-emacs@gnu.org; Mon, 03 Aug 2020 04:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k2WDN-0000Do-JP for bug-gnu-emacs@gnu.org; Mon, 03 Aug 2020 04:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Aug 2020 08:53: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.1596444723779 (code B ref 29533); Mon, 03 Aug 2020 08:53:01 +0000 Original-Received: (at 29533) by debbugs.gnu.org; 3 Aug 2020 08:52:03 +0000 Original-Received: from localhost ([127.0.0.1]:44239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k2WCQ-0000CU-NC for submit@debbugs.gnu.org; Mon, 03 Aug 2020 04:52:02 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:42420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k2WCP-0000C1-8k for 29533@debbugs.gnu.org; Mon, 03 Aug 2020 04:52:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FGSx684a1DiHFQgxwS9OcSv65cLDNl4SXdIBvE6ORF0=; b=bC20u/FXSUwhzE5jvivjFSZyGl 22y1cd8dLlVXlUE82FjqMCRlTJGMY4BGfi7V/BoS+G37GiWuMFCm6Qw5p2OlPDGJOUHTOk+u2ByRF FoypghKUVcCi7Ycqr2BbfkEt8TRDV0CsM44Utknq490oDje3odP9jIJpJES6v0T4UI2Y=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2WC7-0006Ut-J2; Mon, 03 Aug 2020 10:51:54 +0200 In-Reply-To: <87lflpcu2x.fsf@gmail.com> (stardiviner's message of "Mon, 18 May 2020 20:21:10 +0800") 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:183923 Archived-At: stardiviner writes: > No need to be announced in etc/NEWS. It's still original keybinding. And not a > big difference. It needs a NEWS entry (it's a new user-level variable), and it needs documentation in the erc manual. But I don't really understand the patch. > * 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'. [...] > +(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 I'm not sure why this is documented here -- this is what erc does in general, isn't it? > +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. Did you miss including this bit in the patch? There's no logic for keeping the variable up-to-date in the code you sent, neither for re-joining after a disconnect. > +(setq erc-join-channels-alist '(("*.freenode.net" "#emacs" "#org-mode"))) > + Debugging left behind? > +(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))))) Should the server default to the current one? And this code should go into the `interactive' part, since you're prompting the user. Also, the original erc-join-channel has this logic: (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 (let ((chnl (if (looking-at "\\([&#+!][^ \n]+\\)") (match-string 1) "")) (table (when (erc-server-buffer-live-p) (set-buffer (process-buffer erc-server-process)) erc-channel-list))) (completing-read "Join channel: " table nil nil nil nil chnl)) Which should looks very useful, and should be replicated in the new command. Also: (when (or current-prefix-arg erc-prompt-for-channel-key) (read-from-minibuffer "Channel key (RET for none): " nil)))) should also be replicated, and at that point, perhaps the erc-join-channel-select command isn't that useful -- perhaps erc-join-channel should instead just be amended to add the channels from -alist to the table the user is prompted for. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no