CSI 205 Emacs Commands |
If emacs does not work properly with your terminal emulator system:
(1) exit emacs, give the command
eval `resize`
restart emacs and try again
(2) Make sure that the commands in your .login file get the
correct terminal type for your terminal emulator. (Ask for help
on the newsgroup if necessary.)
(3) It may be a good idea use the Kermit communication software.
It works better with emacs and other unix programs than
some other terminal emulators such as Hyperterm. Albany provides
students with free copies of Kermit95 from its Academic Computing
Web software download page and from computers in LC-3 and LC-4.
Bring 2 floppy disks. Ask the consultants in LC-27 for help.
The meta.cmd file will make emacs easier to use.
General Emacs Commands ( work anytime, anyplace)
Note: for "region related" commands, the region consists of all text
between "dot" (the current cursor position) and "mark" (set via C-@ command)
There are literally hundreds of commands in emacs. They all
have somewhat self explanatory spelled out names. On-line help is available to
find relevant or apropos ones (C-h a) and to document a given command (C-h f).
C-h access on-line help at any time, type ? for instructions
Cursor motion, file opening, quitting:
On properly set up terminals, you can use the arrow keys to move the
cursor around. Otherwise, these always work:
C-f forward one character (move curser forward)
C-b backward character (move curser backward)
C-p previous line (move curser up one line)
C-n next line (move curser down one line)
C-v scroll up (scroll text of window up one full screen)
ESC v scroll down (scroll text of window down one full screen)
ESC-< move to beginning of buffer
ESC-> move to end of buffer
C-a beginning of line (move curser to beginning of line)
C-e end of line (move cursor to end of line)
C-r reverse search (incremental)
C-s search forward (incremental)*
Repeated use of C-s or C-r will find subsequent occurances of the
search string. Typing an ordinary character will extend the
search string and find the next occurance of the extended string.
Finish incremental search with cursor at match last found with
ESC, stop with cursor returned to place before search with C-g
C-x o other window (switch to). "windows" divide up the screen,
some functions make new windows.
C-x 1 make the window with the cursor in it be the only window
C-x C-f find (visit) another file, change to the buffer of the file
if file has already been visited. Visiting a directory lists it.
C-g interrupt command -- used to abort typing to prompts, searches,
or other long running commands if you change your mind.
C-q self insert (quote, insert next character into buffer
rather than executing its command). Otherwise, restart
output (undo C-s) if terminal honors C-s/C-q flow control*
C-x C-c Exit emacs (after saving any files that need saving)
C-@ set mark (for setting regions)
(ESC-X set-mark-command will work if C-@ fails on some terminal
emulators. Get your emulator fixed or find out how to define another
key combination to set the mark)
ESC-w copy region (save region in kill ring, but don't remove from buffer)
Commands for changing or editing data:
They work on every non-read-only buffer, including the "minibuffer"
for prompted inputs at the bottom of the screen.
Ordinary characters, tabs and new-lines insert themselves at the cursor.
DEL delete the character left of the dot
C-k kill to end of line (delete text, saving it in kill ring)
C-w kill the region (remove from buffer and save in kill ring)
C-y yank (and insert) text from kill ring
Use these 3 and cursor motion commands to move text around
C-x C-s Save changes on disk (write file)*
C-x C-u undo the last completed command
C-x i insert another file into buffer
Extended commands:
ESC-x execute extended command, to run the command you type in.
Follow command name with new-line to execute. Get automatic
completion display with SPC. Abort type in with C-g.
In emacs documentation, M- means (roughly) ESC-
*if C-s freezes your screen, or if a spurious `I-search:' prompt appears,
it means that your terminal connection honors or emits flow control.
Type C-q to unfreeze screen. Flow control should be disabled for proper
operation of emacs; ask for help.
Network News: To start reading news, enter ESC-x gnus This puts one
in "newsgroup" mode. When in newsgroup mode (buffer showing you all
the newsgroups). Note: The "current newsgroup" means the one the
cursor is pointing at. Available commands:
SPC Show messages in that newsgroup
C-u SPC Show all messages, including those already read and deleted
l list newsgroups (only those newsgroups subscribed to)
L list all newsgroups (including those not subscribed to)
j jump to a specific newsgroup
a post an article
g get new news (get articles arriving since current session began)
n next unread group (go to)
p previous unread group (go to)
q quit reading news
u unsubscribe from current group (or re-subscribe if not subscribed)
C catchup on old news (mark every article as read)
C-c TAB run the info system on gnus
News Subject mode (when actually displaying articles):
a post an article to the current newsgroup
f followup: post followup to current message
F Followup: post followup, including original message in text
s search: incremental search on the current article
d delete an article, move to next one (w/o displaying it)
u un-delete the current article (leave it marked unread)
n next (go to) unread article
p previous (go to) unread article
C-o append message to a mail file
q quit reading articles from this newsgroup
r reply to the current article via mail
R reply to current via mail, include article in draft
SPC show next page of current article
< go to beginning of article
> go to end of article
= delete other windows and show subject headers in current window
C Cancel an article already posted (doesn't always work)
C-c C-c send the message (after you finished editing the message that
you want to send)
Type the name of the newsgroup to send it to at the prompt,
such as sunya.class.csi402
and then just a newline on the next prompt.
Rmail (sending and receiving mail): To enter rmail, enter "ESC-X rmail":
? help: open a window containing summary of mail commands
g get new mail
m mail a message: compose a new mail message
c continue composing message previously started
r reply to current message
f forward message to another user
o output message (append) to another rmail file
C-o output message (append) to a Unix mail format file
n next message: display the next undeleted message
d delete message (and move to next one)
u undelete message: going backwards from current, undelete first
deleted message encountered
e expunge deleted messages (make deletions permanent)
s save changes in file
q quit rmail (saving changes in file)
ESC-n next message: display next message, whether deleted or not
p previous message: display the previous undeleted message
ESC-p previous message: display previous message, whether deleted or not
> end of messages: display last message in Rmail file
< beginning of messages: display first message in Rmail file
ESC-s Search for message containing given string
h Show headers (summary of all message recieved)
j jump to a specific message number (as shown in header summary)
message number taken from prefix arg (defaults to 1)
When typing in a mail message:
C-c C-c Send the message
ESC-q reformat paragraph (make paragraph look neat)
GDB To invoke gdb, run "ESC-x gdb", then supply the name of the a.out
file you wish to debug.
You can then type gdb commands in the *gud* window. The source lines
around the currently execution source line will pop up when a breakpoint
is hit or you step through the program.
You can save keystrokes by using *gud* mode bindings. Type C-h m
to see them.
Hints for using gdb under emacs:
--------------------------------
To pass the interrupt character ^C to gdb to break into long loops or
waiting for input, type ^C ^C
To pass the end of file character to gdb so end of file is appended to the
program input you have typed in, type ^Q ^D and hit return
(The ^Q is needed so emacs does not interpret ^D as an emacs command)
Another useful technique is to prepare the input in a file say "datafile"
and redirect the input from the debugger to the program being debugged with
(gdb) run < datafile
The program can be run with command line arguments with
(gdb) run first second third etc.
![]()