Closed maxecharel closed 2 months ago
Hi!
Thanks for the report. I haven't seen this problem so far, but I think I know the reason for the problem. Consult tries to preview the files partially, but then fails to detect the file as binary, because the file doesn't contain zeros in the first part of the file.
Try adjusting consult-preview-partial-size and consult-preview-partial-chunk. Furthermore you can disable pdf preview via consult-preview-excluded-files
. Does this change anything?
Can you send me one of these pdf files such that I can test this myself?
Thanks!
I conducted a few more experiments and I have pushed an improvement in https://github.com/minad/consult/commit/9d96faff6d9231d30c3a17df82abedf8c13ee2c8. Please let me know if you still observe issues.
Hi @minad ,
Thank you for the fix!
After upgrading consult
to 20240224.1017 and without changing the value of consult-preview-partial-size
or consult-preview-partial-chunk
, I get
Binary file ‘<filename.pdf>’ not previewed
in line with the changes you've committed. As you suggested, I tried to adjust consult-preview-partial-size
, and after some experiments
(setq consult-preview-partial-size (* 1.5 1048576))
did the job: the file is previewed :) On the other hand, setting consult-preview-partial-size
to the default and instead adjusting consult-preview-partial-chunk
does not solve the problem (even with values like (* 100 102400)
).
Long story short, your fix allows not to get an error, and the adjustment of consult-preview-partial-size
allows to preview the file. Thanks a lot!
Do you think it would be worth documenting this problem and the solution? Even maybe giving a hint to the user, with something like
Binary file ‘<filename.pdf>’ not previewed. Try increasing the value of `consult-preview-partial-size'.
?
BTW, do you still want a copy of the files for which I've encountered the issue?
Best,
M
Do you think it would be worth documenting this problem and the solution? Even maybe giving a hint to the user, with something like
The message is already long. I don't want to make it more verbose. It should not be necessary to inform the user every time about this variable. I expect users to look at configuration variables documented in the README. Also the customization interface is very useful for discovery.
BTW, do you still want a copy of the files for which I've encountered the issue?
Not needed. Thanks!
Hi, For some PDF files generated with
latexmk-pdflatex
fromAUCTeX
, consult preview called by/fromconsult-buffer
gives me this type of error:(NB:
epdfinfo
is the server on whichpdf-tools
relies)However, I have no problem reading them directly from the
pdf-view-mode
provided bypdf-tools
. Can also be read by Okular. Sorry for the limited amount of information provided, I have no clue regarding the possible cause of this error that seems consult-specific (epdfinfo
enters the equation, but since I have no problem opening these pdfs directly frompdf-tools
, I guess we can discard it as the only or even main source of the problem?)As always, thanks for the great work.
Best,
M
Emacs 29.2
consult
20240223.1314 (MELPA)pdf-tools
20230611.239 (MELPA)