From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#59477: python-tests fail without tree-sitter Date: Sun, 27 Nov 2022 14:07:13 +0100 Message-ID: <0F939218-834F-43D1-8F0B-D812848F1CB3@gmail.com> References: <207B066C-2C1F-40B3-9E13-9DFC3ABCF92F@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_F22C6DB0-32CE-403E-9466-317663A9B62D" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40647"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , 59477@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 27 14:08:18 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 1ozHOM-000AR2-3C for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 27 Nov 2022 14:08:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozHOC-0000aN-DV; Sun, 27 Nov 2022 08:08:08 -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 1ozHO6-0000ZT-Sl for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 08:08: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 1ozHO6-0000Nh-KQ for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 08:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozHO6-0004WR-Fd for bug-gnu-emacs@gnu.org; Sun, 27 Nov 2022 08:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Nov 2022 13:08: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.166955444317376 (code B ref 59477); Sun, 27 Nov 2022 13:08:02 +0000 Original-Received: (at 59477) by debbugs.gnu.org; 27 Nov 2022 13:07:23 +0000 Original-Received: from localhost ([127.0.0.1]:42261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozHNT-0004WC-Fh for submit@debbugs.gnu.org; Sun, 27 Nov 2022 08:07:23 -0500 Original-Received: from mail-lf1-f46.google.com ([209.85.167.46]:47060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozHNQ-0004W4-Vo for 59477@debbugs.gnu.org; Sun, 27 Nov 2022 08:07:21 -0500 Original-Received: by mail-lf1-f46.google.com with SMTP id bp15so13496639lfb.13 for <59477@debbugs.gnu.org>; Sun, 27 Nov 2022 05:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=QfDgMTcCpg5nbWsoc9TEEWw547L19XZ77OFuDtrwT28=; b=mqF6H9/ASNGK+0Pc7r+CdKI2tZvF4qTNG2tMKH+uJPOEXYet5ZX/YQQ50JnXbqSpPh 43QPyRyzYdQ/a8dUo3tfaOU84c4xFo71rohl/QB43RLxUx74bE0ewdmG7Eic8WlVlVrK u6OY75DMJcMSxbX0U6PH1EsIticAqXyLxGs4eTnpQMg0iQtaDwBx+nHKZKZc4jBvGrmH Ctx21A5GIRiyJtfyc4yRw1h4uRnFO+PJfScTsBzN8eZIGFnhMZRBeI1C8naKmiI40Jxm WysBk5FuLRqpvu7x3nAVzu37ixFiv7LXkEUPavzB9/gDESnP346TrRYsEKnSzvDu//Tm ElOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QfDgMTcCpg5nbWsoc9TEEWw547L19XZ77OFuDtrwT28=; b=QDq1mkoz8tssm2h7NmUARIJcsb1aSHXv5eIszneS1o2OiFT+CrJN35817aQSF+XMJ7 Elr1vtwM+r7QonK3FJ6RicdZ3m4E3Pka5SUHs09BXf4oMf5nu3ipJO/u0HMme5kjV4mT 2YTE86IKItDdcHIZ0tKjpmNggTnk043Vuhs0DM7+MtBHwVXLK5Iw3d62IBj/mtgzOn4n k3sAMnUMocm2HZYtFiByaZR615rAZBiRQXrnkvs0qzaU7EGXa+LcKIPztS4YwYdYKnNx xlow+yskYi1CkBvoJ+ompvltQel22BJBGQc2H8H97UgvU24aqiSS78PWSf85IKEvvw4Z gSxA== X-Gm-Message-State: ANoB5pmufs8d8j7SwcaRYK5KmhIgKgaFxDPRD/4QAh2D2JGbPIFeaW1S aKPHDHcMoC+K0TRmWJjfLco= X-Google-Smtp-Source: AA0mqf55JUXQSfmYn4w2fIOd2/loHoAjAMMF/RCm4UHp1tr8vNXZkgW8N0O1PSvtk7QAuyrpJxlIqg== X-Received: by 2002:ac2:54a8:0:b0:494:7541:9dee with SMTP id w8-20020ac254a8000000b0049475419deemr14718231lfk.680.1669554434721; Sun, 27 Nov 2022 05:07:14 -0800 (PST) Original-Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se. [188.150.171.209]) by smtp.gmail.com with ESMTPSA id 9-20020a2eb949000000b002797e41e1bdsm927293ljs.86.2022.11.27.05.07.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2022 05:07:14 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.13) 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:249210 Archived-At: --Apple-Mail=_F22C6DB0-32CE-403E-9466-317663A9B62D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 26 nov. 2022 kl. 23.18 skrev Yuan Fu : > 1. Setting require-final-newline to t doesn=E2=80=99t work As expected; it's not relevant here. > 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 Yes, because you then reuse an old buffer that already has local = variables set. I'm tempted to push this patch that sinks the call to = python-indent-guess-indent-offset so that it comes last in mode = initialisation, as discussed in my previous message. Any objection? As mentioned, I'm not sure it really addresses the root problem but at = least it should be no worse than before the changes that broke the test. --Apple-Mail=_F22C6DB0-32CE-403E-9466-317663A9B62D Content-Disposition: attachment; filename=python-mode.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="python-mode.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index acfee21135..fc80c755e4 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6584,9 +6584,6 @@ python-base-mode (make-local-variable 'python-shell-internal-buffer) - (when python-indent-guess-indent-offset - (python-indent-guess-indent-offset)) - (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) ;;;###autoload @@ -6605,7 +6602,11 @@ python-mode python-syntax-propertize-function) (setq-local imenu-create-index-function #'python-imenu-create-index) - (add-hook 'which-func-functions #'python-info-current-defun nil t)) + + (add-hook 'which-func-functions #'python-info-current-defun nil t) + + (when python-indent-guess-indent-offset + (python-indent-guess-indent-offset))) ;;;###autoload (define-derived-mode python-ts-mode python-base-mode "Python" @@ -6625,7 +6626,10 @@ python-ts-mode #'python-imenu-treesit-create-index) (setq-local treesit-defun-type-regexp (rx (or "function" "class") "_definition")) - (treesit-major-mode-setup))) + (treesit-major-mode-setup) + + (when python-indent-guess-indent-offset + (python-indent-guess-indent-offset)))) ;;; Completion predicates for M-x ;; Commands that only make sense when editing Python code --Apple-Mail=_F22C6DB0-32CE-403E-9466-317663A9B62D--