Closed Airead closed 11 years ago
Hi, I uploaded a new version. Give it a try.
Thank you for py-autopep8!
I have tested it, but it didn't work. test code:
import sys
def hello(num):
print num
the above code have warning:
E302 expected 2 blank lines, found 1
after I run python-fmt, nothing changes in the buffer. :(
Beause I can't find how to patch a buffer with another diff buffer, so I instead (go--apply-rcs-patch patchbuf)
with:
(setq lineno (line-number-at-pos))
(erase-buffer)
(insert-file tmpfile)
(goto-line lineno)
Maybe it's not the best solution, but it works. :)
Yeah, I didn't supplied the necessary function. Try the current version.
tested, but it's still not perfect... test code:
import sys
def hello(num):
print num
(note: blank line)
above code have warning:
W391 blank line at end of file
autopep8 will fix it, but python-fmt do nothing. :(
how do you call autopep8? I've tried it, but it doesn't remove the blank lines. (autopep8 0.9.2)
autopep8 version is different.
airead@AIREAD:/tmp/test$ autopep8 --version
autopep8 0.9.2
airead@AIREAD:/tmp/test$ cat t.py
import sys
def hello(num):
print num
airead@AIREAD:/tmp/test$ autopep8 t.py
import sys
def hello(num):
print num
airead@AIREAD:/tmp/test$
hm, that seems to be a problem with the before-save-hook. If I open the file with the blank line and save it the hook doesn't get called. If I make a chance in that file, the hook is called and the blank line is removed. If I open the file with the blank lines and call python-fmt (M-x python-fmt) directly the lines are also removed.
I bind C-c f
to python-fmt
, when I call python-fmt
I got
Wrote /tmp/autopep823214tpJ.py
save-current-buffer: Symbol's function definition is void: go--kill-whole-line
the go--kill-whole-line
doesn't exist....
And I go to eat dinner
Replaced it with kill-whole-line
in current version
works, perfect now!
Glad to hear.
when I run python-fmt, I get errors:
and what should I do?