De-tangle company-auctex and company-math
Co-authored-by: Henrik Lissner <henrik@lissner.net>
This commit is contained in:
parent
03e7d1a66c
commit
6b58c8d451
1 changed files with 20 additions and 15 deletions
|
@ -76,23 +76,28 @@
|
||||||
preview-scale-function
|
preview-scale-function
|
||||||
(lambda () (* (/ 10.0 (preview-document-pt)) preview-scale))))
|
(lambda () (* (/ 10.0 (preview-document-pt)) preview-scale))))
|
||||||
|
|
||||||
;; set-up company-auctex, but with company-math supplying the math symbols backend
|
(defvar +latex--company-backends nil)
|
||||||
|
|
||||||
(def-package! company-auctex
|
(def-package! company-auctex
|
||||||
:when (featurep! :completion company)
|
:when (featurep! :completion company)
|
||||||
:after latex
|
:defer t
|
||||||
:config
|
:init
|
||||||
(def-package! company-math
|
(add-to-list '+latex--company-backends 'company-auctex-environments nil #'eq)
|
||||||
:defer t
|
(add-to-list '+latex--company-backends 'company-auctex-macros nil #'eq))
|
||||||
;; We can't use the `set-company-backend!' because Auctex reports its
|
|
||||||
;; major-mode as `latex-mode', but uses LaTeX-mode-hook for its mode, which is
|
(def-package! company-math
|
||||||
;; not something `set-company-backend!' anticipates (and shouldn't have to!)
|
:when (featurep! :completion company)
|
||||||
:init
|
:defer t
|
||||||
(add-hook! LaTeX-mode
|
:init
|
||||||
(setq-local company-backends
|
(add-to-list '+latex--company-backends 'company-math-symbols-latex nil #'eq))
|
||||||
(append '((company-math-symbols-latex
|
|
||||||
company-auctex-macros
|
(when +latex--company-backends
|
||||||
company-auctex-environments))
|
;; We can't use the `set-company-backend!' because Auctex reports its
|
||||||
company-backends)))))
|
;; major-mode as `latex-mode', but uses LaTeX-mode-hook for its mode, which is
|
||||||
|
;; not something `set-company-backend!' anticipates (and shouldn't have to!)
|
||||||
|
(add-hook! 'LaTeX-mode-hook
|
||||||
|
(add-to-list (make-local-variable 'company-backends)
|
||||||
|
+latex--company-backends)))
|
||||||
|
|
||||||
;; Nicely indent lines that have wrapped when visual line mode is activated
|
;; Nicely indent lines that have wrapped when visual line mode is activated
|
||||||
(def-package! adaptive-wrap
|
(def-package! adaptive-wrap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue