hniksic / emacs-htmlize

Convert buffer text and decorations to HTML.
193 stars 44 forks source link

Fixes #51. Copy expanded-tab before propertizing. #53

Closed TobiasZawada closed 4 months ago

TobiasZawada commented 5 months ago

Here is an alternative way to avoid the duplication of overlay images.

I created this alternative branch for the case that you are concerned about any performance impact that make-string could possibly cause.

The function remains exactly the same as long as expanded-string is not propertized with a display property. If it is propertized then the string from htmlize-tab-spaces which expanded-tab points to is first copied and then the copy is propertized. This way htmlize-tab-spaces also remains untouched.

I find this branch slightly uglier than 51-remove-htmlize-tab-spaces because the resulting code is somewhat more complicated. But, on the other hand this branch has only minimal changes that just fix the problem and do not change the timing characteristics of the package otherwise. I think it can safely be assumed that display-propertized indentation rarely occurs.

TobiasZawada commented 4 months ago

@hniksic Hi Hrvoje, Could you please accept this pull-request? It fixes bug #51, is minimal and it does not block potential further development on this topic. Especially, it does not block Fixes 51. Do not use htmlize-tab-spaces for htmlize-untabify-string. #52 if you want to take that approach later on.

Thanks in advance, Tobias