The very unofficial .emacs home EMacro - Tips
what is this all about ?
customization basics
special topics
local dotfiles
dotfiles on the web
new and updated pages
useful sites and pages
search locally
OS/2 Emacs
Additional Resources
Installation Docs
Release Notes
To Do
Latest Additions
local files:
John J. Glynn
David Jolley

linked files:


The Emacs wiki

Advice from Emacs wizards

  1. .Profile
  2. Apropos Regular Expressions
  3. Big Brother Database
  4. Cache of EMacro
  5. Controlling Commands
  6. Configuring EMacro
  7. CUA.el and Clashing Commands
  8. Edit Unusual Files
  9. Elisp Hacking
  10. Find Functions & Variables
  11. ISpell
  12. Japanese
  13. KDE Colors
  14. Keyboard Performance
  15. Kill Several Buffers
  16. MAC OS
  17. Open New Window
  18. Oracle
  19. Put Emacs On A Diet
  20. Replace Text In A Subdirectory
  21. Remote Printing
  22. Searching EmacsWiki
  23. Shell Commands
  24. Superscripts
  25. su root permissions
  26. TrueType Fonts
  27. Upgrading EMacro
  28. Word Wrap
  29. XEmacs .emacs upgrade
  30. XEmacs Toolbar Adjustment


If you use zsh, bash, ksh, or similar shell, you can edit your history of commands with: set -o emacs
I used to have the following in my unix $HOME/.profile. You may have to put this in a .zshrc | .bashrc | .kshrc, as Emacs starts an interactive shell. EMacro now supports ansi-color.el, which allows colorized ls inside M-x shell. However, you may freely use this sample to disable or enable functionality, only when your terminal is an Emacs term. See also Shell Commands M-x shell brings up a shell inside Emacs. Control Up Arrow allows you to recall previous commands. #-*-Shell-Script-*- #Hint for emacs to open file in shell script mode
#use source, setenv for c shell
EDITOR=xemacs #Make xemacs your default editor
export EDITOR

#Bourne shell (sh) does not support alias
#Redefine ls for emacs, which cannot handle ansi color escapes
#Emacs sets the $EMACS environment variable for `M-x shell`
#This fancy notation sets $EMACS to "f", if it is unset:
if [ ${EMACS:=f} = t ]; then; alias ls='/bin/ls -ACF' #for emacs

#otherwise, we exploit our fully functional terminal:
else; alias ls='/usr/local/gnu/bin/ls -ACF --color'; fi
export ls

Apropos Regular Expressions

You can use regular expressions to search help. If you want to learn how to stop duplicated commands in Emacs shell history, you would say, "Search for shell OR comint, followed by dup" or, in Emacs speak:

M-x apropos RET \(shell\|comint\).*dup RET

Big Brother Database

Loading EMacro's inet.el enables BBDB. You can activate it in a supported mode, such as GNUS (Internet Emailer and Usenet newsreader) by hitting ":", when the cursor is near an address. This adds the address to the BB DataBase, and brings it up in a buffer at bottom, where a right mouse click brings up a popup menu.

Cache of EMacro

locate-library() is one of the slowest commands in elisp. EMacro optimizes this command, by saving its results in ~/emacs/preferences/e-cache.el (or e-xcache.el for XEmacs). This also has the side effect, that when you've installed or browse-url.el, and conditions work right, that you can click on the links to download these packages.

There are far more packages in [X]Emacs, than the EMacro team can support, but all the supported libraries, not bundled with [X]Emacs, are listed in the cache[s]. EMacro currently does not automatically refresh the cache, so you must delete them, when you change supported packages in your load-path. This is what happens, when you run ~/emacs/bin/[os]/e-refresh. EMacro will automatically repopulate any missing items in the cache.

Controlling Commands

  • Cancel commands with C-g
  • History of commands to repeat with M-x M-p.
  • Repeat to cycle through history C-x ESC ESC
  • Sometimes C-x z repeats commands, too.

Configuring Emacro

Before you make changes to EMacro, you should read INSTALL.txt's section on upgrading. Rather than simply uncommenting code, copy your uncommented code to postload.el, (or a file you call from it). This file is meant to be modified.

CUA.el and Clashing Commands

Say you are running cua-mode, and you wish to use the command shortcut for M-x comment-region. First, you mark the region by dragging the mouse, or shift-arrow. You type C-c (Control C) and then C-o. To your surprise, it copies text to the clipboard, then tries to open a file. The trick is to execute these commands rapidly together: C-c C-o. If you are in a programming mode (modeline at bottom says c-mode or emacs-lisp-mode, etc), then the selected region will be commented out.

Edit Unusual Files

Using the variable file-name-handler-alist, you can execute arbitrary code when opening a file. This is used by dired and ange-ftp / efs. You can adapt this to other things, such as seamlessly editing text stored in a database, where (X)Emacs silently performs the select/update.

Elisp Hacking

You can always hit C-x e after a closing parenthesis, to execute the preceding lisp function. GNU Emacs also supports interactive interpretation: try M-x ielm

Find Functions & Variables

The best way to find emacs functions & variables is to install hyper-apropos, in hyperbole from However, you can type C-h v, or C-h f then tab, to have the complete list of possible variable or function names, respectively. Then click in the *completion* buffer that should have appeared and do an i-search C-s using for your keyword. This also lets you inspect what values are currently set.


If you're running NT Emacs and want to use the Cygwin port of ispell[1] together with the German and Swiss dictionaries by Bjoern Jacke (he got them from Heinz Knutzen), here is the info you need.
The key is to get the binary distribution and install it, then get the source distribution, add #define MASKBITS 64 to local.h and run make programs (the other targets fail, that's why I need the binary distribution as well). Copy the programs into whatever directory you keep the stuff from the binary distribution.
Now you can get the German and Swiss dictionaries by Bjoern and run make there (no problem as soon as you have the MASKBITS stuff), and copy the .hash and .aff files into wherever the binary distribution puts them.
Into you .emacs, put the following lisp code. It is copied from the deutsch8 entry. If you want other command line options and word boundaries, just take another entry from ispell-dictionary-alist as a template.

(add-to-list 'ispell-dictionary-alist
	       "[']" t ("-C" "-d" "german") "~latin1" iso-8859-1))
(add-to-list 'ispell-dictionary-alist
	       "[']" t ("-C" "-d" "swiss") "~latin1" iso-8859-1))

I just installed the Portuguese dictionary for ispell from and had to add the following entry to ispell-dictionary-alist:

(add-to-list 'ispell-dictionary-alist
	       "[']" t ("-C" "-d" "portugues") "~latin1" iso-8859-1))


If you want to display Japanese fonts, you should have MULE & LEIM support compiled in to Emacs. It may help to look at japanese.el & canna.el. You will also need to have Japanese fonts installed.
You can put -*- coding: foo; -*- in the first line of the file (into a LaTeX comment, for instance), for the right value of foo.
You can use file-coding-system-alist to tell Emacs about the right coding system based on the file name.

KDE Colors

Edit $KDEDIR/apps/kdisplay/app-defaults/

Keyboard Performance

See "AutoRepeat" in XF86Config file, if you use XFree86 (Linux). See also resources.html

Kill Several Buffers

You can select and remove several buffers with C-x C-b to show list, then cursor to each, and type "d" to delete. Hit "x" to exit.


You may see a dialog comes up saying that some settings have to be initialized the first time emacs is started, and that emacs may have to be restarted. If you see this again on the restart, set Preferences... -> Cross Platform -> Convert text files to Macintosh format to Never. Note that EMacro Help only supports Netscape browser. If you are are good at Applescript, you can help the EMacro project improve this!

Open New Window

To see 2 windows in your emacs editor, try C-x 4 b. Also see the split-window-recent() function in functions.el


You can get query results in emacs sql-mode on one line with 'set linesize 9999'. See also auto-fill-mode & hscroll to adjust line wrapping.

Put Emacs On A Diet

You probably shouldn't use Emacs if you are starved for disk space. Your best bet is to use an Emacs clone, such as Jed or Jove. Following are some Emacs files that are not critical. We will use the word move, to free these files. Contact your system administrator, as to whether you should move them to another partion or system (and link), compress, or, if needed, ~delete~. "~emacs" refers to the main emacs directory. "~lisp" means ~emacs/lisp
Proceed with CAUTION! We are not responsible for this advice! Further, this advice has not been tested, and could lead to Emacs misbehaving!

  • Move all files in ~emacs/lisp/ which do not end with '.el' or '.elc'. Furthermore, move all files which end with '.el' if a corresponding '.elc' file exists. Do this for all subdirectories as well. You can also move all files from the doc directory except for the DOC* files.
  • The following directories are not part of core editor functionality, and can be moved
  • ~lisp/mail/
  • ~lisp/gnus/
  • ~lisp/term/
  • ~lisp/play/
  • ~lisp/emulation/
  • ~lisp/calendar/
  • If you only need english ascii, you can move these directories:
  • ~emacs/leim/
  • ~lisp/language/
  • ~lisp/international/

Remote Printing

Windows users can simply give a UNC name to their printer, e.g. \\remote\hp6. Windows users might also wish to use "print", when EMacro prompts the first time for the print command. This is saved in preferences.el as
(setq lpr-command "print")
If your Linux system administrator hasn't set up /dev/rp0, you might be able to EMacro's first time prompt with something like
rsh server lp -d hp-printer
This is saved in preferences.el as
(setq lpr-command "ssh")
(setq lpr-switches '("print_server" "lp" "-d" "printer_name"))

Replace Text In A Subdirectory

If you want to search & replace "foo" with "bar" in all your C files (which have names like "file.c" or "file.h"):

  • M-x dired


    or   /home/path/*.c
  • If you are using Gnu Emacs, you can mark a subtree of directories by
    M-x find-dired
    -name "*.[ch]"
    Note that Microsoft Windows comes with a default find.exe that comes first in PATH.
  • Mark the files you want to work on.
    See "Mark" in menu, or C-h a
  • Type 'Q' dired-do-query-replace
  • Type in your replacements as regexps

Searching EmacsWiki

You need to escape special characters, so to search for c++, you would need to enter   c\+\+   in the HTML search box.

Shell Commands

See also .Profile

Emacs emulates many unix commands. Examples: M-x cd, M-x dir, M-x grep

These shells support smart things like arrows & color:
  • M-x tshell
  • M-x term
instead of
  • M-x shell
In M-x shell, C-up gets you the previous command.

Also try C-u M-| (shell-command-on-region) which runs a command such as grep or sort, using the selected text


C-x 8 ^1 in Emacs.
On some keyboards it is AltGr+Shift 1 There's also footnote.el which has more features.

su root permissions

You can use Ange-ftp (Emacs) or EFS (XEmacs) to edit files with another user's permissions. This may require the FTP service to be running. Simply open a file using this syntax:
C-x f

TrueType Fonts

From: Peter Baumgartner Enable TrueType Fonts under XWindow by running the xfstt font server. Extend the font path by
xset fp+ inet/
This line typically goes into ~/.xinitrc. Port number 7101 is the default.
Now you can use X-font specifications for ttf-fonts in the usual way. For instance, in ~/.Xresources, set the default XEmacs fonts with

XEmacs.default.attributeFont: -ttf-verdana-medium-r-normal-*-17-*-75-75-*-*-iso8859-1

Upgrading EMacro

If you told EMacro that you have a fast internet connection, and you have a suitable tool, such as the lynx browser in your path, EMacro will check at startup for an upgrade. If you are tired of the prompt, and really do not want to upgrade, you can either comment out the code at the bottom of e-config.el, or fake a higher version in e-macro.el. Note that this will adversly impact our support of EMacro to you.

Word Wrap

Emacs calls "Word Wrap" as fill mode. EMacro lets you type M-x auto-fill-mode to turn this on and off. Emacs does one better, where you can hit C-x . to indent plain text, after, for example, an * used as a bullet. M-q will insert a new bullet at the beginning of the current line. XEmacs lets you turn this on with M-x filladapt-mode

XEmacs .emacs upgrade

When you upgrade your version of XEmacs, you may be prompted to migrate EMacro's .emacs file. Currently, we recommend against this.

  • Advantages Creates a .toolbar file, but you can create one yourself
  • Disadvantages May modify your .emacs file, making EMacro incompatible with (GNU/FSF) Emacs

XEmacs Toolbar Adjustment

M-x edit-toolbar
EMacro already loads user defined toolbars in ~/.xemacs/.toolbar


  • Keys (Note that the - is just a separator)
  • A- Means hold down the Alt key,while typing the next keyboard key. You are not likely to see this often; applies only to keyboards with both Alt and Meta keys.
  • C- Hold Control key, while pressing next key.
  • M- Press Meta key with the next letter. Most keyboards, this is the Alt key (be sure to try both the left, as well as right Alt keys). Otherwise, press and release the ESC key, then press the next key.
  • S- Press Shift key, then next key.
  • Buffer Active file loaded into RAM memory. Much like windows on top of each other, that you switch to, using C-x C-b. Buffers can also be split using C-x 2, for example
  • Frame Another window of Emacs, if you run in a GUI
  • Kill Cut selected text: C-w or S-DEL
  • Kill Buffer Clipboard that holds selected text
  • Mark and Point The beginning and end of region of selected text. Point is where the text cursor currently is.
  • Minibuffer The status area at the bottom of Emacs
  • Yank Paste selected text: C-y or S-INS
All content copyright by the contributors. Website maintained with Emacs , wsmake and html-helper-mode
Emacs community logo by Daniel Lundin Last updated on Sat Jan 22 14:57:04 2005 by Ingo Koch