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: Theodor Thornhill
Subject: Re: Average-user-facing interface for tree-sitter
Date: Thu, 20 Oct 2022 20:10:59 +0200

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> Yes, sorry, I made some further changes to js-mode. Could you have a look
>>> and see if it makes sense?
>>>
>> I'm not sure I really like the new changes.
>
> [ Context: I'm largely to blame, I proposed the change.  ]
>

No worries :-)

>> Now we init everything in
>> js-mode in addition to everything treesitter related.  So now stuff like
>>
>> ```
>>   (setq-local font-lock-defaults
>>               (list js--font-lock-keywords nil nil nil nil
>>                     '(font-lock-syntactic-face-function
>>                       . js-font-lock-syntactic-face-function)))
>>   (setq-local syntax-propertize-function #'js-syntax-propertize)
>>   (add-hook 'syntax-propertize-extend-region-functions
>>             #'syntax-propertize-multiline 'append 'local)
>>   (add-hook 'syntax-propertize-extend-region-functions
>>             #'js--syntax-propertize-extend-region 'append 'local)
>>   (setq-local prettify-symbols-alist js--prettify-symbols-alist)
>>
>>   (setq-local parse-sexp-ignore-comments t)
>> ```
>
> Hmm... yeah, undoing those add-hook settings of various other variables
> which treesit-mode doesn't use is a problem.  We need to find
> a better way.
>
>

Yeah.  Shouldn't it be possible to just have a global var instead of a
mode?  That way we can just look for that variable when enabling the
mode, and avoid calling anything other than what we want.  At least for
the foreseeable future, enabling these per mode in the init file
shouldn't really be too much of a problem, IMO.  When more users
actually get to try this we can get a feel for how the init should best
be handled.

To me the '*-use-tree-siter' defcustoms was beautiful :)

Theo



reply via email to

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