From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Deneb Meketa Newsgroups: gmane.emacs.bugs Subject: bug#20860: python.el's fill-paragraph incorrectly handles doc-strings with long first lines Date: Mon, 19 Apr 2021 17:12:24 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000019ca7405c05c4fc1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6667"; mail-complaints-to="usenet@ciao.gmane.io" To: 20860@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 20 02:43:10 2021 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 1lYeTu-0001cQ-Oj for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Apr 2021 02:43:10 +0200 Original-Received: from localhost ([::1]:36942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYeTt-0005tb-Qy for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Apr 2021 20:43:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYeTm-0005tG-6f for bug-gnu-emacs@gnu.org; Mon, 19 Apr 2021 20:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40861) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYeTl-0001gN-VH for bug-gnu-emacs@gnu.org; Mon, 19 Apr 2021 20:43:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYeTl-0006g7-Rx for bug-gnu-emacs@gnu.org; Mon, 19 Apr 2021 20:43:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Deneb Meketa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Apr 2021 00:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20860 X-GNU-PR-Package: emacs Original-Received: via spool by 20860-submit@debbugs.gnu.org id=B20860.161887934825621 (code B ref 20860); Tue, 20 Apr 2021 00:43:01 +0000 Original-Received: (at 20860) by debbugs.gnu.org; 20 Apr 2021 00:42:28 +0000 Original-Received: from localhost ([127.0.0.1]:52407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYeTC-0006f9-8j for submit@debbugs.gnu.org; Mon, 19 Apr 2021 20:42:28 -0400 Original-Received: from mail-qk1-f172.google.com ([209.85.222.172]:33282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYe0n-0003oV-Rw for 20860@debbugs.gnu.org; Mon, 19 Apr 2021 20:13:07 -0400 Original-Received: by mail-qk1-f172.google.com with SMTP id o5so37792624qkb.0 for <20860@debbugs.gnu.org>; Mon, 19 Apr 2021 17:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pixar.com; s=google; h=mime-version:from:date:message-id:subject:to; bh=CigtBktM2vM2VMV+DfqFzm+AYW4Q1JBcXTvPWY+fuT4=; b=clnVFsFqbZwPKcrl39rjcTW06+ScVMAsSt4z7x7NBe/ojYK0dQBFaFpWVJt51jKhVK Tshv8rLc8garLMhgl1FJi255iJKo0Z4JAoIoN/DLKbW9ly2yqbjcuYBqFe+R10l2NZ2l qLkMnq/s2DQMmc6mkqDqdKQgmHAOXE3tGDi1Wqi/nvOfemMsy0Y8OgJqD8YSJbBOdTU9 7PXCf6+lpiQ31VCnr9qg20Z10MCvJeWBDxv1UUrcmhwOdKHnuQycp/0GDCqx7rrE1EtE c+4LCQYyBY6GqJ1+WdrZn4hUCSb8rqPruntpqtlvCOBAml7E8cVne8PHr9ff0WJnsZ8F bpQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=CigtBktM2vM2VMV+DfqFzm+AYW4Q1JBcXTvPWY+fuT4=; b=nZw93o5zdwjuAvto9ILs1Iv3Z4nY0+fwuE1mOeLUgdLB9dk01T6NbT2Sjm2oOTdxnN WVU5mu87p8eqvs4IUfziTwIeIDbDyYvrg6kz88gCvknGRzIKF2O4qgsKLCPBUDzQ32gG cIgndqv64Ek3jsa/PAnPK5CaCVI9s6oZ3kcdCVzx/D2guX6VRUWPYGYTQdweFasW7l12 AeWfPj0KtTJoV8EzATuRbhmQHd18gZzZTrsuIK8i41Le0SQjy/9ozHQh98JqBdmYrGVe ylyxoKDj9mdluO57pcC44XFxm5x3g5lf1hE5fT5G4KsSF7mZC9RnWuetAIMOr3OGLG+t 88dw== X-Gm-Message-State: AOAM532KDVeWiKR600od7Rm7k+F8EaHSlPcUCOA5DSHvJoWhCJywa9bM ma8uJvQ1IfdU+nYR/4JruKT6YbzUFedTFZfAipxvfWaprJhMDg== X-Google-Smtp-Source: ABdhPJwHMz0IivO2CB7YHxp2lcKK7zBK694oWXyziHAMd06d5+qvRE8ez8q+ZgAYOPz/2ElngMvTaOccaT2x/XjrzQQ= X-Received: by 2002:ae9:ef43:: with SMTP id d64mr6473643qkg.429.1618877580154; Mon, 19 Apr 2021 17:13:00 -0700 (PDT) X-Mailman-Approved-At: Mon, 19 Apr 2021 20:42:24 -0400 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" Xref: news.gmane.io gmane.emacs.bugs:204520 Archived-At: --00000000000019ca7405c05c4fc1 Content-Type: multipart/alternative; boundary="00000000000019ca7205c05c4fbf" --00000000000019ca7205c05c4fbf Content-Type: text/plain; charset="UTF-8" Attached please find a patch for consideration. I also ran into this issue, and found this fix. When we narrow to perform the main fill, we need to preserve the entire first line. Otherwise the fill operation won't see the beginning of the first line; it will think that line begins at the opening quote, and thus will allow the first line to be longer than it should. I have tested this in 26.1 with docstrings and ordinary strings, single and triple quotes, auto-fill and fill-paragraph, docstring styles pep-257 and django. As far as I can tell, this function has not changed since 26.1. Proposed commit message: Python: fix overlong first line in string fill. When we narrow to perform filling, make sure to include the entire first line in the narrowed view. Otherwise the fill doesn't work correctly. --00000000000019ca7205c05c4fbf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Attached please find a patch for consideration.

I also ran into this issue, and found this fix.=C2=A0 When we narr= ow to perform the main fill, we need to preserve the entire first line.=C2= =A0 Otherwise the fill operation won't see the beginning of the first l= ine; it will think that line begins at the opening quote, and thus will all= ow the first line to be longer than it should.

I h= ave tested this in 26.1 with docstrings and ordinary strings, single and tr= iple quotes, auto-fill and fill-paragraph, docstring styles pep-257 and dja= ngo.=C2=A0 As far as I can tell, this function has not changed since 26.1.<= /div>

Proposed commit message:

= Python: fix overlong first line in string fill.

When we narrow to perform filling, make sure to include the entire= first line in
the narrowed view.=C2=A0 Otherwise the fill doesn't w= ork correctly.

--00000000000019ca7205c05c4fbf-- --00000000000019ca7405c05c4fc1 Content-Type: text/x-patch; charset="US-ASCII"; name="emacs-bug20860.patch" Content-Disposition: attachment; filename="emacs-bug20860.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_knp9d15p0 LS0tIHB5dGhvbi5PTEQuZWwJMjAyMS0wNC0xOSAxNjoxODozOS44NDA1MjgwMDAgLTA3MDAKKysr IHB5dGhvbi5ORVcuZWwJMjAyMS0wNC0xOSAxNjoyMjozNy44NzQ0MzkwMDAgLTA3MDAKQEAgLTM5 NDUsMTYgKzM5NDUsMjEgQEAgKGRlZnVuIHB5dGhvbi1maWxsLXN0cmluZyAoJm9wdGlvbmFsIGp1 cwogICAgICAgICAgIChzZXQtbWFya2VyCiAgICAgICAgICAgIChtYWtlLW1hcmtlcikKICAgICAg ICAgICAgKG9yIChweXRob24tc3ludGF4LWNvbnRleHQgJ3N0cmluZykKICAgICAgICAgICAgICAg IChhbmQgKGVxdWFsIChzdHJpbmctdG8tc3ludGF4ICJ8IikKICAgICAgICAgICAgICAgICAgICAg ICAgICAgIChzeW50YXgtYWZ0ZXIgKHBvaW50KSkpCiAgICAgICAgICAgICAgICAgICAgIChwb2lu dCkpKSkpCiAgICAgICAgICAobnVtLXF1b3RlcyAocHl0aG9uLXN5bnRheC1jb3VudC1xdW90ZXMK ICAgICAgICAgICAgICAgICAgICAgICAoY2hhci1hZnRlciBzdHItc3RhcnQtcG9zKSBzdHItc3Rh cnQtcG9zKSkKKyAgICAgICAgIChzdHItbGluZS1zdGFydC1wb3MKKyAgICAgICAgICAoc2F2ZS1l eGN1cnNpb24KKyAgICAgICAgICAgIChnb3RvLWNoYXIgc3RyLXN0YXJ0LXBvcykKKyAgICAgICAg ICAgIChiZWdpbm5pbmctb2YtbGluZSkKKyAgICAgICAgICAgIChwb2ludC1tYXJrZXIpKSkKICAg ICAgICAgIChzdHItZW5kLXBvcwogICAgICAgICAgIChzYXZlLWV4Y3Vyc2lvbgogICAgICAgICAg ICAgKGdvdG8tY2hhciAoKyBzdHItc3RhcnQtcG9zIG51bS1xdW90ZXMpKQogICAgICAgICAgICAg KG9yIChyZS1zZWFyY2gtZm9yd2FyZCAocnggKHN5bnRheCBzdHJpbmctZGVsaW1pdGVyKSkgbmls IHQpCiAgICAgICAgICAgICAgICAgKGdvdG8tY2hhciAocG9pbnQtbWF4KSkpCiAgICAgICAgICAg ICAocG9pbnQtbWFya2VyKSkpCiAgICAgICAgICAobXVsdGktbGluZS1wCiAgICAgICAgICAgOzsg RG9jc3RyaW5nIHN0eWxlcyBtYXkgdmFyeSBmb3Igb25lbGluZXJzIGFuZCBtdWx0aS1saW5lcnMu CkBAIC0zOTY4LDE3ICszOTczLDE3IEBAIChkZWZ1biBweXRob24tZmlsbC1zdHJpbmcgKCZvcHRp b25hbCBqdXMKICAgICAgICAgICAgIDs7IGdyYXBoaWMgaWRlYSBvZiBlYWNoIHN0eWxlLgogICAg ICAgICAgICAgKGBkamFuZ28gKGNvbnMgMSAxKSkKICAgICAgICAgICAgIChgb25ldHdvIChhbmQg bXVsdGktbGluZS1wIChjb25zIDEgMikpKQogICAgICAgICAgICAgKGBwZXAtMjU3IChhbmQgbXVs dGktbGluZS1wIChjb25zIG5pbCAyKSkpCiAgICAgICAgICAgICAoYHBlcC0yNTctbm4gKGFuZCBt dWx0aS1saW5lLXAgKGNvbnMgbmlsIDEpKSkKICAgICAgICAgICAgIChgc3ltbWV0cmljIChhbmQg bXVsdGktbGluZS1wIChjb25zIDEgMSkpKSkpCiAgICAgICAgICAoZmlsbC1wYXJhZ3JhcGgtZnVu Y3Rpb24pKQogICAgIChzYXZlLXJlc3RyaWN0aW9uCi0gICAgICAobmFycm93LXRvLXJlZ2lvbiBz dHItc3RhcnQtcG9zIHN0ci1lbmQtcG9zKQorICAgICAgKG5hcnJvdy10by1yZWdpb24gc3RyLWxp bmUtc3RhcnQtcG9zIHN0ci1lbmQtcG9zKQogICAgICAgKGZpbGwtcGFyYWdyYXBoIGp1c3RpZnkp KQogICAgIChzYXZlLWV4Y3Vyc2lvbgogICAgICAgKHdoZW4gKGFuZCAocHl0aG9uLWluZm8tZG9j c3RyaW5nLXApIHB5dGhvbi1maWxsLWRvY3N0cmluZy1zdHlsZSkKICAgICAgICAgOzsgQWRkIHRo ZSBudW1iZXIgb2YgbmV3bGluZXMgaW5kaWNhdGVkIGJ5IHRoZSBzZWxlY3RlZCBzdHlsZQogICAg ICAgICA7OyBhdCB0aGUgc3RhcnQgb2YgdGhlIGRvY3N0cmluZy4KICAgICAgICAgKGdvdG8tY2hh ciAoKyBzdHItc3RhcnQtcG9zIG51bS1xdW90ZXMpKQogICAgICAgICAoZGVsZXRlLXJlZ2lvbiAo cG9pbnQpIChwcm9nbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHNraXAtc3lu dGF4LWZvcndhcmQgIj4gIikK --00000000000019ca7405c05c4fc1--