Describe the bug
When the emacs server has the menu bar disabled, opening pdfs gives a Error running timer ‘pdf-cache--prefetch-start’
Steps to Reproduce the behaviour
-
emacs -Q
-
Evaluate
(package-initialize)
(use-package pdf-tools
:init (pdf-loader-install)
:mode (("\\.pdf\\'" . pdf-view-mode)))
(menu-bar-mode -1)
(server-start)
(note: you can disable the menu bar after (server-start); it makes no difference)
emacsclient some_pdf_file.pdf
I get
Error running timer ‘pdf-cache--prefetch-start’: (wrong-type-argument number-or-marker-p nil)
Interestingly, if you don't kill the buffer, and call emacsclient again with the same file, there are no errors. But if you call it on another file, you get the same error.
Enabling the menu bar makes errors go away. Disabling it brings the errors back.
Note that this happens with emacsclient, but not if you simply do:
(package-initialize)
(use-package pdf-tools
:init (pdf-loader-install)
:mode (("\\.pdf\\'" . pdf-view-mode)))
(menu-bar-mode -1)
and open a file. So there is something about the client + lack of menu bar.
What is the expected behaviour?
The file is opened without any error
Desktop
- OS: Debian GNU Linux
- Emacs Version: GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) of 2024-12-23
- Poppler Version: libpoppler140:amd64 24.08.0-2
Your pdf-tools install
pdf-tools Version: pdf-tools-20240429.407 , commit 30b5054
pdf-tools customization / configuration that you use: shown above
Additional context
I now (toggle-debug-on-error). This is the output when I call emacsclient:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
#f(compiled-function (_) #<bytecode 0x2e6814773c69be7>)(1)
pdf-cache-prefetch-pages-function-default()
pdf-cache--prefetch-start(#<buffer file1.pdf>)
apply(pdf-cache--prefetch-start #<buffer file1.pdf>)
timer-event-handler([t 0 0 500000 t pdf-cache--prefetch-start (#<buffer file1.pdf>) idle 0 nil])
pdf-info-query(number-of-pages "/home/ramon/Downloads/file1.pdf")
pdf-info-number-of-pages()
pdf-cache-number-of-pages()
pdf-view-goto-page(1)
pdf-view-new-window-function((#<window 3 on file1.pdf> (overlay . #<overlay from 1 to 1822728 in file1.pdf>)))
image-mode-winprops(nil t)
image-mode-reapply-winprops()
redisplay_internal\ \(C\ function\)()
Changing the code above to
(use-package pdf-tools
:init (pdf-loader-install)
:mode (("\\.pdf\\'" . pdf-view-mode)))
;; Yes, we could use use-package hook, but for easier reproducibility
(add-hook 'pdf-view-mode-hook (lambda() (pdf-cache-prefetch-minor-mode -1)))
solves the issue. However, this does not seem like a great idea, since caching is disabled.
Describe the bug
When the emacs server has the menu bar disabled, opening pdfs gives a
Error running timer ‘pdf-cache--prefetch-start’Steps to Reproduce the behaviour
emacs -Q
Evaluate
(note: you can disable the menu bar after
(server-start); it makes no difference)emacsclient some_pdf_file.pdfI get
Error running timer ‘pdf-cache--prefetch-start’: (wrong-type-argument number-or-marker-p nil)Interestingly, if you don't kill the buffer, and call emacsclient again with the same file, there are no errors. But if you call it on another file, you get the same error.
Enabling the menu bar makes errors go away. Disabling it brings the errors back.
Note that this happens with emacsclient, but not if you simply do:
and open a file. So there is something about the client + lack of menu bar.
What is the expected behaviour?
The file is opened without any error
Desktop
Your pdf-tools install
pdf-toolsVersion: pdf-tools-20240429.407 , commit 30b5054pdf-toolscustomization / configuration that you use: shown aboveAdditional context
I now
(toggle-debug-on-error). This is the output when I call emacsclient:Changing the code above to
solves the issue. However, this does not seem like a great idea, since caching is disabled.