Håkon Hægland
Håkon Hægland

Reputation: 40718

Select custom emacs major mode at command line

I have created my own major mode in emacs for editing certain files. I would like to select this mode from the command line (the mode works fine if I auto-load it from within my Emacs init file (~/.emacs). I have tried the following (see How can I start different mode with Emacs in command line? ) :

emacs -f my-mode file &

but nothing happens. (I have stored my mode file in ~/emacs/my-mode.el.)

(I have also tried emacs -f matlab-mode file just to see if there is something wrong with my particular mode file, but I do not get matlab-mode either)

I am using GNU Emacs 23.3.1 on Ubuntu 12.04.

Upvotes: 1

Views: 305

Answers (1)

abo-abo
abo-abo

Reputation: 20342

The order of arguments matters. This works for me:

emacs test.org -f c++-mode &

Upvotes: 2

Related Questions