Closed hongyi-zhao closed 3 years ago
I get the impression that lsp-mode
changed the default server for LaTeX, so you need to tell it that you want to use Digestif. Can you try customizing the variable lsp-tex-server
and see if that helps?
When you solve the problem with lsp-mode
, let me know the details, so I can update the README (I myself only use Eglot).
I get the impression that lsp-mode changed the default server for LaTeX, so you need to tell it that you want to use Digestif. Can you try customizing the variable lsp-tex-server and see if that helps?
Any hint or documentation for the format and usage of setting this variable, especially the case of Digestif
?
When you solve the problem with lsp-mode, let me know the details, so I can update the README (I myself only use Eglot).
Surely.
Any hint or documentation for the format and usage of setting this variable, especially the case of Digestif?
M-x customize-variable
M-x customize-variable RET
Then filtering the result with lsp
gives the following list:
But I still can't find any clues for the setting you mentioned above.
Like I said above, lsp-tex-server
is supposed to be the variable that controls that. But I'm just relying on what I read online on lsp-mode's website.
I find the corresponding source code here:
(defcustom lsp-tex-server 'texlab
"Choose LSP tex server."
:type '(choice (const :tag "texlab" texlab)
(const :tag "digestif" digestif))
But still can't figure out how to do the corresponding setting.
(setq lsp-tex-server 'digestif)
The setting and testing are shown below.
The digestif info:
werner@X10DAi:~$ digestif --help
Usage: digestif [-h] [-v] [-g FILES]
Digestif is a language server for TeX
Optional arguments:
-v, --verbose Enable log output to stderr
-g, --generate FILES Generate data file stubs for FILES
-h, --help Display this message and quit
Environment variables:
DIGESTIF_DATA Paths to look for data files
DIGESTIF_TEXMF Paths to look for TeX files
DIGESTIF_TLPDB Path to the TeXLive package database file
If your TeX distribution or Digestif are installed in a non-standard
location, you may need to set some of the above variables.
Emacs' initialization file configurations:
(use-package lsp-mode)
(require 'lsp-mode)
(setq lsp-tex-server 'digestif)
(use-package company-lsp)
(require 'company-lsp)
(push 'company-lsp company-backends)
(add-to-list 'company-lsp-filter-candidates '(digestif . nil))
But still failed, as shown below:
I can't see any obvious problem in your config. I think you should check with the lsp-mode people.
Anyway, based on the wonderful notes here, I tried out the following solution using auctex
, eglot
, texlab
, and company
:
;;; Auctex
;Using AUCTeX from local Git repo without installation
(straight-use-package
`(auctex :type git :host nil :repo "https://git.savannah.gnu.org/git/auctex.git"
:pre-build ,(pcase system-type
(`berkeley-unix '("gmake"))
(_ '(
`("bash" "-c" "cd" ,(straight--repos-dir "auctex"))
("./autogen.sh")
("./configure" "--without-texmf-dir" "--with-lispdir=.")
("make")
)))))
(setq TeX-data-directory (straight--repos-dir "auctex")
TeX-lisp-directory TeX-data-directory)
; Or set the following variable via custom-set-variables in the opened buffer by the following command.
; M-x describe-variable RET preview-TeX-style-dir RET
;`(preview-TeX-style-dir ,(concat ".:" (straight--repos-dir "auctex") "latex:"))
(setq preview-TeX-style-dir (concat ".:" (straight--repos-dir "auctex") "latex:"))
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
;;; eglot, company, and texlab
(use-package company)
(add-hook 'after-init-hook 'global-company-mode)
(use-package eglot)
;https://tam5917.hatenablog.com/entry/2021/04/01/014719
;; hook into AUCTeX
(add-hook 'TeX-mode-hook 'eglot-ensure)
;; ensure we don't use digestif server, which is far less than texlab on features and characteristics.
(delete (assoc '(tex-mode context-mode texinfo-mode bibtex-mode)
eglot-server-programs) eglot-server-programs)
;; ensure texlab is set as the server.
(add-to-list 'eglot-server-programs
'((latex-mode tex-mode context-mode texinfo-mode bibtex-mode) . (
"texlab"
)))
Based on my actual testing experience, digestif
's capability is far less powerful than that of texlab
. Hence, I switched to texlab
.
Based on my actual testing experience, digestif's capability is far less powerful than that of texlab.
What does is do that Digestif doesn't?
What does is do that Digestif doesn't?
It only can provide partial results shown by texlab
.
On Ubuntu 20.04, I try to test the
Emacs with the lsp-mode package
based setting according to the instruction here using the following steps:digestif
according to the instruction here:(load "auctex.el" nil t t) (load "preview-latex.el" nil t t) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil)
(use-package lsp-mode) (use-package company-lsp) (require 'company-lsp) (push 'company-lsp company-backends) (add-to-list 'company-lsp-filter-candidates '(digestif . nil))