From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8J/zDUN2F1+7PQAA0tVLHw (envelope-from ) for ; Tue, 21 Jul 2020 23:12:03 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id iPrcCUN2F1/rdAAA1q6Kng (envelope-from ) for ; Tue, 21 Jul 2020 23:12:03 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9D0409404D7 for ; Tue, 21 Jul 2020 23:12:01 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id EBAB91FFA7; Tue, 21 Jul 2020 19:11:49 -0400 (EDT) X-Greylist: delayed 493 seconds by postgrey-1.36 at nmbug; Tue, 21 Jul 2020 19:11:45 EDT Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by mail.notmuchmail.org (Postfix) with ESMTPS id B95D51FA58 for ; Tue, 21 Jul 2020 19:11:45 -0400 (EDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 16D515C00C4 for ; Tue, 21 Jul 2020 19:03:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 21 Jul 2020 19:03:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=from:to:subject:date:message-id:mime-version:content-type; s= fm3; bh=ztTtuc2OJp9/xkX3ge8Xxb4rbC9SddvwBowj4srk2wY=; b=oTsX526W hKS/T0ZAXqbfYdHyxBQQgFPHAWhJu66e96UHt2vvjqCn952/VUc3VUEoza3Wla/A ImyLBB6G+UBKaO++ccJESgxZT7gCpvgwSmMajDMZgUSu0mQ9PLiMw8udGxFaXM0M V4xX9xhPjmDPs+QDcHu3MOB+0sFF5lyrQ1TrlIFh7VqQ8FU2gEfsTnEeZvWzHKR8 sZFZ9HXBbV06048DZwfHLU3rAW38obfea6064mF9ckEhtp44KmdaL//Om77lp9eN dwOOEWs4ND4qoy5zTOz7jVwT5RECZM8L5ijlhOfSCVoQCaVAykZNvGYEgAvni/2S weZFdk4DWXOiYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=ztTtuc2OJp9/xkX3ge8Xxb4rbC9Sd dvwBowj4srk2wY=; b=II7V4iYgDM+5GJttAiat0BF5Jps2CU1RQlfgy6MF4DUVB 4zRcvIPOAar8YjnhnvjwjMHgEt22V0L0woRuKf8S03H1vpfvZVVYBuNBczzUELpp j+iZFYCug5o8xEhxam+XVh4BmhPqKedHWRCLKJ3HtmXG42Tqc8czraJdVhXLMo7G FLJQ/ka83PhuCqpoFouAX//2BsI+wBqp1zVRi61T8M2V94ucwh+ZvBl2003oK0pa qA/9jCTm5paG0A/Oy1zHp++9nepX2nx4GMe/RwJktbVL+Q3kE7QLYsThP74GpEV+ C6nrBVi6vxzN1PrP2R9VQjnI64TCy6J8MUyKkyHdQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrgeekgddujecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesthdtredttddttd enucfhrhhomhepufgvrghnucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihh ihhtthhonhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeelleegjeehvdehgeehgfefge dvhfdvfefffeehjedtgeefheffiedtfeetjeeuheenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehsphifhhhithhtohhnsehsphifhhhithhtoh hnrdhnrghmvg X-ME-Proxy: From: Sean Whitton To: notmuch@notmuchmail.org Subject: notmuch.el: notmuch-search: avoid wiping out buffer-local variables Date: Tue, 21 Jul 2020 16:03:27 -0700 Message-ID: <87mu3s5v40.fsf@iris.silentflame.com> MIME-Version: 1.0 Message-ID-Hash: EIOWGUFU3IHAPUIYVYV3GFEOMIESBNC3 X-Message-ID-Hash: EIOWGUFU3IHAPUIYVYV3GFEOMIESBNC3 X-MailFrom: spwhitton@spwhitton.name X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=spwhitton.name header.s=fm3 header.b=oTsX526W; dkim=fail (body hash did not verify) header.d=messagingengine.com header.s=fm3 header.b=II7V4iYg; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 1.53 X-TUID: Yj/my9O4E3Au 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: 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