commit b411e9be6b36ccf95bc003bc720d4f6674a86ab2
parent ee91b1bac016f79d3b3b8c73c6e99018270ea24f
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date: Sun, 22 Jul 2018 09:37:22 -0400
Adjust latex completion backends to work in org-mode.
Diffstat:
M | README.org | | | 61 | +++++++++++++++++++++++++++++++++---------------------------- |
1 file changed, 33 insertions(+), 28 deletions(-)
diff --git a/README.org b/README.org
@@ -516,43 +516,48 @@ Install =company-quickhelp= and set delay, FG/BG colors, max lines.
#+END_SRC
*** Backend Configurations
-**** =company-math=
-Install =company-math= and add it to =company-backends=.
-Enable unicode symbol backend globally.
+**** =company-auctex=
+Install =company-auctex= and add it to =company-backends=. This is for =acutex= macro completion.
+Adding backends is handled by =company-auctex-init=.
#+BEGIN_SRC emacs-lisp
- (use-package company-math
- :ensure t
- :init (add-to-list 'company-backends
- '(company-math-symbols-unicode)))
+ (use-package company-auctex
+ :ensure t
+ :init
+ (company-auctex-init)
+ :config
+ (defun company-auctex-prefix (regexp)
+ "Returns the prefix for matching given REGEXP in org-mode and latex-mode."
+ (and (or (derived-mode-p 'latex-mode) (derived-mode-p 'org-mode))
+ (when (looking-back regexp)
+ (match-string-no-properties 1)))))
#+END_SRC
-Enable math symbol backend only in =TeX-mode=.
+**** DISABLED =company-math=
+Install =company-math= and add it to =company-backends=.
+***** Unicode Symbols
+Enable unicode symbol backend globally.
#+BEGIN_SRC emacs-lisp
- (defun company-math-init ()
- (setq-local company-backends
- (append '((company-math-symbols-latex))
- company-backends)))
-
- (add-hook 'TeX-mode-hook 'company-math-init)
+ (use-package company-math
+ :ensure t)
+ ;; :init (add-to-list 'company-backends
+ ;; '(company-math-symbols-unicode)))
#+END_SRC
-**** =company-anaconda=
-Install =company-anaconda= and add it to =company-backends=.
+***** Math Symbols
+Enable math symbol backend only in =TeX-mode= and =org-mode=.
#+BEGIN_SRC emacs-lisp
- (use-package company-anaconda
- :ensure t
- :init (add-to-list 'company-backends
- 'company-anaconda))
-#+END_SRC
+ (defun user/company-math-init()
+ (setq-local company-backends
+ (append '((company-math-symbols-latex
+ ;;company-math-symbols-unicode
+ company-auctex-macros
+ company-auctex-symbols
+ company-auctex-environments))
+ company-backends)))
-**** =company-auctex=
-Install =company-auctex= and add it to =company-backends=. This is for =acutex= macro completion.
-Adding backends is handled by =company-auctex-init=.
-#+BEGIN_SRC emacs-lisp
- (use-package company-auctex
- :ensure t
- :init (company-auctex-init))
+ (add-hook 'TeX-mode-hook 'user/company-math-init)
+ (add-hook 'org-mode-hook 'user/company-math-init)
#+END_SRC
**** =company-yasnippet=