GNU bug report logs - #79180
31.0.50; Customize-browse emits treesit warnings

Previous Next

Package: emacs;

Reported by: Sean Devlin <spd <at> toadstyle.org>

Date: Tue, 5 Aug 2025 20:19:02 UTC

Severity: normal

Merged with 64487

Found in versions 29.0.92, 31.0.50

To reply to this bug, email your comments to 79180 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Tue, 05 Aug 2025 20:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sean Devlin <spd <at> toadstyle.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 05 Aug 2025 20:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sean Devlin <spd <at> toadstyle.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Customize-browse emits treesit warnings
Date: Tue, 5 Aug 2025 15:18:10 -0500
Hi folks,

Browsing the customization settings can raise warnings for tree-sitter
modes that are not in use.

Recipe:

0. Build Emacs with tree-sitter support, but don't install associated
language grammars
1. Emacs -Q
2. M-x customize-browse
3. Expand the "Programming" group
4. Expand the "Languages" group

You will see a warning for any installed tree-sitter modes whose
grammars are not installed. Emacs ships with several such modes,
e.g. ruby-ts-mode, elixir-ts-mode, heex-ts-mode, php-ts-mode, and
lua-ts-mode.

The warnings are surprising, since I'm just browsing customization
settings, and not even settings specific to those modes. I haven't tried
to enable any of these modes so far.

I think most users will not preemptively install language grammars for
every installed tree-sitter mode (especially as more such modes are
added), so browsing customization settings should not raise warnings
like this.

Should these libraries really make noise like this when they are
unintentionally loaded by the user?

Cheers, and thanks!


In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.6.0, NS
appkit-2575.70 Version 15.6 (Build 24G84)) of 2025-08-03 built on Mac
Repository revision: e70723fcb7b9cf2daad92d563f97735892d758e1
Repository branch: spd-igc
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.6

Configured using:
'configure --with-ns --with-modules --with-native-compilation
--with-libgmp --with-tree-sitter --with-sqlite3 --with-mps=yes
--without-imagemagick --without-dbus CPPFLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig
ac_cv_func_posix_spawn_file_actions_addchdir=no'

Configured features:
ACL GIF GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES MPS NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Special

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-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 lisp-mnt message yank-media rfc822 mml
mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums misearch multi-isearch cus-theme eieio-custom
eieio-base xwidget url-handlers image-mode dired dired-loaddefs exif
format-spec bookmark wid-browse tree-widget vhdl-mode verilog-mode diff
vera-mode hippie-exp tcl sql view simula sieve sieve-mode sieve-manage
sasl sasl-anonymous sasl-login sasl-plain sh-script executable
ruby-ts-mode ruby-mode python project compat pcase ps-mode prolog align
php-ts-mode html-ts-mode perl-mode pascal opascal octave rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-enc
xmltok modula2 meta-mode m4-mode lua-ts-mode ld-script js c-ts-common
info-look info icon hideshow heex-ts-mode fortran f90 ethio-util robin
elixir-ts-mode warnings dcl-mode tempo css-mode treesit smie sgml-mode
imenu eww track-changes vtable url-queue thingatpt shr pixel-fill
kinsoku url-file svg xml dom browse-url xdg url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util url-parse auth-source cl-seq eieio eieio-core
cl-macs password-cache json map byte-opt gv url-vars mailcap puny mm-url
gnus nnheader gnus-util time-date mail-utils range mm-util mail-prsvr
cperl-mode facemenu cfengine cfengine3 bat-mode asm-mode antlr-mode
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs compile text-property-search comint subr-x ansi-osc
ansi-color ring comp-run bytecomp byte-compile comp-common rx
ring-bell-fns pulse face-remap color cus-edit pp cus-start cus-load
icons wid-edit cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
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 kqueue
cocoa ns lcms2 multi-tty make-network-process tty-child-frames
native-compile mps emacs)

Memory information:
((conses 24 0 0) (symbols 56 0 0) (strings 40 0 0) (string-bytes 1 0)
(vectors 24 0) (vector-slots 8 0 0) (floats 24 0 0)
(intervals 64 0 0) (buffers 1072 0))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Wed, 06 Aug 2025 12:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sean Devlin <spd <at> toadstyle.org>
Cc: 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Wed, 06 Aug 2025 15:26:21 +0300
merge 79180 64487
thanks

> From: Sean Devlin <spd <at> toadstyle.org>
> Date: Tue, 5 Aug 2025 15:18:10 -0500
> 
> Browsing the customization settings can raise warnings for tree-sitter
> modes that are not in use.
> 
> Recipe:
> 
> 0. Build Emacs with tree-sitter support, but don't install associated
> language grammars
> 1. Emacs -Q
> 2. M-x customize-browse
> 3. Expand the "Programming" group
> 4. Expand the "Languages" group
> 
> You will see a warning for any installed tree-sitter modes whose
> grammars are not installed. Emacs ships with several such modes,
> e.g. ruby-ts-mode, elixir-ts-mode, heex-ts-mode, php-ts-mode, and
> lua-ts-mode.
> 
> The warnings are surprising, since I'm just browsing customization
> settings, and not even settings specific to those modes. I haven't tried
> to enable any of these modes so far.
> 
> I think most users will not preemptively install language grammars for
> every installed tree-sitter mode (especially as more such modes are
> added), so browsing customization settings should not raise warnings
> like this.
> 
> Should these libraries really make noise like this when they are
> unintentionally loaded by the user?

This is a known issue, see bug#64487.  It's a side effect of the
decision to warn users when they activate tree-sitter based modes for
which they don't have a grammar library installed.  These warnings are
triggered by Custom which loads all the packages belonging to a
customization group when you browse that group.

The warning is harmless, and we don't have a good solution that would
avoid it in Customize but still emit it when the mode is loaded in
other ways.  Ideas for how to pull that trick will be welcome.  (The
fact that Custom loads the packages is a known misfeature.)




Merged 64487 79180. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 06 Aug 2025 12:27:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Fri, 08 Aug 2025 06:32:02 GMT) Full text and rfc822 format available.

Message #13 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Sean Devlin <spd <at> toadstyle.org>, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Fri, 08 Aug 2025 09:29:27 +0300
> This is a known issue, see bug#64487.  It's a side effect of the
> decision to warn users when they activate tree-sitter based modes for
> which they don't have a grammar library installed.  These warnings are
> triggered by Custom which loads all the packages belonging to a
> customization group when you browse that group.
>
> The warning is harmless, and we don't have a good solution that would
> avoid it in Customize but still emit it when the mode is loaded in
> other ways.  Ideas for how to pull that trick will be welcome.  (The
> fact that Custom loads the packages is a known misfeature.)

I have a patch that removes these warnings.
Should I post it here or on emacs-devel?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Fri, 08 Aug 2025 07:06:02 GMT) Full text and rfc822 format available.

Message #16 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Fri, 08 Aug 2025 10:05:38 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: Sean Devlin <spd <at> toadstyle.org>,  79180 <at> debbugs.gnu.org
> Date: Fri, 08 Aug 2025 09:29:27 +0300
> 
> > This is a known issue, see bug#64487.  It's a side effect of the
> > decision to warn users when they activate tree-sitter based modes for
> > which they don't have a grammar library installed.  These warnings are
> > triggered by Custom which loads all the packages belonging to a
> > customization group when you browse that group.
> >
> > The warning is harmless, and we don't have a good solution that would
> > avoid it in Customize but still emit it when the mode is loaded in
> > other ways.  Ideas for how to pull that trick will be welcome.  (The
> > fact that Custom loads the packages is a known misfeature.)
> 
> I have a patch that removes these warnings.
> Should I post it here or on emacs-devel?

Please post here, and thanks.  If it turns out a more general
discussion is needed, we will start it on emacs-devel then.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Fri, 08 Aug 2025 18:02:02 GMT) Full text and rfc822 format available.

Message #19 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Fri, 08 Aug 2025 20:57:27 +0300
[Message part 1 (text/plain, inline)]
>> I have a patch that removes these warnings.
>> Should I post it here or on emacs-devel?
>
> Please post here, and thanks.  If it turns out a more general
> discussion is needed, we will start it on emacs-devel then.

This new option was discussed many times on emacs-devel,
and here it's finally implemented.  As an example the patch
demonstrates the required changes only for markdown-ts-mode, and
similarly the same changes will be applied to all other ts-modes:

[treesit-enabled-modes.patch (text/x-diff, inline)]
diff --git a/lisp/textmodes/markdown-ts-mode.el b/lisp/textmodes/markdown-ts-mode.el
index a94d1590fa0..e44ee583edd 100644
--- a/lisp/textmodes/markdown-ts-mode.el
+++ b/lisp/textmodes/markdown-ts-mode.el
@@ -403,8 +403,14 @@ markdown-ts-mode
 
 (derived-mode-add-parents 'markdown-ts-mode '(markdown-mode))
 
-(if (treesit-ready-p 'markdown)
-    (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-ts-mode)))
+;;;###autoload
+(when (treesit-available-p)
+  (unless (fboundp 'markdown-mode)
+    (defalias 'markdown-mode #'ignore))
+  (unless (rassq 'markdown-mode auto-mode-alist)
+    (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)))
+  (add-to-list 'treesit-mode-remap-alist
+               '(markdown-mode . markdown-ts-mode)))
 
 (provide 'markdown-ts-mode)
 ;;; markdown-ts-mode.el ends here
diff --git a/lisp/treesit.el b/lisp/treesit.el
index dc17515ff99..69b48e0402b 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -5397,6 +5397,35 @@ treesit-ensure-installed
         ;; Check that the grammar was installed successfully
         (treesit-ready-p lang))))
 
+;;; Treesit enabled modes
+
+(defun treesit--enabled-modes-type ()
+  `(choice (const :tag "Disable all automatic associations" nil)
+           (const :tag "Enable all available ts-modes" t)
+           (set :tag "List of enabled ts-modes"
+                ,@(sort (mapcar (lambda (m) `(const ,(cdr m)))
+                                treesit-mode-remap-alist)))))
+
+;;;###autoload
+(defcustom treesit-enabled-modes nil
+  "Specify what treesit modes to enable by default."
+  :type (treesit--enabled-modes-type)
+  :initialize #'custom-initialize-default
+  :set (lambda (sym val)
+         (mapc (lambda (m)
+                 (if (stringp (car m))
+                     (setq auto-mode-alist
+                           (if (or (eq val t) (memq (cdr m) val))
+                               (cons m auto-mode-alist)
+                             (delete m auto-mode-alist)))
+                   (setq major-mode-remap-alist
+                         (if (or (eq val t) (memq (cdr m) val))
+                             (cons m major-mode-remap-alist)
+                           (delete m major-mode-remap-alist)))))
+               treesit-mode-remap-alist)
+         (set-default sym val))
+  :version "31.1")
+
 ;;; Shortdocs
 
 (defun treesit--generate-shortdoc-examples ()
diff --git a/src/treesit.c b/src/treesit.c
index bb720589c85..e9dc6596d89 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -5299,6 +5299,16 @@ cons (REGEXP . FN), which is a combination of a regexp and a predicate
 buffer.  */);
   Vtreesit_languages_require_line_column_tracking = Qnil;
 
+  DEFVAR_LISP ("treesit-mode-remap-alist",
+	       Vtreesit_mode_remap_alist,
+	       doc:
+	       /* An alist remapping mode symbols.
+
+The value should be an alist of (MODE . TS-MODE).  This alist
+is used to modify the value of `major-mode-remap-alist'
+depending on the customization of `treesit-enabled-modes'.  */);
+  Vtreesit_mode_remap_alist = Qnil;
+
   staticpro (&Vtreesit_str_libtree_sitter);
   Vtreesit_str_libtree_sitter = build_string ("libtree-sitter-");
   staticpro (&Vtreesit_str_tree_sitter);

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Fri, 08 Aug 2025 23:45:02 GMT) Full text and rfc822 format available.

Message #22 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Sean Devlin <spd <at> toadstyle.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Fri, 8 Aug 2025 18:44:22 -0500

> On Aug 6, 2025, at 7:26 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> 
> This is a known issue, see bug#64487.  It's a side effect of the
> decision to warn users when they activate tree-sitter based modes for
> which they don't have a grammar library installed.  These warnings are
> triggered by Custom which loads all the packages belonging to a
> customization group when you browse that group.
> 
> The warning is harmless, and we don't have a good solution that would
> avoid it in Customize but still emit it when the mode is loaded in
> other ways.  Ideas for how to pull that trick will be welcome.  (The
> fact that Custom loads the packages is a known misfeature.)

Thanks, that makes sense. Sorry for the noise.



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Sat, 09 Aug 2025 05:38:02 GMT) Full text and rfc822 format available.

Message #25 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Sat, 09 Aug 2025 08:36:48 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: spd <at> toadstyle.org,  79180 <at> debbugs.gnu.org
> Date: Fri, 08 Aug 2025 20:57:27 +0300
> 
> >> I have a patch that removes these warnings.
> >> Should I post it here or on emacs-devel?
> >
> > Please post here, and thanks.  If it turns out a more general
> > discussion is needed, we will start it on emacs-devel then.
> 
> This new option was discussed many times on emacs-devel,
> and here it's finally implemented.  As an example the patch
> demonstrates the required changes only for markdown-ts-mode, and
> similarly the same changes will be applied to all other ts-modes:

Sorry, I'm probably missing something: this patch seems to completely
remove the warning about manual activation of, say, markdown-ts-mode
when the grammar library is not installed?  IOW, what happens under
this patch if the user says "M-x markdown-ts-mode RET" and the grammar
library is not installed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Sun, 10 Aug 2025 06:58:02 GMT) Full text and rfc822 format available.

Message #28 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Sun, 10 Aug 2025 09:50:47 +0300
>> >> I have a patch that removes these warnings.
>> >> Should I post it here or on emacs-devel?
>> >
>> > Please post here, and thanks.  If it turns out a more general
>> > discussion is needed, we will start it on emacs-devel then.
>> 
>> This new option was discussed many times on emacs-devel,
>> and here it's finally implemented.  As an example the patch
>> demonstrates the required changes only for markdown-ts-mode, and
>> similarly the same changes will be applied to all other ts-modes:
>
> Sorry, I'm probably missing something: this patch seems to completely
> remove the warning about manual activation of, say, markdown-ts-mode
> when the grammar library is not installed?

It removes the warning during loading the markdown-ts-mode.el package
with e.g. `(require 'markdown-ts-mode)`.

> IOW, what happens under this patch if the user says "M-x
> markdown-ts-mode RET" and the grammar library is not installed?

It proposes to install the grammar library:

  Tree-sitter grammar for `markdown' is missing; install it? (y or n)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Sun, 10 Aug 2025 07:58:02 GMT) Full text and rfc822 format available.

Message #31 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Sun, 10 Aug 2025 10:57:06 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: spd <at> toadstyle.org,  79180 <at> debbugs.gnu.org
> Date: Sun, 10 Aug 2025 09:50:47 +0300
> 
> >> >> I have a patch that removes these warnings.
> >> >> Should I post it here or on emacs-devel?
> >> >
> >> > Please post here, and thanks.  If it turns out a more general
> >> > discussion is needed, we will start it on emacs-devel then.
> >> 
> >> This new option was discussed many times on emacs-devel,
> >> and here it's finally implemented.  As an example the patch
> >> demonstrates the required changes only for markdown-ts-mode, and
> >> similarly the same changes will be applied to all other ts-modes:
> >
> > Sorry, I'm probably missing something: this patch seems to completely
> > remove the warning about manual activation of, say, markdown-ts-mode
> > when the grammar library is not installed?
> 
> It removes the warning during loading the markdown-ts-mode.el package
> with e.g. `(require 'markdown-ts-mode)`.

And if the mode is loaded via some autoload cookie?

> > IOW, what happens under this patch if the user says "M-x
> > markdown-ts-mode RET" and the grammar library is not installed?
> 
> It proposes to install the grammar library:
> 
>   Tree-sitter grammar for `markdown' is missing; install it? (y or n)

How does that work?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Sun, 10 Aug 2025 17:50:01 GMT) Full text and rfc822 format available.

Message #34 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Sun, 10 Aug 2025 20:49:19 +0300
>> >> This new option was discussed many times on emacs-devel,
>> >> and here it's finally implemented.  As an example the patch
>> >> demonstrates the required changes only for markdown-ts-mode, and
>> >> similarly the same changes will be applied to all other ts-modes:
>> >
>> > Sorry, I'm probably missing something: this patch seems to completely
>> > remove the warning about manual activation of, say, markdown-ts-mode
>> > when the grammar library is not installed?
>> 
>> It removes the warning during loading the markdown-ts-mode.el package
>> with e.g. `(require 'markdown-ts-mode)`.
>
> And if the mode is loaded via some autoload cookie?

Yes.

>> > IOW, what happens under this patch if the user says "M-x
>> > markdown-ts-mode RET" and the grammar library is not installed?
>> 
>> It proposes to install the grammar library:
>> 
>>   Tree-sitter grammar for `markdown' is missing; install it? (y or n)
>
> How does that work?

'markdown-ts-mode' ensures this with (treesit-ensure-installed 'markdown).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Mon, 11 Aug 2025 11:48:01 GMT) Full text and rfc822 format available.

Message #37 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Mon, 11 Aug 2025 14:46:41 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: spd <at> toadstyle.org,  79180 <at> debbugs.gnu.org
> Date: Sun, 10 Aug 2025 20:49:19 +0300
> 
> >> >> This new option was discussed many times on emacs-devel,
> >> >> and here it's finally implemented.  As an example the patch
> >> >> demonstrates the required changes only for markdown-ts-mode, and
> >> >> similarly the same changes will be applied to all other ts-modes:
> >> >
> >> > Sorry, I'm probably missing something: this patch seems to completely
> >> > remove the warning about manual activation of, say, markdown-ts-mode
> >> > when the grammar library is not installed?
> >> 
> >> It removes the warning during loading the markdown-ts-mode.el package
> >> with e.g. `(require 'markdown-ts-mode)`.
> >
> > And if the mode is loaded via some autoload cookie?
> 
> Yes.
> 
> >> > IOW, what happens under this patch if the user says "M-x
> >> > markdown-ts-mode RET" and the grammar library is not installed?
> >> 
> >> It proposes to install the grammar library:
> >> 
> >>   Tree-sitter grammar for `markdown' is missing; install it? (y or n)
> >
> > How does that work?
> 
> 'markdown-ts-mode' ensures this with (treesit-ensure-installed 'markdown).

OK, so can you describe the workflow of someone who wants to use
markdown-ts-mode for Markdown files?  Currently, they need to load
markdown-ts-mode; what would be the replacement of that if this patch
is installed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Tue, 12 Aug 2025 06:21:02 GMT) Full text and rfc822 format available.

Message #40 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Tue, 12 Aug 2025 09:18:43 +0300
> OK, so can you describe the workflow of someone who wants to use
> markdown-ts-mode for Markdown files?  Currently, they need to load
> markdown-ts-mode; what would be the replacement of that if this patch
> is installed?

Here is the workflow: when someone wants to use markdown-ts-mode for
Markdown files, then the user customizes the option 'treesit-enabled-modes'
either to t (enables all ts-modes) or to the list '(markdown-ts-mode)'
(by clicking on the checkbox "markdown-ts-mode").  Then no need to
load markdown-ts-mode manually: visiting a Markdown file will autoload
markdown-ts-mode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79180; Package emacs. (Tue, 12 Aug 2025 12:20:02 GMT) Full text and rfc822 format available.

Message #43 received at 79180 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: spd <at> toadstyle.org, 79180 <at> debbugs.gnu.org
Subject: Re: bug#79180: 31.0.50; Customize-browse emits treesit warnings
Date: Tue, 12 Aug 2025 15:18:58 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: spd <at> toadstyle.org,  79180 <at> debbugs.gnu.org
> Date: Tue, 12 Aug 2025 09:18:43 +0300
> 
> > OK, so can you describe the workflow of someone who wants to use
> > markdown-ts-mode for Markdown files?  Currently, they need to load
> > markdown-ts-mode; what would be the replacement of that if this patch
> > is installed?
> 
> Here is the workflow: when someone wants to use markdown-ts-mode for
> Markdown files, then the user customizes the option 'treesit-enabled-modes'
> either to t (enables all ts-modes) or to the list '(markdown-ts-mode)'
> (by clicking on the checkbox "markdown-ts-mode").  Then no need to
> load markdown-ts-mode manually: visiting a Markdown file will autoload
> markdown-ts-mode.

OK, and what would they need to do if they then change their minds and
want to stop using markdown-ts-mode, switching back to markdown-mode?

Also, what will happen in customize-group, when they select the
"Languages" group?  And what if they then select, say, Lua Ts group
when the relevant grammar is not installed?




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.