% -----------------------------------------------------------------------------
%              Reference Sheet for Emacs 19 @ Oberlin CS (1996)
%  (derived from Kennis Koldewyn's <kkoldewyn@kpmg.com> Unix/Emacs reference)
% -----------------------------------------------------------------------------
% Karl Fogel, <kfogel@cs.oberlin.edu> <kfogel@red-bean.com>


\documentstyle[11pt]{article}
%\pagestyle{empty}
\oddsidemargin=-0.25in
\evensidemargin=-0.25in
\topmargin=-1in
\textheight=9.5in
\textwidth=7.5in

\newcommand{\key}[1]{\verb!#1!}
\newcommand{\z}[1]{{\em #1\/}}
\newcommand{\s}[1]{\verb!/!}
\newcommand{\sect}[1]{{\Large\bf #1} \par \vspace{4pt}}
\newenvironment{tabled}
  {\begin{tabular}{@{}p{1.1in}p{3.6in}@{}}}
  {\end{tabular}}

\begin{document}

\parindent=4.6742in
\begin{tabular}{@{}p{0.75in}cp{0.75in}@{}}
  & \Large\bf Notes & \\ \hline
\end{tabular}

\parindent=0in

\sect{Files}
\begin{tabled}
  \key{ls}                      & Lists files \\
  \key{rm} \z{file}             & Remove \z{file} \\
  \key{cp} \z{from} \z{to}      & Makes a copy of \z{from} named \z{to} \\
  \key{mv} \z{file} \z{newname} & Renames \z{file} to \z{newname} \\
\end{tabled}

\vspace{12pt}

\sect{Directories}
\begin{tabled}
  \key{cd} \z{directory}        & Go to \z{directory} (stands for ``change
                                  directory'')  \\
  \key{cd}                      & Go to your home directory \\
  \key{pwd}                     & Display the name of the current directory \\
  \key{mkdir} \z{name}          & Make a new directory called \z{name} \\
  \key{rmdir} \z{name}          & Remove the directory \z{name} (it must
                                  first be empty) \\
\end{tabled}

\vspace{12pt}

\sect{File Names}
\begin{tabled}
  \z{file}                      & An ordinary file \\
  \z{dir}\s\z{file}             & A file named \z{file} in a directory named
                                  \z{dir} \\
  \key{/}                       & The root directory \\
  \verb!~!                      & Your home directory \\
  \verb!~!\z{user}              & The home directory of \z{user} \\
  \key{.}                       & The current directory \\
  \key{..}                      & The ``parent'' directory \\ 
\end{tabled}

\vspace{12pt}

\sect{Handy Commands}
\begin{tabled}
  \key{cat} \z{file}            & Display the contents of \z{file} \\
  \key{more} \z{file}           & Display \z{file} a page at a time \\
  \key{lpr} \z{file}            & Print out \z{file} on the lab printer \\
  \key{man} \z{command}         & Display manual pages about \z{command} \\
  \key{man -k} \z{word}         & Display commands with manual entries
                                  related to \z{word} \\
\end{tabled}

\vspace{12pt}

\sect{Emacs: Moving Around}
\begin{tabled}
  \key{C-b}/\key{C-f}           & Move back/forward one character \\
  \key{M-b}/\key{M-f}           & Move back/forward one word \\
  \key{C-a}/\key{C-e}           & Move to the beginning/end of the line \\
  \key{C-p}/\key{C-n}           & Move up/down to the previous/next line \\
  \key{C-v}/\key{M-v}           & Move down/up a screen \\
  \key{M-<}/\key{M->}           & Move to the beginning/end of the buffer \\
  \key{C-s}/\key{C-r}           & Search forward/backward (\key{RET} exits the
                                  search) \\ 
\end{tabled}

\vspace{12pt}

\sect{Emacs: Cut and Paste}
\begin{tabled}
  \key{C-d}/\key{DEL}           & Delete next/previous chacter \\
  \key{M-d}/\key{M-DEL}         & Delete next/previous word \\
  \key{C-k}                     & Cut (``kill'') to the end of the line \\
  \key{C-SPC {\rm or} C-@}      & Set the mark \\
  \key{C-w}                     & Cut from cursor to mark (stands for
                                  ``wipe'') \\ 
  \key{M-w}                     & Copy from cursor to mark \\
  \key{C-y}                     & Paste the last text cut or copied (stands for
                                  ``yank'') \\
  \key{M-y}                     & Retrieve older cuts (can only be used after
                                  \key{C-y}) 
\end{tabled}

\clearpage

\parindent=4.6742in
\begin{tabular}{@{}p{0.75in}cp{0.75in}@{}}
  & \Large\bf Notes & \\ \hline
\end{tabular}

\parindent=0in

\sect{Emacs: Multiple Buffers}
\begin{tabled}
  \key{C-x C-f}                 & Find a file \\
  \key{C-x C-s}                 & Save the current buffer \\
  \key{C-x b}                   & Switch to another buffer \\
  \key{C-x C-b}                 & Display a list of all buffers \\
  \key{C-x k}                   & Kill the current buffer \\
\end{tabled}

\vspace{12pt}

\sect{Emacs: Windows}
\begin{tabled}
  \key{C-x 0}                   & Delete this window \\
  \key{C-x 1}                   & Display only one window \\
  \key{C-x 2}                   & Split window in two vertically \\
  \key{C-x 3}                   & Split the window in two horizontally \\
  \key{C-x o}                   & Switch cursor to another window \\
\end{tabled}

\vspace{12pt}

\sect{Emacs: Sending Mail}
\begin{tabled}
  \key{C-x m}                   & Start a new mail message \\
  \key{C-c C-c}                 & Send the mail message \\
\end{tabled}

\vspace{12pt}

\sect{Emacs: Reading Mail}
\begin{tabled}
  \key{M-x vm}                  & Start the mail viewer (stands for ``view
                                  mail'') \\
  \key{SPC}                     & Display next message/next page of current
                                  message \\
  \key{n}/\key{p}               & Go to next/previous message (skips deleted
                                  ones) \\
  \key{N}/\key{P}               & Go to next/previous message (doesn't skip) \\
  \key{d}/\key{u}               & Delete/undelete message \\
  \key{r}                       & Reply to message \\
  \key{R}                       & Reply to message, quoting original message \\
  \key{q}                       & Quit VM, saving changes \\
  \key{x}                       & Exit VM without saving changes \\
\end{tabled}

\sect{Emacs: Getting Help}
\begin{tabled}
  \key{C-h}                     & Generic help prefix key (see below) \\
  \key{C-h t}                   & Run the emacs tutorial
  \key{C-h k}                   & Help on key (or key sequence) \\
  \key{C-h f}                   & Describe function (asks for function name) \\
  \key{C-h w}                   & Where is function?  (i.e. which key) \\
  \key{C-h C-h}                 & Help on help \\
\end{tabled}

\end{document}
