From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/87797 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Baer Newsgroups: gmane.emacs.gnus.general Subject: Re: solution Date: Mon, 30 Oct 2017 13:02:52 -0700 Message-ID: <87r2tk2ykz.fsf_-_@mikesoffice.com> References: <8760b29724.fsf@mikesoffice.com> <87tvykt6fs.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1509393861 27238 195.159.176.226 (30 Oct 2017 20:04:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Oct 2017 20:04:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: ding@gnus.org To: Eric Abrahamsen Original-X-From: ding-owner+m36011@lists.math.uh.edu Mon Oct 30 21:04:16 2017 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from mxfilter-048035.atla03.us.yomura.com ([107.189.48.35]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9GI5-0005qe-JU for ding-account@gmane.org; Mon, 30 Oct 2017 21:04:09 +0100 X-Yomura-MXScrub: 1.0 Original-Received: from lists1.math.uh.edu (unknown [129.7.128.208]) by mxfilter-048035.atla03.us.yomura.com (Halon) with ESMTPS id 7fcebe59-bdad-11e7-b60e-b499baabecb2; Mon, 30 Oct 2017 20:04:13 +0000 (UTC) Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.87) (envelope-from ) id 1e9GH3-0005tH-Tm; Mon, 30 Oct 2017 15:03:05 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1e9GGz-0005sl-Qs for ding@lists.math.uh.edu; Mon, 30 Oct 2017 15:03:01 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.87) (envelope-from ) id 1e9GGx-0005oF-5D for ding@lists.math.uh.edu; Mon, 30 Oct 2017 15:03:01 -0500 Original-Received: from dns.mikesoffice.com ([75.101.48.145] helo=mail.mikesoffice.com) by quimby.gnus.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1e9GGv-0000jo-DI for ding@gnus.org; Mon, 30 Oct 2017 21:02:57 +0100 Original-Received: from localhost (unknown [IPv6:2001:470:1f05:274:3e97:eff:feba:52f]) by mail.mikesoffice.com (Postfix) with ESMTPSA id B2F63395D5F; Mon, 30 Oct 2017 13:02:52 -0700 (PDT) X-Face: "*g#dUT3;8M9AE5dLk\\b4G\cNCQkRb.g/2QwEXQKf.: (Eric Abrahamsen's message of "Fri, 27 Oct 2017 18:19:35 -0700") List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:87797 Archived-At: >>>>> On Fri, 27 Oct 2017 18:19:35 -0700, Eric Abrahamsen said: Eric> Michael Baer writes: >> I think I'm missing something obvious and I hoped someone here could >> help point it out to me. I have function to run offlineimap and then >> gnus-group-get-new-news. When I run the function the gnus group frame >> isn't updated with the new mail folder info (e.g. number of unread mail >> / total number of mail, etc.). If I run M-x gnus-group-get-new-news or >> just 'g' afterwords, the frame is updated as expected. It just doesn't >> update from the gnus-group-get-new-news in my function. The function is >> listed below. >> >> Gnus v5.13 >> GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.17) of 2017-09-14 >> >> >> (defun cc-offlineimap-and-get-news () >> (interactive) >> (gnus-group-get-new-news) >> (shell-command "dotopright.pl 'time offlineimap; sleep 4'") >> (gnus-group-get-new-news) >> ) Eric> I don't know exactly what's going wrong here, but I have to assume that Eric> there's a timing mismatch between the `shell-command', and your second Eric> `gnus-group-get-new-news'. It's true that `shell-command' is meant to be Eric> synchronous, so it ought to work, but you'll be better off using the Eric> tools specifically meant for these situations. That would probably be a Eric> combination of `start-process-shell-command' and sentinels. Eric> This is totally untested: Eric> (defun cc-offlineimap-and-get-news () Eric> (interactive) Eric> (let ((proc (start-process-shell-command Eric> "offlimap" nil "dotopright.pl 'time offlineimap'"))) Eric> (set-process-sentinel Eric> proc (lambda (proc event) Eric> (when (string-prefix-p "finished" event) Eric> (gnus-group-get-new-news)))))) Eric> That also allows you to handle different events in the sentinel Eric> callback, popping up a buffer if things go wrong, etc. Eric> Like I said, untested, but something like that should get you there. Eric> Eric Thanks Eric, that got me thinking along the right path. Just as an FYI for anyone, the problem seemed to be a combination of the Perl script and running the commands in a terminal (I think the terminal) One of those caused the commands to run asynchronously. If I run the commands without the perl-script/terminal, it works synchronously as expected. -Mike -- Michael Baer gnus@mikesoffice.com omnes deorsum absurdo est