From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aC1SJ9m6kWD/WwAAgWs5BA (envelope-from ) for ; Tue, 04 May 2021 23:21:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KJHsItm6kWAoRgAAB5/wlQ (envelope-from ) for ; Tue, 04 May 2021 21:21:29 +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) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9750E1BCEB for ; Tue, 4 May 2021 23:21:28 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 23D6D271D5; Tue, 4 May 2021 17:21:23 -0400 (EDT) X-Greylist: delayed 321 seconds by postgrey-1.36 at nmbug; Tue, 04 May 2021 17:21:19 EDT Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mail.notmuchmail.org (Postfix) with ESMTPS id 692A02716D for ; Tue, 4 May 2021 17:21:19 -0400 (EDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CB90F5C0156; Tue, 4 May 2021 17:15:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 04 May 2021 17:15:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imapmail.org; h= from:to:subject:date:message-id:mime-version:content-type; s= fm3; bh=QlMjPAA/s2HoMqP33FuwXHylCQ4eY7caeAApY6nmCLg=; b=hJjvdGd4 R2a9MLb3OCgo8geiBr199EckxjZpx+HlOZGDqkJ/JUo//gII4emLw8+HDgJtdgzz iB+qUlau3THtstJj95XlMjPmId1yKrpLNfKz7oizAISN76ady6J6XKK8RqnoHaJo 8tbZmOm+axjw66WK1iYKeJDdTb2RO16WwNFTebQEwU1cxEruQt/22SNRSUEZXELn gxNMxtPGyeqTBWzW+rxP4X07gFRcjGgUajTC8HWz2XRqCDcXaEHnk9dB4JFpdG7Q GCMLpoNNht8y8QpdPz8IsGtbmqxNaC6b+CTNQhcxYFvCc6wNXrUNE5u1fRA576ab m7qmci0QYsTOqA== 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=fm2; bh=QlMjPAA/s2HoMqP33FuwXHylCQ4eY 7caeAApY6nmCLg=; b=dmuHy3PrraeX+12xvBaZu1+vaGPkIah3WatooKdCVilIp 2JZxclVqGs+LIY05WFpeKj9a+pIBwnavJBdwfPW3rWJ8BfkcHlhHGrBv9Ygl2eko xCXIy8D4opLNf66EWve6xesQWQjlM8NiX0INsGebFR88OeqoMcS+a9vezGP0aTEe vaCJ4q/2Kt5R2IneHcF6rp7u0IOzFs6pSA2UgRjCvVD+4+//9xq5suG9UVdXxWvX lZcO8XfPu8ACb2MI1+VFNHSpQEjVSKgY6FLWarMHa4inqmwC/XgRr07S7xeUwICs 6HQ8liwaoZbtGThwkjr7SjF0sYnWNvK1/3IEwJXSA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefiedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesthdtredttd dttdenucfhrhhomhepofgrthhtucfnuhhnughinhcuoehmughlsehimhgrphhmrghilhdr ohhrgheqnecuggftrfgrthhtvghrnhepfeefkeeiveffueegleeiieekhefhtedtkeevve dtgeehieetheevieetudfftdefnecukfhppeejiedrudeirddufeehrdduudelnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgulhesihhmrg hpmhgrihhlrdhorhhg X-ME-Proxy: Received: from localhost (c-76-16-135-119.hsd1.il.comcast.net [76.16.135.119]) by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 4 May 2021 17:15:57 -0400 (EDT) From: Matt Lundin To: notmuch@notmuchmail.org Subject: Bug (emacs): lexical binding breaks tag hooks Date: Tue, 04 May 2021 16:15:55 -0500 Message-ID: <87v97ytd2s.fsf@fastmail.fm> MIME-Version: 1.0 Message-ID-Hash: QRAEKZFEYHUIR3F6QUVU6HML4BDQ3Y3O X-Message-ID-Hash: QRAEKZFEYHUIR3F6QUVU6HML4BDQ3Y3O X-MailFrom: mdl@imapmail.org 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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620163289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=mKRg1uK446s8A0DXXqnLjrZNPXpiYXxM4qV74Wf6sK4=; b=DvyhYYLkZy1BIIkn/0259nEnOyR21FLeRh2eF/RFFdejqGvzbsF7EfWSTCkeuZWDLGLk9Z jSXV+/ZZiX+j2rvrIrAdy3cKD7n5pYTZN2dcxU+QehN02qOHQ7hvdHOjMvV/6NgQXFA+hV sT5Qj4ryTj3ipJAEolLK3z5OjG2Kr3D7wWa8dG/E5Y6J02jIOXEHU3+cLU+zFNQCMYUXSz MGY9a25mXlAf1wL8ZWO0VznBxR08y1UX1ejbYCPGLCi8b6PkUNFzzME0UD4JDtgsIipBvb ziSshZiktFgKYBXpt7+GgZrepySxYQOwHnZbR7K81+5QhgB0hpDZIXffGIJ9vw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620163289; a=rsa-sha256; cv=none; b=PjUve9LWF7s9tHicHdzEI1kr7EKnEUp/pRnza+hE6900ucfzvnnkqfNRgGA0ro0T/F6Sgg nAEUxcgkFh4dPN7WPOwpDkjfoeHmeljPv56O4u3ZJJvNW/aPQAjsUUBaxKA/O6RcIEPyjl 9IMl3h4tsvkE3/r/5cfhVjMP72wHwX5KBSuYLsv79OgZvO8y3M/5BFiaOSfj7Zdm9rutkY aNQPDLfVr0mz6iK65FEcf31vfH13uR27MIJzRAnogONW2kzAI34C7HzQnYG/Cnnit6ss90 +ScaBD2ClJlryoyJtfyMz6ATA4K6f4LM4uNBJTWOI2CbRvcRY1qdFJ9hl1udig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=imapmail.org header.s=fm3 header.b=hJjvdGd4; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm2 header.b=dmuHy3Pr; 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-Migadu-Spam-Score: -0.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=imapmail.org header.s=fm3 header.b=hJjvdGd4; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm2 header.b=dmuHy3Pr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=imapmail.org (policy=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-Migadu-Queue-Id: 9750E1BCEB X-Spam-Score: -0.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3Rxs4TYwLBt0 With the upgrade to notmuch 0.32, functions added to 'notmuch-after-tag-hook' or 'notmuch-before-tag-hook' no longer have access to the 'tag-changes' or 'query' variables advertised in the docstrings of both hooks. If I try to access either variable in a hook function, emacs throws an error. I believe this results from the addition of lexical binding in commit fc4cda07a9af. Here are steps to reproduce: 1. Create a hook that accesses either the 'query' or 'tag-changes' variable: (defun my-notmuch-tag-change-test () tag-changes) (add-hook 'notmuch-before-tag-hook #'my-notmuch-tag-change-test) 2. Attempt to change a tag in a message. This results in the following backtrace: --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (void-variable tag-changes) my-notmuch-tag-change-test() run-hooks(notmuch-before-tag-hook) (progn (run-hooks 'notmuch-before-tag-hook) (if (<= (length query) notmuch-tag-argument-limit) (apply 'notmuch-call-notmuch-process "tag" (append tag-changes (list "--" query))) (let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ") " -- " query))) (notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch"))) (run-hooks 'notmuch-after-tag-hook)) (if tag-changes (progn (run-hooks 'notmuch-before-tag-hook) (if (<= (length query) notmuch-tag-argument-limit) (apply 'notmuch-call-notmuch-process "tag" (append tag-changes (list "--" query))) (let ((batch-op (concat (mapconcat ... tag-changes " ") " -- " query))) (notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch"))) (run-hooks 'notmuch-after-tag-hook))) notmuch-tag("id:87v981o2hj.fsf@tethera.net" ("+test")) notmuch-show-tag(("+test")) notmuch-show-add-tag(("+test")) funcall-interactively(notmuch-show-add-tag ("+test")) call-interactively(notmuch-show-add-tag nil nil) command-execute(notmuch-show-add-tag) --8<---------------cut here---------------end--------------->8--- Best, Matt