I'm trying to create a realtime/WYSIWYG editor for LaTeX fragments -- the general idea is that at each move of point / edit of the fragment, the overlay should update to reflect the newly changed fragment, including a cursor symbol indicating where point is now.
However, it's impossible to move point into an image overlay -- any command that would end up inside the overlaid region is preempted so that point ends up at the end of the overlay.
Is there any way to override this behavior so that point can be inside of the overlaid region? I know I can do this XWidgets but I would prefer that the solution be compatible with the built-in fragment preview mechanism that org offers, which uses overlays.
An example of the behavior that I'm talking about: Run the following function with some image, with point at 1
:
(defun image-overlay-minimal-repro ()
(interactive)
(let ((ov (make-overlay (point) (+ (point) 10))))
(overlay-put ov
'display
(list 'image :type 'png :file "~/Downloads/dog-png-dog-png-image-267.png"))))
; 1234567890 test test
The image overlay will occlude all the digits, and it only takes one motion of point to cross the entire overlay. I want it to take 10 movements of point.