I setup one python3.5.1 virtualenv for test purpose, and find elpy cannot recognise the "async" and "await" keyword. As a result, the indent is not correct when the function is declared as
async def hello(world):
pass
Do you have any plan to support the new keywords? Thank you!
Hello, and thanks for the report! Indentation is provided by Emacs' built-in python mode. Could you report this problem using M-x report-emacs-bug, please, so it gets fixed upstream?
If this does not happen "soonish", Elpy should probably fix this outside of Emacs …
Thanks for your reply, and I have submitted the bug for Emacs.
Apparently, there is a patch but it lacks review and acceptance: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21783
As it did not look like this is going to get fixed any time soon, I just pushed the patch to the Emacs repo as commit 1f6b0bc. Sadly, this is too late to get into emacs-25, so the next release of Emacs will still not support Python 3.5.
I just ran into this as well... Is there any workaround, e.g. a python.el package or just a manual hack I could drop into my .emacs or something? Emacs 25 has been "coming soon" for like 3 years, right? The idea of having to wait for Emacs 26 in order to get basic indentation support in my python code is kinda, well, terrifying!
Also, that patch seems to be missing font-lock support for await
The idea of having to wait for Emacs 26 in order to get basic indentation support in my python code is kinda, well, terrifying!
Tell me about it :-(
I'll see if I can fix that in Elpy. Might be tricky, as some of that stuff there is done at compile time.
Also, that patch seems to be missing font-lock support for
await
Oh, hm. That, too. And also upstream.
Thanks.
Ok, await is now properly fontified in git.
As for fixing this from Elpy, the indentation rules use a macro called python-rx which is defined at compile time. This macro is used all over the place. So to fix this, Elpy would basically have to re-load python.el after monkey-patching it. That's horrible.
Could you contact [email protected] and ask them to cherry-pick 1f6b0bc1 and 928f5194 to the 25 branch so that Emacs 25 will support Python 3.5 properly? Maybe we have a chance of getting that into the release …
Email sent, though I didn't subscribe first so I'll give it an hour to see where the email actually went :-)
I guess the hacky workaround in the mean time would be to pull python.el out of git and drop it into my load-path somewhere ahead of the built-in version?
Email sent, though I didn't subscribe first so I'll give it an hour to see where the email actually went :-)
Thank you. emacs-devel is set up to deal with non-subscribers, so should be fine.
I guess the hacky workaround in the mean time would be to pull python.el out of git and drop it into my load-path somewhere ahead of the built-in version?
Yes.
Here's the thread for the record: https://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00604.html
johnw just pushed those commits to the emacs-25 branch, meaning Emacs 25 will support Python 3.5 when it gets released.
Thank you for helping getting this pushed! :-)
:clap:
BTW, it looks like someone also needs to add StopAsyncIteration to the list of built-in exceptions -- I'm pretty sure this isn't the right place to mention that, but I'm not sure what is :-)
Dunno. Considering for how long a time no one looked at that original Python 3 patch, this place is as good as any. I just pushed a commit that should update the exception list to include all exceptions in Python 2.7 and 3.5. Won't make it into Emacs 25, but I guess that's survivable.
Thanks!
On Apr 27, 2016 1:49 AM, "Jorgen Schäfer" [email protected] wrote:
Dunno. Considering for how long a time no one looked at that original
Python 3 patch, this place is as good as any. I just pushed a commit
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1a08fb07546a4488511abb65bcae5c0d8b192c20
that should update the exception list to include all exceptions in Python
2.7 and 3.5. Won't make it into Emacs 25, but I guess that's survivable.—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/jorgenschaefer/elpy/issues/848#issuecomment-215014841
I guess this is sort of resolved – with Emacs 25, Python 3 should be supported sufficiently. So, closing this.
Again, thank you for bringing this up!
For anyone who stumbles upon this page and is using Ubuntu, you can upgrade to Emacs 25
Most helpful comment
Here's the thread for the record: https://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00604.html