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 AA9436DE1344 for ; Sat, 8 Oct 2016 14:01:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.13 X-Spam-Level: X-Spam-Status: No, score=-0.13 tagged_above=-999 required=5 tests=[AWL=-0.109, 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 ToFgKDXxLyKh for ; Sat, 8 Oct 2016 14:01:46 -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 C4CD36DE12D9 for ; Sat, 8 Oct 2016 14:01:38 -0700 (PDT) Received: by mail-wm0-f68.google.com with SMTP id 123so8125048wmb.3 for ; Sat, 08 Oct 2016 14:01:38 -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=P4ff4wAx9xZgHl/urCBaSK+zKNxwoUEMX4eRMQw6OwM=; b=UDqrBOk8a29Et8s392UDta4F/xI+Khd/6qCI3S8tb36z+ibmo0pJPowmRUYYbQwObV p5X1xMl74/0/03lh8zr/aW0dWfAZaSDMPI1wlBucwSHlpe6S5TSyXpwWVHCMIiIOo7ej uDUAZk76dYjQcqVq9kwogw80jnZFBEI828E2Le8u8HlxagnnP7rL+BXdnqBN/BLKo6k+ Kv/W0QAl0WuSyFQJZ4XHVAG1x6+PxSSd4OM4OvJM4O2CRjTQ/rNx0uPD5GtQZcUv+hVm am4NYi2kF8nAIMyZm//q0oo87LA4DsEvPKjem1bw6Dm9gBuNeuBDvETrN5xXiVJog5os C8yg== 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=P4ff4wAx9xZgHl/urCBaSK+zKNxwoUEMX4eRMQw6OwM=; b=L0hgGjR9nGz9s2trop6Dwq2c/lMqHhUcrRiVBWTHYoG719bz1EBmb+//R8uOZX4S2T qylWuhMzq8Pb3BdM4pJpVZ24FX9GqeifB26/148+D7kSjP5KmHIOFSjDCMFnAjmGChix uwZb92qQmTdyMi1YmHpq49L22uMksWDShGhjqImpvkLV1EnreZP0tui6b+9B8qTiHzib nLTexSTyWnjskTHwwv82hOy85dtaqPk89Ux8VuXmY+DhvbvusOPwIg0sVhtmPtlMBrkb h0j/VqI+MVfj4iU2J6l4brQ/YrI/UyIGkFigdTXFIuHm1uX4S2tfIbQb7/6FFu4avvfZ 5RYw== X-Gm-Message-State: AA6/9Rn2I/RtvME1OzzrUBzIRJvLFvXEL0gHDdsTEwK3q9w0nnNGEelxBjd6QdiL3Hwr/g== X-Received: by 10.28.8.139 with SMTP id 133mr3704592wmi.80.1475960497491; Sat, 08 Oct 2016 14:01:37 -0700 (PDT) Received: from adiPC.lan ([188.24.54.197]) by smtp.gmail.com with ESMTPSA id bl3sm26649351wjc.26.2016.10.08.14.01.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Oct 2016 14:01:36 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v4 6/6] emacs: notmuch-lib: add refresh all buffers function Date: Sun, 9 Oct 2016 00:01:39 +0300 Message-Id: <20161008210139.25322-7-adi@adirat.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161008210139.25322-1-adi@adirat.com> References: <20161008210139.25322-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, 08 Oct 2016 21:01:46 -0000 notmuch-refresh-all-buffers calls each buffer's major mode specific refresh function using the generic notmuch-refresh-this-buffer function. Each buffer-specific refresh function has the same form, taking a prefix and a no-display arg. Passing the no-display arg is very useful because it tells the buffer-specific refresh functions to work in the background and not bring forward the refreshed buffer in a window. This again is very useful for silent async background updating the emacs display when new mail is fetched. 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 e1b5066..1162130 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -430,6 +430,21 @@ display the buffer.") (notmuch-poll) (notmuch-refresh-this-buffer prefix no-display)) +(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 to a window if not already displayed. 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 nil 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