Open pdf file in emacs with customized pdf viewer
目录
Abstract: Customize pdf viewer in emacs.
After updating my emacs to 29.1 version, I found the pdf viewer is not working well. These days, I will read a lot of papers in pdf format. So it is necessary to solve the pdf viewer problem in my emacs workflow.
My solution is like following:
(after! org
(add-to-list 'org-file-apps
'("\\.pdf\\'" . (lambda (file link)
(call-process "zathura" nil 0 nil "--mode" "fullscreen" file)))))
(setq bibtex-completion-pdf-open-function (lambda (file)
(call-process "zathura" nil 0 nil "--mode" "fullscreen" file)))
The key point is to create a function to open pdf file through zathura (or any
other pdf viewer you like). For example, the value of
bibtex-completion-pdf-open-function
is default as find-file
, which is a
build-in pdf viewer in emacs. On org-mode, the value is named org-file-apps
.
So it is easy to create the customized function, for example,
(lambda (file) (call-process "zathura" nil 0 nil "--mode" "fullscreen" file))