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 B4CA76DE0ABE for ; Sat, 17 Sep 2016 01:58:35 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.672 X-Spam-Level: X-Spam-Status: No, score=-0.672 tagged_above=-999 required=5 tests=[AWL=0.049, 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 rPjQGHf60U5Q for ; Sat, 17 Sep 2016 01:58:33 -0700 (PDT) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 5F4FE6DE0AAA for ; Sat, 17 Sep 2016 01:58:33 -0700 (PDT) Received: by mail-wm0-f65.google.com with SMTP id b184so6993762wma.3 for ; Sat, 17 Sep 2016 01:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=6+cQY2vdyML79bcwJAAR5UziBN3IPP/Vzm4kyJyPQCA=; b=sx1mxnggyLK5AbU/tHVD61IS+0C1gj+o4Z01LDu5YuYCUPh0nL69RHDkXGZDJdhCa7 Xz7n7CS/dx8Ce/6vZ6BlpU1D395qxMD1H7sm1BpqwCpWfUj5BC7vRJ964CvV4Kz2Isur 8SJK/3NQ0pkUTUwGlmRAEE0c18vLl4StRdWdCSlO2IXSAvSSBkjDB7Zf8JPQ3t1vEwUv 5ANDfJkib1VnIrKKbH0ugsbD2iA1FuQ4Fq3FXPCwIejFPd4npeCiSoN6tbwO7foTpmDw PRGDoP7nknt2LtxyONTzv74Kydk44g0n6Nwu34Gg98dVVdB46XXtHd2dO2bGTBTtrifp 9w3w== 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:date :message-id:mime-version; bh=6+cQY2vdyML79bcwJAAR5UziBN3IPP/Vzm4kyJyPQCA=; b=Vp4aqNbwenccR9kSPZWQmlyyELE1GxHPcfHoeqUVCGW4+DwxW6a0Nc/uvxik1XrCoj LxvfvVqt0xwHnA1hjjOwVQrT4MKLk/jgJX2ajh2Mn20eQBUts8NhiPvvVPePf0v9y1rr 6l5ZOb07Q2YTOXao/SqJYLs2V2YQAL79Ug91W/f4Qz0G74y5UXYyC5wF27r3zq0fZeJs QSIaUrLP/um3OkSbbj94sHG5REQX1mr9MqLK8wqxNYmexF6fzXTDLk5SXVPfRIjNvg9d 6iK3RdWXICmO4VcR3ofS3VGwVTLAAflKMeItW2KfAnVdaD16PpOSD0iHTMByXD6jTyKS 9aLQ== X-Gm-Message-State: AE9vXwPb3Q2W3LkTuUfungLPa47BjBE6OdjzG3rSkqmpSWWq1CSdUW+XGrChKP2kvt0I9A== X-Received: by 10.28.67.132 with SMTP id q126mr1238783wma.84.1474102711292; Sat, 17 Sep 2016 01:58:31 -0700 (PDT) Received: from adiPC ([188.24.78.211]) by smtp.gmail.com with ESMTPSA id bw9sm12175342wjc.33.2016.09.17.01.58.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Sep 2016 01:58:30 -0700 (PDT) From: Ioan-Adrian Ratiu To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH 4/4] emacs: add refresh all buffers function In-Reply-To: <87a8f7bmsn.fsf@qmul.ac.uk> References: <20160910142819.19349-1-adi@adirat.com> <20160910142819.19349-5-adi@adirat.com> <87a8f7bmsn.fsf@qmul.ac.uk> Date: Sat, 17 Sep 2016 11:58:30 +0300 Message-ID: <87oa3mewcp.fsf@adirat.com> 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: Sat, 17 Sep 2016 08:58:35 -0000 On Fri, 16 Sep 2016, Mark Walters wrote: > On Sat, 10 Sep 2016, Ioan-Adrian Ratiu wrote: >> 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)) > > I think this is a case where dolist might be more idiomatic (and maybe > you want buffer to be local to this function?) Yes, good idea, I'll rewrite in v2. > >> + (when (string-prefix-p "notmuch" (format "%s" buffer-mode)) >> + (with-current-buffer buffer >> + (notmuch-refresh-this-buffer no-display)))))) > > Is there a problem with this being slow if there are lots of show > buffers? notmuch show is synchronous? I am not saying it is a problem, > just wondered if you had considered it. I hadn't encountered any problems in practice. I tested with a maximum of 20 or so show buffers at a time and didn't notice any slowness, but I wasn't paying close attention because updates were happening in the background (only a few buffers were actually shown in windows). If this is a problem, then we can try to make it faster, sure. > > Best wishes > > Mark > >> + >> (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 >> >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> https://notmuchmail.org/mailman/listinfo/notmuch