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=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, RCVD_IN_DNSWL_LOW autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3882 invoked from network); 25 Sep 2020 18:46:29 -0000 Received: from lists1.math.uh.edu (129.7.128.208) by inbox.vuxu.org with ESMTPUTF8; 25 Sep 2020 18:46:29 -0000 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.94) (envelope-from ) id 1kLsjW-00GO4m-4H; Fri, 25 Sep 2020 13:46:14 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kLsjS-00GO2r-EL for ding@lists.math.uh.edu; Fri, 25 Sep 2020 13:46:10 -0500 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kLsjN-009O9G-U4 for ding@lists.math.uh.edu; Fri, 25 Sep 2020 13:46:10 -0500 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=aNfiU0/nE2vqviLP5H4k/HZ/D0/ZQe5mDN+iUlb73qE=; b=Adg2aHKrLiUrLu7A9vVojWB50F 2fIes9A/ze1PQbjPMncqQzwxG3CIZHFHlAJdjQLEXrl4nNTf1Zr+V9sekcq5KF1a6jU3PJh1evesU clQrLxvtiAJd0NpujIj+Y/6zC72Aky/2/fBfHOw8BGjYH78O7MzZ84A2w6fnAfBD1WZY=; Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214] helo=ciao.gmane.io) by quimby with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLsjG-0005Qr-7R for ding@gnus.org; Fri, 25 Sep 2020 20:46:01 +0200 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kLsjE-000486-Si for ding@gnus.org; Fri, 25 Sep 2020 20:45:56 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: ding@gnus.org From: Eric Abrahamsen Subject: Re: Does Gnus automatically run 'notmuch new' if configured? Date: Fri, 25 Sep 2020 11:45:52 -0700 Message-ID: <87mu1ditjz.fsf@ericabrahamsen.net> References: <875z83njo0.fsf@tullinup.koldfront.dk> <87o8luz39v.fsf@ucl.ac.uk> <87o8lukxsm.fsf@tullinup.koldfront.dk> <873635akcz.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cancel-Lock: sha1:xV+VUo0N0a4OFBCUNk2dL5ybABc= List-ID: Precedence: bulk Pankaj Jangid writes: > On Fri, Sep 25 2020, Eric Abrahamsen wrote: > >> Ahem, I may have led you astray with `async-shell-command', which is >> mostly meant to be called interactively -- in which case you usually >> want to see the output. In lisp code that runs in the background, >> you're better off using `start-process', where you can tell it not to >> keep the output: > > I had explored a little bit of `start-process` and `call-process` when I > was reading help on `async-shell-comman`. But then I thought these are > low level methods and I don't need that much control. > >> (start-process "unnecessary label" nil "/path/to/notmuch" '("new")) > > This is nice. I am using this now. Just a correction. Last argument is > not list. List was giving error. I am using below code, > > (start-process "notmuch" "*Notmuch*" "notmuch" "new") Oops, sorry! [...] >> which hook is best for the purpose? Currently I am using >> `gnus-after-getting-new-news-hook`. But that is run only when I press >> `g` (gnus-group-get-new-news). It seems that the hook is not invoked >> when I start Gnus. > > Hm. That seems like a bug to me - I would expect it to fire after > getting new news, regardless of whether it was fetched by startup or by > explicit action. > > You could advice M-x gnus to run notmuch after startup: > > (defadvice gnus (after gnus-notmuch-new activate) > (your-run-notmuch-new-function)) > > in addition to the hook. > > But it still feels wrong that the hook doesn't fire - doesn't it? It is weird, but the code is very clear: startup runs `gnus-get-unread-articles' directly, and the hook isn't run there. "g" in the group buffer runs `gnus-group-get-new-news', which first calls `gnus-get-unread-articles', then runs the hook. You could certainly argue that that's weird, but that's how it currently works. Rather than an advice, I would just add your function to the `gnus-startup-hook', as well. Eric