I have been using emacs for some time now and am slowly getting the hang of things. However, I don't know enough emacs-lisp to implement the following functionality:
I want to define a list (say prog-modes), which will be a list of the programming modes I use (.c, .cpp, .h, .el, .py). If the file I'm opening is of a type mentioned in this list, I want it to be opened read-only. Otherwise, I want it to open normally.
I prefer opening my files read-only to avoid any mess-up with stray edits, but this gets irritating when emacs tries to auto-open files and write to them (eg. in org-mode), hence the need for such a function.