bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#68445: [PATCH] Problem with python--treesit-syntax-propertize


From: kobarity
Subject: bug#68445: [PATCH] Problem with python--treesit-syntax-propertize
Date: Sun, 21 Jan 2024 23:47:39 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

I am resending my mail, as I made a mistake in X-Debbugs-CC.

I wrote:
> Hi,
> 
> I found a problem with python--treesit-syntax-propertize recently
> introduced by the Bug#67977 patch.
> 
> 1. emacs -Q
> 2. Open a file in python-ts-mode with the following contents:
> 
> #+begin_src python
> """Docstring.
> 
> test.
> """
> S = """string."""
> #+end_src
> 
> 3. Locate the point on the third line.
> 4. M-q
> 5. An empty line will be inserted.
> 6. M-q
> 7. The string literal on the last line will be split as follows:
> 
> S = ""
> 
> "string."""
> 
> This problem does not occur in python-mode.
> 
> The direct cause of this problem is that the string-delimiter property
> set in the docstring is removed.  python--treesit-syntax-propertize is
> called to set the property, but it fails to set it properly.  Here is
> the trace of python--treesit-syntax-propertize from step 4 above.
> 
> ======================================================================
> 1 -> (python--treesit-syntax-propertize 1 45)
> 1 <- python--treesit-syntax-propertize: nil
> ======================================================================
> 1 -> (python--treesit-syntax-propertize 16 45)
> 1 <- python--treesit-syntax-propertize: nil
> 
> python--treesit-syntax-propertize is called with argument START 16.
> This is the position inside the docstring.
> 
> It seems to me that python--treesit-syntax-propertize assumes that the
> START argument is outside the triple-quoted string.  So one solution
> might be to change START to the start of the string if it is within a
> string, as in the attached patch.  However, I'm not sure this is the
> right approach.  Should we use
> syntax-propertize-extend-region-functions?
> 
> --
> In GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, X toolkit, cairo
>  version 1.16.0, Xaw scroll bars) of 2024-01-13 built on ubuntu
> Repository revision: 106cd9aafe8248ef91d7e89161adc5f912ea54eb
> Repository branch: master
> System Description: Ubuntu 22.04.3 LTS

I appreciate your comments.





reply via email to

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