I just made public an auctex preview package that I have been working on for 
some time. It essentially shows the preview locally and temporarily in a frame 
or as an 'after-string, similar to what Overleaf has been doing recently.

https://github.com/haji-ali/preview-point

Any feedback/bug reports are appreciated.

One of the "helper" packages that I wrote is `preview-dvi` which fixes what I 
think are several issues with preview related to robustness and ensuring 
files/folders are not orphaned in the preview directory.

In addition to plugging my package here, I wanted to check if these are indeed 
real issues, and if there is interest in implementing those fixes in 
preview.el. I'll try to summarize the issues here. The fixes are all marked by 
"NOTE" in my preview-dvi.el

- In `preview-dvipng-process-setup`, `TeX-sentinel-function` is set temporarily 
to a function which just shows a message. This is corrected immediately in 
`preview-start-dvipng` where `preview-dvipng-sentinel` is used. This is an 
issue becasue `sit-for` is called in `preview-start-dvipng` which may process 
output of running processes (through timers for example) which means that a 
process that is done by that time could have the temporary sentinel being 
called.

- In `preview-dvipng-place-all`, the `filenames` property in overwritten in two 
places. This lead in some cases (which I haven't been able to pin down exactly 
yet) to orphaned files. I think checking this property and deleting 
corresponding files before they are overwritten is better.

- When the preview command is aborted, there is a chance that this happens 
before the previews are generated but after a temp directory is create, in this 
case an empty folder is left behind. I think `preview-dvi-abort` should delete 
the folder if it is empty. This also happens in preview-gs-place.

- `preview-place-preview` calls `preview-clearout` which deletes old overlays 
and their associated files. But I think this creates an issue when 
`preview-leave-open-previews-visible` is non-nil, where the same file is used 
in the new overlay causing image display errors in some cases.

Let me know if you agree that these issues need fixing. I note that I 
tested/"fixed" dvipng part, but other processes have similar code.

-- Al

Reply via email to