I am writing on a large LaTeX Document using Emacs with AUCTeX, RefTeX and Company for autocompletion. RefTeX for citations is working fine and finds my bibliography entries really fast. However, when company searches for labels it has to scan every file used in the project, this takes several seconds and is done every time I move the point in a \ref{} command. Also while scanning for files, I cannot make additional keyboard input, making me wait until scanning is finished every time. Here is the relevant part of my Emacs configuration:
;;------------------------------------------------------------------------------
;; Company -> Autocomplete
;;------------------------------------------------------------------------------
(use-package company
:config
(setq company-idle-delay 0
company-minimum-prefix-length 4
company-selection-wrap-around t)
:bind
(("C-<tab>" . company-complete))
)
(global-company-mode t)
(use-package company-math :ensure t)
(use-package company-reftex :ensure t)
(use-package company-bibtex :ensure t)
(use-package math-symbol-lists)
(use-package company-math :ensure t)
(use-package company-reftex :ensure t)
(use-package company-bibtex :ensure t)
(add-hook 'LaTeX-mode-hook
(lambda()
(make-local-variable 'company-backends)
(setq company-backends
(append '((:separate company-reftex-citations
company-bibtex
company-reftex-labels))
company-backends))
(setq company-backends
(append '((:separate company-math-symbols-latex
company-math-symbols-unicode
company-latex-commands
company-ipa-symbols-unicode
company-dabbrev))
company-backends))))
;;------------------------------------------------------------------------------
;; LaTeX
;;------------------------------------------------------------------------------
(setq-default TeX-output-dir "build")
(setq-default TeX-master nil)
;; RefTex
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; Enable RefTex in AUCTex Latex mode
(add-hook 'latex-mode-hook 'turn-on-reftex) ; Enable RefTex in Emacs Latex mode
;; Enable LaTeX Preview Pane
;(add-hook 'LaTeX-mode-hook 'latex-preview-pane-mode)
;(add-hook 'latex-mode-hook 'latex-preview-pane-mode)
(setq-default reftex-plug-into-AUCTeX t)
(setq-default reftex-default-bibliography '("./bibliography/Masterthesis.bib"))
(setq-default reftex-bibliography-commands '("bibliography" "nobibliography" "addbibresource"))
(setq reftex-use-external-file-finders t)
(setq reftex-external-file-finders
'(("tex". "kpsewhich -format=.tex %f")
("bib". "kpsewhich -format=.bib %f")))
Can I speed up the company process for scanning labels? Or is this there at least a way to disable the automatic scanning?
I am new to Emacs and think my problem might result from a faulty configuration.