From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: stardiviner Newsgroups: gmane.emacs.help Subject: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list Date: Fri, 1 Dec 2017 18:54:26 +0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1512152535 22011 195.159.176.226 (1 Dec 2017 18:22:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 1 Dec 2017 18:22:15 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 To: emacs-help Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 01 19:22:11 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKpwu-0005NR-Mz for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Dec 2017 19:22:08 +0100 Original-Received: from localhost ([::1]:59413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKpx1-0000bP-Vj for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Dec 2017 13:22:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKoGT-0002UW-SE for help-gnu-emacs@gnu.org; Fri, 01 Dec 2017 11:34:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKoGO-0000ul-N3 for help-gnu-emacs@gnu.org; Fri, 01 Dec 2017 11:34:13 -0500 Original-Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]:34763) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKoGO-0000td-HA for help-gnu-emacs@gnu.org; Fri, 01 Dec 2017 11:34:08 -0500 Original-Received: by mail-pf0-x232.google.com with SMTP id a90so4870882pfk.1 for ; Fri, 01 Dec 2017 08:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=xDhrzQKFLrvC8KrpHfO2wV5Eq0XJfvA+46hhjSmgvzg=; b=GRXWLWJ5WcWgosCbI+2LYW2zFHf5mQDibvj6+tgD6JyRpRjM4xUZFutW19/gVUzVWw erebD/7nqJb+V5pbZWNf3qpJwzILPobD7zI4axw1eUaXqjm26pqaFP6xQ2VuV+/VilIE IDDH9uqNnP3vnCZQbAVhDdk8KPhisodOf0CCq3cAMyhqGzw+817Myxk2SseavRfopO+o ob8EuazvK5NhnH2BVxQohaUaJBW3bgnc2OMaSwVBPZu5bTaSuIM7By/EcJL5Bc5c2jPO Ye2PNc/930XsJlpqLG3ZQHqLHbnPnQSA4GyysV7MIoKccLNphQPvOMVu6EcZIFqh9t22 cFKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=xDhrzQKFLrvC8KrpHfO2wV5Eq0XJfvA+46hhjSmgvzg=; b=HDZnIQi5e8QG1GCnHxF4J+uNrQuUQIgeDOdU+qKpkFPYBhb/x5G6Y6A9JZea5+oKjg OMb8w5218d36feb8dyLg/NXdHb8LN31YDZ0hlWZPOiwCSHTp1MkxfIMmssHPVUmDLwMi CCGRa3wnzM8WP7tZD37OQ4IBXB7JNbouf+OlPBQKCfPXQf7bwdMn7rSt2KkvwHoy4/v6 3hQUc2gGV8loR1Y00CHCn2pQu/qagYOtMy0u2VV4VppGHob20iiaqBIkYakaVBOqV+3w KemwUOg5flEHIl6MljxUx5HYaEECfUlky7Ng2N2dsGkbuN14HyU/l1F6WGmMZUJ1mfMQ MP6Q== X-Gm-Message-State: AJaThX6LfVSvzaheek7tXu3qPmRYkrntn/6yZnnF5Ok7xvsyRMsk+xi9 uwNV/277ZL8Grqd1JkX+KC3lZxA= X-Google-Smtp-Source: AGs4zMYZGdvfd71jYknU3ctbxCNdcU7suGRLknVgVBBetqjgvSQU2n7Yr/JpjgbXfnFmlJPofOxHkQ== X-Received: by 10.98.196.77 with SMTP id y74mr10067047pff.186.1512125670785; Fri, 01 Dec 2017 02:54:30 -0800 (PST) Original-Received: from [0.0.0.0] ([119.28.89.243]) by smtp.gmail.com with ESMTPSA id v1sm11581138pgt.87.2017.12.01.02.54.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Dec 2017 02:54:30 -0800 (PST) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:115153 Archived-At: let erc-join-channel support to select channels from history or a defined list. I have a code prototype: #+begin_src emacs-lisp (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))     (when (or current-prefix-arg erc-prompt-for-channel-key)       (read-from-minibuffer "Channel key (RET for none): " nil))))   (erc-cmd-JOIN channel (when (>= (length key) 1) key))) #+end_src #+begin_src emacs-lisp (defcustom erc-join-channels-frequently-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-frequently-alist       '((".*\\.freenode.net" ; "freenode.net"          "#emacs"          "#org-mode"          "#lisp"          "#clojure"          "#clojure-beginners"          "#archlinux"          "#swift-lang"          "#docker"          "#hackerrank"          ))) (defun erc-join-channels-frequently-select (channel &optional key)   "Select a channel to join from alist of channels to."   (interactive "P")   (completing-read "Select a channel to join: "                    (cdr (car                          erc-join-channels-frequently-alist)))   ;; TODO match IRC server for the selected channel.   ) ;; FIXME: (advice-add 'erc-join-channels-frequently-select :before 'erc-join-channel) #+end_src With this feature, user can avoid typing, and don't need to remember the channel name, and use the join channels history.