From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/87796 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: Updating frame on gnus-group-get-new-news Date: Fri, 27 Oct 2017 18:19:35 -0700 Message-ID: <87tvykt6fs.fsf@ericabrahamsen.net> References: <8760b29724.fsf@mikesoffice.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1509153669 13572 195.159.176.226 (28 Oct 2017 01:21:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 28 Oct 2017 01:21:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: ding@gnus.org Original-X-From: ding-owner+m36010@lists.math.uh.edu Sat Oct 28 03:21:05 2017 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from mxfilter-048034.atla03.us.yomura.com ([107.189.48.34]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8Fny-0001ug-7u for ding-account@gmane.org; Sat, 28 Oct 2017 03:20:54 +0200 X-Yomura-MXScrub: 1.0 Original-Received: from lists1.math.uh.edu (unknown [129.7.128.208]) by mxfilter-048034.atla03.us.yomura.com (Halon) with ESMTPS id 3fffdd50-bb7e-11e7-8a16-b499baa2b07a; Sat, 28 Oct 2017 01:20:58 +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 1e8Fn8-0007b7-H6; Fri, 27 Oct 2017 20:20:02 -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 1e8Fn4-0007aJ-A9 for ding@lists.math.uh.edu; Fri, 27 Oct 2017 20:19:58 -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 1e8Fn2-0000PH-SG for ding@lists.math.uh.edu; Fri, 27 Oct 2017 20:19:58 -0500 Original-Received: from [195.159.176.226] (helo=blaine.gmane.org) by quimby.gnus.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1e8Fn1-0004Mg-Gq for ding@gnus.org; Sat, 28 Oct 2017 03:19:55 +0200 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1e8Fmn-0003K8-En for ding@gnus.org; Sat, 28 Oct 2017 03:19:41 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:hYZsXIY1YHnDzDXqaLgrFdKJ4Q8= List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:87796 Archived-At: 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) > ) I don't know exactly what's going wrong here, but I have to assume that there's a timing mismatch between the `shell-command', and your second `gnus-group-get-new-news'. It's true that `shell-command' is meant to be synchronous, so it ought to work, but you'll be better off using the tools specifically meant for these situations. That would probably be a combination of `start-process-shell-command' and sentinels. This is totally untested: (defun cc-offlineimap-and-get-news () (interactive) (let ((proc (start-process-shell-command "offlimap" nil "dotopright.pl 'time offlineimap'"))) (set-process-sentinel proc (lambda (proc event) (when (string-prefix-p "finished" event) (gnus-group-get-new-news)))))) That also allows you to handle different events in the sentinel callback, popping up a buffer if things go wrong, etc. Like I said, untested, but something like that should get you there. Eric