From cf50a7c5b71cc9ddd162eede51028828d4507e53 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Fri, 4 Oct 2024 12:49:16 -0700 Subject: [PATCH] Change to AUCTeX --- disabled.el | 15 +++++++++++++++ init.el | 36 +++++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/disabled.el b/disabled.el index 0bdaef3..708c038 100644 --- a/disabled.el +++ b/disabled.el @@ -145,3 +145,18 @@ ;; :config ;; (company-quickhelp-mode 1) ;; (setopt company-quickhelp-delay nil)) + +;; (La)TeX +;; (use-package tex-mode +;; :hook ((latex-mode . eglot-ensure) +;; (tex-mode . my/-setup-tex-mode-compile-command)) +;; :init +;; (defun my/-setup-tex-mode-compile-command () +;; "Setup `compile-command' for `tex-mode'." +;; (let ((quoted-name (shell-quote-argument buffer-file-name))) +;; (setq-local compile-command +;; (concat "latexmk -pdf " +;; "-auxdir=" quoted-name "-build" +;; " " quoted-name)))) +;; :config +;; (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode))) diff --git a/init.el b/init.el index 1212e2c..6cb39c9 100644 --- a/init.el +++ b/init.el @@ -574,9 +574,11 @@ visual states." :hook (text-mode . my/-cape-setup-text-mode) :init (defun my/-cape-setup-text-mode () - (setq-local completion-at-point-functions - '(cape-dict cape-dabbrev) - corfu-auto nil))) + ;; Only run this if we are not in `TeX-mode' + (unless (bound-and-true-p TeX-mode-p) + (setq-local completion-at-point-functions + '(cape-dict cape-dabbrev) + corfu-auto nil)))) ;; xref (use-package xref @@ -915,20 +917,24 @@ COMMAND and COMINT are like `compile'." `(,(concat (regexp-opt '("gschema" "gresource" "ui")) "\\'") . nxml-mode))) -;; (La)TeX -(use-package tex-mode - :hook ((latex-mode . eglot-ensure) - (tex-mode . my/-setup-tex-mode-compile-command)) +;; AUCTeX +(use-package auctex + :hook ((LaTeX-mode . turn-on-reftex) + (LaTeX-mode . LaTeX-math-mode)) :init - (defun my/-setup-tex-mode-compile-command () - "Setup `compile-command' for `tex-mode'." - (let ((quoted-name (shell-quote-argument buffer-file-name))) - (setq-local compile-command - (concat "latexmk -pdf " - "-auxdir=" quoted-name "-build" - " " quoted-name)))) + (add-to-list 'major-mode-remap-alist '(plain-tex-mode . plain-TeX-mode)) + (add-to-list 'major-mode-remap-alist '(latex-mode . LaTeX-mode)) + (add-to-list 'major-mode-remap-alist '(ams-tex-mode . AmSTeX-mode)) + (add-to-list 'major-mode-remap-alist '(context-mode . ConTeXt-mode)) + (add-to-list 'major-mode-remap-alist '(texinfo-mode . Texinfo-mode)) + (add-to-list 'major-mode-remap-alist '(doctex-mode . docTeX-mode)) + (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode)) :config - (add-to-list 'auto-mode-alist '("/\\.latexmkrc\\'" . perl-mode))) + (setq TeX-auto-save t + TeX-parse-self t + reftex-plug-into-AUCTeX t) + (setq-default TeX-master nil) + (TeX-global-PDF-mode 1)) ;; blueprint (use-package blueprint-ts-mode