From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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 autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 21225 invoked from network); 2 May 2020 15:14:09 -0000 Received: from lists1.math.uh.edu (129.7.128.208) by inbox.vuxu.org with ESMTPUTF8; 2 May 2020 15:14:09 -0000 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.92.3) (envelope-from ) id 1jUtpb-0000lv-G7; Sat, 02 May 2020 10:13:31 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jUtpX-0000j9-3e for ding@lists.math.uh.edu; Sat, 02 May 2020 10:13:27 -0500 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jUtpV-00076I-MZ for ding@lists.math.uh.edu; Sat, 02 May 2020 10:13:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8iMz6yC/105lnkpDxfgm7zHkq5Kijx7Dt+wE3Yaqt7A=; b=VmUvjanHZP2PmGgN93/pAT0eQd /3T12O/8FRHssImQmRZ/KinG3vIG0Ka8DjFkdty3ai79+sde0qKPMEz+4kc6JJ2t8Zut5v1C+zrYM qS0Hveg0SfXj8CajTLtVz3fuMvo602P5BpVYdz/QtcydHeI+8DOE35/U6K7JtoUUQ25E=; Received: from ericabrahamsen.net ([52.70.2.18] helo=mail.ericabrahamsen.net) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUtpO-0004Ky-Eb; Sat, 02 May 2020 17:13:21 +0200 Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id B92E1FA0E2; Sat, 2 May 2020 15:13:15 +0000 (UTC) From: Eric Abrahamsen To: David Engster Cc: Lars Ingebrigtsen , ding@gnus.org Subject: Re: new wifi connection = nntp timeout = Emacs restart? References: <87sgh3coxn.fsf@ericabrahamsen.net> <87o8rogew7.fsf@barthel.ch> <87zhb7mlf0.fsf@ericabrahamsen.net> <87a72t35ng.fsf@gnus.org> <87sggkeuvr.fsf@ericabrahamsen.net> <874kt01w30.fsf@gnus.org> <87r1w4boft.fsf@ericabrahamsen.net> <877dxwzjz6.fsf@gnus.org> <87mu6sbntb.fsf@ericabrahamsen.net> <87368kziq4.fsf@gnus.org> <87h7x0bm8p.fsf@ericabrahamsen.net> <87y2qcy2vb.fsf@gnus.org> <87mu6sc7hz.fsf@randomsample> <87imhgc58s.fsf@randomsample> <87sggja7hv.fsf@ericabrahamsen.net> <87d07ncrb3.fsf@randomsample> <874ksz89c3.fsf@ericabrahamsen.net> <878siad4ez.fsf@randomsample> Date: Sat, 02 May 2020 08:13:13 -0700 In-Reply-To: <878siad4ez.fsf@randomsample> (David Engster's message of "Sat, 02 May 2020 12:20:20 +0200") Message-ID: <874ksys73q.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-ID: Precedence: bulk David Engster writes: >> David Engster writes: >> >>>> Hey, that's pretty handy! Just FYI, the function name is quoted >>>> unnecessarily >>> >>> Oops... >>> >>>> and sleep-start is actually nil when it's going to sleep, >>>> who knows why. >>> >>> Uhm, not for me. I just tested again to make sure. On sleep it is 't', >>> on wakup it is nil. This is also the documented behavior: >> >> Huh, the first time I tried it, it only seemed to fire on wakeup (giving >> me a nil). And I forgot that `gnus-close-all-servers' doesn't actually >> redisplay the *Server* buffer, so was confusing myself. > > Yes, I noticed this as well. There's `gnus-close-server' and there's > `gnus-server-close-server', and the latter does a bit more, like setting > the server's status to 'closed' and updating the server buffer. I don't > think it matters for the connection, though, it's just confusing. Right. >> On wakeup all my nnimap servers were denied, but I'm sure it's just a >> matter of messing with it sufficiently. > > I'll try this for a while and see how it goes. I think this could be > expanded, like for instance checking for 'State' of NetworkManager > before trying to open servers that require an active connection. > > For the record, this is what I'm using now: > > (require 'dbus) > (defun my-go-to-sleep-handler (sleep-start) > (when sleep-start > (message "Gnus: Machine going to sleep, closing connections") > (gnus-close-all-servers))) > > (dbus-register-signal :system > "org.freedesktop.login1" > "/org/freedesktop/login1" > "org.freedesktop.login1.Manager" > "PrepareForSleep" > 'my-go-to-sleep-handler) > > (defun my-network-state-handler (name change-vals change-novals) > (let ((state (assoc "State" change-vals))) > (when (and state > (= (caadr state) 30)) > (message "Gnus: Networking going down, closing servers.") > (gnus-close-all-servers)))) > > (dbus-register-signal :system > "org.freedesktop.Networkmanager" > "/org/freedesktop/NetworkManager" > "org.freedesktop.DBus.Properties" > "PropertiesChanged" > 'my-network-state-handler) But this requires installing the NetworkManager package, right? Which I've been happily doing without. I wonder what percentage of Gnus users are on dbus-enabled systems... I don't suppose it's worth trying to make something built-in for them.