Álvaro Ramírez
Bending Emacs - Episode 6: Overlays
The Bending Emacs series continues with a new a new episode.
Bending Emacs Episode 6: Overlays
Today we had a quick intro to overlays. Here's the snippet I used for adding snippets:
(save-excursion (goto-char (point-min)) (when (search-forward "Hello World" nil t) (let* ((start (match-beginning 0)) (end (match-end 0)) (ov (make-overlay start end))) (overlay-put ov 'face '(:box (:line-width 1 :color "yellow"))) ;; (overlay-put ov 'face 'underline) ;; (overlay-put ov 'face 'highlight) ;; (overlay-put ov 'before-string "🔥 ") ;; (overlay-put ov 'after-string " 🚀") ;; (overlay-put ov 'display "Howdy Planet") ;; (overlay-put ov 'invisible t) ;; (overlay-put ov 'help-echo "Yay overlay!") ;; (overlay-put ov 'mouse-face 'success) (overlay-put ov 'category 'overlays) (overlay-put ov 'evaporate t) ov)))
Similarly, this is what we used for removing the overlay.
(remove-overlays (point-min) (point-max)
'category 'overlays)
Of the experiments, you can find:
- Redaction snippet at the related blog post.
- Dired media metadata at Ready Player's ready-player-dired.el.
- Link previews: While I don't have elisp to share for link previews just yet, I did release a tiny thumbnail utility named rinku ;)
Hope you enjoyed the video!
Want more videos?
Liked the video? Please let me know. Got feedback? Leave me some comments.
Please go like my video, share with others, and subscribe to my channel.
If there's enough interest, I'll continue making more videos!
Make it all sustainable
Enjoying this content or my projects? I am an indie dev. Help make it sustainable by ✨sponsoring✨
Need a blog? I can help with that. Maybe buy my iOS apps too ;)