GNU bug report logs - #21254
24.5; python.el: Docstring fill-paragraph not working with style pep-257-nn

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Holger Schmidt <Holger.Schmidt@HIDDEN>; Keywords: confirmed; dated Thu, 13 Aug 2015 15:48:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as found in versions 26.1. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) confirmed. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 21254 <at> debbugs.gnu.org:


Received: (at 21254) by debbugs.gnu.org; 26 Sep 2019 12:04:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 26 08:04:25 2019
Received: from localhost ([127.0.0.1]:42842 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iDSVU-0001hF-LN
	for submit <at> debbugs.gnu.org; Thu, 26 Sep 2019 08:04:24 -0400
Received: from mail-pg1-f195.google.com ([209.85.215.195]:40137)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1iDSVP-0001gj-Af
 for 21254 <at> debbugs.gnu.org; Thu, 26 Sep 2019 08:04:22 -0400
Received: by mail-pg1-f195.google.com with SMTP id w10so1460284pgj.7
 for <21254 <at> debbugs.gnu.org>; Thu, 26 Sep 2019 05:04:19 -0700 (PDT)
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:cc
 :content-transfer-encoding;
 bh=ydRU8Oe1huopvTFEp99HOMZxgT2m6O8nhoY/35cZok8=;
 b=n4Kvic3m1LcOCPx6gq+LrNDTb6LptF05iw1iVZ2/a4TuLEoxSv3kKm+KBH/IfAvCbu
 4Dc1x9Ur3rqFn523nD4kYghpUNR7qtZtcOqQ4yCrP40RMNxyKpyV94JI0H/BBlI6WjTO
 +zp/2hVou+/G8lyRSFn/SJOWHGnU2k+IxI+eu8v/DYKoUmtAgThL6eiitTVDPOUaZ2Ly
 /DmfukQXIgX9qm0NCCbq59aXJiuSj5GX+t1asyYWZOtYFfPfVtSsbp8XW9fU1jlQL3f+
 K6subLg+8X8ZTXEcsddDo/IRH3+MnwFqS1c1/JSvjDOiLO/xs0s3XQaq9lkV5Cj3Yg2t
 t16w==
X-Gm-Message-State: APjAAAWJ7MTjaBOASjGBP+jWjvnDJ//3B2M/z081PuP2RBaSMyUzBh7p
 edRfUVigSp6MGpWIrgixhzAnwNDzg0C8oOeBv427XOZK
X-Google-Smtp-Source: APXvYqyFGVHviqryjRpOkhOwX6r0ym5g2WrUNInfSN7Bm9YF+zqsxUdACVAhNBZS7QWnfmhPn4Nal29I40DLSWkx4p4=
X-Received: by 2002:a63:4f4b:: with SMTP id p11mr3183284pgl.333.1569499452622; 
 Thu, 26 Sep 2019 05:04:12 -0700 (PDT)
MIME-Version: 1.0
From: Stefan Kangas <stefan@HIDDEN>
Date: Thu, 26 Sep 2019 14:04:01 +0200
Message-ID: <CADwFkm=hEyxf=CuZNLL11WXOuOCUW_RLdqZx-5dCJZFw9NAiEA@HIDDEN>
Subject: Re: bug#21254: 24.5; python.el: Docstring fill-paragraph not working
 with style pep-257-nn
To: Holger Schmidt <Holger.Schmidt@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 21254
Cc: 21254 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

tags 21254 confirmed
found 21254 26.1
quit

Holger Schmidt <Holger.Schmidt@HIDDEN> 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.
>
> Example (the docstring is one long line):
>
> 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 sp=
aces in this case.  With python-fill-docstring-style set to 'pep-257-nn the=
re should be a newline at the end."""
>         pass
>
> This should be formatted like this:
>
> 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
>
> But the result is this (fill-paragraph (M-q) inside 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

I can reproduce this on Emacs 26.1 and current master.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#21254; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Aug 2015 15:47:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 13 11:47:21 2015
Received: from localhost ([127.0.0.1]:55167 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZPuiu-00008L-7t
	for submit <at> debbugs.gnu.org; Thu, 13 Aug 2015 11:47:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46969)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3l-0001eG-Bx
 for submit <at> debbugs.gnu.org; Thu, 13 Aug 2015 07:52:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3j-0000hj-Qc
 for submit <at> debbugs.gnu.org; Thu, 13 Aug 2015 07:52:37 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:35322)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3j-0000hZ-OG
 for submit <at> debbugs.gnu.org; Thu, 13 Aug 2015 07:52:35 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56969)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3i-0008EX-5B
 for bug-gnu-emacs@HIDDEN; Thu, 13 Aug 2015 07:52:35 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3e-0000Xi-1O
 for bug-gnu-emacs@HIDDEN; Thu, 13 Aug 2015 07:52:34 -0400
Received: from mxout34.expurgate.net ([91.198.224.34]:50048)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3d-0000UC-O7
 for bug-gnu-emacs@HIDDEN; Thu, 13 Aug 2015 07:52:29 -0400
Received: from [127.0.0.1] (helo=localhost)
 by relay.expurgate.net with smtp (Exim 4.80.1)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3Z-0008KW-0Q
 for bug-gnu-emacs@HIDDEN; Thu, 13 Aug 2015 13:52:25 +0200
Received: from [194.15.148.6] (helo=mail.zmdi.com)
 by relay.expurgate.net with esmtp (Exim 4.80.1)
 (envelope-from <Holger.Schmidt@HIDDEN>) id 1ZPr3Y-0006c7-I9
 for bug-gnu-emacs@HIDDEN; Thu, 13 Aug 2015 13:52:24 +0200
Received: from mail.zmdi.com (localhost [127.0.0.1])
 by mail.zmdi.com (Postfix) with ESMTP id 4D1CAFF127
 for <bug-gnu-emacs@HIDDEN>; Thu, 13 Aug 2015 13:52:24 +0200 (CEST)
From: Holger Schmidt <Holger.Schmidt@HIDDEN>
To: <bug-gnu-emacs@HIDDEN>
Subject: 24.5;
 python.el: Docstring fill-paragraph not working with style pep-257-nn
Date: Thu, 13 Aug 2015 13:52:20 +0200
Message-ID: <jgyoaibz9qj.fsf@HIDDEN>
MIME-Version: 1.0
X-SafeGuard_MailGateway: Version: 6.00.4.16011.i686 SGMG Date: 20150813115224Z
Content-Type: text/plain
X-purgate-relay-fid: relay-9b77e0
X-purgate-sourceid: 1ZPr3Y-0006c7-I9
X-purgate-Ad: Checked for spam and viruses by eXpurgate(R),
 see www.eleven.de for details.
X-purgate-ID: 151534::1439466744-0000070C-0AA15CC1/0/0
X-purgate: clean
X-purgate-type: clean
X-purgate-relay-bid: relay-1e7d0f
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 13 Aug 2015 11:47:17 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

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.

Example (the docstring is one long line):

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

This should be formatted like this:

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

But the result is this (fill-paragraph (M-q) inside 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


In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4)
 of 2015-08-13 on l53
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
System Description:	CentOS release 5.11 (Final)

Configured using:
 `configure --prefix=/local/emacs-24.5'

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: C
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  flyspell-mode: t
  show-paren-mode: t
  fci-mode: t
  flymake-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Starting new Ispell process /usr/bin/aspell with default dictionary...
9: E901 TokenError: EOF in multi-line string [5 times]
Mark set
Auto-saving...
9: E901 TokenError: EOF in multi-line string [9 times]
End of buffer
Saving file /home/schmidth/abc.py...
Wrote /home/schmidth/abc.py
80: E501 line too long (260 > 79 characters) [3 times]
Undo! [2 times]

Load-path shadows:
/home/schmidth/main/trunk/emacs/site-lisp/css-mode hides /local/emacs-24.5/share/emacs/24.5/lisp/textmodes/css-mode
/home/schmidth/main/trunk/emacs/site-lisp/verilog-mode hides /local/emacs-24.5/share/emacs/24.5/lisp/progmodes/verilog-mode
/home/schmidth/main/trunk/emacs/site-lisp/flymake hides /local/emacs-24.5/share/emacs/24.5/lisp/progmodes/flymake

Features:
(shadow sort mail-extr emacsbug message format-spec rfc822 mailabbrev
gmm-utils mailheader sendmail add-log vc-dispatcher vc-svn flyspell
ispell python json disp-table paren cus-start cus-load
fill-column-indicator edmacro kmacro flymake compile comint ansi-color
mediawiki derived url-cache cl-macs cl gv ring mm-url gnus gnus-ems
nnheader mail-utils wid-edit mml easymenu mml-sec mm-decode mm-bodies
mm-encode url-http tls url url-proxy url-privacy url-expand url-methods
url-history mailcap url-auth mail-parse rfc2231 rfc2047 rfc2045
ietf-drums url-cookie url-domsuf url-util url-parse auth-source eieio
byte-opt bytecomp byte-compile cl-extra cl-loaddefs cl-lib cconv
eieio-core gnus-util mm-util help-fns mail-prsvr password-cache url-gw
url-vars tabbar easy-mmode redo+ which-func imenu autorevert filenotify
delsel xemacs-theme time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

Memory information:
((conses 16 156269 7595)
 (symbols 48 25223 0)
 (miscs 40 340 817)
 (strings 32 29661 3447)
 (string-bytes 1 881207)
 (vectors 16 15256)
 (vector-slots 8 452487 8536)
 (floats 8 105 248)
 (intervals 56 377 31)
 (buffers 960 14)
 (heap 1024 423219 13302))





Acknowledgement sent to Holger Schmidt <Holger.Schmidt@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#21254; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.