<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: The SVN Move Command}
\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.EMCUseful}
\wikidoc{auth=mikerb@mit.edu}

%====================================================================
\section*{Useful emacs commands}
%====================================================================


Emacs contains a huge wealth of built in functionality to make basic
tasks easier. If you ever find yourself asking "can emacs do X?",
the answer is probably "Yes! And it has a keyboard shortcut!" It is
possible to do nearly every editing task using your keyboard.

%====================================================================
\subsection*{Emacs Help}
Emacs has a powerful help system. The help system will easily show you
information about how to use a command, what key it is bound to (or
what key it would be bound to if you've stolen the binding for
something else). Help can be invoked with \var{C-h} followed by
another key depending on what type of help you want.

\noindent
Important help commands:
\var{C-h ?} - Help on help.

\noindent
\var{C-h k} - Help on keys. Type this command, followed by a keyboard
shortcut. Help for the function bound to that key sequence is
displayed. For example, \var{C-h k C-h k} will tell you that

\begin{consoleverb}
C-h k runs the command describe-key
\end{consoleverb}

\noindent
\var{C-h f} - Help on functions. Type a function name to find out
about it. If you press \var{tab}, emacs will offer completion
suggestions, so you don't necessarily need to know the name of the
function.

\noindent
\var{C-h v} - Help on variables. Like \var{C-h f}.

\noindent
\var{C-h m} - Help for mode. Find out features of the current major
mode and any active minor modes. Helpful for discovering useful
functions that the mode's authors have included and bound to keys.

\noindent
\var{C-h i} - Emacs info. Browseable help manual.

%====================================================================
\subsection*{C++ Programming in Emacs}
Opinions differ on the use of tabs in source code, but if you want to
avoid inserting them, you can put the following in .emacs. You can
change "2" in the second line to be whatever tab width you prefer:

\begin{fileverb}
(setq-default indent-tabs-mode nil)
(setq tab-width 2)
\end{fileverb}

\noindent
By default, emacs open .h files in C-mode instead of C++ mode. You can
improve your syntax highlighting by switching to C++ mode (\var{M-x
  C++-mode RET}), but if you want to make it default, use the
following:

%I'm not sure what escaping, if any, is necessary inside the fileverb
%environment. The correct string is '("\\.h\\'"
\begin{fileverb}
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
\end{fileverb}

\noindent
As long as a class implmentation (.cpp file) and header (.h file) are
in the same folder, emacs will easily switch between them for you with
the command: \var{M-x ff-find-other-file RET}.

\noindent
This is most useful if you assign it to a shortcut key. You can put
something like the following in your \var{.emacs}:

\begin{fileverb}
(global-set-key (kbd "C-f") 'ff-find-other-file)
\end{fileverb}

\noindent
You can make certain words get special syntax highlighting, even in
comment strings:

\begin{fileverb}
(add-hook 'c-mode-common-hook
  (lambda ()
    (font-lock-add-keywords nil
      '(("\\&lt;\\(FIXME\\|TODO\\|HACK\\|fixme\\|todo\\|hack\\)" 1 
        font-lock-warning-face t)))))
\end{fileverb}

\noindent
Directory locals are a powerful tool to customize the way emacs treats
an entire directory. For example, given the following directory
structure:

\begin{consoleverb}
project/
  build.sh
  src/
    pApp/
    lib_foo/
\end{consoleverb}

\noindent
Creating the file src/.dir-locals will direct emacs to apply the
settings in that file to all files in the src directory. 

\noindent
For example, if \var{.dir-locals} contains
%Note that although you could use elisp to reference the build script
%without changing directories, the build script won't work if not
%invoked from the top level directory, so the cd command is necessary.
\begin{fileverb}
((c++-mode
  . ((compile-command . "cd ../../\; ./build.sh"))))
\end{fileverb}

\noindent
Then for any file in c++-mode, using the emacs compile command will
invoke the build script.

\noindent
You might want to bind compilation to a key and make the compilation
buffer scroll to show any pertinent errors:
\begin{fileverb}
  (global-set-key (kbd "&lt;f5&gt;") 'compile)
  (setq compilation-scroll-output t)
\end{fileverb}

\end{document}

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