joostkremers / pandoc-mode

An Emacs minor mode for interacting with Pandoc.
https://joostkremers.github.io/pandoc-mode/
178 stars 14 forks source link

Allow conversion of scratch buffer #63

Open fm4d opened 8 years ago

fm4d commented 8 years ago

It would be nice to allow conversion of non-file buffers like scratch which is now impossible due to:

(buffer-file-name buffer)
(file-name-nondirectory filename)

in pandoc--call-external which fails because (buffer-file-name #scratch) ==> nil.

joostkremers commented 8 years ago

That's actually a nice idea. pandoc-mode needs a file name, since some output format require an output file. But it's easy to create a file name based on the buffer name.

With this fix, a buffer that's not visiting a file can be processed in the normal way. If an output file is created, it gets the name of the buffer (plus relevant extension).

joostkremers commented 8 years ago

Hmm, I'm just thinking, there's a nicer way to do this. Stay tuned.

joostkremers commented 8 years ago

Done: dd1152f. Now, when pandoc is run on a buffer not visiting a file, messages display the buffer name instead of the (bogus) file name constructed from it.

Please let me know if you run into problems.