In order to prevent accidental editing of a file when opening a library of virtual environments such as virtualenv, if you change the Emacs setting, you can open it automatically in read-only state without executing C-x C-q.
An example of setting targeting pyenv's directory is as follows.
(add-hook 'find-file-hook
(lambda ()
(dolist (pattern '("~/.pyenv/versions/.*"
;; add here
))
(if (string-match (expand-file-name pattern) buffer-file-name)
(read-only-mode)
))))
Top comments (0)