Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs change file extension - mode association

Tags:

emacs

octave

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.

like image 412
marczellm Avatar asked Feb 18 '13 17:02

marczellm


2 Answers

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))

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)
like image 132
marczellm Avatar answered Oct 09 '22 17:10

marczellm


Use this.

;; octave-mode
(autoload 'octave-mode "octave-mode" "Loding octave-mode" t)
(add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode))
like image 22
CantGetANick Avatar answered Oct 09 '22 16:10

CantGetANick