Article View: gnu.emacs.gnus
Article #1Re: Completion for ERC networks
From: Mekeor Melire
Date: Mon, 05 Oct 2026 10:32
Date: Mon, 05 Oct 2026 10:32
51 lines
2435 bytes
2435 bytes
On 2026-10-01 at 17:21, <phako@invalid.net> wrote:
> Hello everybody,
Hi!
This is the NNTP group / mailing-list for Gnus. Your question is
not related to Gnus but to ERC.
> --8<---------------cut here---------------start------------->8---
> (defun my-erc-up (network)
> (interactive "Snetwork: ")
>
> (pcase network
> ('libera
> (let ((erc-sasl-mechanism 'external))
> (erc-tls :server "irc.libera.chat" :port 6697
> :client-certificate t)))
> ('example
> (let ((erc-sasl-auth-source-function
> #'erc-sasl-auth-source-password-as-host))
> (erc-tls :server "irc.example.net" :port 6697
> :user "alyssa"
> :password "Example.Net")))))
> --8<---------------cut here---------------end--------------->8---
>
> However, I wish it could be possible to have these networks be
> autocompleted when the function is run and I'm prompted for the network
> name in the mini-buffer.
> If someone knows a quick solution, TIA.
Try
(completing-read "Network: " '("libera" "example"))
which I think you can put into the `interactive' expression:
(defun my-erc-up (network)
(interactive
(list (completing-read "Network: " '("libera" "example"))))
...)
Make sure to check out the optional arguments to
`completing-read', particularly REQUIRE-MATCH.
(completing-read PROMPT COLLECTION &optional PREDICATE
REQUIRE-MATCH INITIAL-INPUT HIST DEF INHERIT-INPUT-METHOD)
--
Good luck!
Mekeor
Technical Details
Message-ID:
<8733uk4euw.fsf@posteo.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.mb-net.net!open-news-network.org!.POSTED!not-for-mailReferences:
<6abe7a80$0$988$426a34cc@news.free.fr>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.mb-net.net!open-news-network.org!.POSTED!not-for-mail From: Mekeor Melire <mekeor@posteo.de> Newsgroups: gnu.emacs.gnus Subject: Re: Completion for ERC networks Date: Mon, 05 Oct 2026 12:32:39 +0200 Organization: MB-NET.NET for Open-News-Network e.V. Message-ID: <8733uk4euw.fsf@posteo.de> References: <6abe7a80$0$988$426a34cc@news.free.fr> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: gwaiyur.mb-net.net; logging-data="1106474"; mail-complaints-to="abuse@open-news-network.org" Cancel-Lock: sha1:SWDR7k8C2OzIqL7xuoULHVtNFE8= sha1:hWqqTfTxBdZwDe5I4LvlKKg4CT4= sha256:U5fu0L6uKBWNznVke3Gbn54T0nPMEVl9bSrYbjRmk9Q= sha1:zmxxE5eB0E32hZh4I08gbD4ZIIw= sha256:p3bncsuzataaWRu2gUJ/0RcvM0L8iWy/F2fY3djR5bI=