Miscellaneous Emacs Features
This was described earlier, for file names. The same holds for command names,
buffer names, etc.
A D V E R T I S E M E N T
You can give just the first few letters of, say, an M-x command (e.g. M-x cal
instead of M-x calendar). Then hit the Space bar, and emacs will do name
completion, showing you which commands begin with the string you have so far.
Use of the Tab and Return keys in this context produces results like Space,
but with some differences. Experiment with them, and you'll see the difference.
Once you get accustomed to this feature, you will find that you rarely have
to spell out a full command name; the Space bar will do most of your typing for
you! All you have to do is give enough characters for uniqueness, and hit the
space bar.
Abbreviations
Suppose you are writing an article about the state of Washington. Instead of
typing ``Washington'' again and again, you need type it only once. After you
type it that first time, place the cursor one character to the right of the
final letter in the word, in this case the second `n', and type C-x +. You will
then be prompted for an abbreviation, say `wa'. From then on, whenever you type
`wa', followed by a space, emacs will expand your abbreviation to the
full word `Washington'.
To take effect, the emacs variable `abbrev-mode' must have the value
`t', i.e. true. You can check this by using the C-x v command, and if it has the
value `nil', i.e. false, you can either use the `set-variable' function to set
it, or simply `M-x abbrev-mode'.
File Backup
Emacs periodically will make backup copies of all files you are
editing. The copies are distinguished by a tilde at the end of their names.
Using Emacs Under X11
Emacs does allow you to make use of the mouse in certain ways. One of
the most useful is as a speedier alternative to C-x o in switching windows. If
you are in one window and wish to move to another, simply click the left mouse
button in that window. And even better--the cursor will not only move to that
window, but also move to the exact position within the window that the mouse
pointed to when you clicked.
Customizing Emacs
Emacs allows you to make your own abbreviations of commands. Some you
would use only in a given emacs session, or even only in a given emacs
buffer. Others you would use all the time, and thus you would put them into your
.emacs file. See the on-line help facilities described below for the commands
global-set-key, local-set-key, add-global-abbrev, etc. My .emacs file shows some
examples of their use.
You can also use the emacs-lisp language to write new commands.
Learning More About Emacs
On-Line Help
Emacs has an excellent on-line help facility, including the following
commands:
C-h t invoke an emacs tutorial
C-h f get a short description of a function
C-h a list all functions whose name includes the given string
C-h b list all the bindings of keys
C-x v get an explanation of a given emacs variable, and find out
its current value
M-x info get more extensive information on emacs features
The tutorial is mainly about cursor-movement commands, which is not very
useful if you will (as I recommend) be using vip-mode for those actions.
C-h f is much more useful. If for example I wish to know about the various
e-mail commands which emacs has, I can type C-h a and then when prompted
in the minibuffer, type `mail'. A buffer will then be created which lists all
emacs commands whose name includes the string `mail'. For example, one of
them will be rmail; I can then learn more about it by typing C-h f and then
answering `rmail' when the prompt appears in the minibuffer.
The command M-x info is quite good. Just follow instructions (e.g. your first
command in it will probably be `m emacs').
Library Files
Various emacs commands are actually files in the lisp subdirectory of
the emacs directory on your machine. You may wish to browse through this
subdirectory. To find out where it is, type
to the Unix shell. The .el files you see in that directory are written in the
emacs-lisp language, so you can use these as examples to help learn from. Note
that whenever you see a function or variable name which is new to you, you can
find its definition by using C-h f.
Footnotes
- ...C-z.1
- C-z also works, but this would conflict with emacs's vi
capability.
- ...arises.2
- And since it generally does take a few seconds to start up, it's better
to just do this once, at the beginning of one's Unix session.
- ...C-g.3
- If you are in vip-mode at the time, you may have to type C-g more than
once.
- ...files4
- Since they are temporary, they will not be on the disk, though you have
the option of saving them to disk if it becomes useful to do so
- ...facility.5
- Actually I must type `_-x calendar', since I am in vip-mode and thus the
ESC key isn't available for emacs commands.
- ...*Completions*,6
- You may wish to move the cursor to this buffer, e.g. to scroll it (the
list may be too large to fit the window) or maybe even to save it to a file.
You cannot make this move by using C-x b, as that would need the minibuffer,
which is already in use, but you can temporarily leave the minibuffer by
using C-x o, to go to another window; just keep using this command until you
get to the *Completions* window. By the way, the *Completions* buffer will
be killed once you actually finish with the minibuffer.
- ...function.7
- This is a very common usage, e.g. to check whether the parameters match
up correctly, though in this example there are no parameters.
|