我有一長串文件和文件擴展名,我希望Emacs以ruby模式自動打開。從使用谷歌,最基本的解決方案是這樣的:如何將自動模式對的列表對齊?
(setq auto-mode-alist (cons '("\.rake$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\.thor$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("Gemfile$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("Rakefile$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("Crushfile$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("Capfile$" . ruby-mode) auto-mode-alist))
這似乎對我來說是重複的。有沒有一種方法可以定義對的列表一次,並循環或直接將其放在auto-mode-alist
?我試過
(cons '(("\\.rake" . ruby-mode)
("\\.thor" . ruby-mode)) auto-mode-alist)
但這似乎並不奏效。有什麼建議麼?
謝謝!一個問題 - 「let」和「let *」有什麼區別? – bitops
使用'let *',每個本地綁定表達式都可以看到列表中以前表達式生成的本地綁定。在這種情況下,我需要查看'ruby-files'來設置'ruby-regexp'。參見:'C-h f let * RET'與'C-h f let RET'。 – phils