larstvei / Focus

Dim the font color of text in surrounding paragraphs
470 stars 14 forks source link

Provide an example to make Focus with tree-sitter for python #29

Closed lgfang closed 2 months ago

lgfang commented 2 months ago

Emacs 29.3 comes with a built-in tree-sitter library. This PR updates the REAME.org to include an example of configuring Focus to work with tree-sitter for python source code.

larstvei commented 2 months ago

Hi!

Thanks for your contribution. I won't merge the change though, because it seems too specific to Python, where I think a more general solution is possible.

Tree-sitter does implement its own thing at point: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/treesit.el#n2745

However, it seems that it has yet to make this play nice with the thing at point library that Focus leverages.

I'll close this for now, but you are welcome to open an issue for adding tree-sitter support, similar to how Org mode gets special treatment.

lgfang commented 2 months ago

Thank you very much for the explanation! It does sound better to support treesit's own thing at point.

On Sun, 14 July 2024, 00:43 Lars Tveito, @.***> wrote:

Hi!

Thanks for your contribution. I won't merge the change though, because it seems too specific to Python, where I think a more general solution is possible.

Tree-sitter does implement its own thing at point: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/treesit.el#n2745

However, it seems that it has yet to make this play nice with the thing at point library https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/thingatpt.el that Focus leverages.

I'll close this for now, but you are welcome to open an issue for adding tree-sitter support, similar to how Org mode gets special treatment https://github.com/larstvei/Focus/blob/17c471544f540f2cf9a05fd6cd87e52e5de317e2/focus.el#L128 .

— Reply to this email directly, view it on GitHub https://github.com/larstvei/Focus/pull/29#issuecomment-2226934977, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQTHCF3NL2ZJFMVLFUMCZLZME4J7AVCNFSM6AAAAABKUFJQG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWHEZTIOJXG4 . You are receiving this because you authored the thread.Message ID: @.***>