doomemacs/modules/tools/pdf/config.el
Henrik Lissner 09cb4f6716
Major refactor & optimization of how modules load their packages
Now that we are loading package autoloads files (as part of the
generated doom-package-autoload-file when running make autoloads), many
:commands properties are redundant. In fact, many def-package! blocks
are redundant.

In some cases, we can do without a config.el file entirely, and can move
into the autoloads file or rely entirely on package autoloads.

Also, many settings have been moved in their module's autoloads files,
which makes them available ASAP; their use no longer depends on module
load order.

This gained me a modest ~10% boost in startup speed.
2018-05-25 00:46:16 +02:00

26 lines
1,015 B
EmacsLisp

;;; tools/pdf/config.el -*- lexical-binding: t; -*-
(def-package! pdf-tools
:mode ("\\.pdf\\'" . pdf-view-mode)
:config
(unless noninteractive
(pdf-tools-install))
(map! :map pdf-view-mode-map
"q" #'kill-this-buffer
doom-leader-key nil)
(setq-default pdf-view-display-size 'fit-page)
;; 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)))
)