unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 74412@debbugs.gnu.org, liaotx2@gmail.com, Daan Ro <daanturo@gmail.com>
Subject: bug#74412: 31.0.50; Treesit-outline conflict with outli in Emacs 31
Date: Sat, 23 Nov 2024 12:46:18 -0800	[thread overview]
Message-ID: <983F9100-E76A-4F92-890A-7B2136C3B8E8@gmail.com> (raw)
In-Reply-To: <86o729q7jx.fsf@gnu.org>



> On Nov 21, 2024, at 1:07 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Date: Thu, 21 Nov 2024 15:16:14 +0700
>> From: Daan Ro <daanturo@gmail.com>
>> Cc: "liaotx2@gmail.com" <liaotx2@gmail.com>, 
>> "74412@debbugs.gnu.org" <74412@debbugs.gnu.org>
>> 
>> Before treesit.el went to set those variables, there have been already a
>> bunch of packages based on outline-minor-mode for partitioning code into
>> sections using comments only by highlighting headers and providing
>> navigation, folding, etc. inspired by emacs-lisp-mode's outline-regexp
>> settings.
>> 
>> Such ones enable a feel of "literate" programming by bringing
>> outline-mode features to code section delimited by headings (special
>> comments like ";;;", ";; *") using just comments regardless of code
>> semantic.
>> 
>> The above is my use of outline-minor-mode, maybe other people have
>> different use cases. treesit.el makes the configuration harder by the
>> additional variable setting. I wish there's a hook like
>> treesit-after-major-mode-setup-hook to let people fine-tune or even undo
>> settings, but of course treesit-disable-features to prevent any
>> execution from the start is still better.
> 
> There's a mode hook run by every mode based on treesit.el, so if the
> settings by treesit.el are inappropriate, and the major mode itself
> somehow decided to use them anyway, and the user doesn't like that,
> the user should be able to countermand the treesit.el settings in that
> mode hook.
> 
> In addition, packages that use outline-minor-mode in ways that are
> incompatible with what treesit.el does should be able to reset these
> variables to nil or to some other function, as they need.
> 
> The purpose of treesit.el doing this is to make it easier for
> treesit-based modes to set up their support for outline-minor-mode, so
> that we won't need to perform the same settings in every major mode
> based on tree-sitter.  I don't see anything wrong here.  Modes and
> packages which for some reason don't like that should override these
> values, and that is easy enough to do without adding any user options.
> Let's keep in mind that every new user option makes Emacs more complex
> to use for users, which need to learn about the option and modify
> their init files.  Instead, modes and packages should DTRT by default
> without requiring users to get their (mode's) act together.


The issue is usually that tree-sitter automatically sets outline-search-function, and the package that uses outline-minor-mode only sets outline-regexp and doesn’t set outline-search-function to nil. Since outline prioritizes outline-search-function over outline-regex, it appears that tree-sitter’s outline setting overrides that of the package.

Most outline-related packages don’t set outline-search-function to nil since it’s usually nil by default. So tree-sitter’s behavior will surely break these packages. But since tree-sitter’s setup runs before minor modes, we can’t really tell if the user will later enable a minor mode that tree-sitter’s setup might break.

TRT here is probably for the packages to explicitly set outline-search-function to nil.

Yuan




  reply	other threads:[~2024-11-23 20:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18  2:59 bug#74412: 31.0.50; Treesit-outline conflict with outli in Emacs 31 Taka Obsid
2024-11-18 12:29 ` Eli Zaretskii
2024-11-19  1:47   ` Taka Obsid
2024-11-19 15:37     ` Eli Zaretskii
2024-11-19 18:09 ` Juri Linkov
2024-11-20  3:34   ` Taka Obsid
2024-11-20  7:15     ` Juri Linkov
2024-11-20 14:06       ` Taka Obsid
2024-11-20 17:21         ` Juri Linkov
2024-11-20 18:23         ` Juri Linkov
2024-11-21  1:48           ` Taka Obsid
2024-11-21  6:51             ` Eli Zaretskii
2024-11-20 17:06 ` Daan Ro
2024-11-20 17:18   ` Juri Linkov
2024-11-20 17:51     ` Daan Ro
2024-11-20 18:25       ` Juri Linkov
2024-11-20 18:53     ` Eli Zaretskii
2024-11-20 18:50   ` Eli Zaretskii
2024-11-21  8:16     ` Daan Ro
2024-11-21  9:07       ` Eli Zaretskii
2024-11-23 20:46         ` Yuan Fu [this message]
2024-11-21 17:58       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=983F9100-E76A-4F92-890A-7B2136C3B8E8@gmail.com \
    --to=casouri@gmail.com \
    --cc=74412@debbugs.gnu.org \
    --cc=daanturo@gmail.com \
    --cc=eliz@gnu.org \
    --cc=liaotx2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).