unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62907: Eglot does not start managing LaTeX buffer despite reporting successful connection
@ 2023-04-17 15:21 Michael Eliachevitch
       [not found] ` <handler.62907.B.168174773410232.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Eliachevitch @ 2023-04-17 15:21 UTC (permalink / raw)
  To: 62907

[-- Attachment #1: Type: text/plain, Size: 7563 bytes --]

User-agent: mu4e 1.11.2; emacs 30.0.50

When I run `M-x eglot' in a LaTeX-buffer and select "texlab" as a language-server, I get an echo-area message indicating that the connection was successful:

  [eglot] Connected! Server `TexLab' now managing `(tex-mode context-mode texinfo-mode bibtex-mode)' buffers in project `phd-thesis'.

However, I don't get any mode-line indication and the variable `eglot--managed-mode' is nil, so it seems it didn't properly activate.

I initally noticed the error in that when I tried auto-completing with `eglot-completion-at-point', I got the error message

  (jsonrpc-error "No current JSON-RPC connection" (jsonrpc-error-code . 32603) (jsonrpc-error-message . "No current JSON-RPC connection"))

I get the same message when e.g. running `M-x eglot-stderr-buffer', so I cannot attach that, but I attached the contents of eglot-events-buffer. With debug-on-error enabled I get the backtrace

  Debugger entered--Lisp error: (jsonrpc-error "No current JSON-RPC connection" (jsonrpc-error-code . 32603) (jsonrpc-error-message . "No current JSON-RPC connection"))
    jsonrpc-error("No current JSON-RPC connection")
    eglot--current-server-or-lose()
    byte-code("\300 C\207" [eglot--current-server-or-lose] 1)
    command-execute(eglot-stderr-buffer record)
    execute-extended-command(nil "eglot-stderr-buffer" nil)
    funcall-interactively(execute-extended-command nil "eglot-stderr-buffer" nil)
    command-execute(execute-extended-command)

But the initial bug is that Eglot didn't start managing the buffer when I run the command and that doesn't raise an error initially.

I can reproduce the error with "emacs -Q". It seemed to work in the past (couple of weeks ago) and now it doesn't anymore. I changed a lot in my Emacs config but that it works with emacs -Q suggests something else changed rather than just my emacs init file.

I tried two texlab versions, 5.4.1 and 5.5.0 and also other latex language-servers such as digestif and ltex-ls and got the same issue. Also it doesn't matter whether I use AucTeX or plain latex.el (which I had in emacs -Q anyway). I also disabled my dir-local variables when testing. So it doesn't seem to depend on the latex language server version.

However, I don't have problems running Eglot in other major modes, e.g. it works in Python with the pylsp  server.

For reproducing, any latex file seemed to work for me, but I attached a very minimal latex-project for testing anyway. texlab can be downloaded as a static binary from https://github.com/latex-lsp/texlab/releases/tag/v5.5.0. Then, to reproduce, just open the latex file in the attached project, run `M-x eglot', select texlab, and check if it starts managing the buffer. Then, `eglot--managed-mode' should be `t' and I expect auto-completion to work.

I'm still not 100% sure this is a bug or something messed up in my local configuration, but I just couldn't find the issue, so I thought I might as well report it just in case it's not known. If you cannot reproduce it with the above instructions, feel free to close this bug. Below is the additional system and config information as provided by report-emacs-bug.

Cheers, Michael

---

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.17.8) of 2023-04-17 built on e490
Repository revision: a46201f57eb114b8107435caf3588edbb666829e
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --enable-link-time-optimization --with-native-compilation=yes
 --with-xinput2 --with-pgtk --without-xaw3d --with-sound=alsa
 --with-xwidgets --with-tree-sitter --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=native -mtune=generic -O3 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fuse-ld=mold -fuse-ld=mold'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK
PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LC_ALL: C.UTF-8
  value of $LC_COLLATE: C.UTF-8
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LC_MONETARY: de_DE.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: C
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: LaTeX

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils tutorial thai-util thai-word mule-util lao-util
enriched disp-table facemenu view face-remap time-date cus-edit
cus-start cus-load wid-edit eglot external-completion jsonrpc xref
flymake-proc flymake thingatpt project ert pp ewoc debug backtrace
find-func filenotify pcase url-util url-parse auth-source eieio
eieio-core password-cache json map byte-opt url-vars imenu comp
comp-cstr warnings icons rx cl-seq cl-macs gv cl-extra help-mode
bytecomp byte-compile vc-git diff-mode easy-mmode vc-dispatcher
cl-loaddefs cl-lib tex-mode compile text-property-search shell subr-x
pcomplete comint ansi-osc ansi-color ring latexenc rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win
pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads xwidget-internal dbusbind inotify dynamic-setting
system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 299038 29240)
 (symbols 48 14103 0)
 (strings 32 63171 2952)
 (string-bytes 1 1850467)
 (vectors 16 37399)
 (vector-slots 8 678882 29431)
 (floats 8 97 380)
 (intervals 56 856 0)
 (buffers 984 19))



[-- Attachment #2: eglot-events-buffer.eld --]
[-- Type: text/plain, Size: 7341 bytes --]

[internal] Mon Apr 17 17:36:18 2023:
(:message "Running language server: /usr/sbin/texlab")
[client-request] (id:1) Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 175044 :clientInfo
                      (:name "Eglot")
                      :rootPath "/home/michael/projects/phd-thesis/" :rootUri "file:///home/michael/projects/phd-thesis" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                                                                                                                              ())
                      :capabilities
                      (:workspace
                       (:applyEdit t :executeCommand
                                   (:dynamicRegistration :json-false)
                                   :workspaceEdit
                                   (:documentChanges t)
                                   :didChangeWatchedFiles
                                   (:dynamicRegistration t)
                                   :symbol
                                   (:dynamicRegistration :json-false)
                                   :configuration t :workspaceFolders t)
                       :textDocument
                       (:synchronization
                        (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
                        :completion
                        (:dynamicRegistration :json-false :completionItem
                                              (:snippetSupport t :deprecatedSupport t :resolveSupport
                                                               (:properties
                                                                ["documentation" "details" "additionalTextEdits"])
                                                               :tagSupport
                                                               (:valueSet
                                                                [1]))
                                              :contextSupport t)
                        :hover
                        (:dynamicRegistration :json-false :contentFormat
                                              ["markdown" "plaintext"])
                        :signatureHelp
                        (:dynamicRegistration :json-false :signatureInformation
                                              (:parameterInformation
                                               (:labelOffsetSupport t)
                                               :documentationFormat
                                               ["markdown" "plaintext"]
                                               :activeParameterSupport t))
                        :references
                        (:dynamicRegistration :json-false)
                        :definition
                        (:dynamicRegistration :json-false :linkSupport t)
                        :declaration
                        (:dynamicRegistration :json-false :linkSupport t)
                        :implementation
                        (:dynamicRegistration :json-false :linkSupport t)
                        :typeDefinition
                        (:dynamicRegistration :json-false :linkSupport t)
                        :documentSymbol
                        (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
                                              (:valueSet
                                               [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
                        :documentHighlight
                        (:dynamicRegistration :json-false)
                        :codeAction
                        (:dynamicRegistration :json-false :codeActionLiteralSupport
                                              (:codeActionKind
                                               (:valueSet
                                                ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
                                              :isPreferredSupport t)
                        :formatting
                        (:dynamicRegistration :json-false)
                        :rangeFormatting
                        (:dynamicRegistration :json-false)
                        :rename
                        (:dynamicRegistration :json-false)
                        :inlayHint
                        (:dynamicRegistration :json-false)
                        :publishDiagnostics
                        (:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
                                             (:valueSet
                                              [1 2])))
                       :window
                       (:workDoneProgress t)
                       :general
                       (:positionEncodings
                        ["utf-32" "utf-8" "utf-16"])
                       :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                   ()))
                      :workspaceFolders
                      [(:uri "file:///home/michael/projects/phd-thesis" :name "~/projects/phd-thesis/")]))
[server-reply] (id:1) Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:completionProvider
            (:resolveProvider t :triggerCharacters
                              ["\\" "{" "}" "@" "/" " "])
            :definitionProvider t :documentFormattingProvider t :documentHighlightProvider t :documentLinkProvider
            (:resolveProvider :json-false)
            :documentSymbolProvider t :executeCommandProvider
            (:commands
             ["texlab.cleanAuxiliary" "texlab.cleanArtifacts" "texlab.changeEnvironment"])
            :foldingRangeProvider t :hoverProvider t :inlayHintProvider t :referencesProvider t :renameProvider
            (:prepareProvider t)
            :textDocumentSync
            (:change 2 :openClose t :save
                     (:includeText :json-false))
            :workspaceSymbolProvider t)
           :serverInfo
           (:name "TexLab" :version "5.5.0")))
[client-notification] Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                            ()))
[client-notification] Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
          (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                   ())))
[server-request] (id:1) Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params
          (:items
           [(:section "texlab")]))
[client-reply] (id:1) Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :id 1 :result
          [nil])
[server-request] (id:2) Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :id 2 :method "workspace/configuration" :params
          (:items
           [(:section "texlab")]))
[client-reply] (id:2) Mon Apr 17 17:36:18 2023:
(:jsonrpc "2.0" :id 2 :result
          [nil])

[-- Attachment #3: latex-mwe.tar.gz --]
[-- Type: application/gzip, Size: 10840 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#62907: Eglot does not start managing LaTeX buffer despite reporting successful connection
       [not found] ` <handler.62907.B.168174773410232.ack@debbugs.gnu.org>
@ 2023-04-17 18:16   ` Michael Eliachevitch
  2023-04-17 18:31     ` João Távora
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Eliachevitch @ 2023-04-17 18:16 UTC (permalink / raw)
  To: 62907


I just compiled the latest emacs29 git branch and there I can't reproduce the error, changing back to the emacs30 compile from master I get it again. So must be something that's different between those two branches, not necessarily in Eglot.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#62907: Eglot does not start managing LaTeX buffer despite reporting successful connection
  2023-04-17 18:16   ` Michael Eliachevitch
@ 2023-04-17 18:31     ` João Távora
  2023-04-17 20:29       ` Michael Eliachevitch
  0 siblings, 1 reply; 5+ messages in thread
From: João Távora @ 2023-04-17 18:31 UTC (permalink / raw)
  To: Michael Eliachevitch; +Cc: 62907

Thanks Michael,

I think i have everything to try to reproduce this, but it'll
have to wait until I'm back at my Arch Linux machine, probably.

João

On Mon, Apr 17, 2023 at 7:27 PM Michael Eliachevitch
<m.eliachevitch@posteo.de> wrote:

> I just compiled the latest emacs29 git branch and there I can't reproduce
> the error

This is good.  You could try a Git bisection if you have time and know
how.

João





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#62907: Eglot does not start managing LaTeX buffer despite reporting successful connection
  2023-04-17 18:31     ` João Távora
@ 2023-04-17 20:29       ` Michael Eliachevitch
  2023-04-19  0:10         ` João Távora
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Eliachevitch @ 2023-04-17 20:29 UTC (permalink / raw)
  To: João Távora; +Cc: 62907


>> I just compiled the latest emacs29 git branch and there I can't 
>> reproduce
>> the error
>
> This is good.  You could try a Git bisection if you have time and 
> know
> how.

I did a minimal Git bisection on the eglot.el file only, without 
recompiling the rest of Emacs. Seems the error was introduced in 
eglot.el in

  a74403adda0d67b6f0430d1c038a7c96579f3450
  Eglot: fix LSP "languageId" detection

It still works for the previous commit 43290391ce2.

I started it with

    git bisect start master emacs-29  -- lisp/progmodes/eglot.el

in an Emacs repository. Than, at each step, I opened "emacs -Q", 
where the Emacs executable is compiled from the same Emacs 29 branch 
(as I said I didn't recompile). At each git-bisect step I just 
opened the eglot.el file from the Emacs repository and ran `M-x 
eval-buffer`, then opened the LaTeX file, ran `M-x eglot` and 
checked the value of `eglot--managed-buffer`.

1. At the moment my Emacs setup is a bit awkward as I compile Emacs 
from the Archlinux AUR repository via the emacs-git package. I 
tested emacs-29 by just editing the branch into the PKGBUILD, but 
this PKGBUILD-editing approach wouldn't be appropriate for a git 
bisect, for that I should probably just clone and compile Emacs 
normally. I have cloned the Emacs repo, but never set the compile 
flags myself. But probably should do that in the future if I want to 
follow Emacs development and be able to patch things myself).

2. I'm sending my Emails from mu4e with format=flowed and long 
lines, inspired by [*], so that Email viewers with f=f support 
reflow the lines and non-compliant clients like Gmail just reflow 
them because the lines are too long. But I found this kind of sucks 
when viewing the Email text on the debbugs.gnu.org website for 
instance. Do you know if these long-line f=f mails are discouraged 
on Emacs mailing lists, bugs or patches? Probably I should adapt 
`fill-flowed-encode-column` based on the recipient and not use the 
setup with long default lines on software mailing lists, will try a 
smaller value now. Hopefully my mails looked okay to you.

  [*]: https://vxlabs.com/2019/08/25/format-flowed-with-long-lines/





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#62907: Eglot does not start managing LaTeX buffer despite reporting successful connection
  2023-04-17 20:29       ` Michael Eliachevitch
@ 2023-04-19  0:10         ` João Távora
  0 siblings, 0 replies; 5+ messages in thread
From: João Távora @ 2023-04-19  0:10 UTC (permalink / raw)
  To: Michael Eliachevitch, 62907-done

On Mon, Apr 17, 2023 at 10:31 PM Michael Eliachevitch
<m.eliachevitch@posteo.de> wrote:
>
>
> >> I just compiled the latest emacs29 git branch and there I can't
> >> reproduce
> >> the error
> >
> > This is good.  You could try a Git bisection if you have time and
> > know
> > how.
>
> I did a minimal Git bisection on the eglot.el file only, without
> recompiling the rest of Emacs. Seems the error was introduced in
> eglot.el in
>
>   a74403adda0d67b6f0430d1c038a7c96579f3450
>   Eglot: fix LSP "languageId" detection
>
> It still works for the previous commit 43290391ce2.

Your bisection was very effective and found the culprit.
Don't worry about your "awkward" setup and configuration just
for this bug, because I also found and reproduced the bug with
your instructions and it was just a plain old oversight after
a deeper-than-usual refactor.

The bug is fixed now on master, just pushed the following commit:

  commit 9093834d0b590bc15ed994bd62f18f7b47a48f55 (HEAD -> master)
  Author: João Távora <joaotavora@gmail.com>
  Date:   Wed Apr 19 00:59:17 2023 +0100

      Eglot: unbreak activation/management of derived modes (bug#62907)

So thanks for this report and perfectly complete recipe.  I'm
closing the bug (if you find it to be somehow _not_ fixed I will
reopen).

> 2. I'm sending my Emails from mu4e with format=flowed and long
> lines, inspired by [*], so that Email viewers with f=f support
> reflow the lines and non-compliant clients like Gmail just reflow
> them because the lines are too long. But I found this kind of sucks
> when viewing the Email text on the debbugs.gnu.org website for
> instance. Do you know if these long-line f=f mails are discouraged
> on Emacs mailing lists, bugs or patches? Probably I should adapt
> `fill-flowed-encode-column` based on the recipient and not use the
> setup with long default lines on software mailing lists, will try a
> smaller value now. Hopefully my mails looked okay to you.

They looked OK but not the usual. The usual being the hard line
breaks and about 70/80 columns  I'm guilty of using Gmail to answer
half of the mails I send to these lists (the other half I use Gnus).
In Gmail, I break the lines manually (sometimes horribly).  In Gnus
I use M-q to justify the text.  I have no idea what flags any of these
MUAs is sending.

João





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-19  0:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 15:21 bug#62907: Eglot does not start managing LaTeX buffer despite reporting successful connection Michael Eliachevitch
     [not found] ` <handler.62907.B.168174773410232.ack@debbugs.gnu.org>
2023-04-17 18:16   ` Michael Eliachevitch
2023-04-17 18:31     ` João Távora
2023-04-17 20:29       ` Michael Eliachevitch
2023-04-19  0:10         ` João Távora

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).