prettier-emacs
prettier-emacs copied to clipboard
Handle cloned buffers and give a friendly error message when not visiting a file
Fix for https://github.com/prettier/prettier-emacs/issues/75.
- Get the buffer file using
(buffer-file-name (buffer-base-buffer))
instead ofbuffer-file-name
. The new code also works with indirect buffers. - In case the file can't be found, raise a helpful error message.
Note: I am not familiar at all with prettier-js, I just noticed this problem while trying to use it and the fix looked easy enough. Please check to make sure this PR doesn't screw anything up.