Subject: Re: bug#25734: Python - fix imenu regexp for async functions

From: [email-masked]
Date: Sat, 18 Feb 2017 09:22:53 -0500

unarchive 24820
forcemerge 24820 25734
quit

Michael Kleehammer <[email-masked]> writes:

> 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.

As far as I can tell, your patch has no effect on imenu, after applying
it and doing M-x imenu RET TAB, I get this *Completions* buffer:

    Click on a completion to select it.
    In this buffer, type RET to select the completion near point.

    Possible completions are:
    *Rescan*
    def.(async)
    this_is_not_async.(def)

Since the patch in #24820 does fix the problem, I'm merging this bug
into that one.

> 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.

AFAIK, it's too late to fix non-critical bugs in emacs-25, but python.el
is both in Emacs "core" and a GNU ELPA package, so you can install the
version from master using package.el (when we bump its package version,
that is).