|
|
Intro to Using EECS Workstations
Version 2.0 |
||
|
|
|||
|
|||
|
I. The Basics Each time Emacs loads up, it executes the commands contained within the .emacs file. These commands are written in Emacs-Lisp, a special version of the Lisp programming language used to write Emacs itself. The traditional way of customizing emacs was to edit the .emacs file directly. This is still popular, but perhaps it is easier to use the new "Customize" menu. This guide discusses the first way of customizing Emacs; that is, manually. Caution: Even small typos can lead to the whole program not working properly. So unless you code perfectly every time, be prepared for some debugging. A good practice is to make a backup of the original .emacs file before you start messing with it. Later, if you decide to revert to original settings, just replace the file with the backup. The .emacs file usually exists in the home directory. Thus to edit the .emacs file:
cory% emacs ~/.emacs & (If you're using the PC version of Emacs, you can find out where your home directory is by opening and saving the file ~/.emacs. Search for .emacs and you'll probably find it in a place like C:\). To customize settings, you either add new functions or assign values to variables. You can write your functions and think of all the variables you want to set from scratch. But it's easier to start from an example file and see what functions and variables are interesting to you. From there, you can copy/paste a compilation of stuff into your .emacs file. You'd just adjust the appropriate numbers of truth values for various settings. Looking through sample files and editting them to fit your tastes is a very good way to start out. As a sidenote, the .emacs file can get rather huge. Thus, it is common practice to split up different sections into their respective files and then just include links to them from your .emacs file. These files may have a ".el" extension (which stands for "Emacs Lisp"). For example, suppose you have a file that for settings for HTML editting called HTML.el in your home directory. And you have another one that has color settings for Java editting called Java.el. And you have one that adds an alarm clock feature called Alarm.el. Instead of appending their contents into one huge file, you can just link to each one within the .emacs file for a total of three more lines. In your .emacs add:
... blah blah blah ... (load-file "~/HTML.el") (load-file "~/Java.el") (load-file "~/Alarm.el") ... blah blah blah ... Here, the blah blah blah represents other code. Keep in mind that placement of the lines matters. That is, if there is a conflict in settings, the files you load later will overwrite settings that were set earlier. Also, you may see compiled versions of .el files, which have the .elc extension. These byte compiled files run more efficiently. But you link to them just the same. Ready to get started? You can find many example .emacs files from dotemacs.de, which features submissions from users from all over the world. Or, you can look immediately below for some interesting and useful customizations! II. RSemacs Over the years, I have compiled many customizations into a collection called RSemacs. The files in the collection are plain text files, containing Emacs Lisp (.el) code. There is also a README file, which I really urge you to read in order to take note of the many features but also the limitations and areas still being debugged.
You can download this collection, install it as described below, and start using it as-is! It's really easy to do (just read the README). Of course, you can also go into the code, and change things to fit your style. That's easy to do, too. There are comments in the code that explain how to set various settings. If you want to read the README before downloading the collection, you can see a copy of it here: README.txt. Click on the link and see Section 5 for a complete listing of features that I customized. |
|||
|
|
|||
| ©Copyright 2001, Richard Shiao. All rights reserved. Please send comments to: [email protected] | |||