3 ms·
Do you have the appropriate emacs plugins for writing Python? I'm a bit surprised that the code isn't formatted properly with emacs out of the box. Then again,
by exDM69 15y ago
Do you have the appropriate emacs plugins for writing Python? I'm a bit surprised that the code isn't formatted properly with emacs out of the box. Then again, many editors need some sort of addon to be able to cope with whitespace sensitive syntax.
If it were an actual grammatical ambiguity, any editor couldn't get it right but it can't be since the Python parser can understand it.
- pnathan 15y agoIt is not a grammatical ambiguity in terms of Python. Here's a pastebin that illuminates the problem. http://pastebin.com/3fdxts4n http://pastebin.com/3fdxts4n
- mattdeboard 15y agoI see. I never have that problem because when I C-S-<Backspace> and put my cursor at the beginning of the line I want to paste it retains indentation level fine. edit: What version of emacs are you using? Are you using python.el or python-mode.el for editing Python? python.el handles try/except, if/else, etc., etc., indentation pretty marvelously. edit2: If you'd rather talk about this out-of-band I'm on freenode as mdeboard or my email address is in my profile.
- pnathan 15y ago23.3.x and python.el. It's very stock. What function does C-S-backspace give you? I see kill-whole-line on my install. Once I am writing in a block, the indents work fine, but... I can't paste something into a block and whack the 'reformat all' to come out correctly, especially if it has multiple levels of indentation. Since my code gets reworked substantially while I'm in the middle of it, this wastes my time. Braces are not noise...
- mattdeboard 15y agoIt sounds like you need to use the kill ring & pasting from the kill ring more. It preserves indentation levels, and selecting a region then M-x indent-region will handle all this for you.