Created
January 21, 2013 08:13
-
-
Save spacebat/4584465 to your computer and use it in GitHub Desktop.
Playing around with the invisible text property in emacs
This file contains 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 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)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Showing the text again left as an exercise for the reader