我是 Emacs 新手。我打算使用sh-mode
一些文件名模式,因此我将以下几行添加到~/.emacs.d/init.el
:
(dolist (pattern '("\\.zsh$"
"\\.?zshrc$"
"zshrc\\."))
(add-to-list 'auto-mode-alist (pattern . sh-mode)))
但是,它显示以下错误:
符号的函数定义是无效的:模式
如果我使用:
(dolist (pattern '("\\.zsh$"
"\\.?zshrc$"
"zshrc\\."))
(add-to-list 'auto-mode-alist '(pattern . sh-mode))) ;; Note the additional quote
pattern
被添加到列表中,但不是列表中的。
有人能帮帮我吗?谢谢!
答案1
解决方案:
(dolist (pattern '("\\.zsh$"
"\\.?zshrc$"
"zshrc\\."))
(add-to-list 'auto-mode-alist `(,pattern . sh-mode)))