With the gnus included in recent debian packaged i386 emacs 25.2, in the Group buffer, an M-g to get count of messages of a foreign imap group at imap.mail.yahoo.com hangs. If C-g to stop then a second M-g succeeds. Sticking in some protocol trace showed out >> 1 CAPABILITY out >> 1 LOGIN "username" "password" in << 1 OK CAPABILITY completed out >> 2 SELECT "mailboxname" in << 1 OK LOGIN completed hang ... I suspect nnimap.el interprets "1 OK CAPABILITY" response as being login completion, and issues the SELECT. Could that be right? I don't know if a server is supposed to allow pipelined SELECT before login completes. It seems recent imap.mail.yahoo.com doesn't like it. I see nnimap-login uses nnimap-command so I take it the intention in gnus is not to attempt such a thing anyway, but wait for login success. I get some joy from the diff below setting nnimap-sequence so it starts "2 LOGIN". The first M-g then succeeds for me as hoped. I think the reason a second M-g on the group succeeds is that nnimap-sequence is left incremented after the first attempt, so it goes "3 LOGIN" or whatever bigger number. I have this on a rather lagged connection, if that might make a difference. I see the login taking a noticeable second or so, but don't know if that's by the server or the connection. ------------------- Gnus v5.13 GNU Emacs 25.2.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2017-09-12, modified by Debian