Last active
January 24, 2020 02:21
-
-
Save alphapapa/5bc3b304ffece0c73138ec5c4c87641b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ap/overlay-isearch-test () | |
(interactive) | |
(with-current-buffer (get-buffer-create "*overlay-isearch-test*") | |
(pop-to-buffer (current-buffer)) | |
(erase-buffer) | |
(dolist (ov (overlays-in (point-min) (point-max))) | |
(delete-region (overlay-start ov) (overlay-end ov)) | |
(delete-overlay ov)) | |
(insert "foo\n") | |
(ap/insert-overlaid "bar\n" :transcluded-content t) | |
(insert "baz\n"))) | |
(defun ap/insert-overlaid (string &rest properties) | |
"Insert STRING and overlay it, then return the overlay. | |
If PROPERTIES, add them as properties to the overlay." | |
(let* ((beg (point)) | |
(end (progn | |
(insert string) | |
(point))) | |
(ov (make-overlay beg end))) | |
(when properties | |
(cl-loop for (key value) on properties by #'cddr | |
do (overlay-put ov key value))) | |
ov)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment