From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59477: python-tests fail without tree-sitter Date: Sat, 26 Nov 2022 14:18:37 -0800 Message-ID: References: <207B066C-2C1F-40B3-9E13-9DFC3ABCF92F@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4019"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , 59477@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 26 23:19:36 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oz3WJ-0000pN-Mo for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Nov 2022 23:19:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oz3Vr-0001xb-2C; Sat, 26 Nov 2022 17:19:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oz3Vn-0001xA-T2 for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2022 17:19:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oz3Vn-0004Eh-Ko for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2022 17:19:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oz3Vm-0007uE-Gx for bug-gnu-emacs@gnu.org; Sat, 26 Nov 2022 17:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Nov 2022 22:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59477 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 59477-submit@debbugs.gnu.org id=B59477.166950112730384 (code B ref 59477); Sat, 26 Nov 2022 22:19:02 +0000 Original-Received: (at 59477) by debbugs.gnu.org; 26 Nov 2022 22:18:47 +0000 Original-Received: from localhost ([127.0.0.1]:41638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oz3VX-0007u0-6T for submit@debbugs.gnu.org; Sat, 26 Nov 2022 17:18:47 -0500 Original-Received: from mail-pl1-f179.google.com ([209.85.214.179]:41548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oz3VU-0007tt-Fy for 59477@debbugs.gnu.org; Sat, 26 Nov 2022 17:18:45 -0500 Original-Received: by mail-pl1-f179.google.com with SMTP id io19so6899562plb.8 for <59477@debbugs.gnu.org>; Sat, 26 Nov 2022 14:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9pa6ZIiGL5Npbhh0O91+wuczjCEnwh3uxn3kz/htgU8=; b=Lk4TLj3v+QK222OFbobvM2oT2vFdHnHa4ettTw0nZ5NKs9WeTrvONVJ/C7/NTFoPK6 bg6Wm/F46L/pWyXU6fMhfB5h9D+bbOQve1vxNlUDtlOCJ6z9AweDay0Z7aguNtze7AX5 +XuT7eKodAXCPy+/VJ1jTzCFTdhx8n0aDeoB7/wOsoMkmGHcESgpy9NfUJRePwH1trjQ 5IKZQNx6wArkunPwfsAuUwtSeS4huagwbyr1cyDFC0ugI3qZwqluX9x1TYxGXRJPQDhR Gr46ROttDA86KI/BFVIE/Kr3/TgjslmH6NaQgHbVI7CsvSAGtQK+rkXQLGzJ7YSuwlNE Oaxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9pa6ZIiGL5Npbhh0O91+wuczjCEnwh3uxn3kz/htgU8=; b=0WFQApXEt8W+ilkb56K8ztl+Em7aO9+6Rm9CeUxxH64IaOsduSNPpqwGoqtH/8jrqr 0l7x1mz21gAgCnyvdM/agjlL4m2BQlzzlFLlY8rZMYSpsGemISJJwhe8e1tuA2EMKu3J Ze9r2u99So7OQ20RGVR1lI7hP7tz0wpCboMvBR/K5ubPL4oAuNUNlQBxq+WRdJM4H83/ ZgC8vtAQfMNOV0NN/XS6OSu5M9/nsgAuZ3MTGLU35IpFzCxyUoItdirKyF+WoYIXzfJ1 ORzPhPiDTjCWbmLK/UmAIEQo5ouBujWqiF/d/d9ZCB5wNorUOiV7nwm2UVX5llItZI8e s6QA== X-Gm-Message-State: ANoB5pksovJcAzaOE1e1wOifcvCPkcu7Goi3h5rIfgcmggkUm0weg16E cCRtMvXfEVP1Dkbo2GQuflE= X-Google-Smtp-Source: AA0mqf47LvjgY7p3tTlv7GXoWPWfQH3eHZIFkWoQf8R2KDFq0e6+YBujTwngs6wXL3H+coMFcFXIpg== X-Received: by 2002:a17:90b:2316:b0:20a:74b8:ea2a with SMTP id mt22-20020a17090b231600b0020a74b8ea2amr54928836pjb.73.1669501118524; Sat, 26 Nov 2022 14:18:38 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id u10-20020a170902e5ca00b00188f07c10c9sm5807070plf.192.2022.11.26.14.18.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Nov 2022 14:18:38 -0800 (PST) In-Reply-To: <207B066C-2C1F-40B3-9E13-9DFC3ABCF92F@gmail.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249147 Archived-At: > On Nov 25, 2022, at 8:50 AM, Mattias Engdeg=C3=A5rd = wrote: >=20 >> But if I run this in a buffer manually I get the ending newline. = I=E2=80=99m not sure what=E2=80=99s the cause of that. Bisecting give = 7c5d4348330b206aff1f8e5bc4fd241d6a6dc0b5, but that commit doesn=E2=80=99t = change anything filling-related.=20 >=20 > No idea really, but it might have something to do with the fact that = the changes move the assignments >=20 > (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) >=20 > so that they are executed after >=20 > (when python-indent-guess-indent-offset > (python-indent-guess-indent-offset)) >=20 > 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). >=20 > 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. >=20 > 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 >=20 > (re-search-forward (rx (syntax string-delimiter)) nil t) >=20 > and so on. Sorry about not being of much help here. >=20 Thanks, that=E2=80=99s a very useful information. And I can only blame = myself for breaking the tests :-) While still unable to find the culprit. I have the following = observations: 1. Setting require-final-newline to t doesn=E2=80=99t work 2. If I change with-temp-buffer to with-current-buffer = (get-buffer-create "*test*=E2=80=9D), the problem disappears, the = newlines is not dropped 3. I edebugged fill-paragraph, the newlines in the temp buffer = disappears at line 865 in fill.el, where the recursive call returns. = Before (funcall function justify) returns (`function` is fill-paragraph = itself), the newline still exists, but after we return to the caller at = line 865, the newline disappears. I checked for newline by hitting e and evaluating (char-before = (point-max)) Yuan=