Context
In notmuch there is the a function that reads the :search-type property from a list and compares it to a symbol. This comparison is always nil for 'tree' / 'unthreaded, even though saved-search is set correctly (or not - that is the question).
A reduced problem follows below.
; ...
(cond
((eq (plist-get saved-search :search-type) 'tree)
`(lambda () (notmuch-tree ',query)))
((eq (plist-get saved-search :search-type) 'unthreaded)
`(lambda () (notmuch-unthreaded ',query)))
(t
`(lambda () (notmuch-search ',query ',oldest-first)))))
; ...
Reduced Problem
The following minimal test shows the problem. I would expect that this sexp evaluates to 't though it evaluates to nil.
(eq (plist-get `(:search-type 'tree) :search-type) 'tree)
This can be reduced to
(eq (car '('tree)) 'tree) ; => nil
(eq 'tree 'tree) ; => t
Work Around
Using intern to create the item in the list works:
(eq (car `(,(intern "tree"))) 'tree) ; => t
Question
According to my understanding of the eq documentation both 'tree instances in (eq (car '('tree)) 'tree) should be the same object.
Why is this not the case?
Emacs Version
I am using doom (if that is relevant) which compiles the elisp to native code (if that is of any help).
"GNU Emacs 28.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-01-18"
(eq (car '(tree)) 'tree) ; => t– choroba Jan 26 '22 at 08:55