unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Revert "emacs: notmuch-search: avoid wiping out buffer-local variables"
@ 2020-11-08 17:49 Jonas Bernoulli
  2020-11-09  1:47 ` Sean Whitton
  2020-12-25 18:34 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jonas Bernoulli @ 2020-11-08 17:49 UTC (permalink / raw)
  To: notmuch

This reverts commit f9fbd1ee3bfd679175d88af403752d87a730349f.

Emacs provides a mechanism for avoiding wiping out buffer-local
variables: marking them as "permanent local", which essentially
means "don't wip out the local value when enabling major-mode".

  (put 'the-variable 'permanent-local t)

See (info "(elisp)Creating Buffer-Local").

Whether refreshing the buffer contents should involve re-enable the
mode is a different question, which should not be decided based on
the fact that we want keep the value of some random variable, not
least because some other (e.g. cache) variables are likely expected
to be wiped.
---
 emacs/notmuch.el | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 83bcee57..c4078bd3 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -995,11 +995,7 @@ (defun notmuch-search (&optional query oldest-first target-thread target-line no
     (if no-display
 	(set-buffer buffer)
       (pop-to-buffer-same-window buffer))
-    ;; avoid wiping out third party buffer-local variables in the case
-    ;; where we're just refreshing or changing the sort order of an
-    ;; existing search results buffer
-    (unless (eq major-mode 'notmuch-search-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)
-- 
2.29.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "emacs: notmuch-search: avoid wiping out buffer-local variables"
  2020-11-08 17:49 [PATCH] Revert "emacs: notmuch-search: avoid wiping out buffer-local variables" Jonas Bernoulli
@ 2020-11-09  1:47 ` Sean Whitton
  2020-12-25 18:34 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Whitton @ 2020-11-09  1:47 UTC (permalink / raw)
  To: Jonas Bernoulli

Hello,

On Sun 08 Nov 2020 at 06:49PM +01, Jonas Bernoulli wrote:

> This reverts commit f9fbd1ee3bfd679175d88af403752d87a730349f.
>
> Emacs provides a mechanism for avoiding wiping out buffer-local
> variables: marking them as "permanent local", which essentially
> means "don't wip out the local value when enabling major-mode".
>
>   (put 'the-variable 'permanent-local t)
>
> See (info "(elisp)Creating Buffer-Local").
>
> Whether refreshing the buffer contents should involve re-enable the
> mode is a different question, which should not be decided based on
> the fact that we want keep the value of some random variable, not
> least because some other (e.g. cache) variables are likely expected
> to be wiped.

Nice, thank you for the info.  I've tested that my usecase works after
reverting the patch so I support reverting it.

Reviewed-by: Sean Whitton <spwhitton@spwhitton.name>

-- 
Sean Whitton

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "emacs: notmuch-search: avoid wiping out buffer-local variables"
  2020-11-08 17:49 [PATCH] Revert "emacs: notmuch-search: avoid wiping out buffer-local variables" Jonas Bernoulli
  2020-11-09  1:47 ` Sean Whitton
@ 2020-12-25 18:34 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2020-12-25 18:34 UTC (permalink / raw)
  To: Jonas Bernoulli, notmuch

Jonas Bernoulli <jonas@bernoul.li> writes:

> This reverts commit f9fbd1ee3bfd679175d88af403752d87a730349f.
>

applied to master.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-25 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-08 17:49 [PATCH] Revert "emacs: notmuch-search: avoid wiping out buffer-local variables" Jonas Bernoulli
2020-11-09  1:47 ` Sean Whitton
2020-12-25 18:34 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).