From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 46E786DE0C19 for ; Thu, 6 Oct 2016 07:06:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.971 X-Spam-Level: X-Spam-Status: No, score=0.971 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.972] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R8-E3_mlzHSM for ; Thu, 6 Oct 2016 07:06:36 -0700 (PDT) X-Greylist: delayed 1354 seconds by postgrey-1.35 at arlo; Thu, 06 Oct 2016 07:06:36 PDT Received: from ni.com (skprod3.natinst.com [130.164.80.24]) by arlo.cworth.org (Postfix) with ESMTPS id 642076DE0941 for ; Thu, 6 Oct 2016 07:06:36 -0700 (PDT) Received: from us-aus-mgwout1.amer.corp.natinst.com (nb-snip2-1338.natinst.com [130.164.19.135]) by us-aus-skprod3.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id u96Di26h031323; Thu, 6 Oct 2016 08:44:02 -0500 Received: from adi-pc-linux.iotechamer.corp.natinst.com ([130.164.14.198]) by us-aus-mgwout1.amer.corp.natinst.com (Lotus Domino Release 8.5.3FP6 HF1218) with ESMTP id 2016100608440244-645272 ; Thu, 6 Oct 2016 08:44:02 -0500 From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v3 4/4] emacs: notmuch-lib: add refresh all buffers function Date: Thu, 6 Oct 2016 16:42:27 +0300 Message-Id: <20161006134227.17194-5-adi@adirat.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161006134227.17194-1-adi@adirat.com> References: <20161006134227.17194-1-adi@adirat.com> X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 10/06/2016 08:44:02 AM, Serialize by Router on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 10/06/2016 08:44:02 AM, Serialize complete at 10/06/2016 08:44:02 AM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-06_06:, , signatures=0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2016 14:06:40 -0000 notmuch-refresh-all-buffers calls each buffer's major mode specific refresh function using the generic notmuch-refresh-this-buffer function. It is very useful because by passing a non-nil arg to the buffer specific refresh functions it refreshes all notmuch buffers in the background and this again is very useful when doing periodic timer-based mail syncing. Signed-off-by: Ioan-Adrian Ratiu --- emacs/notmuch-lib.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index af6a8f4..01733a2 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -432,6 +432,21 @@ in a window on screen, no-display has no effect." (notmuch-poll) (notmuch-refresh-this-buffer)) +(defun notmuch-refresh-all-buffers (&optional no-display) + "Invoke `notmuch-refresh-this-buffer' on all notmuch major-mode buffers. + +If no-display is non-nil all buffers are silently refreshed, i.e. they are +not foregrounded even if not displayed in any window. If no-display is nil +then each buffer's mode-specific refresh function uses its default behaviour." + (dolist (buffer (buffer-list)) + (let ((buffer-mode (buffer-local-value 'major-mode buffer))) + (when (memq buffer-mode '(notmuch-show-mode + notmuch-tree-mode + notmuch-search-mode + notmuch-hello-mode)) + (with-current-buffer buffer + (notmuch-refresh-this-buffer no-display)))))) + (defun notmuch-prettify-subject (subject) ;; This function is used by `notmuch-search-process-filter' which ;; requires that we not disrupt its' matching state. -- 2.10.0