I end up looking at source files of packages I have installed fairly often and want to avoid accidentally editing them while I am viewing them. After looking at https://emacs.stackexchange.com/a/3681/767, I put together this:
(dir-locals-set-class-variables 'emacs '((nil . ((buffer-read-only . t) (show-trailing-whitespace . nil) (tab-width . 8) (eval . (whitespace-mode -1)))))) (dir-locals-set-directory-class (concat user-emacs-directory "elpa") 'emacs) (dir-locals-set-directory-class (locate-dominating-file (locate-library "winner") "lisp") 'emacs)
This worked fine until I went to install a new package. At that point, the machinery kicks in to create autoloads and then fails to write them because they are considered to be read-only.
I suspect I could do something with
defadvice but maybe my whole approach needs to be rethought. Has anyone else already solved this?
C-x C-qto change a buffer's read-only status. (And there's always undo ;-).)
M-x report-emacs-bugabout the failure to install packages with such a config.