unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65813: [PATCH] Fix elixir-ts-mode with embedded heex
@ 2023-09-07 20:46 john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-07 23:06 ` Yuan Fu
  0 siblings, 1 reply; 4+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-07 20:46 UTC (permalink / raw)
  To: 65813; +Cc: Yuan Fu

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Tags: patch

The elixir test with embedded heex fails after d05494a9ff8. Restoring
the ‘(when (eq (treesit-parser-language parser) language)’ part fixes
it. The call to ‘(treesit-parser-list language)’ was not working right
either since t-p-l expects the optional argument to be a buffer but
language is a string like "heex".


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Check-embedded-languages-use-the-correct-parser.patch --]
[-- Type: text/patch, Size: 1276 bytes --]

From 2d7ea1119f12890350f0c04b1e6c70a9856e1f87 Mon Sep 17 00:00:00 2001
From: john muhl <jm@pub.pink>
Date: Thu, 7 Sep 2023 15:43:01 -0500
Subject: [PATCH] Check embedded languages use the correct parser

* lisp/treesit.el (treesit-update-ranges): Restore check to
ensure embedded languages are handled by the appropriate parser.
---
 lisp/treesit.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 6fefc122582..63515e7f45c 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -680,9 +680,11 @@ treesit-update-ranges
                             (treesit--merge-ranges
                              old-ranges new-ranges beg end)
                             (point-min) (point-max))))
-          (dolist (parser (treesit-parser-list language))
-            (treesit-parser-set-included-ranges
-             parser set-ranges))))))))
+          (dolist (parser (treesit-parser-list))
+            (when (eq (treesit-parser-language parser)
+                      language)
+              (treesit-parser-set-included-ranges
+               parser set-ranges)))))))))
 
 (defun treesit-parser-range-on (parser beg &optional end)
   "Check if PARSER's range covers the portion between BEG and END.
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#65813: [PATCH] Fix elixir-ts-mode with embedded heex
  2023-09-07 20:46 bug#65813: [PATCH] Fix elixir-ts-mode with embedded heex john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-07 23:06 ` Yuan Fu
  2023-09-08  0:09   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Yuan Fu @ 2023-09-07 23:06 UTC (permalink / raw)
  To: john muhl; +Cc: 65813-done

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]



> On Sep 7, 2023, at 1:46 PM, john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
> 
> Tags: patch
> 
> The elixir test with embedded heex fails after d05494a9ff8. Restoring
> the ‘(when (eq (treesit-parser-language parser) language)’ part fixes
> it. The call to ‘(treesit-parser-list language)’ was not working right
> either since t-p-l expects the optional argument to be a buffer but
> language is a string like "heex".
> 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Check-embedded-languages-use-the-correct-parser.patch --]
[-- Type: text/patch; x-unix-mode=0644; name="0001-Check-embedded-languages-use-the-correct-parser.patch", Size: 1309 bytes --]

From 2d7ea1119f12890350f0c04b1e6c70a9856e1f87 Mon Sep 17 00:00:00 2001
From: john muhl <jm@pub.pink>
Date: Thu, 7 Sep 2023 15:43:01 -0500
Subject: [PATCH] Check embedded languages use the correct parser

* lisp/treesit.el (treesit-update-ranges): Restore check to
ensure embedded languages are handled by the appropriate parser.
---
 lisp/treesit.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 6fefc122582..63515e7f45c 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -680,9 +680,11 @@ treesit-update-ranges
                             (treesit--merge-ranges
                              old-ranges new-ranges beg end)
                             (point-min) (point-max))))
-          (dolist (parser (treesit-parser-list language))
-            (treesit-parser-set-included-ranges
-             parser set-ranges))))))))
+          (dolist (parser (treesit-parser-list))
+            (when (eq (treesit-parser-language parser)
+                      language)
+              (treesit-parser-set-included-ranges
+               parser set-ranges)))))))))
 
 (defun treesit-parser-range-on (parser beg &optional end)
   "Check if PARSER's range covers the portion between BEG and END.
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 59 bytes --]


Thank you very much, John. I pushed a fix to master.

Yuan

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#65813: [PATCH] Fix elixir-ts-mode with embedded heex
  2023-09-07 23:06 ` Yuan Fu
@ 2023-09-08  0:09   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-08  0:46     ` Yuan Fu
  0 siblings, 1 reply; 4+ messages in thread
From: john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-08  0:09 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 65813-done

Yuan Fu <casouri@gmail.com> writes:

>> On Sep 7, 2023, at 1:46 PM, john muhl via Bug reports for GNU Emacs,
>> the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
>> 
>> Tags: patch
>> 
>> The elixir test with embedded heex fails after d05494a9ff8. Restoring
>> the ‘(when (eq (treesit-parser-language parser) language)’ part fixes
>> it. The call to ‘(treesit-parser-list language)’ was not working right
>> either since t-p-l expects the optional argument to be a buffer but
>> language is a string like "heex".
>> 
>
> [2. text/patch; 0001-Check-embedded-languages-use-the-correct-parser.patch]...
>
>
> Thank you very much, John. I pushed a fix to master.

You’re welcome. Tests (not just elixir) are now complaining about
‘treesit-local-parsers-in’ being missing.

  Test ruby-ts-indent-empty-if-else condition:
      (void-function treesit-local-parsers-in)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#65813: [PATCH] Fix elixir-ts-mode with embedded heex
  2023-09-08  0:09   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-08  0:46     ` Yuan Fu
  0 siblings, 0 replies; 4+ messages in thread
From: Yuan Fu @ 2023-09-08  0:46 UTC (permalink / raw)
  To: john muhl; +Cc: 65813-done



> On Sep 7, 2023, at 5:09 PM, john muhl <jm@pub.pink> wrote:
> 
> Yuan Fu <casouri@gmail.com> writes:
> 
>>> On Sep 7, 2023, at 1:46 PM, john muhl via Bug reports for GNU Emacs,
>>> the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
>>> 
>>> Tags: patch
>>> 
>>> The elixir test with embedded heex fails after d05494a9ff8. Restoring
>>> the ‘(when (eq (treesit-parser-language parser) language)’ part fixes
>>> it. The call to ‘(treesit-parser-list language)’ was not working right
>>> either since t-p-l expects the optional argument to be a buffer but
>>> language is a string like "heex".
>>> 
>> 
>> [2. text/patch; 0001-Check-embedded-languages-use-the-correct-parser.patch]...
>> 
>> 
>> Thank you very much, John. I pushed a fix to master.
> 
> You’re welcome. Tests (not just elixir) are now complaining about
> ‘treesit-local-parsers-in’ being missing.
> 
>  Test ruby-ts-indent-empty-if-else condition:
>      (void-function treesit-local-parsers-in)

Seems that I pushed some untested commits with the fix commit. I’ve fixed the problem on master. Thanks for your patience.

Yuan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-08  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 20:46 bug#65813: [PATCH] Fix elixir-ts-mode with embedded heex john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-07 23:06 ` Yuan Fu
2023-09-08  0:09   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08  0:46     ` Yuan Fu

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).