diff options
| author | tslil clingman <> | 2020-05-14 14:34:15 -0700 |
|---|---|---|
| committer | tslil clingman <> | 2020-05-14 14:34:15 -0700 |
| commit | 299b171de274000ab6af5ae5fbaf3caaeabb086e (patch) | |
| tree | 026d21a65d0dc3efefe08ff65c74f6d7e6fbc198 | |
| parent | 98f9ef9249146bea697701d1dd969441a3b51981 (diff) | |
finally sorted out company and labels, thanks -reftex!
| -rw-r--r-- | emacs/inits/24-latex.el | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/emacs/inits/24-latex.el b/emacs/inits/24-latex.el index f7296c1..14a022d 100644 --- a/emacs/inits/24-latex.el +++ b/emacs/inits/24-latex.el @@ -1,4 +1,4 @@ -;; Time-stamp: <2020-05-09 14:34:52 (tslil@forfeit)> +;; Time-stamp: <2020-05-14 14:33:14 (tslil@forfeit)> (defvar latex-template-dir (expand-file-name "~/academic/typeset/latex-templates")) (defun prompt-latex-file-template () @@ -24,6 +24,8 @@ populated from the directory *latex-template-dir*" (use-package company-auctex :ensure t :defer t) +(use-package company-reftex :ensure t :defer t) + (use-package unfill :ensure t) (use-package pdf-tools @@ -33,25 +35,49 @@ populated from the directory *latex-template-dir*" (use-package latex :ensure auctex + :ensure pdf-tools :bind (:map LaTeX-mode-map ("'" . better-TeX-insert-single-quote) ("TAB" . LaTeX-indent-line) ("M-q" . unfill-paragraph) + ("M-SPC" . (lambda () (interactive) (insert ?\\))) ; Never used just-one-space ("C-c C-g" . pdf-sync-forward-search)) + :hook (LaTeX-mode . (lambda () - (require 'company-auctex) - (electric-pair-local-mode -1) - (spell-fu-mode) - (display-line-numbers-mode) - (auto-fill-mode -1) - (visual-line-mode) - (cdlatex-mode t) - (company-auctex-init) - (siege-mode 1) - (cdm-mode) - (pdf-tools-install) + (latex-setup-visual-aesthetics) + (latex-setup-text-environment) + (latex-setup-special-minor-modes) + (latex-setup-completions) (prompt-latex-file-template))) :init + (defun latex-setup-visual-aesthetics () + (interactive) + (auto-fill-mode -1) + (visual-line-mode) + (display-line-numbers-mode)) + + (defun latex-setup-text-environment () + (interactive) + (electric-pair-local-mode -1) + (spell-fu-mode) + (siege-mode 1)) + + (defun latex-setup-special-minor-modes () + (interactive) + (cdlatex-mode t) + (cdm-mode) + (pdf-tools-install)) + + (defun latex-setup-completions () + (interactive) + (require 'reftex) + (turn-on-reftex) + (require 'company-auctex) + (require 'company-reftex) + (dolist (backend '(company-auctex-macros company-auctex-symbols company-auctex-environments + company-reftex-citations company-reftex-labels)) + (add-to-list 'company-backends backend))) + (defun better-TeX-insert-single-quote () (interactive) (let ((old-open TeX-open-quote) @@ -68,9 +94,8 @@ populated from the directory *latex-template-dir*" (apply fun args))) :config - ;; Make synctex and pdf-tools understand multiple frames - ;; (advice-add 'pdf-sync-backward-search-mouse :around #'pdf-tools-display-buffer-use-some-frame) - ;; (advice-add 'pdf-sync-forward-search :around #'pdf-tools-display-buffer-use-some-frame) + (advice-add 'pdf-sync-backward-search-mouse :around #'pdf-tools-display-buffer-use-some-frame) + (advice-add 'pdf-sync-forward-search :around #'pdf-tools-display-buffer-use-some-frame) (dolist (entry '(("diagram") ("vdiagram") ("diagram*") ("vsubdiagram") ("vsubdiagrams"))) (push entry LaTeX-indent-environment-list)) @@ -94,15 +119,16 @@ populated from the directory *latex-template-dir*" TeX-electric-escape nil LaTeX-electric-left-right-brace t) + (setq reftex-plug-into-AUCTeX t) (setq-default TeX-master nil) (setq TeX-auto-save t TeX-parse-self t TeX-PDF-mode t TeX-source-correlate-mode 'synctex - TeX-view-program-selection '( ((output-dvi style-pstricks) "dvips and gv") - (output-dvi "xdvi") - (output-pdf "Zathura") - (output-html "xdg-open"))) + TeX-view-program-selection '(((output-dvi style-pstricks) "dvips and gv") + (output-dvi "xdvi") + (output-pdf "Zathura") + (output-html "xdg-open"))) (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)) |
