astoff / digestif

A language server for TeX and friends
Other
251 stars 6 forks source link

info lookup for latex core macros terminates connection with Emacs/Eglot #58

Closed dr-scsi closed 1 year ago

dr-scsi commented 1 year ago

Hi,

Consider this latex file:

\documentclass{article}

\begin{document}

\noindent
foo

\end{document}

Now do ESC-: (goto-char 50) RET and Eglot loses connection to digestif. In *Messages* buffer, I see this:

[jsonrpc] Server exited with status 1
[eglot] (warning) Reconnecting after unexpected server exit.
[eglot] Connected! Server `Digestif' now managing `(latex-mode tex-mode context-mode texinfo-mode bibtex-mode)' buffers in project `eglot'.
[eglot] Reconnected!

This seems the relevant part after M-x eglot-events-buffer RET (line breaks added for better legibility):

...
(:jsonrpc "2.0" :id 5 :method "textDocument/hover" :params
          (:textDocument
           (:uri "file:///c%3A/path/to/eglot-test.tex")
           :position
           (:line 4 :character 6)))
[stderr] info: ./(latex2e)\indent : No such file or directory
[server-reply] (id:4) Fri Jan 13 13:06:13 2023:
(:jsonrpc "2.0" :result nil :id 4)
[stderr] Der Befehl "\noindent'" ist entweder falsch geschrieben oder
[stderr] konnte nicht gefunden werden.
[server-reply] (id:5) Fri Jan 13 13:06:13 2023:
(:jsonrpc "2.0" :result
          (:contents
           (:value "`\\noindent`: Go into horizontal mode, without an indent.\n\n
# Documentation\n\n
`\\noindent` is defined in the [latex](https://www.ctan.org/pkg/latex) package.\n\n
- <info:latex2e#\\indent & \\noindent>\n
- [A (Not So) Short Introduction to LaTeX 2ε](file://C:/path/to/texlive/2022/texmf-dist/doc/latex/lshort-english/lshort.pdf)\n
- [LaTeX 2ε for authors](file://C:/path/to/texlive/2022/texmf-dist/doc/latex/base/usrguide.pdf)\n
- [LaTeX 2ε for class and package writers](file://C:/path/to/texlive/2022/texmf-dist/doc/latex/base/clsguide.pdf)" :kind "markdown"))
          :id 5)
[internal] Fri Jan 13 13:06:13 2023:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

This is my setup:

If seems to me that info doesn't grok the command for finding latex2e.info. I'm not familiar with this, but I can do info latex2e RET in bash and it works. Emacs also finds the files since $INFOPATH and Info-directory-list are adjusted. Any idea what's going wrong? TIA. i

astoff commented 1 year ago

The command that is supposed to be executed is info '(latex2e)\indent & \noindent'. I suppose this doesn't work in your system's shell? How should it be properly escaped in that case?

dr-scsi commented 1 year ago

Thanks for the hint. I tried different things and in the MinGW64-bash, doing this

info latex2e -n '\indent & \noindent'

works whereas

info '(latex2e)\indent & \noindent'
=> info: ./(latex2e)\indent & \noindent: No such file or directory

does not.

Using the -n option works with all of these:

info latex2e -n 'Document classes'
info latex2e -n 'Front/back matter'
info latex2e -n '\@ifstar'
info latex2e -n '\/'
info latex2e -n '\- (hyphenation)'
info latex2e -n '\alph \Alph \arabic \roman \Roman \fnsymbol'

Would it make sense to use the alternate input version in digestif?

astoff commented 1 year ago

Okay, works for me too, so I should probably change it. But still I wonder, how can your info be different? I have

$ info --version
info (GNU texinfo) 6.8

Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
dr-scsi commented 1 year ago

I have:

-> info --version
info (GNU texinfo) 7.0.1

Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Do you have a chance to update your version? If it works for you, then it's probably a Msys2 issue.

dr-scsi commented 1 year ago

This issue seems to be fixed in Info upstream, closing. Thanks for your attention.