Discussion:
Automatically begin mode at startup
(too old to reply)
AndreLTR
2013-08-13 15:10:53 UTC
Permalink
Hello,

How could I start an emacs mode automatically at startup please? In my case, I'd like to have the matlab-mode launched automatically by default.

TIA,

Andre Luiz
Michael Heerdegen
2013-08-13 16:20:25 UTC
Permalink
Post by AndreLTR
How could I start an emacs mode automatically at startup please? In my
case, I'd like to have the matlab-mode launched automatically by
default.
Do you want the *scratch* buffer to be in matlab-mode, or do you want to
create a new buffer using that mode at startup? Or do you want that
certain files are in matlab-mode after opening them?


Michael.
AndreLTR
2013-08-13 21:57:50 UTC
Permalink
Post by Michael Heerdegen
Post by AndreLTR
How could I start an emacs mode automatically at startup please? In my
case, I'd like to have the matlab-mode launched automatically by
default.
Do you want the *scratch* buffer to be in matlab-mode, or do you want to
create a new buffer using that mode at startup? Or do you want that
certain files are in matlab-mode after opening them?
Michael.
Dear Michael,

I'd like the scratch buffer to be in matlab-mode for this mode is begun automatically whenever I open a *.m file.

THX,

André Luiz
Michael Heerdegen
2013-08-14 12:24:26 UTC
Permalink
Hi AndreLTR,
Post by AndreLTR
I'd like the scratch buffer to be in matlab-mode for this mode is
begun automatically whenever I open a *.m file.
Setting `initial-major-mode' is a good idea:

(setq initial-major-mode 'matlab-mode)

The file association is done with
(see http://www.emacswiki.org/emacs/MatlabMode)

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

I recommend to use

(require 'matlab)

in your init file.

BTW, you can also give elisp code to the emacs binary, like this:

emacs --eval '(matlab-mode)'


Regards,

Michael.
Thad Floryan
2013-08-13 20:44:14 UTC
Permalink
Post by AndreLTR
How could I start an emacs mode automatically at startup
please? In my case, I'd like to have the matlab-mode
launched automatically by default.
Hi Andre,

Simplest case is to set the mode in the .emacs file.

My preference is to default to "Fundamental" when initiating
a new instance of Emacs and the following line in .emacs does
that for me:

(setq initial-major-mode 'fundamental-mode)

Thad
AndreLTR
2013-08-14 19:09:50 UTC
Permalink
Post by AndreLTR
Hello,
How could I start an emacs mode automatically at startup please? In my case, I'd like to have the matlab-mode launched automatically by default.
TIA,
Andre Luiz
Michael,

Great! THX!

TIA,

Andre Luiz

Loading...