[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Feature Request] ERC: let erc-join-channel support to select channels f
[Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
Fri, 1 Dec 2017 18:54:26 +0800
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0
let erc-join-channel support to select channels from history or a
I have a code prototype:
(defun erc-join-channel (channel &optional key)
If `point' is at the beginning of a channel name, use that as default."
(let ((chnl (if (looking-at "\\([&#+!][^ \n]+\\)") (match-string 1) ""))
(table (when (erc-server-buffer-live-p)
(set-buffer (process-buffer erc-server-process))
(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-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."
:type '(repeat (cons :tag "Server"
(regexp :tag "Name")
(repeat :tag "Channels"
(string :tag "Name")))))
'((".*\\.freenode.net" ; "freenode.net"
(defun erc-join-channels-frequently-select (channel &optional key)
"Select a channel to join from alist of channels to."
(completing-read "Select a channel to join: "
;; TODO match IRC server for the selected channel.
(advice-add 'erc-join-channels-frequently-select :before 'erc-join-channel)
With this feature, user can avoid typing, and don't need to remember the
channel name, and use the join channels history.
- [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list,