Disable markdown-ts-mode & markdown-ts-view-mode for Emacs 31

Ported from emacs-31 release branch:

   commit 984932d4dc
   Author: Sean Whitton <spwhitton@spwhitton.name>
   Date:   Mon Jun 1 11:48:42 2026 +0100

       Disable markdown-ts-mode & markdown-ts-view-mode for Emacs 31

This synchronizes master's Eglot with emacs-31.  The goal of that commit
is to demote those markdown-ts-mode.el modes to "experimental" status in
emacs-31, but Eglot was already relying on them and changes were needed.

984932d4dc is not the commit that best
does those changes, but since that commit was marked "do not merge" on
emacs-31, I thought it best to bring it here manually so any further
work -- which doesn't contradict the overarching intention -- can
continue in emacs-31 with clean merges to master (where the GNU-devel
core Elpa package is pulled from).

* lisp/progmodes/eglot.el (eglot-documentation-renderer)
(eglot--format-markup): Don't call eglot--builtin-mdown-p.
* doc/misc/eglot.texi (Customization Variables):
* etc/EGLOT-NEWS: Don't mention markdown-ts-mode

Co-authored-by: Sean Whitton <spwhitton@spwhitton.name>
This commit is contained in:
João Távora 2026-06-01 11:48:42 +01:00
parent 43f1630346
commit bfa4d6dd40
3 changed files with 12 additions and 20 deletions

View file

@ -998,15 +998,14 @@ will consider it to be part of the workspace. The default is
@cindex markdown renderer
@item eglot-documentation-renderer
This variable controls how Eglot renders at-point documentation
imported from the server (@pxref{Eglot Features}). By default, the
variable's value is set during startup to a markdown renderer if
available, either @code{markdown-ts-view-mode} or
@code{gfm-view-mode}. These utilities visually enhance the
documentation content through fontification and other formatting. If
you set it to @code{t}, plain text will be requested from the server
and no rendering is attempted. If the variable's value is @code{nil},
Eglot will attempt to find a suitable renderer every time.
This variable controls how Eglot renders at-point documentation imported
from the server (@pxref{Eglot Features}). By default, the variable's
value is set during startup to the @code{gfm-view-mode} markdown
renderer if available. This utility visually enhances the documentation
content through fontification and other formatting. If you set it to
@code{t}, plain text will be requested from the server and no rendering
is attempted. If the variable's value is @code{nil}, Eglot will attempt
to find a suitable renderer every time.
@item eglot-mode-map
This variable is the keymap for binding Eglot-related command. It is in

View file

@ -32,11 +32,7 @@ New key bindings: 'k' shuts down, 'r' reconnects, 'e' visits the events
buffer, 'w' shows workspace configuration, and 'RET' invokes
'eglot-describe-connection'.
** New LSP documentation rendering backends (bug#80127)
Eglot uses new built-in 'markdown-ts-mode' of Emacs 31, which means that
on newer versions of Emacs the external 'markdown-mode.el' package does
not need to be installed to render Markdown content.
** 'eglot-documentation-renderer' replaces 'eglot-prefer-plaintext'.
The variable 'eglot-documentation-renderer' replaces the now-obsolete
'eglot-prefer-plaintext'. By default, the variable selects a markdown

View file

@ -537,15 +537,13 @@ or file operation kinds not in the alist."
"If non-nil, activate Eglot in cross-referenced non-project files."
:type 'boolean)
(defcustom eglot-documentation-renderer (cond ((eglot--builtin-mdown-p)
'markdown-ts-view-mode)
((fboundp 'gfm-view-mode)
(defcustom eglot-documentation-renderer (cond ((fboundp 'gfm-view-mode)
'gfm-view-mode)
(t
nil))
"Control rendering of LSP documentation fragments.
If set to a major mode symbol `gfm-view-mode' or `markdown-ts-view-mode'
request markdown-snippets and use the corresponding Markdown renderer.
If set to the major mode symbol `gfm-view-mode', request
markdown-snippets and use `gfm-view-mode' to render it.
If t, always request and render plain text snippets. If set to nil,
decide dynamically."
:type '(choice (const :tag "Plain text" t)
@ -2278,7 +2276,6 @@ If MODE, force MODE to be used for fontifying MARKUP."
(cond
(forced-mode forced-mode)
((fboundp eglot-documentation-renderer) eglot-documentation-renderer)
((eglot--builtin-mdown-p) #'markdown-ts-view-mode)
((fboundp 'gfm-view-mode) #'gfm-view-mode)
(t #'text-mode)))
(calc (s &optional (forced-mode mode) &aux (x (calc2 forced-mode)))