|
From: | Thomas Lord |
Subject: | Re: are there hooks for text becoming visible or hidden in a given window? |
Date: | Sat, 26 Feb 2022 13:42:32 -0800 |
User-agent: | Roundcube Webmail/1.3.17 |
Thank you to everyone who replied to this. I found it very helpful. One thing I take away from the discussion is that my fear that the time-cost of scanning the visible text in a buffer is probably a "hangover" from first starting to write Emacs Lisp programs in the late 1980s when things were generally much slower than today. I also realized, thinking more about my problem domain, that perfect synchronization of the various windows is not essential and its even better in the long run to assume synchronization can lag noticably as long as its not a huge lag. That, plus the various hooks identified that will do at least part of the job give me lots of options to start by brute-forcing sync. between commands and/or on a periodic timer and then, if necessary, use the existing hooks to perhaps speed that up a bit. Thanks! -t On 2022-02-24 14:25, Thomas Lord wrote:
Dear Emacs Lisp hackers, Is there a way to mark a region of text in a buffer, so that when that text becomes visible in any window, or when it stops being visible, a hook is called and provided the location of the text in the buffer, and the window in which its visibility has changed? I would like to implement a feature that when certain text changes visibility, the contents of separate buffer are automatically changed. For example, if a markdown image link scrolls into view in one buffer, the image itself would appear in a second window, but disappear from the second window if the link is deleted or scrolled outside of the window. I couldn't find anything like this and I don't see a clean alternative. Watching scroll events would only cover part of the problem and I'm worried about the interactive performance of having to frequently search the range of visible text for text with a certain property or within a certain overlay. Thanks, -t
[Prev in Thread] | Current Thread | [Next in Thread] |