On Tuesday, 2020-07-21 at 16:03:27 -07, Sean Whitton wrote:
> Hello,
>
> I have some code to cycle through a list of searches. The remaining
> searches are stored in a buffer-local variable, working something like
> this (simplified):
>
> (defun spw/next-unread-group ()
>(interactive)
>(notmuch-search (car spw/more-unread-groups)
>(set (make-local-variable 'spw/more-unread-groups)
> (cdr spw/more-unread-groups
>
> However, my spw/more-unread-groups variable gets wiped out by
> notmuch-refresh-this-buffer, because the latter calls
> notmuch-search-mode, and major modes wipe out buffer-local variables.
>
> So far as I can tell that call doesn't actually have any effect when the
> mode is already notmuch-search-mode, so may I propose this patch to
> support my use case:
Seems reasonable. Could you add a comment in the code explaining that
it's to avoid clobbering third-party buffer local variables?
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index dd18f2e1..dcbc1eb2 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -987,7 +987,8 @@ the configured default sort order."
> (if no-display
> (set-buffer buffer)
>(switch-to-buffer buffer))
> -(notmuch-search-mode)
> +(unless (eq major-mode 'notmuch-search-mode)
> + (notmuch-search-mode))
> ;; Don't track undo information for this buffer
> (set 'buffer-undo-list t)
> (set 'notmuch-search-query-string query)
>
> --
> Sean Whitton
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
dme.
--
What did you learn today? I learnt nothing.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org