pdf-tools
pdf-tools copied to clipboard
Rebuilding with straight.el leads to `tablist-filter-eval` Invalid Function error (when displaying / listing annotations)
Evaluating the function pdf-annot-list-annotations
gives the following error
tablist-filter-eval: Invalid function: (feval (filter) (pcase
filter (`(not \, (and operand (guard (not (cdr operand))))) (not
(feval (car operand)))) (`(and \, (and operands (guard (= 2
(length operands))))) (and (feval (nth 0 operands)) (feval (nth 1
operands)))) (`(or \, (and operands (guard (= 2 (length
operands))))) (or (feval (nth 0 operands)) (feval (nth 1
operands)))) (`(,op \, (and operands (guard (= (length operands)
1)))) (let ((fn (assq op tablist-filter-unary-operator))) (unless
fn (error "Undefined unary operator: %s" op)) (funcall fn id
entry (car operands)))) (`(,op \, (and operands (guard (= (length
operands) 2)))) (let ((fn (cdr (assq op
tablist-filter-binary-operator)))) (unless fn (error "Undefined
binary operator: %s" op)) (funcall fn id entry (car operands)
(cadr operands)))) ((guard (stringp filter)) (let ((fn (cdr
(assoc filter named-alist)))) (unless fn (error "Undefined named
filter: %s" filter)) (if (functionp fn) (funcall fn id entry))
(feval (if (stringp fn) (tablist-filter-unparse fn) fn))))
(`nil t) (_ (error "Invalid filter: %s" filter))))
This seems to be a problem of the package tablist
, which I'm on version 1.0
. Note that the readme of this repo currently says that >= 0.7
is enough for tablist
.
This seems to be the same issue in the old, unmaintained repo.
Maybe this helps https://github.com/politza/tablist/issues/23#issuecomment-1144943269
Edit:
Looks like I did not solve anything but that pdf-annot-list-annotations
does work when the pdf has no annotations and throws this error when there are annotations.
Thanks. As people point out in the link in the comment above, after deleting the compiled .elc files related to tablist (with straight in ".../straight/build/tablist/") this error disappears for me (also with annotations in the pdf).
Ok, the trick is not to regenerate the build files (e.g., via straight-rebuild-package
) after removing the .elc
files.
This bug gets me all the time I do a rebuild all and then I forget how to solve it. Can this instruction not to recompile the .elc files be built into the build recipe somehow? Thanks.
I do not have any experience with straight
, someone from that community will need to look into the build recipe part of it. Tagging it appropriately and hoping someone with know how to go ahead here.
Is this really only a straight.el issue or a general issue with the byte compilation?
Disabling byte-compilation in straight.el via a :no-byte-compile
attribute in the recipe was discussed in this issue and implemented here, but it not part of the latest version of straight.el.
I've never faced this problem with el-get
-- which also compiles the .el
files. Nor have I seen this problem with people who use MELPA + package.el
. All reports are related to straight.el
, hence the subject edit.
The byte compilation error mentioned here arises because cl-
macros are not defined when tablist
is byte-compiled.
I believe this should be fixed once https://github.com/politza/tablist/pull/26 is merged (which is unlikely as the maintainer seems inactive).
Evaluating (require 'cl-lib)
before byte-compilation would be a workaround. I'm not sure what is the right way to ensure it though.