From: Matt Lundin <mdl@imapmail.org>
To: notmuch@notmuchmail.org
Subject: Bug (emacs): lexical binding breaks tag hooks
Date: Tue, 04 May 2021 16:15:55 -0500 [thread overview]
Message-ID: <87v97ytd2s.fsf@fastmail.fm> (raw)
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
next reply other threads:[~2021-05-04 21:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 21:15 Matt Lundin [this message]
2021-05-05 2:26 ` [PATCH] emacs: restore tag-changes and query bindings for tag hooks Kyle Meyer
2021-05-05 13:42 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v97ytd2s.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).