[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stackexchange question: sync html source and rendered buffers
> I considered trying to provide a feature for this, but it seemed like a
> lot of work, and I don't have that availability now.
That does sound like a lot of work (a big feature request posed as a
question...) and also sounds like a very useful feature.
There is an Emacs package, impatient-mode, that does automatic buffer
refreshing in JavaScript-capable browsers:
https://github.com/netguy204/imp.el
The point syncing feature can make emacs-w3m very useful for quickly
navigating very deeply nested/messy HTML files for editing.
Do you have ideas for how to implement this without modifying w3m? The
most reliable method I can think to implement this is to modify the HTML
parser to annotate the parse tree so that every character in text that
will be rendered is mapped to a file position. Then make the HTML
renderer produce two files: the rendered HTML, and a map from rendered
HTML file position to HTML source file position.
I took a few minutes to see how eww handles parsing, and it looks like
libxml-parse-html-region does not return any kind of file position
annotations, so no quick shortcuts there.
Vladimir