Skip to content

Instantly share code, notes, and snippets.

@magnars
Last active December 14, 2015 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magnars/5057886 to your computer and use it in GitHub Desktop.
Save magnars/5057886 to your computer and use it in GitHub Desktop.
(defvar adv-destination-room-overlay nil)
(make-variable-buffer-local 'adv-destination-room-overlay)
(defun adv-fontify-destination-room (s)
(set-text-properties
0 (length s)
`(face (:foreground ,(format "#%02x%02x%02x" 30 30 30)))
s)
s)
(defun adv-delete-destination-room-overlay (&rest ignore)
(when adv-destination-room-overlay
(delete-overlay adv-destination-room-overlay)
(setq adv-destination-room-overlay nil)))
(defun adv-create-destination-room-overlay (contents)
(adv-delete-destination-room-overlay)
(unless (save-excursion (goto-char (point-max)) (bolp))
(setq contents (concat "\n" contents)))
(setq adv-destination-room-overlay
(make-overlay (point-max) (point-max) nil t t))
(overlay-put adv-destination-room-overlay 'priority 100)
(overlay-put adv-destination-room-overlay 'after-string
(adv-fontify-destination-room contents)))
(adv-create-destination-room-overlay "Several\nLines\nHere")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment