-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheasymacs-pdf-tools.el
38 lines (31 loc) · 1.07 KB
/
easymacs-pdf-tools.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
;;; PDF-tools as LaTeX viewer: very handy, but tricky to install
;; This is very slow to load, so defer.
(use-package pdf-tools
:ensure t
:defer t)
(defun easymacs-pdf-tools-require ()
(unless (featurep 'pdf-tools)
(message "Please wait: initializing PDF Tools")
(require 'pdf-tools)
(pdf-tools-install)))
(add-to-list 'auto-mode-alist
'("\\.pdf\\'" .
(lambda ()
(easymacs-pdf-tools-require)
(add-hook 'pdf-tools-enabled-hook 'auto-revert-mode))))
(add-hook 'TeX-after-compilation-finished-functions
'TeX-revert-document-buffer)
(setq revert-without-query (quote (".*.pdf")))
(defun easymacs-TeX-pdf-tools-sync-view ()
(easymacs-pdf-tools-require)
(TeX-pdf-tools-sync-view))
(setq TeX-view-program-list
'(("PDF Tools" easymacs-TeX-pdf-tools-sync-view)))
(defun easymacs-latex-pdf-frame ()
(interactive)
(let ((output-file (TeX-active-master (TeX-output-extension))))
(if (file-exists-p output-file)
(progn
(find-file-other-frame output-file)
(revert-buffer))
(message "Output file %S does not exist." output-file))))