How can I save my Emacs settings?

5.1k views Asked by At

I am using the Emacs editor, and every time I start Emacs, I lose my previous settings.

For example, every time I have to type:

  • M-x cua-mode RET
  • M-x auto-complete-mode RET

How can I save my settings in Emacs?

Thanks.

3

There are 3 answers

0
phils On BEST ANSWER

The best answer I can think of is to point you at the manual:
http://www.gnu.org/software/emacs/manual/html_node/emacs/Customization.html

In particular, see the sections on "Easy Customization" and the "Init File"; but I would recommend at least skimming over everything in this section.

5
BillRobertson42 On

You can add them to your .emacs file.

(cua-mode)
(auto-complete-mode)

If you find that there are already things in your .emacs file, then you might want to add the commands at the end.

1
Asha On

In your emacs directory there is a site-lisp folder. Normally it will be empty. you could create a file default.el in this folder. Add these two lines (cua-mode t) (auto-complete-mode) and save it.This will be executed during Init. If you want to set environment variables for your emacs application only(not permanent) add a file called site-start.el in the site-lisp directory and define value for that variable ex:(setenv "VARIABLENAME" "value"). The site-lisp directory is in the standard search path for Lisp library.