Last active
April 8, 2016 15:26
-
-
Save wasamasa/7f92676a8f01e6cbbb7851e2d089ce13 to your computer and use it in GitHub Desktop.
Buffer obfuscation
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
(defvar my-buffer-obfuscation-overlay nil) | |
(defun my-obfuscate-buffer () | |
(interactive) | |
(let* ((buffer-content (buffer-substring (point-min) (point-max)))) | |
(dotimes (i (length buffer-content)) | |
(let ((char (aref buffer-content i))) | |
(when (string-match-p "[[:graph:]]" (char-to-string char)) | |
(aset buffer-content i ?.)))) | |
(setq my-buffer-obfuscation-overlay | |
(make-overlay (point-min) (point-max))) | |
(overlay-put my-buffer-obfuscation-overlay | |
'display buffer-content))) | |
(defun my-unobfuscate-buffer () | |
(interactive) | |
(when my-buffer-obfuscation-overlay | |
(delete-overlay my-buffer-obfuscation-overlay) | |
(setq my-buffer-obfuscation-overlay nil))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment