From unknown Sun Jun 22 04:34:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#56135: 29.0.50; python.el - forward-sexp regression over triple-quoted strings Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: joaotavora@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2022 06:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56135 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 56135@debbugs.gnu.org Cc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Received: via spool by submit@debbugs.gnu.org id=B.165588066825873 (code B ref -1); Wed, 22 Jun 2022 06:52:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Jun 2022 06:51:08 +0000 Received: from localhost ([127.0.0.1]:33837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3uCg-0006jC-Hy for submit@debbugs.gnu.org; Wed, 22 Jun 2022 02:51:08 -0400 Received: from lists.gnu.org ([209.51.188.17]:34278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o3uCU-0006iW-3g for submit@debbugs.gnu.org; Wed, 22 Jun 2022 02:51:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3uCS-0004ee-A9 for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 02:50:53 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:40944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3uCP-0001Q0-HB for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 02:50:52 -0400 Received: by mail-wr1-x42f.google.com with SMTP id w17so21926884wrg.7 for ; Tue, 21 Jun 2022 23:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=vmvO4YIWSb4wvPCs7hQlZo/Wgpa7VZ5b57IS8Lt2h1w=; b=f0Z0m2T68AvlUXQXrMYgbv8fYq5nGtA2soHmBgxq39Lmfx6eU3aYXtJfhojqDoE0sO swcbxYxWeyCeTryCNj5L/rAKxxgxgt7nasJaTEilxdDigBsvtXDBtpBw/sGdJrDygCst 5q07Mln4jlTb5uoVFE0w7M9QcgHJgoixAZomDCKJHPqqIVv6vO9feqFeaKkaJrpTUZah bSp9wxFpki+IMn9yzAVVF4AK3v5ZIvkhwNQ8THDImHTE/JyHtn5BDMKM6LQJjMEIDUAu ElvGkIU/Ybzs9F+E6k0gzLObbdb9g1bLttTVx2S+Q/Jo/6zN+Tn727NXRXHg5I1ZVOZb anXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=vmvO4YIWSb4wvPCs7hQlZo/Wgpa7VZ5b57IS8Lt2h1w=; b=bNTKbChQK+cMr/WyIBNAZ4JWd44A2v2iKhAgc2IlOz3044xczglL6AXw6wv31XZBFq Mx0LmzBFEPRUXLwmvBmKLtkzI2qzEZfpH6/i8ism3geA2H7XdYpQ96pP5tsQfK1zNI3w xCjOFzrNXi0O5Hq3jrlbYPw+LJtG/rnmFcb8KPUriewy0/SmRMmxoTacLyzbU1GXJX5D zjdvodsJaJm0muQRnwOS13lcltOvP1Rcn5CpIgGLdM7+wOLo85xYwtwRIJiAKTo0WFsA pB1Ry6wix8S1keQuFfDL5XPML8xbjwQqhY5teMg5itAqu+uDG9XA7bR8XadsrPcWiLTI 0OUg== X-Gm-Message-State: AJIora9LQ6cGyCeNZHJVTZo9Eq6uDnsAqOUAhEy6enTEKYUpJ8Jxi33W lm6+7F2RIQinLowU3F6fotuyHZRC30o= X-Google-Smtp-Source: AGRyM1ve2ZqMNbxbsVa9M44NybluVKAGAuJLwoLyERR9URR58K+H/xrf9fztSn26i3gcLaKdJ1xSDg== X-Received: by 2002:adf:f84a:0:b0:21b:88b8:183 with SMTP id d10-20020adff84a000000b0021b88b80183mr1671745wrq.265.1655880646235; Tue, 21 Jun 2022 23:50:46 -0700 (PDT) Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id e1-20020a5d5941000000b0020c5253d907sm18142049wri.83.2022.06.21.23.50.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 23:50:45 -0700 (PDT) From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Date: Wed, 22 Jun 2022 08:50:44 +0200 Message-ID: <875yktgpiz.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! I believe this commit: 2021-09-21 "Make syntax-ppss more accurate for Python triple quotes (bug#49518)" (0646c68171) =E2=80=A6 introduced a regression for users who set python-forward-sexp-fun= ction to nil (or users who set forward-sexp-function buffer-locally, as was suggested by python.el's commentary before Emacs 28.1). To reproduce: $ echo '"""Quotes for days"""' > repro.py $ emacs -Q -eval '(setq python-forward-sexp-function nil)' repro.py ; C-M-f - Point should move to position 22, - As of the above commit, it lies at position 3. (Note: if one visits the file before setting the user option, the setting will not be taken into account; to reproduce, one should then either set forward-sexp-function directly, or revert the buffer) I've attached an ert test for this recipe; it passes when run against 0646c68171^ (i.e. the parent commit) and fails as of 0646c68171. I haven't started to dig into what the change meant to fix, so I cannot say whether TRT would be to keep the change and improve on it or revert the change and fix the original problem some other way. Let me know if I can assist further; thanks for your time. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ert-python-forward-sexp.patch diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index e17bc0df92..7243eb0e59 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -2763,6 +2763,13 @@ python-nav-forward-sexp-safe-1 (python-nav-forward-sexp-safe 1) (should (looking-at "$")))) +(ert-deftest python-nav-forward-sexp-nil () + (let ((python-forward-sexp-function nil)) + (python-tests-with-temp-buffer + "'''A docstring.'''" + (forward-sexp nil t) + (should (= (point) 19))))) + (ert-deftest python-nav-up-list-1 () (python-tests-with-temp-buffer " --=-=-= Content-Type: text/plain In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-05-08 built on amdahl30 Repository revision: e8ed4317e879683872d956cc919d0957fff18531 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: openSUSE Tumbleweed Configured using: 'configure --with-cairo --with-gconf --with-sqlite3 --with-xinput2' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=local locale-coding-system: utf-8-unix --=-=-=-- From unknown Sun Jun 22 04:34:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#56135: 29.0.50; python.el - forward-sexp regression over triple-quoted strings Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2022 22:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56135 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec , 56135@debbugs.gnu.org Cc: Stefan Monnier Received: via spool by 56135-submit@debbugs.gnu.org id=B56135.16559363409077 (code B ref 56135); Wed, 22 Jun 2022 22:19:01 +0000 Received: (at 56135) by debbugs.gnu.org; 22 Jun 2022 22:19:00 +0000 Received: from localhost ([127.0.0.1]:36799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o48ga-0002MJ-Oh for submit@debbugs.gnu.org; Wed, 22 Jun 2022 18:18:59 -0400 Received: from mail-ot1-f44.google.com ([209.85.210.44]:38413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o48gL-0002Ls-9B for 56135@debbugs.gnu.org; Wed, 22 Jun 2022 18:18:55 -0400 Received: by mail-ot1-f44.google.com with SMTP id c3-20020a9d6843000000b0060c2c63c337so14108920oto.5 for <56135@debbugs.gnu.org>; Wed, 22 Jun 2022 15:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wSAaXgrS88VWgRKdUnfqQYzasnYdcRC1oQrVgm03Wu4=; b=ldu7oIGVi+bUfb7gD2vlJP/ghafTQYhCUHfRgHWi5DTyfexV36eG3wSkq6EEwjjZOH YFmMbqH2x86ak5OD+fJJUSw49LUXNoMGp/bZc3lL3PpTGE391poh5Yo9t47tYzWxDQIE gNYR9qOdsXbEWDcR80WV5KCqJaoBlbl/h01VXf5XtXDr4RBR1fdRKn00fjDx/dqDDyfy X3cCL64K2+A+P350FGW1AGrJY65p3j1kxVvkTZwQLRjjHiBvyHGCKhLMVwqH+jTKI4Gw o9upbhKomtSk65KM8wzVVz28ZN7xJNwuh0eeZ7R4olyq7MLhK3L+ZX1VUfL1/PbEXlId qFpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wSAaXgrS88VWgRKdUnfqQYzasnYdcRC1oQrVgm03Wu4=; b=CeTN4OohedMaOrwS26WTI2ZGJW5JblpNJX+XMR2FweWd4FuULMQSCPe+CLTsQrjgHH PtpWX9CLaB4BTQrBBz+qPVyEl09m9NNCr1K2jcJrsrqLKnjkhCW4OZDJ7DB8tVjFp3Qg 7NLbqG+FUOtUpurAMxZUHbEA/EuzoNpgx8q2iIaf98v1CBXHgBfSSxlBCO2PgoTqNNYF ZqcBISuKCoucfzeZwIBnXuffk1iPNTSyJTbiguRFNsvCw8N7MOxoL5AoYSzNlM/VAWmv UJ7ZEaHDJQbsXIr68jaMaOZ4UyBwDhFu4NrAta3BYnK92nTkUivM0b+pl+xhEP8ECt8b ijOA== X-Gm-Message-State: AJIora9+hFsGCYA9alGWAxcC5F9BQ2Ca82WwbngiNw1ZCMyj1PvI5ooC U9OCYlNqPhK/x7N45incAR60K0UivZ66VZkCtcs= X-Google-Smtp-Source: AGRyM1tU2bbJMt16kLc/YxkplYmmomb+1Goqqz/D2OhQVPfXfPU+qIctd0MH3SObvnwsaIR0HnKOTZDwlQ4qWkYDI0k= X-Received: by 2002:a05:6830:18d1:b0:60b:f82f:c2f6 with SMTP id v17-20020a05683018d100b0060bf82fc2f6mr2386428ote.317.1655936315551; Wed, 22 Jun 2022 15:18:35 -0700 (PDT) MIME-Version: 1.0 References: <875yktgpiz.fsf@gmail.com> <877d58juup.fsf@gmail.com> <87y1xotlna.fsf@gmail.com> In-Reply-To: <87y1xotlna.fsf@gmail.com> From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Date: Wed, 22 Jun 2022 23:19:40 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000dbf59405e210b7f3" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000dbf59405e210b7f3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 22, 2022 at 10:48 PM K=C3=A9vin Le Gouguec wrote: > K=C3=A9vin Le Gouguec writes: > > > Jo=C3=A3o T=C3=A1vora writes: > > > >> On a very superficial analysis, I would say you're _not_ experiencing = a > >> bug, because setting the f-sexp-f to nil buffer-locally would mean > >> you don't want any python-specific behaviour for triple quotes. > >> > >> It might be a regression for a previous state of the working tree, but > then > >> again that state seems to have been buggy itself, undoubtedly, at leas= t > as > >> described by myself in 0646c6817139. > >> > >> Why are you setting python-forward-sexp-function to nil? > > > > [wall of text follows] > > ( > Hadn't realized we had taken this off-list. FWIW if you found all > my verbiage informative, don't hesitate to (tell me to) forward it > back on the bug tracker. > ) > Ups. That was my mistake. Wondering what to do now. Should we re-send to the tracker. Or let future generations wonder about the missing great wall of text. Anyway, I did find your wall of text informative, particularly this point. > Wondering what the best way forward would be. Maybe a third suggested > value for python-forward-sexp-function, which would handle triple-quotes > but not add those "implicit paired delimiters"? Yes, I think this makes sense. Let's see what other think, but a patch that extracts only that bit from the current functionality and puts it in a third value would be a good idea, I think. Jo=C3=A3o --000000000000dbf59405e210b7f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Jun 22, 2022 at 10:48 PM K=C3=A9vin Le Gouguec <kevin.legouguec@gmail.com> wro= te:
K=C3=A9vin L= e Gouguec <kevin.legouguec@gmail.com> writes:

> Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> writes:
>
>> On a very superficial analysis, I would say you're _not_ exper= iencing a
>> bug, because setting the f-sexp-f to nil buffer-locally would mean=
>> you don't want any python-specific behaviour for triple quotes= .=C2=A0
>>
>> It might be a regression for a previous state of the working tree,= but then
>> again that state seems to have been buggy itself, undoubtedly, at = least as
>> described by myself in 0646c6817139.=C2=A0
>>
>> Why are you setting python-forward-sexp-function to nil?
>
> [wall of text follows]

(
=C2=A0 =C2=A0 Hadn't realized we had taken this off-list.=C2=A0 FWIW if= you found all
=C2=A0 =C2=A0 my verbiage informative, don't hesitate to (tell me to) f= orward it
=C2=A0 =C2=A0 back on the bug tracker.
)

Ups.=C2=A0 That was my mistake.=C2= =A0 Wondering what to do now.=C2=A0 Should we re-send to the
tracker.=C2=A0 Or let future generations wonder about the missing great wa= ll of text.

A= nyway, I did find your wall of text informative, particularly this point.

> Wondering what the best way for= ward would be.=C2=A0 Maybe a third suggested
> value for python-forwa= rd-sexp-function, which would handle triple-quotes
> but not add thos= e "implicit paired delimiters"?

Yes, I t= hink this makes sense.=C2=A0 Let's see what other think, but a patch
that extracts only that bit from the current functionality and puts= it in
a third value would be a good idea, I think.

Jo=C3=A3o
--000000000000dbf59405e210b7f3-- From unknown Sun Jun 22 04:34:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#56135: 29.0.50; python.el - forward-sexp regression over triple-quoted strings Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jun 2022 06:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56135 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Cc: 56135@debbugs.gnu.org, Stefan Monnier Received: via spool by 56135-submit@debbugs.gnu.org id=B56135.165596698117287 (code B ref 56135); Thu, 23 Jun 2022 06:50:02 +0000 Received: (at 56135) by debbugs.gnu.org; 23 Jun 2022 06:49:41 +0000 Received: from localhost ([127.0.0.1]:37069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Ger-0004Uj-8T for submit@debbugs.gnu.org; Thu, 23 Jun 2022 02:49:41 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:40467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Geo-0004UT-PQ for 56135@debbugs.gnu.org; Thu, 23 Jun 2022 02:49:40 -0400 Received: by mail-wr1-f51.google.com with SMTP id w17so26477217wrg.7 for <56135@debbugs.gnu.org>; Wed, 22 Jun 2022 23:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=4u4djkCGrvtt7yXVNhyULhDMUgI4N66Qv1OF6av6L0s=; b=h4FrVk18d0SE1RdUo9XjR9mjqFQJ2DT/5dqS+hAbh9yhl1v9i2mPUcJqQbNCyOx90Y C10qQDJpmVOwqPtv5KGcQNz44iOlkhxV48o+xewE3qc74EC2ZAl1kADOoRuNUsckWFS6 ut9bT9kb8vThfUe1fTw/JnwGyFWKE62OjKpLkHn5sVWFQ/v668rdXTOBT0Zy19hhwnyM PBlez1BpY8f1EBoMQycTwE91FCm7XHd0LcuYLlU9jLqpJ/cnKe8aTXIocu3dyHLAe0Al WXrYBxHvbJEACYS6M47Tvq29DTLS20YqZQcd4F/8dtIGYxFDtDJjF3wWbcY3WCd4QJBB VGeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=4u4djkCGrvtt7yXVNhyULhDMUgI4N66Qv1OF6av6L0s=; b=gIazW2Djjwt82Ihtx8VFCW6zCQo+jhu4aWNlAdnPxaL9RpCTUZdDsrFr27BNigLk2H agAkxE+IyrvWOpb+EKKrhOnsRK75WSntTHWIQQLv26h4trs93PYKyiacYddJuVTCUQiG iBHg05rt8VpYSs9IyR0asEahMSo8zId6Uwy2xnh9lWkVW2GbSrHC8oY7kGg7WQ1xbyTg J1fd1XQmJXa4rvvoxyWVqBKzz6kErNv1uaur37l5nxK77U7UmPeS6j6I5XucsCO0XpYb cHnC4+wqDGmtfQO1t+t5OBPH8z+t7Ipwws/12DilJZMXjCW69Gic9OEAl3lzKejb/l+n w2AA== X-Gm-Message-State: AJIora9FKipHhj/8J5cb1I6sYPPxwjN9DDNln76UTsqY5ntAjsNeY/GK +ShfTf3qPzWul4ua0hDEsC0= X-Google-Smtp-Source: AGRyM1sGolw77AdKscD4oCVFZAfgBiWNgxfImlVDppS80nqoUDli2i3p+1Se6Ly6rMNvKq21F3G7dQ== X-Received: by 2002:a5d:4e47:0:b0:21a:39fd:5bb5 with SMTP id r7-20020a5d4e47000000b0021a39fd5bb5mr6608301wrt.712.1655966972677; Wed, 22 Jun 2022 23:49:32 -0700 (PDT) Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id o19-20020a05600c511300b0039c7dbafa7asm1970022wms.19.2022.06.22.23.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 23:49:32 -0700 (PDT) From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec References: <875yktgpiz.fsf@gmail.com> <877d58juup.fsf@gmail.com> <87y1xotlna.fsf@gmail.com> Date: Thu, 23 Jun 2022 08:49:31 +0200 In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 22 Jun 2022 23:19:40 +0100") Message-ID: <87fsjv27t0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Jo=C3=A3o T=C3=A1vora writes: > On Wed, Jun 22, 2022 at 10:48 PM K=C3=A9vin Le Gouguec wrote: > > K=C3=A9vin Le Gouguec writes: > > > Jo=C3=A3o T=C3=A1vora writes: > > > >> Why are you setting python-forward-sexp-function to nil? > > > > [wall of text follows] > > ( > Hadn't realized we had taken this off-list. FWIW if you found all > my verbiage informative, don't hesitate to (tell me to) forward it > back on the bug tracker. > ) > > Ups. That was my mistake. Wondering what to do now. Should we re-send = to the=20 > tracker. Or let future generations wonder about the missing great wall o= f text. =F0=9F=98=81 I'll forward it in a separate message, in case someone finds o= ther points to bounce off of. > Anyway, I did find your wall of text informative, particularly this point. > >> Wondering what the best way forward would be. Maybe a third suggested >> value for python-forward-sexp-function, which would handle triple-quotes >> but not add those "implicit paired delimiters"? > > Yes, I think this makes sense. Let's see what other think, but a patch > that extracts only that bit from the current functionality and puts it in= =20 > a third value would be a good idea, I think. Mm. I've stepped through python-nav--forward-sexp with Edebug, and there wasn't any obvious "triple-quote handler" to extract. IIUC * being on either end of a triple-quote block satisfies python-info-{beginning,end}-of-statement-p, so 'context' becomes 'statement-{start,end}, * (then we dance a little gigue to compute next-sexp-{context,pos}, which we do not end up using in this scenario,) * eventually we call python-nav-{end,beginning}-of-statement. So the "magic" happens in those functions IIUC. E.g. in python-nav-end-of-statement we either=20 * skip the whole cond form because the initial (goto-char (line-end-position)) took us at EOL after a single-line string, or=E2=80= =A6 * go down the (setq string-start (python-syntax-context 'string)) path for multiline strings, or=E2=80=A6 * =E2=80=A6 oh! Mm, well, here's a bug maybe? Consider: """string 1""" def foo(): """string 2 (multiline). """ print("""string 3""") ^ So *with python-forward-sexp-function set to its default value* (python-nav-forward-sexp), with point on the ^ mark (at the beginning of """string 3"""), * before commit 0646c68, C-M-f moved to the end of """string 3""", * now it just moves over one pair of quotes. (Feel like I should note that single-line triple-quoted strings have their uses FWIW, since they let one write single and double quotes into the string without the need to backslash-escape them) I see that the new commentary in python-syntax-stringify addresses this, I guess? > ;; FIXME: This makes sexp-movement a bit suboptimal since """a"= "" > ;; is now treated as 3 strings. So AFAICT while the change meant to improve the situation with electric-pair-mode (which I'm grateful for, since I'm a happy user of that minor mode), it did make sexp-movement a bit more "janky" (meaning "hard to predict and rely on", no offense meant), *regardless* of whether users (un)set (python-)forward-sexp-function =F0=9F=98=95 From unknown Sun Jun 22 04:34:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#56135: =?UTF-8?Q?[K=C3=A9vin?= Le Gouguec] Re: bug#56135: 29.0.50; python.el - forward-sexp regression over triple-quoted strings References: <875yktgpiz.fsf@gmail.com> In-Reply-To: <875yktgpiz.fsf@gmail.com> Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Jun 2022 06:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56135 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 56135@debbugs.gnu.org Received: via spool by 56135-submit@debbugs.gnu.org id=B56135.165596723217713 (code B ref 56135); Thu, 23 Jun 2022 06:54:02 +0000 Received: (at 56135) by debbugs.gnu.org; 23 Jun 2022 06:53:52 +0000 Received: from localhost ([127.0.0.1]:37084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Git-0004bb-QC for submit@debbugs.gnu.org; Thu, 23 Jun 2022 02:53:52 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:53761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Giq-0004bM-Jn for 56135@debbugs.gnu.org; Thu, 23 Jun 2022 02:53:50 -0400 Received: by mail-wm1-f52.google.com with SMTP id z9so10434893wmf.3 for <56135@debbugs.gnu.org>; Wed, 22 Jun 2022 23:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=GXvJHKyAJB+ReLW2CpAExBHcdQe1B9z3H5xgiVZcr20=; b=I14rITXpVUUJEGiFRjwq7iegGaQFi8uLAsnDNICyyy6mLuuymTRAXzO/b1EvUaIvRm OD3qWQ0IAvWD/ZEMjQeKutdglQcECgulxO1vmEvNfqYjeceCj1vu4V/YZlwpPMfa4JB2 NIfLqekeO+DV8NSdDkJIVf9kP3IimQaLxYsDz0YN6DakCPfz5qXCbnKiYTBd5MXAL/xV Qw10kd7flLfaxawjxll8ulO3EcNAtAxlmj4fOiZ8h2qzf6JeSj89oIRI939pn5boVr4e V/Xt1A5PQwsRfY7UWCm1JQfz6xa91TGNhhfI8GGFjDyDccLKtAQH4DQoM5SuQhFBOx2w qkoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=GXvJHKyAJB+ReLW2CpAExBHcdQe1B9z3H5xgiVZcr20=; b=I7P9DRzPd8scs102I7bzeKZCdcevcFe5XJ32NT6m+UVH82+GtNcKkGtzxxvMFtCnwZ pTBTJ8bA5LkpVMTPi7pWtu+wnOKPBVtRJYBfi6iH+e++Crl4oO8uc71vXFZSC2xh/M8t vN3+laB6kDkZPPbEb61WcvWOXScCYl1G3f7gkt0IrQRbgM3U69tbtKrqeD2ektytTyUc AfLoNfIWa4qiNw70uBhCEM0px7amzYHzBUxpe/q/+ZpVqSb3V/HAyWiE8f1jXg8tDDJe 0aGhJ5mF7B7wZtQ0DqnV4sBCtJlEPUB727JDkvwAHyIKhtMnWBccrRAX11NlhrR1k4A2 MLTw== X-Gm-Message-State: AJIora95bRVK2CoaFLsPxdI9ACmxLlgpwTddJXN+CzAIY5Jgq2DQruBX SRBfxZsSUPZTjXjklU76Xb5fHYdBEjw= X-Google-Smtp-Source: AGRyM1vrpEHLeo6V4q81rUKc67vVuMSYlvT3hvcPLve8qVNsc6JETCmJjhj/EOtJbTRSJTawVSyJFQ== X-Received: by 2002:a05:600c:286:b0:3a0:30f8:8a43 with SMTP id 6-20020a05600c028600b003a030f88a43mr1562138wmk.90.1655967222598; Wed, 22 Jun 2022 23:53:42 -0700 (PDT) Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id l35-20020a05600c1d2300b0039c95b31e66sm1911419wms.31.2022.06.22.23.53.41 for <56135@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 23:53:42 -0700 (PDT) From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Date: Thu, 23 Jun 2022 08:53:41 +0200 Message-ID: <87bkuj27m2.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) (Off-list message that Jo=C3=A3o already replied to in ; re-sent for archival) -------------------- Start of forwarded message -------------------- From: K=C3=A9vin Le Gouguec To: Jo=C3=A3o T=C3=A1vora Cc: Stefan Monnier Subject: Re: bug#56135: 29.0.50; python.el - forward-sexp regression over triple-quoted strings Date: Wed, 22 Jun 2022 22:39:42 +0200 Jo=C3=A3o T=C3=A1vora writes: > On a very superficial analysis, I would say you're _not_ experiencing a=20 > bug, because setting the f-sexp-f to nil buffer-locally would mean > you don't want any python-specific behaviour for triple quotes.=20=20 > > It might be a regression for a previous state of the working tree, but th= en > again that state seems to have been buggy itself, undoubtedly, at least a= s=20 > described by myself in 0646c6817139.=20=20 > > Why are you setting python-forward-sexp-function to nil? The motivation behind that user option (or the commentary suggesting to set forward-sexp-function to nil before the user option existed) is to change how python-mode's *ward-sexp commands behaves wrt blocks. Consider this function: def foo(): return bar_baz(quux, corge) By default, when point is=E2=80=A6 * at the start of "def": C-M-f moves to the end of the function (at the end of "bar_baz(quux, corge)"), * at the end of "bar_baz(quux, corge)": C-M-b moves to the beginning of the function (at the start of "def"). IOW by default python-mode uses sexp commands to move across whole blocks, even when point is on something that might be considered a sexp in other major modes (identifiers, or paired delimiters); I imagine that since Python blocks are based on whitespace rather than explicit delimiters, python-mode tries to be helpful by adding "implicit paired delimiters": (a)[b]def foo():(b) (c)return bar_baz(quux, corge)[c](a) (Read "(x) jumps to the corresponding (x)"; using [y] with square brackets to designate "destination points" for C-M-f/C-M-b that cannot be used as "source" points for C-M-b/C-M-f, since they are shadowed by (x) "source" points in the same spot) Setting (python-)forward-sexp-function to nil was the recommended way to take those implicit paired delimiters out of the equation[1]. So that was the situation before this commit, AFAICT: triple-quote docstrings did not enter the picture and even with forward-sexp-function set to nil, C-M-[bf] did TRT (skipping over them). I can readily believe that things working the way I liked was a happy accident and, on balance, your change fixed more than it broke. Wondering what the best way forward would be. Maybe a third suggested value for python-forward-sexp-function, which would handle triple-quotes but not add those "implicit paired delimiters"? FWIW my impression (from some light Googling) is that setting this option to nil (or the forward-sexp-function variable buffer-locally) is something that a fair number of python-mode users have been doing for years, without worrying about how that would impact docstring navigation. [1] Irrelevant motivation tucked under a footnote: Getting rid of the "implicit paired delimiters" suits me well, since it's easier for me to reason about: * I frequently overshoot my movement and need to hit e.g. a couple of back- commands after a string of forward- commands; python-mode's those invisible pair delimiters make {forward,backward}-sexp no longer cancel each other, which is disorienting; * if point is on a word or a paired delimiter, I expect *ward-sexp to move over that, instead of leaping over a whole block. E.g. when point is on the closing parenthesis of "bar_baz(quux, corge"): if I want to move to the start of "bar_baz", * with "traditional" sexps, it's just two C-M-b away, * with python-mode's default sexps, it's=E2=80=A6 I dunno; M-b C-M-u C-= M-b? M-m M-f C-f? It's frustrating because in any other major mode, I don't need to _stop and think_ about how to solve that puzzle; those invisible pairs force me to hold my fingers, squint and guess their position, then plan my route. I'm sure python-mode's default block movement is useful to some folks; IME I do fine with defun-movement (C-M-[ae]) or python-mode's other block commands (M-[ae]). I get more value out of C-M-[bf] by keeping them limited to identifiers and pairs. -------------------- End of forwarded message --------------------