From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to execute code after start-process completion? Date: Sat, 26 Sep 2020 17:21:30 +0300 Message-ID: <83k0wgr53p.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30617"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Pankaj Jangid Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 26 16:22:29 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMB5o-0007qU-VZ for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Sep 2020 16:22:28 +0200 Original-Received: from localhost ([::1]:53552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMB5o-00052c-0d for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Sep 2020 10:22:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMB4y-0004d0-Ca for emacs-devel@gnu.org; Sat, 26 Sep 2020 10:21:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60648) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMB4y-0007ZW-32; Sat, 26 Sep 2020 10:21:36 -0400 Original-Received: from [176.228.60.248] (port=1325 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kMB4x-0008Pd-C2; Sat, 26 Sep 2020 10:21:36 -0400 In-Reply-To: (message from Pankaj Jangid on Sat, 26 Sep 2020 19:30:41 +0530) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:256463 Archived-At: > From: Pankaj Jangid > Date: Sat, 26 Sep 2020 19:30:41 +0530 > > #+BEGIN_SRC emacs-lisp > (add-hook 'gnus-after-getting-new-news-hook > (lambda () > (start-process "notmuch" "*Notmuch*" "notmuch" "new") > ;; (print (current-time-string) (get-buffer "*Notmuch*")) > )) > #+END_SRC > > After completion of the process (`notmuch new`), I want to execute some > code. As you can see above, I want to put the timestamp in the *Notmuch* > buffer. I know that `start-process` returns the process object. But I > couldn't find how to use it. Please share any pointers/code-snippet on > how to use that object accomplish what I want to do? Or may be there is > a different way to do the task. Please advise. The usual way of doing that is to set up a process-sentinel function. It will be called when the process finishes.