On Fri, 16 Sep 2016, Mark Walters <markwalters1...@gmail.com> wrote:
> On Sat, 10 Sep 2016, Ioan-Adrian Ratiu <a...@adirat.com> wrote:
>> This new notmuch-refresh-all-buffers function calls each buffer's major
>> mode specific refresh function using the generic 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 <a...@adirat.com>
>> 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."
>> +(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
>> + (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
>> (defun notmuch-prettify-subject (subject)
>> ;; This function is used by `notmuch-search-process-filter' which
>> ;; requires that we not disrupt its' matching state.
>> notmuch mailing list
notmuch mailing list