emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extending define-derived-mode


From: Eli Zaretskii
Subject: Re: Extending define-derived-mode
Date: Mon, 05 Jun 2023 14:33:02 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 5 Jun 2023 00:31:02 -0700
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
>  emacs-devel <emacs-devel@gnu.org>,
>  Mickey Petersen <mickey@masteringemacs.org>,
>  Theodor Thornhill <theo@thornhill.no>,
>  dgutov@yandex.ru
> 
> > For users to be able to share stuff like electric-quote-local-mode
> > we'd need to rewrite those supporting modes to allow that.  When one
> > of the two modes uses regexps and syntax tables, whereas the other
> > uses treesit-based parsers, this is not a trivial task.  I invite you
> > to audit the various electric modes we have and see how many of them
> > can be shared with minimum effort between non-TS and TS modes.
> 
> I’m talking about sharing the sharable config. Electric modes already work 
> the same in ts and non-ts modes: electric-pair-mode and electric-quote-mode 
> inserts matching pairs and quotes and aren’t affected by tree-sitter, 
> electric-indent-mode uses the standard indent-line-function which both ts and 
> non-ts modes confront to. Is there any other electric modes?

For one prominent example, see the node "Electric Keys" in the CC Mode
manual, and the minor modes described in "Minor Modes" there.

> Also, ts modes generally have the same syntax table as non-ts modes. So if 
> some package uses the syntax table they are largely not affected either.

But it makes little sense to me to have part of a mode use our syntax
tables, and another part use the results of parsing the code by a
parser library.  I can guarantee inconsistencies.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]