When Emacs starts it will load a file named .emacs
in your home
directory and execute the commands found in it. This file is written
in Emacs Lisp, but you can use it without knowing any Lisp, by copying
other people's sample files. It is mainly useful for making certain
extended commands a permanent part of your Emacs experience, so you
don't have to type them every time you start Emacs. In the example
below, comment lines start with one or more semi-colons, so you would
delete the semi-colons to enable the given feature.
;; Sample ~/.emacs file ;; ;; Un-comment what you want to enable and re-start Emacs ;; ;;Load iswitch mode ;;(require 'iswitchb) ;;Make text mode the default for new buffers ;;(setq default-major-mode 'text-mode) ;;Turn on refill-mode whenever text mode is entered ;;(add-hook 'text-mode-hook ;; '(lambda () (refill-mode 1))) ;;Enable syntax highlighting when it's allowed ;;(when (fboundp 'global-font-lock-mode) ;; (global-font-lock-mode t)) ;;Fix the backspace key ;;(normal-erase-is-backspace-mode 1) ;;Use cperl-mode for editing Perl code, it is better than perl-mode ;;(defalias 'perl-mode 'cperl-mode) ;;Don't blink my cursor, please ;;(blink-cursor-mode nil) ;;Display the current time in the modeline ;;(display-time-mode t) ;;Start the emacs server ;; ;;When this is running, programs calling emacsclient open a buffer ;;in the already running emacs. Useful in mutt or pine for composing ;;mail in Emacs. Type C-x # to exit client buffer and send the text ;;back to the application that called it. ;;(server-start)
The above example gives you a good idea of what can be done in a
.emacs
file, for more in-depth configuration Emacs has a customization
mode that can be accessed with the extended command M-x
customize
. Running it will put you in a curses-style application where
you can choose from customization menus and have your changes written
to your .emacs
file automatically.