Emacs's Default Settings." /> Emacs's Default Settings." /> Emacs's Default Settings." />
LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.
BooksAll ArticlesSafari BookshelfO'Reilly GearFree Newsletters

FAQS
 FAQs
Apache FAQ
Linux FAQ
XML FAQ

Log in to particpate





TECH JOBS


   Linux FAQ > 8. How To Do This or Find Out That...
Question:  8.17. Configuring Emacs's Default Settings.
Answer:

Create a file in your home directory named .emacs with the Emacs Lisp commands that you want to run every time Emacs starts up. You won't see the file in the directory listing. (The leading '.' tells ls not to display it, unless you use the -a command line switch with ls.)

Any kind of Emacs Lisp statement will work in the .emacs file, including entire defuns. Emacs uses lisp variables and statements extensively, and many of the editing functions are written in Emacs Lisp. For example, to enable word wrapping whenever you edit a file that ends with .txt, add the following statement. This is from the Emacs Texinfo help document ( F1-i, then m Emacs Return):

(add-hook text-mode-hook
    '(lambda () (auto-fill-mode 1)))


This adds a statement that calls a hook function whenever a text editing mode is entered for that buffer. The value of text-mode-hook, which is a variable, to auto-fill-mode, which is a function.

If you want to turn off the menu bar at the top of each Emacs frame, add this statement:

(menu-bar-mode -1)


And if you want to include an Emacs Lisp program that someone has written, like msb.el (an enhanced, pop-up buffer menu), make sure the lisp file is in a directory where Emacs can find it (usually it will be named Site-lisp), and add these statements in the .emacs file:

(require 'msb)
(msb-mode 1)


Most tasks have several possible solutions in Emacs Lisp. Any task that can be programmed in Emacs Lisp is valid in the .emacs file. For more information, consult the Texinfo documentation. There is also a FAQ list for Emacs (refer to: What other FAQ's are there for Linux? ).


This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by:

Contact UsMedia KitPrivacy PolicyPress NewsJobs @ O'Reilly
Copyright © 2000-2006 O’Reilly Media, Inc. All Rights Reserved.
All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners.
For problems or assistance with this site, email