> On 2023-06-30, Lifepillar <lifepil...@lifepillar.me> wrote:
> > On 2023-06-30, Yee Cheng Chin <ychin.mac...@gmail.com> wrote:
> > The fix was in https://github.com/macvim-dev/macvim/pull/1390
> 
> To delete the PDF file synchronously after it has been opened in
> Preview, AppleScript can be used:
> 
>     system($"osascript -e 'tell app \"Preview\" to open POSIX file 
> \"{v:fname_in}.pdf\"'")
>     delete($"{v:fname_in}.pdf")
> 
> osascript should return only after the document has been opened. Running
> that will probably ask once for permissions to access files.

Thanks for looking into this.  Let me know if there is something that I
should include in the generic distribution.

Looking at this, I wonder what we should do when encryption is used.
Writing a copy of the file somewhere, without encryption, is bad then.
Even if we delete it soon after.

I suppose encrypting the file won't be possible, since the reader does
not know how to decrypt it.  Or does the Preview app support encryption
somehow?

The alternative is to not use a temp file but write the text through a
pipe/socket.  That also avoids the need to find the right moment to
delete the temp file.  Can we do this somehow?  It may require forking
the process, so that the pipe can be written to asynchronously.  Or
using ch_open() or job_start() and one of the callback functions.
Using a buffer instead of a file to store the text.

-- 
hundred-and-one symptoms of being an internet addict:
263. You have more e-mail addresses than shorts.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_mac+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_mac/20230703175852.69BAE1C08A3%40moolenaar.net.

Reply via email to