unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: stardiviner <numbchild@gmail.com>
Cc: 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: Mon, 03 Aug 2020 10:51:41 +0200	[thread overview]
Message-ID: <87o8nsun6q.fsf@gnus.org> (raw)
In-Reply-To: <87lflpcu2x.fsf@gmail.com> (stardiviner's message of "Mon, 18 May 2020 20:21:10 +0800")

stardiviner <numbchild@gmail.com> writes:

> No need to be announced in etc/NEWS. It's still original keybinding. And not a
> big difference.

It needs a NEWS entry (it's a new user-level variable), and it needs
documentation in the erc manual.

But I don't really understand the patch.

> * 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'.

[...]

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

I'm not sure why this is documented here -- this is what erc does in
general, isn't it?

> +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.

Did you miss including this bit in the patch?  There's no logic for
keeping the variable up-to-date in the code you sent, neither for
re-joining after a disconnect.

> +(setq erc-join-channels-alist '(("*.freenode.net" "#emacs" "#org-mode")))
> +

Debugging left behind?

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

Should the server default to the current one?  And this code should go
into the `interactive' part, since you're prompting the user.

Also, the original erc-join-channel has this logic:

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

Which should looks very useful, and should be replicated in the new
command.  Also:

    (when (or current-prefix-arg erc-prompt-for-channel-key)
      (read-from-minibuffer "Channel key (RET for none): " nil))))

should also be replicated, and at that point, perhaps the
erc-join-channel-select command isn't that useful -- perhaps
erc-join-channel should instead just be amended to add the channels from
-alist to the table the user is prompted for.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  parent reply	other threads:[~2020-08-03  8:51 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 [this message]
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=87o8nsun6q.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=29533@debbugs.gnu.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).