GNU bug report logs -
#29533
Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
Previous Next
Reported by: stardiviner <numbchild <at> gmail.com>
Date: Sat, 2 Dec 2017 06:02:02 UTC
Severity: wishlist
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Noam Postavsky <npostavs <at> gmail.com> writes:
> stardiviner <numbchild <at> 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)
Thanks, I apply you solution, I changed erc's default [C-c C-j] keybinding to new command.
- --
[ 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-----
iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68u+gUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNwvAf8CY1KyFvDnCFl+xXOJmmhKjv+oomo
4M10Vx1bAlCeWH0UYojgydIjEwmjKYcG3GKFCeyIC2B6rx6aZ3t89QmpIr/QQaYD
k+4qCpTI9O72eVHGLFCxNf6U6ob5T/BEqe1CwgG9QmTGko4cjQl6rJEnxPYe8KUk
lvhdFPwY09dUHbc8k6nd2/MaBucm+g9TiPc8Y8FxXdHb88EZC0WUSzF9FkuQ2FHJ
47ZXOdm/UwPmWZpnIpSJ1XxXSDxB0iejHyKCpFraZLbFWp9IjwJGBA+mKwPu8LII
74+5oQFXB9lxhl9EoQbTzR/qrSrL1ISlynV+wSZomVVAXKLTeJIA8EsYeQ==
=zIfK
-----END PGP SIGNATURE-----
This bug report was last modified 5 years and 24 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.