unofficial mirror of bug-gnu-emacs@gnu.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: Wed, 13 May 2020 19:37:06 +0800	[thread overview]
Message-ID: <87ftc4ukv1.fsf@gmail.com> (raw)
In-Reply-To: <CADwFkm=1a8_zVEUTu3aW8cGW5ZsdWtDseb=RKQZP2tWJBX+gfw@mail.gmail.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> Hi, Stefan, I'm afraid I can't submit patch soon. This task is not
>> priority on my tasks now. Because this patch is long time agon, I barely
>> use ERC recently. I still keep this task waited, when I got time to deal
>> with it, and finished it, I will send it here. Sorry about this.
>
> Thank you.  There is no particular rush, but it would be good to get the
> patch merged eventually.

I have a question, I have code like bellowing:


#+begin_src emacs-lisp
;;; original code
(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)))

;;===============================================================================

(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" ; "freenode.net"
         "#emacs"
         "#org-mode"
         "#lisp"
         "#clojure"
         "#clojure-beginners"
         "#archlinux"
         "#swift-lang"
         "#docker"
         "#hackerrank")))

(defun erc-join-channel-select (args)
  "Select a channel to join from alist of channels to."
  (let ((channel (completing-read
                  "Select a channel: "
                  (cdr (assoc
                        (completing-read "Select a server: "
                                         (mapcar 'car erc-join-channels-alist))
                        erc-join-channels-alist)))))
    (setq args (list channel))))

(advice-add 'erc-join-channel :filter-args 'erc-join-channel-select)

(advice-remove 'erc-join-channel 'erc-join-channel-select)
#+end_src

When I press [C-c C-j] (erc-join-channel), the advice is added on function,
but seems not working. Don't know why, do you have any clue?

>
> Best regards,
> Stefan Kangas


- -- 
[ 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
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl672+IUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMAIwf/XPYrBcVkSGyUPTS/8jtwGHwh2vE9
n+lQnTJbd0+9J88D9Hr2lyULOuxtCArBnVYCIHeQSEY8PKvAsXir+Dkw0Jdu50wu
nxnm5YB4vpeerTzZubVuTwiecZqIlu92ZhpNM7Dwh8UZar+R/MxeuBs5u7O84e8p
R4BFEwQC9u5GDfy8TmcGaJocbXEOo0a4XMC81Yqgrukxn1qwRyLq9IYdQzFZTaaq
qzuhmDTmjsvF7AS3nz4E+wuu2VTmLYZ7+60KA+2XPP9NJ6IzmrAiWyltpSzBFkf4
Y48DuFr/PT3R3jpwQfWdwaJVGPjDH0WPFNisEGpq5eAISqMZesuBZiCB7w==
=Itr2
-----END PGP SIGNATURE-----





  parent reply	other threads:[~2020-05-13 11:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e987db8a-fcf6-da73-d914-1deb358b08d3@gmail.com>
2017-12-02  5:44 ` bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87ftc4ukv1.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).