| Advice from Emacs wizards
   .ProfileApropos Regular Expressions
	Big Brother DatabaseCache of EMacroControlling CommandsConfiguring EMacroCUA.el and Clashing CommandsEdit Unusual FilesElisp HackingFind Functions & VariablesISpellJapaneseKDE ColorsKeyboard PerformanceKill Several BuffersMAC OSOpen New WindowOraclePut Emacs On A DietReplace Text In A SubdirectoryRemote PrintingSearching EmacsWikiShell CommandsSuperscriptssu root permissionsTrueType FontsUpgrading EMacroWord WrapXEmacs .emacs upgradeXEmacs Toolbar AdjustmentGLOSSARY If you use zsh, bash, ksh, or similar shell, you can edit your history
of commands with:
 set -o emacsI 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 CommandsM-x shellbrings 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
 
 
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 
 
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.
 
 
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 http://tiny-tools.sf.net 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. 
 
    Cancel commands with C-gHistory of commands to repeat with M-x M-p.Repeat to cycle through history C-x ESC ESCSometimes C-x z repeats commands, too. 
 
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.
 
 
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 typeC-c(Control C) and
thenC-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. 
 
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.
 
 
You can always hit C-x eafter a closing parenthesis, to execute
the preceding lisp function. GNU Emacs also supports interactive
interpretation: tryM-x ielm 
 
The best way to find emacs functions & variables is to install
hyper-apropos, in hyperbole from
http://www.beopen.com/ 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 64to 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
	     '("german"
	       "[a-zA-Z\304\326\334\344\366\337\374]"
	       "[^a-zA-Z\304\326\334\344\366\337\374]"
	       "[']" t ("-C" "-d" "german") "~latin1" iso-8859-1))
(add-to-list 'ispell-dictionary-alist
	     '("swiss"
	       "[a-zA-Z\304\326\334\344\366\337\374]"
	       "[^a-zA-Z\304\326\334\344\366\337\374]"
	       "[']" t ("-C" "-d" "swiss") "~latin1" iso-8859-1))
I just installed the Portuguese dictionary for ispell from
http://fmg-www.cs.ucla.edu/geoff/ispell-dictionaries.html
 and had to add the following entry to ispell-dictionary-alist:
 (add-to-list 'ispell-dictionary-alist
	     '("portugues"
	       "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
	       "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
	       "[']" 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.
 
 Edit $KDEDIR/apps/kdisplay/app-defaults/Emacs.ad 
 
See "AutoRepeat" in XF86Config file, if you use XFree86 (Linux). See also
resources.html
 
 
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!
 
 
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.
 
 
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/ 
 
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-printerThis is saved in preferences.el as
 
 (setq lpr-command "ssh")
 (setq lpr-switches '("print_server" "lp" "-d" "printer_name")) 
 
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 diredor/home/path/
 /home/path/*.cIf you are using Gnu Emacs, you can mark a subtree of directories by
        
 M-x find-dired
 /home/path/
 -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
 dired-markType 'Q' dired-do-query-replaceType in your replacements as regexps 
 
You need to escape special characters, so to search for c++, you would
need to enter   c\+\+in the HTML search box. 
 
See also .Profile
 
Emacs emulates many unix commands. Examples: These shells support smart things like arrows & color:
instead of
InM-x cd,M-x dir,M-x grep M-x shell,C-upgets 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 ^1in Emacs.On some keyboards it is
 AltGr+Shift 1There's also footnote.el which has more features. 
 
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
 /root@localhost:/dir/filename 
 
From: Peter Baumgartner peter@uni-koblenz.de
Enable TrueType Fonts under XWindow by running the xfstt font server.
Extend the font path by
 xset fp+ inet/127.0.0.1:7101This 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
 
 
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.
 
 
Emacs calls "Word Wrap" as fill mode. EMacro lets you type M-x
auto-fill-modeto turn this on and off. Emacs does one better, where you
can hitC-x .to indent plain text, after, for example, an
* used  as a bullet.M-qwill insert a new bullet at the
beginning of the current line. XEmacs lets you turn this on withM-x
filladapt-mode 
 
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 yourselfDisadvantages May modify your .emacs file, making EMacro
    incompatible with (GNU/FSF) Emacs 
 
M-x edit-toolbar
 default-toolbarEMacro 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 exampleFrame Another window of Emacs, if you run in a GUIKill Cut selected text: C-w or S-DELKill Buffer Clipboard that holds selected textMark 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 EmacsYank Paste selected text: C-y or S-INS |