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 1B5AE6DE0AAA for ; Sat, 24 Sep 2016 13:07:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.281 X-Spam-Level: X-Spam-Status: No, score=-0.281 tagged_above=-999 required=5 tests=[AWL=-0.260, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] 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 8WVEKbjJBCMl for ; Sat, 24 Sep 2016 13:07:48 -0700 (PDT) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id 9A5B66DE096A for ; Sat, 24 Sep 2016 13:07:45 -0700 (PDT) Received: by mail-wm0-f68.google.com with SMTP id b184so7946001wma.3 for ; Sat, 24 Sep 2016 13:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B7JkWoifre09hXWC2gFk6Vul2cesO9vS8q4Prd5ptCA=; b=SVp46eiB5rtoTLYMg/BiOS+wipEks7DoNCLs3ftPOJoqyAow67pJCo6Y62OOQ/tWzU qdFr3LxMgBc0C8dgKxnMSOl3fgC1ZYA6DBhVXk5EF3PTuHPBnQuL2qoll5iq/R1ZbC+L eZdmb2cfWlyRPMdhTzz5MVSRe3pj+CDmzzewnXn1GJoYyCOfN1KYbETZtsSiIFpeWHbD ZXSW/VZ7iD0utFw47dV/DjPy+eT1dteqnf3YMFzZhPViVoWhUlfDsBzF5EShRf1TPU/E xQXjo4IZ+BOMtwZNgVrDcduXdA2OTFc0WJl6It5OwoP+qliMLc23fodvSZdqL3fPw3U3 bYww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B7JkWoifre09hXWC2gFk6Vul2cesO9vS8q4Prd5ptCA=; b=G5x64bFvo9Psa5DvlMgcZMSnmaRdcCsnkpYzB1eWtUp6/KMu/oydvVsZLS4CSzfwXe a3qupJt2u+pYQoA5izWN3m6IhVk/M2XtOCY404M/ZSSuy7sAF/JHwDWX2Jc3Y+SEN0Py cyrmQCrYbqM9QotkccBbZwcF9DXD1K7z1kQZe6MSbFQlxyoZq0GzlFhj7IDNGv2LDoxM 5kxbzGgNyDQtcE17PUrA7kwOT5oKWTGGv9WU3i7+rSCvRnYIZyNY/Ey/xxCDz3+hs3G8 1fAlkrSez8qjA01ZhmdeGCsDFqfDNXSwJMpXm5uHeMPpd+yRc6Bqq3vvn8FY+BOio4YU sgyA== X-Gm-Message-State: AA6/9RlpYqJEjQlBMEt6uv9mF3LPItOePoXBJIkKMvTD95zUdLQTWp4A+PpYK6XomcTk2g== X-Received: by 10.194.114.100 with SMTP id jf4mr11783993wjb.87.1474747664067; Sat, 24 Sep 2016 13:07:44 -0700 (PDT) Received: from adiPC.lan ([188.24.78.211]) by smtp.gmail.com with ESMTPSA id p71sm2556420wmf.9.2016.09.24.13.07.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Sep 2016 13:07:43 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v2 4/4] emacs: notmuch-lib: add refresh all buffers function Date: Sat, 24 Sep 2016 23:07:35 +0300 Message-Id: <20160924200735.25425-5-adi@adirat.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160924200735.25425-1-adi@adirat.com> References: <20160924200735.25425-1-adi@adirat.com> 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: Sat, 24 Sep 2016 20:07:49 -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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 6618365..72fee4d 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -428,6 +428,18 @@ 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 (string-prefix-p "notmuch" (format "%s" buffer-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