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 B13E76DE09FB for ; Sun, 25 Sep 2016 04:11:25 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.011 X-Spam-Level: X-Spam-Status: No, score=-0.011 tagged_above=-999 required=5 tests=[AWL=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 x8NA1ixISACM for ; Sun, 25 Sep 2016 04:11:25 -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 9A40A6DE0999 for ; Sun, 25 Sep 2016 04:11:24 -0700 (PDT) Received: by mail-wm0-f68.google.com with SMTP id 133so9676757wmq.2 for ; Sun, 25 Sep 2016 04:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version; bh=w5RleuYPj6UiFD3QfZO/mNcAxfrGSMC0kgQziVedvi8=; b=VjqvpDAEXM+QpSqRy5+CHNfbLJXcTc+V7MD8KV6EbquHWug5jU2kKks3iM2S6GHNis d8XMiIfXDchJx3ti6QBPwImoEPb91ThfYj6TVsXq7KKL+aSt8dRCXr+LNgeWEAVvZ0pc j547t3TvbkrGzz9HcXU0cMHbbNEacXa5dj8ejblQ2OVfCa8ucfRzQTddm+gsRzW+Qr4A mmMiErmaMYmGWQZYHM3QzR90mKvTnulpEPKc/3atPim/YLN476oLwXuDBz61vViZuhbQ Gdz7dGD8GHOGZAqGOcdgdKyrjIZ9ilx19iLqpFgAhTZqODITjLKDobtSzFyDy5KcD5gx PPbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=w5RleuYPj6UiFD3QfZO/mNcAxfrGSMC0kgQziVedvi8=; b=JuCtKtLmka1PUZhgP4B/GiSUly9Gv0OW6hO36rC7QTGfUF2IJIWzUyaaSuKu+dznr8 Go9wUr3UCrajTBwHreEV9bAVFtfx53JlV1J2H7ipZL4ATxg8QE6lNVv32O16yZQgCBg8 snyxYiu9S0vsg3pr7m8H/gGN4TZDk5Sk9wRERDWN0ocALVMCLx+P7ZlnVjGEFzIlnKp6 q6cIEoaXHuz9IjOYMVtKSnkmsO1k/6crmROqLzKWNRVcgmfmVE8OTfIL8j4uAe1qaXfH v6ZyOPqn5QrXGt7201E9rBPoF2Boc5y1XG3yctlqYdH2vrkNDvqUTVplzIDcPiBS6mjV PHDg== X-Gm-Message-State: AE9vXwO5qiINUN3Ff9BrnP/pPE8lbAP547ljYG70PaOU6dTA1vf+KOIirQX2c3IWoN7dEA== X-Received: by 10.194.146.174 with SMTP id td14mr16925744wjb.152.1474801883301; Sun, 25 Sep 2016 04:11:23 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id d64sm6191754wmh.0.2016.09.25.04.11.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Sep 2016 04:11:22 -0700 (PDT) From: Mark Walters To: Ioan-Adrian Ratiu , notmuch@notmuchmail.org Subject: Re: [PATCH v2 4/4] emacs: notmuch-lib: add refresh all buffers function In-Reply-To: <20160924200735.25425-5-adi@adirat.com> References: <20160924200735.25425-1-adi@adirat.com> <20160924200735.25425-5-adi@adirat.com> User-Agent: Notmuch/0.18.1+485~gca076ce (https://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Sun, 25 Sep 2016 12:11:21 +0100 Message-ID: <87twd4utd2.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain 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: Sun, 25 Sep 2016 11:11:25 -0000 On Sat, 24 Sep 2016, Ioan-Adrian Ratiu wrote: > 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)) I think I would prefer an explicit list of possible matches e.g., (when (memq buffer-mode '(notmuch-show-mode notmuch-tree-mode notmuch-hello-mode notmuch-search-mode) This makes it easier to see when it will be called, and makes sure we don't do anything weird if we have notmuch-compose-mode for example. Best wishes Mark > + (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