lang/latex: refactor default viewer resolution
And add evince to list of auto-detected viewers. This should fix an issue where preview-pane was used regardless of what viewer(s) were available.
This commit is contained in:
parent
a9b5640d1f
commit
3fae411918
2 changed files with 36 additions and 34 deletions
|
@ -1,13 +1,17 @@
|
|||
;;; lang/latex/+viewers.el -*- lexical-binding: t; -*-
|
||||
|
||||
(catch 'found-viewer
|
||||
;; fall back pdf previewing to latex-preview-pane
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "preview-pane") 'append)
|
||||
(add-to-list 'TeX-view-program-list '("preview-pane" latex-preview-pane-mode))
|
||||
|
||||
(dolist (viewer +latex-viewers)
|
||||
(if (pcase viewer
|
||||
(pcase viewer
|
||||
(`skim
|
||||
(when (and IS-MAC
|
||||
(file-exists-p! (or "/Applications/Skim.app"
|
||||
"~/Applications/Skim.app")))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "Skim"))))
|
||||
|
||||
(`sumatrapdf
|
||||
(when (and IS-WINDOWS
|
||||
(executable-find "SumatraPDF"))
|
||||
|
@ -24,6 +28,10 @@
|
|||
(when (executable-find "zathura")
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "Zathura"))))
|
||||
|
||||
(`evince
|
||||
(when (executable-find "evince")
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "Evince"))))
|
||||
|
||||
(`pdf-tools
|
||||
(when (featurep! :tools pdf)
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
|
||||
|
@ -31,13 +39,7 @@
|
|||
;; PDF Tools isn't in `TeX-view-program-list-builtin' on macs
|
||||
(add-to-list 'TeX-view-program-list '("PDF Tools" TeX-pdf-tools-sync-view)))
|
||||
;; Update PDF buffers after successful LaTeX runs
|
||||
(add-hook 'TeX-after-compilation-finished-function #'TeX-revert-document-buffer))))
|
||||
|
||||
(throw 'found-viewer t)))
|
||||
|
||||
;; fall back to latex-preview-pane
|
||||
(add-to-list 'TeX-view-program-list '("preview-pane" latex-preview-pane-mode))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "preview-pane")))
|
||||
(add-hook 'TeX-after-compilation-finished-function #'TeX-revert-document-buffer)))))
|
||||
|
||||
|
||||
(after! latex-preview-pane
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
enabling unicode symbols in math regions. This requires the unicode-math latex
|
||||
package to be installed.")
|
||||
|
||||
(defvar +latex-viewers `(skim sumatrapdf zathura okular pdf-tools)
|
||||
(defvar +latex-viewers '(skim evince sumatrapdf zathura okular pdf-tools)
|
||||
"A list of enabled latex viewers to use, in this order. If they don't exist,
|
||||
they will be ignored. Recognized viewers are skim, zathura, okular and
|
||||
pdf-tools.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue