打开js文件时,自动切换到js2-mode
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
其中“\\.js\\'
”是正则表达式用来匹配js文件,
“\\.
”匹配“.
”,“\\'
”匹配字符串结尾
注意:
http://www.emacswiki.org/emacs/AutoModeAlist
Note that \'
matches the end of a string, where as $
matches the empty string before a newline. Thus, $
may lead to unexpected behavior when dealing with filenames containing newlines. (Should be pretty rare…)