From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#21254: 24.5; python.el: Docstring fill-paragraph not working with style pep-257-nn Date: Mon, 27 Feb 2023 11:58:48 +0100 Message-ID: References: Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25475"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) Cc: 21254@debbugs.gnu.org To: Holger Schmidt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 27 12:00:33 2023 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 1pWbFB-0006Rk-29 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Feb 2023 12:00:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWbEt-0003Xc-2R; Mon, 27 Feb 2023 06:00:20 -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 1pWbEh-0003Vg-5v for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 06:00: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 1pWbEg-0007E1-S3 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 06:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWbEg-0002Na-D9 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 06:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2023 11:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21254 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 21254-submit@debbugs.gnu.org id=B21254.16774955439037 (code B ref 21254); Mon, 27 Feb 2023 11:00:02 +0000 Original-Received: (at 21254) by debbugs.gnu.org; 27 Feb 2023 10:59:03 +0000 Original-Received: from localhost ([127.0.0.1]:46213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWbDi-0002Lg-GO for submit@debbugs.gnu.org; Mon, 27 Feb 2023 05:59:02 -0500 Original-Received: from sonic301-21.consmr.mail.ir2.yahoo.com ([77.238.176.98]:33286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWbDg-0002LA-AP for 21254@debbugs.gnu.org; Mon, 27 Feb 2023 05:59:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1677495533; bh=PCM5dxT+WaT4vJ0a9Ql8XGcsYrOBHN1YA/DN1QDMUY0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=rPb6GN3JHlf45xA4ay3/LPXe2kxQIaQSSajKD4xcpolREsmaT1Cfq6AHnDuPS9fpPTMJmIW+ZMcL0l9jhEaPZXPPeii3L0BIs48WflXUinmg8u6InrXbKmNpuH+qAo0Jg9CZPDfbb329j/xzxVJzDMYydG9EIYemJuSkC0qXtTzXyFsjQzpk8d0aM+hEnMOO0QVqE+Y1XwvH5UasKnKylHYsrGdIq3lBKVLrxj9mluT39rCxzqaeORgUU2NpcR/sajfmJtBc1PzGwWm//bkErPEGxwy4u4C3NIotuemVL9o1Rf4VK+52DIOBzxU5FTMXjjumXH7LMIdZxd4iv8dsaA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677495533; bh=RdETY980US9iLi2xjpXBTvrdjW+1bL5l1Wa8gdJCGPC=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Q67qngeI77F7yWLVnXA3yAs39OdiT0tr+W4maJyyxWvvYiP5m4RdRdlbSQDd7lPW86CyTmKkYf7nXZ5UBLEoZl6pMWd9pJO3Q57Km9so+z/0TYF4c5BzMGvztlAOjA0i4MxRL9NqZ6G/ZC2MDheEyNMNozGWLXdrKuCWdkUWs0Bc6XKyaBObMMe4lwTejstNoW2w5b0iwzu/lvQgFQXj8MOPo3V/cfRQ9ix0XewSbuXYY/Pc+d95+uKiAcrtopog8RwLPnF8lbWbOMwYYnpgExkaADtcz4SC6ocLVyYaj2TJCiGw66Dk4MC/5WShA/BI/p4JFPMYhFLrGJ1bNvGyjQ== X-YMail-OSG: Q3KU5SkVM1lOpz58r.02qI_Hj0Vb28Mkc9fpkiiySBZfug2rbwI7nc0.ZjDTs1p cwAOW9vmXi.gxdeOa6Bq2KEhOeUfyxG.6Ev9pqwn3thVKRaZOhlrlv72k56sIbnUjcGXy_fWKuBq MrbOcQqRxxVwdzOIRddU__56aG.7wk0iBNqBD4.gLuUWoJs4iy7LoRqg44aDatc28XHoSZnG99fP cCIic2YbjArFQmevQe5NL.Y7sAUVRMqEJdgfnUmUV57z6qE679NbeZrvTiVRnagG9iqKBeaG9Enn Cpm_YhyfTakvg1da42kzEQlj82K6SWR8xXvnzYYAXLvL5ofI4.7PuFh1OT2oxjCyyjDOcxvKywBu 9DSRklhv5yya7Mxp7kSJd_4gHcdSYa37BoHEjdud0VRXbZPwRGCc3hVyPExFdWUhijxzQkUPFkyL 2Z5coSTXWB0ZkR05ki4vl2n5szuOWtj.nzjJ3ohyP8NOjs_L_mtBdYeXl9P7T8Jg2ynch9a8rPTd e8J7dVDzifnU1xOTVOB3EKYGt2NgvhIfzFIMwLfQj5UYXfJdZEsooeMF8ncBqmf4Y3V4_BnSZNHW K_ZO9W8YZTQIoObwdWw3X3Xk50IU5GuP7LQTcPw_4AINclnilyGKf6bkvqcZwNKqE975l.ndnmyk AiYy6ye7IioAmjKEsQbAn3gYImSoPow45q3Ojm5kBUfMvrb1ti0MWCAQw3pfYHcgTP1Q8O0Bu4zI 1L7xN0uDkitYjmzERbdL9onjmyQiGCEVZU9p3vVsv7sugD2l9ICuoBSj0EVbml_BsrRknVxc74bj yWGNVvCqIsGTWdes6gf9B7SL1T_vaDzYcbeA6KYYe2 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Mon, 27 Feb 2023 10:58:53 +0000 Original-Received: by hermes--production-ir2-65c64dfd66-ntl7g (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 69b4903f5a46ac81a7653bb51d82b8a9; Mon, 27 Feb 2023 10:58:49 +0000 (UTC) In-Reply-To: (Holger Schmidt's message of "Thu, 13 Aug 2015 13:52:20 +0200") X-Mailer: WebService/1.1.21221 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:256865 Archived-At: Holger Schmidt writes: > I write a docstring of a class method in a buffer with Python mode. > python-fill-docstring-style is set to 'pep-257-nn. The > cursor is at the end of the docstring after the three quotes. > fill-paragraph does nothing, but it should format the docstring. > > I move the cursor inside the docstring. fill-paragraph formats the > docstring with four errors: There is no newline after the first > sentence, the first line is longer (72) than fill-column (70), the > second line and following lines are not indented (but start at column 0), > there is no newline at the end. A second fill-paragraph adds the > missing newline at the end. > I tested this in Emacs 29 and I get the following filled docstring: class MyClass(object): def __init__(self): """Class initialization. According to PEP 257 there should be a newline after the first sentence. Following sentences are indented by 8 spaces in this case. With python-fill-docstring-style set to 'pep-257-nn there should be a newline at the end.""" pass It seems like it still misses the newline after the first sentence and the newline at the end. Looking at the code, the missing newline after the first sentence happens because there is no code to do that. The missing newline at the end is a consequence of handling the docstring as a single-line docstring. I think it will be fixed if we add the newline after the first sentence. I'm not familiar with Python or the PEP, but does anyone see any issues if we add a new line after the first sentence of a docstring, if there are more than one?