Merge pull request #525 from UndeadKernel/fix_latex_and_pdftools

Better PDF Tools and LaTeX interaction
This commit is contained in:
Henrik Lissner 2018-04-17 21:21:36 -04:00 committed by GitHub
commit c3c6b5b4de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 84 additions and 41 deletions

View file

@ -0,0 +1,10 @@
;;; tools/pdf/+modeline.el -*- lexical-binding: t; -*-
(def-modeline-segment! +pdf-tools-pages
"Current and total page indicator for PDF documents."
(format " P %d/%d" (pdf-view-current-page) (pdf-cache-number-of-pages)))
(def-modeline! pdf-tools-modeline
(bar matches " " buffer-info +pdf-tools-pages)
(major-mode vcs))

View file

@ -9,23 +9,18 @@
(map! :map pdf-view-mode-map "q" #'kill-this-buffer)
;; Fit pages to screen by default
(setq-default pdf-view-display-size 'fit-page)
;; turn off cua so copy works
(add-hook! 'pdf-view-mode-hook (cua-mode 0)))
(when (featurep! :lang latex)
(after! latex
;; add to the program list
(add-to-list 'TeX-view-program-selection
'(output-pdf "PDF Tools"))
(add-to-list 'TeX-view-program-list
'("PDF Tools" ("TeX-pdf-tools-sync-view")))
;; enable document revert
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
;; correlated mode
(setq TeX-source-correlate-start-server t
TeX-source-correlate-mode t)))
;; Turn off cua so copy works
(add-hook! 'pdf-view-mode-hook (cua-mode 0))
;; Custom modeline that removes useless info and adds page numbers
(when (featurep! :ui doom-modeline)
(load! +modeline)
(add-hook! pdf-tools-enabled (doom-set-modeline 'pdf-tools-modeline)))
;; Handle PDF-tools related popups better
(set! :popup "^\\*Outline*" '((side . right) (size . 40)) '((select)))
;; TODO: Add additional important windows that should be handled differently
;; TODO: These two next rules don't work (they should), investigate
;; (set! :popup "\\*Contents\\*" '((side . right) (size . 40)) nil)
;; (set! :popup "* annots\\*$" '((side . left) (size . 40)) '((select)))
)