<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[onecolumn,letterpaper,11pt]{article}

%===================================================================
\input{common_latex/common_latex_packages}
\input{common_latex/common_latex_definitions}
\input{common_latex/common_latex_help_format}
%===================================================================

\begin{document}

\begin{labcover}
\labtitle{Help Topic: Configuring Emacs}
\vspace{0.1in}
\labdate{Spring 2020}
\vspace{0.1in}
\labauth{Michael Benjamin, mikerb@mit.edu}
\labauth{Department of Mechanical Engineering}
\labauth{MIT, Cambridge MA 02139}
\labline
\end{labcover}

\wikidoc{file=Help.EMCConfigure}
\wikidoc{auth=mikerb@mit.edu}

%====================================================================
\section*{Configuring Emacs}
%====================================================================

Emacs can be configured to your own habits through a custom configuration
file located in your home directory, \var{~/.emacs}. There are a ton of
things you can do here, but below are a few must-haves of my own that I 
encourage you to consider. At the very least, I hope you will make a \var{.emacs}
file of your own and remember that you can customize to your heart's content
later on. A google search on this topic will turn up a lot. 

%====================================================================
\subsection*{An example bare-bones configuration file}

Below is a bare-bones file derived from my own \var{.emacs} file. If you have
no configuration file of your own, this isn't a bad place to start. It hase a 
few features I cannot live without, and I'll discuss those. But for now just get
the below file and call it \var{.emacs} and put it in your home directory. Or 
you can just use \cmd{wget}:

\vspace{0.1in}
\begin{consoleverb}
 $ cd
 $ wget http://oceanai.mit.edu/ivpman/docs/.emacs
\end{consoleverb}
\vspace{0.1in}

\noindent
Here's the file.

\vspace{0.15in}
\begin{fileverb}
;; A bare-bones .emacs configuration file. 

;; Set up the keyboard so the delete key on both the regular keyboard
;; and the keypad delete the character under the cursor and to the right
;; under X, instead of the default, backspace behavior.
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
(global-set-key [home] 'beginning-of-buffer)

;; Always end a file with a newline
(setq require-final-newline t)

;; Stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)

;; Set the fill column width - used in auto-filling
(setq fill-column 80)

;; An absolute must-have in my book 
(define-key ctl-x-map "\C-b" 'electric-buffer-list)

(define-key esc-map "g" 'goto-line)

(global-set-key "\M-t" 'beginning-of-buffer)
(global-set-key "\M-b" 'end-of-buffer)
(global-set-key "\M-i" 'overwrite-mode)

(defun scroll-one-line-ahead ()
  "Scroll ahead one line."
  (interactive)
  (scroll-up 1))

(defun scroll-one-line-behind ()
  "Scroll behind one line."
  (interactive)
  (scroll-down 1))

;; Useful for toggling between .h and .cpp files of a C++ class
(global-set-key "\M-o" 'ff-find-other-file)

(global-set-key [M-down] 'scroll-one-line-ahead)
(global-set-key [M-up]   'scroll-one-line-behind)
\end{fileverb}
\vspace{0.15in}


%====================================================================
\subsection*{Electric Buffer List}

To switch between the currently open file to another file in emacs,
one normally types \var{C-x, C-f}, and types in the new file
name. This gets cumbersome, especially if you're going back and forth
between files. The {\em electric buffer list} refers to list of files
already opened by the user during the current emacs session. To switch
files, you can type
\var{C-x, C-b} and you will notice the window switches temporarily to 
a list of already-opened files. You can use the up and down arrow keys
to select the file you want to jump to, and hit Enter. The screen then
returns to the contents of the newly selected file.

\end{document}

</pre></body></html>