Reputation: 4885
My .emacs file concerning Matlab is as follows:
;; Matlab mode
(autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
(setq matlab-indent-function t)
(setq matlab-shell-command "matlab")
But when I open a Matlab file, I see I'm in Objective-C mode. Since I do not plan on writing Objective-C anytimes soon, how do I default all .m files to open in Matlab mode?
Upvotes: 5
Views: 1371
Reputation: 14065
Your comment says you've resolved this. Something tells me you did it by adding
(add-to-list 'auto-mode-alist '("\\.m" . matlab-mode))
to your .emacs
. I've got so many of these sprinkled around that I just wrote a convenience macro for it:
(defmacro by-extension (ext mode)
`(add-to-list 'auto-mode-alist '(,(format "\\.%s" ext) . ,mode)))
which lets me write things like
(by-extension "m" matlab-mode)
Upvotes: 7