I fixed this by applying the following patch. TBH, I didn't check that everything is still working as expected, but the compilation succeeds.
---
emacs/notmuch.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index d8d3afe..ab58fcb 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -411,13 +411,13 @@ the region between points BEG and END. As a special case, if (=
BEG END), FUNCTION will be applied to the result containing point
BEG."
- (lexical-let ((pos (notmuch-search-result-<wbr>beginning beg))
- ;; End must be a marker in case function changes the
- ;; text.
- (end (copy-marker end))
- ;; Make sure we examine at least one result, even if
- ;; (= beg end).
- (first t))
+ (let ((pos (notmuch-search-result-<wbr>beginning beg))
+ ;; End must be a marker in case function changes the
+ ;; text.
+ (end (copy-marker end))
+ ;; Make sure we examine at least one result, even if
+ ;; (= beg end).
+ (first t))
;; We have to be careful if the region extends beyond the results.
;; In this case, pos could be null or there could be no result at
;; pos.
--
2.9.3