GNU bug report logs - #59477
python-tests fail without tree-sitter

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Date: Tue, 22 Nov 2022 10:14:01 UTC

Severity: normal

Tags: confirmed

Done: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 59477 <at> debbugs.gnu.org
Subject: bug#59477: python-tests fail without tree-sitter
Date: Fri, 25 Nov 2022 17:50:10 +0100
> But if I run this in a buffer manually I get the ending newline. I’m not sure what’s the cause of that. Bisecting give 7c5d4348330b206aff1f8e5bc4fd241d6a6dc0b5, but that commit doesn’t change anything filling-related. 

No idea really, but it might have something to do with the fact that the changes move the assignments

  (setq-local font-lock-defaults
              `(,python-font-lock-keywords
                nil nil nil nil
                (font-lock-syntactic-face-function
                 . python-font-lock-syntactic-face-function)))
  (setq-local syntax-propertize-function
              python-syntax-propertize-function)

so that they are executed after

  (when python-indent-guess-indent-offset
    (python-indent-guess-indent-offset))

instead of before. `python-indent-guess-indent-offset` has the side-effect of setting syntax properties, in particular for the string terminator (triple-quote in the test).

This is important, because python-fill-string (called as part of fill-paragraph in the test) assumes this having already been done and if not, str-end-pos isn't computed correctly and things take a turn for the worse after that.

Stefan probably knows better how this is supposed to work, but presumably python-fill-string should take measures to ensure accurate syntax properties before doing things like

  (re-search-forward (rx (syntax string-delimiter)) nil t)

and so on. Sorry about not being of much help here.





This bug report was last modified 2 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.