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 99A5E6DE0BB9 for ; Sat, 10 Sep 2016 07:28:26 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.721 X-Spam-Level: X-Spam-Status: No, score=-0.721 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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 BaFBvjgDCSzc for ; Sat, 10 Sep 2016 07:28:25 -0700 (PDT) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 7A3C16DE0B6D for ; Sat, 10 Sep 2016 07:28:25 -0700 (PDT) Received: by mail-wm0-f67.google.com with SMTP id b187so6762325wme.0 for ; Sat, 10 Sep 2016 07:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=kSS5oHgK+B3+HPuY6RO9FZMFtq44Ey0lfyA4YSDZdFc=; b=qg6L/PLmr360WUNl4Gq1rZ17lpwKZfQYEPRJKCFFTpUPexgzyWwMGvktzAUdNOxrnK 4HTYtgip+f3U3X4AskoIO3riSekoBR8y461DP5J7y62SHfMYZJdfihnnMr1hgoogBkBo J+CgPWkDfnga3njYlvHLB8OK6C9zBE/jibSfNvFOoFh6SyITk4B/fY0pn+gagAgekmMT tcG5iaIUpQZRYNA72keKHiI1hsngPp68b7+Q+glsQBdNALkJUYME4Ae1Vl2EYSfC6Y9o 4OQli1/Q+Yl2OBIAVgTHu2HRDdgAleHVYxee1tB/5OjwQMOZKEeD/rEtHVff7H5C06Tu Ar0w== 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:date:message-id:in-reply-to :references; bh=kSS5oHgK+B3+HPuY6RO9FZMFtq44Ey0lfyA4YSDZdFc=; b=H3Riez98n9z/YqPHzx3vNa4+VFL4ng6ShTACAfJGDylagV+20eSa3avE3lHquy+HIn 0m8DajOLmyKZweI5/XhIGLk+67Ip0lL9UioTaO3eQnb3VyZF0aT9b0XmowgHpXCS+ndH c225DK10peOAjKiZ8xotiuw7PWZNl93Esqjy7gaVQ/UHpAI8zxI7S/jq48mC3JbbwPSK MDapqCBTbS6GVS/VGATI6thXXUUWdohwtcDeJ4bqm33cmOa1stFGhbaSnKcgSWJO2sLh LKzmz2hJUE72SQz04/GbffsAYiKz8GAEAt11XoVfN9WWBsoMsKQCqC2WzNbZfXnkCxim ZIIQ== X-Gm-Message-State: AE9vXwMSJRyb7t6QwUFyiQa7VBWpR6a5k6uo+39p9bLrZcdgJkUNquI2Uhu4ah9yJLHGpg== X-Received: by 10.28.167.151 with SMTP id q145mr2432704wme.76.1473517703879; Sat, 10 Sep 2016 07:28:23 -0700 (PDT) Received: from adiPC.lan ([188.24.78.211]) by smtp.gmail.com with ESMTPSA id s6sm8555457wjm.25.2016.09.10.07.28.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Sep 2016 07:28:23 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH 4/4] emacs: add refresh all buffers function Date: Sat, 10 Sep 2016 17:28:19 +0300 Message-Id: <20160910142819.19349-5-adi@adirat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160910142819.19349-1-adi@adirat.com> References: <20160910142819.19349-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, 10 Sep 2016 14:28:26 -0000 This new notmuch-refresh-all-buffers function calls each buffer's major mode specific refresh function using the generic function notmuch-refresh-this-buffer. 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 6618365..4cc2041 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -428,6 +428,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." + (let ((buffers (buffer-list))) + (while buffers + (setq buffer (car buffers) + buffers (cdr buffers) + 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.9.3