Emacs更改文件扩展名模式关联 [英] Emacs change file extension - mode association

查看:120
本文介绍了Emacs更改文件扩展名模式关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Emacs在ObjC模式下打开.m文件。但是我想以八度模式打开它们。我已经添加到 .emacs 文件中:

My Emacs opens .m files in ObjC mode. However I want to open them in Octave mode. I have already added to the .emacs file:

(autoload 'octave-mode "octave-mod" nil t)
(setq auto-mode-alist (cons '("\\.m$" . octave-mode) auto-mode-alist))

我还应该怎么办?我确实安装了八度模式。

What else should I do? I do have Octave mode installed.

推荐答案

幸运的是,一切正在工作,不幸的是我不记得我如何修复它:)也许在我的 .emacs 中有一个错误。这是更正确的代码:

Fortunately everything is working now and unfortunately I don't remember how I fixed it :) Maybe there was an error in my .emacs earlier. This is the more correct code:

(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode))

最近版本不需要自动加载;如果您需要启用它,请注意octave-mode不是打字错误。

Autoloading is unneeded in recent versions; if you do need to enable it, note that "octave-mode" is not a typo.

(autoload 'octave-mode "octave-mod" nil t)

这篇关于Emacs更改文件扩展名模式关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆