From: Michael Kleehammer <michael@kleehammer.com>
To: 25734@debbugs.gnu.org
Subject: bug#25734: Python - fix imenu regexp for async functions
Date: Tue, 14 Feb 2017 15:01:28 -0600 [thread overview]
Message-ID: <53fdd849-4f99-48c0-bde7-7d07107984dc@Spark> (raw)
[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]
This patch is for python mode. Recently Python 3 added the “async” keyword for functions like so:
def this_is_not_async():
pass
async def this_is_async():
pass
The mode has already been updated to recognize this for most things, but not imenu. It currently would show:
this_is_not_async (def)
def (async)
The patch below is a minor modification for a regular expression. The old one simply took the 2nd token on the line to be the name; the new one skips the optional “async” keyword.
Please note the current imenu is unusable in a file with a lot of async 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
@@ -1316,7 +1316,7 @@ marks the next defun after the ones already marked."
;;; Navigation
(defvar python-nav-beginning-of-defun-regexp
- (python-rx line-start (* space) defun (+ space) (group symbol-name))
+ (python-rx line-start (* space) (* "async" space) defun (+ space) (group symbol-name))
"Regexp matching class or function definition.
The name of the defun should be grouped so it can be retrieved
via `match-string'.")
[-- Attachment #2: Type: text/html, Size: 2191 bytes --]
next reply other threads:[~2017-02-14 21:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 21:01 Michael Kleehammer [this message]
2017-02-15 1:33 ` bug#25734: Python - fix imenu regexp for async functions npostavs
2017-02-18 14:22 ` npostavs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53fdd849-4f99-48c0-bde7-7d07107984dc@Spark \
--to=michael@kleehammer.com \
--cc=25734@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.