doomemacs/modules/lang/latex/config.el
Henrik Lissner c7254e7bdc
Major optimization refactor, across the board
+ enable lexical-scope everywhere (lexical-binding = t): ~5-10% faster
  startup; ~5-20% general boost
+ reduce consing, function calls & garbage collection by preferring
  cl-loop & dolist over lambda closures (for mapc[ar], add-hook, and
  various cl-lib filter/map/reduce functions) -- where possible
+ prefer functions with dedicated opcodes, like assq (see byte-defop's
  in bytecomp.el for more)
+ prefer pcase & cond (faster) over cl-case
+ general refactor for code readability
+ ensure naming & style conventions are adhered to
+ appease byte-compiler by marking unused variables with underscore
+ defer minor mode activation to after-init, emacs-startup or
  window-setup hooks; a customization opportunity for users + ensures
  custom functionality won't interfere with startup.
2017-06-09 00:47:45 +02:00

84 lines
2.3 KiB
EmacsLisp

;;; lang/latex/config.el -*- lexical-binding: t; -*-
(defvar +latex-bibtex-dir "~/work/writing/biblio/"
"Where bibtex files are kept.")
(defvar +latex-bibtex-default-file "default.bib"
"TODO")
;;
;; Plugins
;;
;; Because tex-mode is built-in and AucTex has conflicting components, we need
;; to ensure that auctex gets loaded instead of tex-mode.
(load "auctex" nil t)
(load "auctex-autoloads" nil t)
(push '("\\.[tT]e[xX]\\'" . TeX-latex-mode) auto-mode-alist)
(add-transient-hook! 'LaTeX-mode-hook
(setq TeX-auto-save t
TeX-parse-self t
TeX-save-query nil
TeX-source-correlate-start-server nil
LaTeX-fill-break-at-separators nil
LaTeX-section-hook
'(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label))
(add-hook! (latex-mode LaTeX-mode) #'turn-on-auto-fill)
(add-hook! 'LaTeX-mode-hook #'(LaTeX-math-mode TeX-source-correlate-mode))
(set! :popup " output\\*$" :regexp t :size 15 :noselect t :autoclose t :autokill t)
(map! :map LaTeX-mode-map "C-j" nil)
(def-package! company-auctex
:when (featurep! :completion company)
:init
(set! :company-backend 'LaTeX-mode '(company-auctex))))
(def-package! reftex ; built-in
:commands (turn-on-reftex reftex-mode)
:init
(setq reftex-plug-into-AUCTeX t
reftex-default-bibliography (list +latex-bibtex-default-file)
reftex-toc-split-windows-fraction 0.2)
(add-hook! (latex-mode LaTeX-mode) #'turn-on-reftex)
:config
(map! :map reftex-mode-map
:leader :n ";" 'reftex-toc)
(add-hook! 'reftex-toc-mode-hook
(reftex-toc-rescan)
(doom-hide-modeline-mode +1)
(map! :Le "j" #'next-line
:Le "k" #'previous-line
:Le "q" #'kill-buffer-and-window
:Le "ESC" #'kill-buffer-and-window)))
(def-package! bibtex ; built-in
:config
(setq bibtex-dialect 'biblatex
bibtex-align-at-equal-sign t
bibtex-text-indentation 20
bibtex-completion-bibliography (list +latex-bibtex-default-file))
(map! :map bibtex-mode-map "C-c \\" #'bibtex-fill-entry))
(def-package! ivy-bibtex
:when (featurep! :completion ivy)
:commands ivy-bibtex)
(def-package! helm-bibtex
:when (featurep! :completion helm)
:commands helm-bibtex)