emacs-devel
[Top][All Lists]
Advanced

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

Re: Average-user-facing interface for tree-sitter


From: Yuan Fu
Subject: Re: Average-user-facing interface for tree-sitter
Date: Tue, 18 Oct 2022 15:06:12 -0700


> On Oct 18, 2022, at 2:48 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>> For separated major modes, they need to do a bit of a dance.
> 
> I don't think we should even try and document what they should do:
> they're evil and we should spend our efforts merging them into one instead.
> 
>> Besides switching to the new major mode, they need  to add (mode
>> . new-mode) to major-mode-remap-alist if global-treesit-mode is on (so
>> next time we go straight to new-mode as long as global-treesit-mode is
>> on).  They also need to add (mode . new-mode) to
>> treesit-remapped-major-mode-alist so global-treesit-mode can remove
>> these entries when it turns off.
> 
> Too much magic, IMO.  Let each case handle it manually, since I suspect
> that every case will be different and the best thing to do will vary (it
> depends on whether the two modes are still actively maintained, whether
> by the same authors or not, the relative age and popularity of the
> respective modes, …)

So we don’t do anything in global-treesit-mode? Ie,

(define-globalized-minor-mode global-treesit-mode treesit-mode
  global-treesit-mode--turn-on
  :version "29.1"
  :group 'treesit
  :predicate t
  (when (not global-treesit-mode)
    (dolist (map treesit-remapped-major-mode-alist)
      (setq major-mode-remap-alist
            (remove map major-mode-remap-alist)))))

to

(define-globalized-minor-mode global-treesit-mode treesit-mode
  global-treesit-mode--turn-on
  :version "29.1"
  :group 'treesit
  :predicate t
  )

And remove treesit-remapped-major-mode-alist?

Yuan




reply via email to

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