unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: stardiviner <numbchild@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Kangas <stefan@marxist.se>,
	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 10:29:31 -0400	[thread overview]
Message-ID: <854ksjhpro.fsf@gmail.com> (raw)
In-Reply-To: <87ftc4ukv1.fsf@gmail.com> (stardiviner's message of "Wed, 13 May 2020 19:37:06 +0800")

stardiviner <numbchild@gmail.com> writes:

> ;;; 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 [...]

> (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)

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

I think advice doesn't affect interactive calls the way you expect.  I
forget the details of it, but anyway it's probably better to just remap
instead, along the lines of:

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

    (define-key erc-mode-map [remap erc-join-channel] 'erc-join-channel-select)





  parent reply	other threads:[~2020-05-13 14:29 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
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 [this message]
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=854ksjhpro.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=29533@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=numbchild@gmail.com \
    --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).