Skip to content

Commit bde9dbb

Browse files
committed
tweak(ltex-ls-plus): use the new fork LTeX+, add a command to download it
1 parent e2ed9b6 commit bde9dbb

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

modules/me-natural-langs.el

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,37 @@ Based on `jinx-mode' if available. Falls back to the built-in
7373
:demand
7474
:config
7575
(eglot-ltex-enable-handling-client-commands)
76+
(defvar +ltex-ls-plus-path (expand-file-name "ltex-ls-plus/" minemacs-local-dir))
77+
(defvar +ltex-ls-plus-bin (expand-file-name "bin/ltex-ls-plus" +ltex-ls-plus-path))
78+
(defun +ltex-ls-plus-download (pre)
79+
"Download the latest release of \"ltex-ls-plus\".
80+
81+
When PRE is non-nil, allow downloading the latest prerelease."
82+
(interactive "P")
83+
(if (zerop
84+
(when-let* ((tarball (+github-download-release
85+
"ltex-plus/ltex-ls-plus"
86+
(concat "-" (cond ((+emacs-options-p 'os/linux) "linux")
87+
((+emacs-options-p 'os/mac) "mac")
88+
((+emacs-options-p 'os/win) "windows"))
89+
"-" (cond ((+emacs-options-p 'arch/x86_64) "x64")
90+
((+emacs-options-p 'arch/x86_64) "aarch64")))
91+
nil :prerelease pre)))
92+
(when (file-directory-p +ltex-ls-plus-path)
93+
(delete-directory +ltex-ls-plus-path t))
94+
(mkdir +ltex-ls-plus-path)
95+
(shell-command (format "tar -C %S -xf %S --strip-components=2" +ltex-ls-plus-path tarball)
96+
(get-buffer-create "*ltex-ls-plus*"))))
97+
(message "Downloaded successfully!")
98+
(user-error "A problem occured when trying to download ltex-ls-plus")))
7699
(+eglot-register
77100
'(text-mode org-mode markdown-mode markdown-ts-mode rst-mode git-commit-mode)
78-
'("ltex-ls" "--server-type=TcpSocket" "--port" :autoport))
101+
`(,+ltex-ls-plus-bin "--server-type=TcpSocket" "--port" :autoport))
79102
(+eglot-register
80103
'(tex-mode context-mode texinfo-mode bibtex-mode)
81104
"digestif"
82105
"texlab"
83-
'("ltex-ls" "--server-type=TcpSocket" "--port" :autoport)))
106+
`(,+ltex-ls-plus-bin "--server-type=TcpSocket" "--port" :autoport)))
84107

85108

86109
(provide 'me-natural-langs)

0 commit comments

Comments
 (0)