From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Kleehammer Newsgroups: gmane.emacs.bugs Subject: bug#25734: Python - fix imenu regexp for async functions Date: Tue, 14 Feb 2017 15:01:28 -0600 Message-ID: <53fdd849-4f99-48c0-bde7-7d07107984dc@Spark> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="58a37144_6b8b4567_119e8" X-Trace: blaine.gmane.org 1487106439 28554 195.159.176.226 (14 Feb 2017 21:07:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2017 21:07:19 +0000 (UTC) To: 25734@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 14 22:07:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cdkJY-0006ij-Ct for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Feb 2017 22:07:08 +0100 Original-Received: from localhost ([::1]:37177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdkJe-00051S-4N for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Feb 2017 16:07:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdkJX-00051F-2x for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:07:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdkJS-0000Ji-46 for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:07:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdkJS-0000Jc-1I for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cdkJR-0001xF-Qj for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Kleehammer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Feb 2017 21:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25734 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14871063917475 (code B ref -1); Tue, 14 Feb 2017 21:07:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Feb 2017 21:06:31 +0000 Original-Received: from localhost ([127.0.0.1]:40281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cdkIw-0001wV-Tq for submit@debbugs.gnu.org; Tue, 14 Feb 2017 16:06:31 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cdkIu-0001wI-NC for submit@debbugs.gnu.org; Tue, 14 Feb 2017 16:06:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdkIo-0000BD-9q for submit@debbugs.gnu.org; Tue, 14 Feb 2017 16:06:23 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:50090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cdkIo-0000B4-6r for submit@debbugs.gnu.org; Tue, 14 Feb 2017 16:06:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdkIm-0004tj-DB for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:06:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdkIh-00006p-F1 for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:06:20 -0500 Original-Received: from mail-oi0-x235.google.com ([2607:f8b0:4003:c06::235]:33918) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdkIh-00006J-9e for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2017 16:06:15 -0500 Original-Received: by mail-oi0-x235.google.com with SMTP id s203so77596554oie.1 for ; Tue, 14 Feb 2017 13:06:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kleehammer-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:message-id:subject:mime-version; bh=I4HR8FWNmy9IcujqKkq2BpxNtqqoE7i1H7OJHo8fcl0=; b=E/Gmecj4k3RRkopMyAGVxkyOAag0PIAIvrIEI6O/15/UYGWRotn0DrPNehhOmwRuO3 FuseiA/IeuOtWaLUxSafd6KozeVHaAMpRQo6K8eQam6FY32W9ZWYvA1sEf2E3qJPC6kq Rr9dSiksW+Hl1/uJ8rexy2WikK4rrp94SOau89WbBGFk7nLhHrVht3fYz7gjfEcgAUXb pKxnX+LYPL2L1PNqfFfCmLANxZMf5oSMYqMEtICVqlXQcwSNH6krcuoht5216BepSxut YwVrghryDRWICdSHGAzC+J2LCuVQLMt47Fzvvn8XN/Gt0Lz7df8rov8euLMXZvP1SfjO 2A6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:message-id:subject:mime-version; bh=I4HR8FWNmy9IcujqKkq2BpxNtqqoE7i1H7OJHo8fcl0=; b=WT7IAtIJNKZDIRPAWBweC5GQxHmdepLQCI4aipu8/ITzllcq660PbAo6RVvbF+nRDs pilNYK38mzsxnmRk0C4k4hA4SITYhHBbpa+Ey/8oiUDJv+x/olB4iMP0eY24eGD05/uI MSuAkRL2J0wILt3F93QJvIjL5E3BmQi+UC8UAuhsb6RowGLMoT8zRqrr+Xc8dsn0A/8+ sByVFFXHubc+vZDNv/TQSuS9gRTJRWs29tgsng2c991C563XKwhwbpKCCNJqUVmova+5 RnKk+rEr3kEW7oklX6LWZvJ73r5ABsQwchsyR0IcLQiml1tLnY+Uf2vuBHtGHqEYlZS6 BKgg== X-Gm-Message-State: AMke39mR8tUDNqfD7lQA1a/62l5nb91YqoAwk22bLwdkbWFEsoNCfaSwMjqX2z29ImuYUg== X-Received: by 10.202.68.10 with SMTP id r10mr17539916oia.181.1487106373871; Tue, 14 Feb 2017 13:06:13 -0800 (PST) Original-Received: from [192.168.1.14] ([47.188.195.162]) by smtp.gmail.com with ESMTPSA id u37sm633528otu.41.2017.02.14.13.06.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 13:06:13 -0800 (PST) X-Readdle-Message-ID: 53fdd849-4f99-48c0-bde7-7d07107984dc@Spark X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129362 Archived-At: --58a37144_6b8b4567_119e8 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This patch is for python mode. =C2=A0Recently Python 3 added the =E2=80=9C= async=E2=80=9D keyword for functions like so: =C2=A0 =C2=A0 def this=5Fis=5Fnot=5Fasync(): =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass =C2=A0 =C2=A0 async def this=5Fis=5Fasync(): =C2=A0 =C2=A0 =C2=A0 =C2=A0 pass The mode has already been updated to recognize this for most things, but = not imenu. =C2=A0It currently would show: =C2=A0 =C2=A0 this=5Fis=5Fnot=5Fasync (def) =C2=A0 =C2=A0 def (async) The patch below is a minor modification for a regular expression. =C2=A0T= he old one simply took the 2nd token on the line to be the name; the new = one skips the optional =E2=80=9Casync=E2=80=9D keyword. Please note the current imenu is unusable in a file with a lot of async f= unctions - it would be nice if this rolled out with 25.2 if possible, whi= ch I believe adds the rest of async support. Thanks, Michael Kleehammer diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 90b5e4e0dc..5ca23fb9ab 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el =40=40 -1316,7 +1316,7 =40=40 marks the next defun after the ones already= marked.=22 =C2=A0;;; Navigation =C2=A0(defvar python-nav-beginning-of-defun-regexp - =C2=A0(python-rx line-start (* space) defun (+ space) (group symbol-nam= e)) + =C2=A0(python-rx line-start (* space) (* =22async=22 space) defun (+ sp= ace) (group symbol-name)) =C2=A0 =C2=A0=22Regexp matching class or function definition. =C2=A0The name of the defun should be grouped so it can be retrieved =C2=A0via =60match-string'.=22) --58a37144_6b8b4567_119e8 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
This patch is fo= r python mode. &=23160;Recently Python 3 added the =E2=80=9Casync=E2=80=9D= keyword for functions like so:

&=23160; &=23160; def this=5Fis=5Fnot=5Fasync():
&=23160; &=23160; &=23160; &=23160; pass

&=23160; &=23160; async def this=5Fis=5Fasync():
&=23160; &=23160; &=23160; &=23160; pass

The mode has already been updated to recognize this for most things,= but not imenu. &=23160;It currently would show:

&=23160; &=23160; this=5Fis=5Fnot=5Fasync (def)
&=23160; &=23160; def (async)

The patch below is a minor modification for a regular expression. &=23= 160;The old one simply took the 2nd token on the line to be the name; the= new one skips the optional =E2=80=9Casync=E2=80=9D keyword.

Please note the current imenu is unusable in a file with a lot of as= ync functions - it would be nice if this rolled out with 25.2 if possible= , which I believe adds the rest of async support.

Thanks,
Michael Kleehammer

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 90b5e4e0dc..5ca23fb9ab 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
=40=40 -1316,7 +1316,7 =40=40 marks the next defun after the ones al= ready marked.=22
&=23160;;;; Navigation
&=23160;
&=23160;(defvar python-nav-beginning-of-defun-regexp
- &=23160;(python-rx line-start (* space) defun (+ space) (group sym= bol-name))
+ &=23160;(python-rx line-start (* space) (* =22async=22 space) defu= n (+ space) (group symbol-name))
&=23160; &=23160;=22Regexp matching class or function definition.
&=23160;The name of the defun should be grouped so it can be retriev= ed
&=23160;via =60match-string'.=22)

--58a37144_6b8b4567_119e8--