blak3mill3r / vmd-mode

Snappy Markdown preview minor mode for emacs
MIT License
68 stars 13 forks source link

remote tramp files do not work (to preview) #16

Open idcrook opened 6 years ago

idcrook commented 6 years ago

I recently found vmd-mode and it is very useful. I have encountered an issue when using TRAMP to edit a file on a remote machine and wanting to use vmd-mode for previewing.

In current code, the tempfile gets created in same directory as original file, concatenating the string .temp setq vmd-copy-file

This works great for local edits on local machine. Unfortunately, for files edited using TRAMP session, e.g. on a remote machine, the .temp file is also placed on the remote machine, and the vmd process does not know how to get to the file. The .temp file gets updated appropriately, but it is not available on local machine to preview.

I think a possible way around this issue could be to provide an alternate way to name a tempfile? It would then be able to have a local alternate path and, e.g.the local platform tempfile area (referring to something like /tmp or %TEMP%) could be used? That would not be perfect, but it would allow the preview of the markdown text to happen in the remote TRAMP session case.

blak3mill3r commented 6 years ago

Thanks for the report! I like your idea. I don't know offhand how to do that (temp file in system temp directory). I'd be glad to accept a PR, or I may take a look at this at some point (when I try to use it with TRAMP).

pierre-rouleau commented 3 years ago

How about adding a defcustom field identifying the directory where the temporary file would be stored? And defaulting to the value of `temporary-file-directory' ? See https://www.gnu.org/software/emacs/manual/html_node/elisp/Unique-File-Names.html