Created
December 3, 2012 17:01
-
-
Save johnfredcee/4196339 to your computer and use it in GitHub Desktop.
Emacs - protect your code from accidental editing
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 make-some-files-read-only () | |
| "when file opened is of a certain mode, make it read only" | |
| (when (memq major-mode '(c++-mode python-mode c-mode actionscript-mode unrealscript-mode lisp-mode)) | |
| (toggle-read-only 1))) | |
| (add-hook 'find-file-hook 'make-some-files-read-only) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment