From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: auto open servers?
Date: Wed, 23 Feb 2022 08:44:31 -0800 [thread overview]
Message-ID: <87mtihjzww.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87ee3tees6.fsf@local.lan>
hput <hputn3@zohomail.com> writes:
> hput <hputn3@zohomail.com> writes:
>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>> hput wrote:
>>>> Is it possible you can post something that combines both code snippets?
>>
>> Eric responded:
>>> You can just put my code inside Emanuel's code:
>>>
>>> (defun gnus-reopen-servers ()
>>> (interactive)
>>> (unless (get-buffer gnus-server-buffer)
>>> (gnus-group-enter-server-mode))
>>> (dolist (elem gnus-opened-servers)
>>> (gnus-close-server (car elem)))
>>> (with-current-buffer gnus-server-buffer
>>> (gnus-server-open-all-servers)))
>>>
>>> Then you'll want to either attach that to a hook, or put it on a timer,
>>> or bind it to a key... or some combination of those.
>>
>> Is it expected that above code should throw focus into server buffer
>> and remain there until manually 'Q'ing out?
>
> Sorry, I see the bit about burying buffer is not encluded there:
>
> this seems to do it without jerking you into the server buffer phsyically.
>
> (defun gnus-reopen-servers ()
> (interactive)
> (unless (get-buffer gnus-server-buffer)
> (gnus-group-enter-server-mode))
> (dolist (elem gnus-opened-servers)
> (gnus-close-server (car elem)))
> (with-current-buffer gnus-server-buffer
> (gnus-server-open-all-servers)
> (bury-buffer) )
> (message "done") )
>
> Tough you probably woud'nt want to run it in the middle of reading a
> group.
Sorry, I didn't actually test that code! You could bury-buffer, but the
safer thing to do would be to wrap the whole thing in
`save-window-excursion', which will recover gracefully from errors and
whatnot.
But really, there isn't any reason to go into the *Server* buffer at
all. Just loop on `gnus-opened-servers' and for each one call
`gnus-close-server' then `gnus-open-server'. When that's done you could
see if the *Server* buffer exists, and if so go there and call
`gnus-server-list-servers' which will refresh the *Server* buffer with
current state.
next prev parent reply other threads:[~2022-02-23 16:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-22 1:28 Emanuel Berg
2022-01-24 8:39 ` Alberto Luaces
2022-01-24 9:40 ` Emanuel Berg
2022-01-24 10:06 ` Emanuel Berg
2022-01-24 10:46 ` Andreas Schwab
2022-01-25 21:28 ` Emanuel Berg
2022-01-25 21:35 ` Emanuel Berg
2022-02-12 16:25 ` hput
2022-02-12 20:24 ` Eric Abrahamsen
2022-02-12 21:11 ` Emanuel Berg
2022-02-12 21:31 ` Eric Abrahamsen
2022-02-12 21:38 ` Emanuel Berg
2022-02-23 16:07 ` hput
2022-02-23 16:19 ` hput
2022-02-23 16:44 ` Eric Abrahamsen [this message]
2022-02-26 6:29 ` Emanuel Berg
2022-02-26 6:34 ` Emanuel Berg
2022-02-12 21:10 ` Emanuel Berg
2022-02-13 13:29 ` hput
2022-02-13 22:46 ` Emanuel Berg
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtihjzww.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=ding@gnus.org \
/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.
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 NNTP newsgroup(s).