I am writing a Perl program in GNU emacs without the file extension .pl or .pm. Is there a way I can set the language environment to Perl without having to开发者_如何学Python change the file extension?
Put the comment
# -*- perl -*-
in the first (or second if you have the interpreter in the first line) line of your file. If you do so it will open in perl mode next time you open it.
You can with the following,
(setq auto-mode-alist
(append '(("\\.pl$" . perl-mode)
("\\.pm$" . perl-mode)) auto-mode-alist))
You can set the mode:
M-x perl-mode
精彩评论