all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Stefan Kangas <stefan@marxist.se>
Cc: stardiviner <numbchild@gmail.com>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	29533@debbugs.gnu.org
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	[thread overview]
Message-ID: <87lflpcu2x.fsf@gmail.com> (raw)
In-Reply-To: <CADwFkm=CaeCi-1bi+hxwmhdQZ3QO9yS+9U2TjU3va_dtxv4=RA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1574 bytes --]


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> 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 default.

>
> 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 not a
big difference.

At last, I attached my generated commit in attachment.

-- 
[ 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
      

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Join-channel-smartly-from-alist-of-stored-channels.patch --]
[-- Type: text/x-patch, Size: 3225 bytes --]

From 26f73fe065196ab8759f6c7f046587e47672ad47 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
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'.
---
 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
--- 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)
-    (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))))
 
+(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.
 
@@ -4008,6 +4036,17 @@ erc-join-channel
       (read-from-minibuffer "Channel key (RET for none): " nil))))
   (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
 
+(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
-- 
2.26.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

  reply	other threads:[~2020-05-18 12:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 10:54 [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list stardiviner
2017-12-01 18:28 ` Drew Adams
2017-12-01 21:53   ` Emanuel Berg
2017-12-01 19:18 ` Emanuel Berg
2017-12-02  5:44 ` bug#29533: Fwd: " stardiviner
2019-10-23  9:21   ` Lars Ingebrigtsen
2020-05-04 12:07     ` Stefan Kangas
2020-05-04 12:38       ` stardiviner
2020-05-04 13:12         ` Stefan Kangas
2020-05-12  5:36           ` stardiviner
2020-05-12 12:48             ` Stefan Kangas
2020-05-13  8:41               ` stardiviner
2020-05-13 11:37               ` stardiviner
2020-05-13 12:32                 ` Stefan Kangas
2020-05-14  3:38                   ` stardiviner
2020-05-14 14:40                     ` Stefan Kangas
2020-05-18 12:21                       ` stardiviner [this message]
2020-05-19  0:15                         ` Stefan Kangas
2020-08-03  8:51                         ` Lars Ingebrigtsen
2020-08-03 13:47                           ` bug#29533: [CLOSED] " numbchild
2020-08-04  8:48                             ` Lars Ingebrigtsen
2020-05-13 14:29                 ` Noam Postavsky
2020-05-14  3:32                   ` stardiviner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lflpcu2x.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=29533@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.