Get the buffer file using (buffer-file-name (buffer-base-buffer)) instead of buffer-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.
Fix for https://github.com/prettier/prettier-emacs/issues/75.
(buffer-file-name (buffer-base-buffer))
instead ofbuffer-file-name
. The new code also works with indirect buffers.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.