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

Do not merge to master.

* lisp/progmodes/eglot.el (eglot-documentation-renderer)
(eglot--format-markup): Don't call eglot--builtin-mdown-p.
* lisp/textmodes/markdown-ts-mode.el (markdown-ts-mode)
(markdown-ts-view-mode): Mark as experimental.
(auto-mode-alist, treesit-major-mode-remap-alist): Don't add
anything.
* doc/misc/eglot.texi (Customization Variables):
* etc/EGLOT-NEWS:
* etc/NEWS: Don't mention markdown-ts-mode or
markdown-ts-view-mode.
This commit is contained in:
Sean Whitton 2026-06-01 11:48:42 +01:00
parent 2c2f1c00ac
commit 984932d4dc
6 changed files with 25 additions and 53 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

@ -3944,15 +3944,6 @@ A major mode based on 'conf-mode' for editing ".npmrc" files.
** New major modes based on the tree-sitter library
*** New major mode 'markdown-ts-mode'.
A major mode based on the tree-sitter library for editing Markdown
files. Markdown files are visited using this mode when the required
tree-sitter grammars ('markdown' and 'markdown-inline') are available,
or when the user has opted in via 'treesit-enabled-modes'. Otherwise,
Markdown files fall back to 'text-mode'.
To install the grammars, use 'M-x markdown-ts-mode-install-parsers'.
*** New major mode 'mhtml-ts-mode'.
An optional major mode based on the tree-sitter library for editing HTML
files. This mode handles indentation, fontification, and commenting for

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)))

View file

@ -27,6 +27,8 @@
;;; Commentary:
;; This is an experimental mode that has a number of unresolved issues.
;;; Code:
(require 'markdown-ts-mode)
@ -196,7 +198,6 @@ fully-qualified file name. If OUTPUT-FILE is nil, assume stdout, or it
is a fully-qualified file name. It should return a list of
arguments suitable for `call-process'.")
;;;###autoload
(defun markdown-ts-convert-file (input-file
&optional
format
@ -226,7 +227,6 @@ found; see the variable `exec-path'."
overwrite
quiet))
;;;###autoload
(defun markdown-ts-convert (&optional
input-file output-file
format display overwrite quiet)
@ -661,7 +661,6 @@ transformed into \"Heading Text\"."
(funcall fixer text)
text))
;;;###autoload
(define-minor-mode markdown-ts-toc-update-before-save-mode
"If enabled, update `markdown-ts-mode' tables of contents before saving."
:init-value nil
@ -676,7 +675,6 @@ transformed into \"Heading Text\"."
:warning
"Minor mode valid only in `markdown-ts-mode' buffers.")))
;;;###autoload
(defun markdown-ts-toc-clear-and-remove (&optional beg end)
"Remove `markdown-ts-mode' table of contents bodies and templates.
Operate on the active region BEG to END, otherwise operate on the
@ -685,7 +683,6 @@ buffer, which may be narrowed."
(markdown-ts--barf-if-not-mode 'markdown-ts-toc-clear-and-remove)
(markdown-ts-toc-clear beg end 'remove))
;;;###autoload
(defun markdown-ts-toc-clear (&optional beg end remove)
"Clear `markdown-ts-mode' table of contents bodies.
Operate on the active region BEG to END, otherwise operate on the
@ -726,7 +723,6 @@ If optional REMOVE is non-nil, remove tables including their templates."
reg-size))
(setq end-pos (min (point-max) (- end-pos reg-size)))))))))
;;;###autoload
(defun markdown-ts-toc-insert-template (&optional char)
"Insert a `markdown-ts-mode` table of contents template at point.
@ -760,7 +756,6 @@ their defaults and is useful as a starting point to customize a table."
"<!-- markdown-ts-toc-end: -->\n"))
(_ (user-error "No such template type: %c" char))))
;;;###autoload
(defun markdown-ts-toc-generate (&optional interactive beg end)
"Generate tables of contents in the current buffer.
`markdown-ts-mode' uses Markdown HTML comment elements to identify table

View file

@ -27,6 +27,8 @@
;;; Commentary:
;; This is an experimental mode that has a number of unresolved issues.
;;
;;;; Tree-sitter Language Versions
;;
;; markdown-ts-mode has been tested with the following grammars and version:
@ -5410,23 +5412,26 @@ With a prefix argument, it can also install optional parsers"
"Emacs was built without Tree-sitter support, or could not load Tree-sitter"))
(text-mode)))))
;;;###autoload
(define-derived-mode markdown-ts-mode text-mode "Markdown"
"Major mode for editing Markdown using tree-sitter grammar.
NOTE: See `markdown-ts--set-up-inline'."
This is an experimental mode that has a number of unresolved issues,
therefore Emacs does not yet enable it by default.
See also `markdown-ts--set-up-inline'."
(markdown-ts-mode--initialize))
(derived-mode-add-parents 'markdown-ts-mode '(markdown-mode))
;;; View mode:
;;;###autoload
(define-derived-mode markdown-ts-view-mode
nil ; Intentionally left blank.
"Markdown View"
"Major mode for read-only viewing Markdown using tree-sitter grammar."
;; NOTE: `markdown-ts-mode' is manually added as a parent to avoid
;; invoking its initialization before we set override variables.
"Major mode for read-only viewing Markdown using tree-sitter grammar.
This is an experimental mode that has a number of unresolved issues,
therefore Emacs does not yet enable it by default."
;; `markdown-ts-mode' is manually added as a parent to avoid invoking
;; its initialization before we set override variables.
(setq-local markdown-ts-menu-bar-show nil)
(setq-local markdown-ts-hide-markup t)
(setq-local markdown-ts-inline-images t)
@ -5443,7 +5448,6 @@ NOTE: See `markdown-ts--set-up-inline'."
;;; Mode utilities:
;;;###autoload
(defun markdown-ts-buffer-string ()
"Like `buffer-string', and convert overlay properties to text properties."
(let ((str (buffer-string)))
@ -5619,7 +5623,6 @@ If non-nil and `point' is in a table, enable
(remove-hook 'post-command-hook
#'markdown-ts--enable-in-table-mode 'local))))
;;;###autoload
(defun markdown-ts-mode-maybe ()
"Enable `markdown-ts-mode' when its grammars are available.
Also propose to install the grammars when `treesit-enabled-modes'
@ -5632,14 +5635,5 @@ is t or contains the mode name."
(markdown-ts-mode)
(text-mode)))
;;;###autoload
(when (boundp 'treesit-major-mode-remap-alist)
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-ts-mode-maybe))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-ts-mode-maybe))
(add-to-list 'auto-mode-alist '("\\.mdx\\'" . markdown-ts-mode-maybe))
;; To be able to toggle between an external package and core ts-mode:
(add-to-list 'treesit-major-mode-remap-alist
'(markdown-mode . markdown-ts-mode)))
(provide 'markdown-ts-mode)
;;; markdown-ts-mode.el ends here