From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32119 invoked from network); 23 Feb 2022 16:44:56 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 23 Feb 2022 16:44:56 -0000 Received: from lists1.math.uh.edu ([129.7.128.208]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nMul4-003woU-Ul for ml@inbox.vuxu.org; Wed, 23 Feb 2022 10:44:55 -0600 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.94.2) (envelope-from ) id 1nMul4-004iSK-5U for ml@inbox.vuxu.org; Wed, 23 Feb 2022 10:44:54 -0600 Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtp (Exim 4.94.2) (envelope-from ) id 1nMul2-004iSD-Qt for ding@lists.math.uh.edu; Wed, 23 Feb 2022 10:44:52 -0600 Received: from quimby.gnus.org ([95.216.78.240]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nMul0-003wo5-6d for ding@lists.math.uh.edu; Wed, 23 Feb 2022 10:44:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:Mime-Version:References:Message-ID:Date:Subject: From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=5xLm2o6hNnzye/YAoUQBw9pDrxkb2PwXRXZ00bsaKTw=; b=L2RzQ1V5NsQIdluPPZO9gp1hBX 5Ki+emXXi6POi/vvgR91gmDtxynOn80Fy0AyYX/G+LJwa3cfpWoDprTmhbcVi8Ei3AYPrjv1LqHzH OL/PfDJlAibU2VJjXJzd7vm0Jw8sWiyJTrSWQKWxgq0+Hrwr2fSWRmXgEueDQcoKToFQ=; Received: from ciao.gmane.io ([116.202.254.214]) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMuks-0003U7-Cr for ding@gnus.org; Wed, 23 Feb 2022 17:44:45 +0100 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nMukn-000A7K-TE for ding@gnus.org; Wed, 23 Feb 2022 17:44:37 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: ding@gnus.org From: Eric Abrahamsen Subject: Re: auto open servers? Date: Wed, 23 Feb 2022 08:44:31 -0800 Message-ID: <87mtihjzww.fsf@ericabrahamsen.net> References: <8735lgsgmf.fsf@zoho.eu> <8735ldcysx.fsf@eps142.cdf.udc.es> <87tudttqtm.fsf@zoho.eu> <87o841tpkz.fsf@zoho.eu> <87v8y98l7t.fsf@igel.home> <87o83zbis4.fsf@zoho.eu> <87mtiw2gsi.fsf@local.lan> <87wnhz96kl.fsf@ericabrahamsen.net> <87ilt5efd9.fsf@local.lan> <87ee3tees6.fsf@local.lan> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:gRWiTSdKj5wqM/k+bo7x9OzrLMg= List-ID: Precedence: bulk hput writes: > hput writes: > >> Eric Abrahamsen 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.