When I browse Emacs help for functions via
C-h f, I often want to peek into the Elisp/C implementation. I want to enter
view-mode automatically when I access source code this way to avoid unnecessary modification. Is there a hook or function I can advise to accomplish this?
I use the alternative approach which you can specify entirely in your init file (as opposed to creating a
.dir-locals.el file), and I simply make the files read-only rather than using
view-mode. My config looks like this:
;; Emacs (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 "/usr/local/src/emacs" 'emacs) (dir-locals-set-directory-class "/usr/local/share/emacs" 'emacs) (dir-locals-set-directory-class "/usr/share/emacs" 'emacs)
Obviously you can do the same thing for your elpa directory, and any other directory which contains third-party source code.