declaring the mode an emacs file should be opened in
emacs
Solution
I usually add something like:
# -*- mode: sh -*-
at the top of the file. See the emacs documentation for more information.
Problem
how can I write, as a comment within a file, the mode that this particular file should be opened with in emacs? for example, suppose I have a script called "foo". In the body of foo, I'd like to put something like: ``` # sh-mode # rest of my script here... ``` to emacs that "sh-mode" should be used when "foo" is opened in emacs. Note, I don't want to do this by file extension from .emacs. The point here is that the filename of "foo" does not say what type of file it is -- I want that to be specified from within the file itself. Is there a way to do this? Thanks.