Remove dependency on highlight.el?
yuhan0 opened this issue · 2 comments
yuhan0 commented
eval-sexp-fu currently requires the large and fully-featured (3000+ LOC) highlight.el
library, for the use of only two basic functions:
hlt-highlight-region
hlt-unhighlight-region
.
These deal with many conditions required of the other hlt functions, but in the context of eval-sexp-fu can be simplified to the following for exactly the same functionality:
- (hlt-highlight-region (car bounds) (cdr bounds) face)
+ (let ((ov (make-overlay (car bounds) (cdr bounds))))
+ (overlay-put ov 'face face)
+ (overlay-put ov 'esf-highlight t)
- (hlt-unhighlight-region (car bounds) (cdr-bounds))
+ (dolist (ov (overlays-in (car bounds) (cdr bounds)))
+ (when (overlay-get ov 'esf-highlight)
+ (delete-overlay ov)))
If this is alright I can open a PR with the above changes :)
hchbaw commented
Thank you for pointing me this.
If this is alright I can open a PR with the above changes :)
Sure, go ahead please. It is very short! and clear to me.
BTW, I had used highlight.el (or some other packages which depend on it) at that time I wrote this code without any considerations. But I don't use it at all recently.
hchbaw commented
I've merged.
Thank you very much your contribution!