wbolster / emacs-python-black

Emacs package to reformat Python using black-macchiato
BSD 3-Clause "New" or "Revised" License
95 stars 11 forks source link

Don't break when there's no newline at the end of the buffer #4

Closed janverb closed 4 years ago

janverb commented 4 years ago

python-black-statement failed when run on the last line with no newline at the end, because it tried to reach past the end of the buffer. This fixes that.

wbolster commented 4 years ago

thanks, merged :shipit:

not sure how you end up without a newline at the end of the buffer... i guess it only happens for unsaved buffers, since saving usually adds it. and i guess with this change, black-macchiato will also add it when formatting the statement.

janverb commented 4 years ago

That's exactly right. Thank you!