Adam's Emacs Dotfiles
I am a big fan of emacs. Over the years I've suckered many
coworkers into using my emacs dotfiles. On this page you can
find the latest version of my emacs dotfiles, plus some meager
associated documentation.
Caveat emptor : Despite appearances, I am not an emacs
expert. I probably can't help you with random emacs problems,
and you might have different ideas about what should go into
your dotfiles.
The gurge.com blog may have additional tips and information.
Please send comments and suggestions to amd@gurge.com
Download
Changelog
Installation
Customization
Tips and Tricks
Download
The latest version is amdelisp-2007-01-20.zip (2.2mb)
Changelog
- 2007-01-20
- completion fixes for emacs 22 compat
- changed nxml indent to 2
- mapped html/sgml to nxml mode
- *.rake => ruby mode
- abtags auto-reloads TAGS files now
- finally tracked down and fixed pesky loaddefs issue
- 2006-09-03
- ruby 1.74.2.14 from Ruby 1.8.4
- ruby electric Mar 2005 from Dee Zsombor
- many ruby fixes and enhancements (Rakefile, yaml, indent=2, etc.)
- cc-mode 5.31.3
- csharp-mode 0.5.0 from Dylan Moonfire (thanks Brigham)
- 2006-08-04 - Initial release.
Installation
- Download and unzip amdelisp.
- If you DO have an existing .emacs file, add this to the top:
(defvar AMDELISP <path-to-elisp>)
(load (format "%s/start" AMDELISP))
For example, if you unzipped amdelisp-2007-01-20.zip
into /myfiles/, you would use:
(defvar AMDELISP "/myfiles/amdelisp-2007-01-20/elisp")
(load (format "%s/start" AMDELISP))
The AMDELISP variable is used elsewhere, so it's important
that you set it.
- If you DON'T have an existing .emacs file, use the one
included in the download, and customize the top as indicated in
step (2).
- Hint for Windows users - remember that emacs looks for
the .emacs file in your HOME directory. The easiest way to
make this work is to manually set the HOME environment
variable.
- Run emacs!
Customization
Font
On Windows, add something like this to your .emacs:
(when window-system
(setq my-font (window-build-font "Andale" 11)))
Colors
I use my own color theme. Try it out with this:
(turn-on-color-theme-amd)
Check out prefs.el to learn how to build your own theme. Mine
is complicated because I like to have different colors for
Windows, Linux, and the terminal.
Keys
All keys are defined in prefs.el. Look there for examples.
Completion
This is extremely handy but some people don't like the
implementation. If you want TAB to complete the current word,
add this:
(require 'complete)
(partial-completion-mode t)
(global-set-key-override0 (if is-win32 [tab] "\t") 'clever-hippie-tab)
(global-set-key-override (if is-win32 [tab] "\t") 'clever-nxml-tab 'nxml-mode)
If you press TAB at the start of the line, it will reindent
the line instead of trying to complete.
Tabs vs. spaces and indent size
These are usually controlled by the two variables
indent-tabs-mode and tab-width. Look in modes.el
to learn how to add hooks to different modes to control the
indent level. This really sucks.
Window size and location
There are three variables that control window
geometry. window-position can be 'left, 'center, or
'right. window-columns is the width of the
window. window-fudge is a fudge factor that nudges the
window a bit (left right top bottom). Thanks to Arthur van
Hoff for this code.
(when window-system
(setq window-position 'right
window-columns 87
window-fudge '(0 12 0 55))
Other stuff
Experiment with this goo and other stuff you see in the sample
.emacs:
(menu-bar-mode 0)
(mouse-wheel-mode t)
(blink-cursor-mode 1)
(global-hl-line-mode)
(transient-mark-mode t)
Tips and Tricks
These dotfiles are chock full of useful stuff. Here are a few
pointers to help you get started.
Feature List
- cross platform - works on Windows and Linux, windowed or in a terminal
- lots of modes - including some simple ones I created (valgrind, svn, mbox, NSIS, ...)
- customizable - these dotfiles are probably more customizable then others you've seen, because they've been used by so many people over the years
- speedy - I use autoloads everywhere so emacs starts up quickly
- make.el - helpers for compiling (try M-s)
- abtags.el - quickly jump around large numbers of files. Build a TAGS file with ctags, then use abtags-find-file (bound to F7 in my .emacs).
- TAGS helpers - M-. to lookup a tag, M-, to pop back
File Arrangement
| .emacs | a sample .emacs file that loads start.el |
|
| elisp/abtags.el | great way to jump around using TAGS files (thanks to Adam Feder) |
| elisp/added.el | standalone functions I wrote |
| elisp/linux.el | linux-specific stuff |
| elisp/make.el | helpers for compiling |
| elisp/modes.el | configuration for all modes |
| elisp/prefs.el | things you actually might want to change (colors, keys, ...) |
| elisp/start.el | entry point that loads the other files |
| elisp/svn.el | some simple subversion wrappers |
| elisp/window.el | helpers for controlling where the emacs window appears |
|
| elisp/emacslib/ | contains 3rd party emacs libraries that I use in my dotfiles |
| elisp/lisp/ | please ignore, this is just to help generate autoloads |
| elisp/subdirs.el | please ignore, this helps to load subdirs |
3rd party libraries in elisp/emacslib/
| apache-mode | modes for many apache conf files |
| ascii | show ascii codes when moving the cursor |
| color-theme | skins for emacs |
| filladapt | helper for "filling" lines. Mainly useful to java comments. |
| gnuserv | used to allow Windows Explorer to send files to an existing emacs |
| guess-offset | tries to guess the indentation size for c/c++/java/etc. |
| htmlize | convert font locked emacs buffers to colored html |
| jdok | useful for parsing java files |
| pager | alternate pageup/pagedown commands that try to return to the same line |
| psvn | sophisticated svn helpers. I wrote a simpler svn.el. |
|
| cc-mode | c/c++/java/etc. mode |
| cperl-mode | perl |
| css-mode | cascading style sheets |
| nxml-mode | XML |
| php-mode | php |
| python-mode | python |
| ruby-mode | ruby (can't find the download link) |
| visual-basic-mode | vb |
|
| html-helper-mode | very old, very broken HTML mode. These days I prefer nxml mode for html. |
| mmm-mode | very old, very broken way to combine modes (like, CSS inside HTML) |
|