Skip to content

Instantly share code, notes, and snippets.

@spacebat
Created January 21, 2013 08:13
Show Gist options
  • Save spacebat/4584465 to your computer and use it in GitHub Desktop.
Save spacebat/4584465 to your computer and use it in GitHub Desktop.
Playing around with the invisible text property in emacs
(defun hide-by-regexp (regexp &optional buffer start finish)
"First stab at hiding from START (default: (point-min)) to the end of the first match of REGEXP in BUFFER."
(save-excursion
(with-current-buffer (or buffer (current-buffer))
(unless start (setq start (point-min)))
(goto-char start)
(when (search-forward-regexp regexp finish t)
(add-text-properties start (point) '(invisible t))))))
@spacebat
Copy link
Author

Showing the text again left as an exercise for the reader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment