% Created 2020-07-07 Tue 19:11
% Intended LaTeX compiler: pdflatex
\documentclass[presentation]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{microtype}
\usepackage[scale=0.9]{sourcecodepro}

  \usepackage[main,include]{embedall}
  \IfFileExists{./\jobname.org}{\embedfile[desc=The original file]{\jobname.org}}{}
  
  \usepackage{minted}
  \usepackage[many]{tcolorbox}
  \setminted{
    frame=none,
    % framesep=2mm,
    baselinestretch=1.2,
    fontsize=\footnotesize,
    highlightcolor=white!95!black!80!blue,
    linenos,
    breakanywhere=true,
    breakautoindent=true,
    breaklines=true,
    tabsize=4,
    xleftmargin=3.5em,
    autogobble=true,
    obeytabs=true,
    python3=true,
    % texcomments=true,
    framesep=2mm,
    breakbefore=\\.+,
    breakafter=\,
    style=autumn,
    breaksymbol=\color{page!60!text}\tiny\ensuremath{\hookrightarrow},
    breakanywheresymbolpre=\,\footnotesize\ensuremath{_{\color{page!60!text}\rfloor}},
    breakbeforesymbolpre=\,\footnotesize\ensuremath{_{\color{page!60!text}\rfloor}},
    breakaftersymbolpre=\,\footnotesize\ensuremath{_{\color{page!60!text}\rfloor}},
  }
  
  \BeforeBeginEnvironment{minted}{
    \begin{tcolorbox}[
      enhanced,
      overlay={\fill[white!90!black] (frame.south west) rectangle ([xshift=2.8em]frame.north west);},
      colback=white!95!black,
      colframe=white!95!black, % make frame colour same as background
      breakable,% Allow white breaks
      arc=0pt,outer arc=0pt,sharp corners, % sharp corners
      boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt % no margin/paddding
    ]
  }
  \AfterEndEnvironment{minted}{\end{tcolorbox}}
  \renewcommand\theFancyVerbLine{\color{black!60!white}\arabic{FancyVerbLine}} % minted line numbering
\usetheme[progressbar=foot]{metropolis}
\author{Timothy}
\date{2020-07-05}
\title{Emacs}
\subtitle{That editor people make jokes about}
\let\textsc\MakeUppercase
\definecolor{verbatim}{HTML}{50a14f}
\makeatletter \def\verbatim@font{\color{verbatim}\normalfont\ttfamily} \makeatother

\colorlet{greenyblue}{blue!70!green}
\colorlet{blueygreen}{blue!40!green}
\providecolor{link}{named}{greenyblue}
\providecolor{cite}{named}{blueygreen}
\hypersetup{
  pdfauthor={Timothy},
  pdftitle={Emacs},
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs 26.3 (Org mode 9.4)},
  pdflang={English},
  breaklinks=true,
  colorlinks=true,
  linkcolor=,
  urlcolor=link,
  citecolor=cite
}
\urlstyle{same}
\begin{document}

\maketitle

\section{Reputation}
\label{sec:reputation}
\begin{frame}[label={sec:jokes}]{Jokes}
\begin{center}
Emacs is a great \textls*[70]{\textsc{os}}, but it lacks a decent text editor.
\end{center}
\end{frame}
\begin{frame}[label={sec:alternative-acronyms}]{Alternative acronyms}
\textls*[70]{\textsc{emacs}} is short for ``Editing \textls*[70]{\textsc{mac}}roS'', but some fun people have come up with alternatives.
\begin{itemize}
\item Eight Megabytes And Constantly Swapping
\item Even a Master of Arts Comes Simpler
\item Emacs Manuals Are Cryptic and Surreal
\item Eradication of Memory Accomplished with Complete Simplicity
\item Elsewhere Maybe Alternative Civilisations Survive
\item Easily Maintained with the Assistance of Chemical Solutions
\item Emacs May Allow Customised Screwups
\item Generally Not Used, Except by Middle-Aged Computer Scientists
\end{itemize}
\end{frame}

\begin{frame}[label={sec:xkcd}]{\textls*[70]{\textsc{xkcd}}}
\begin{figure}[!htb]
  \centering
  \includegraphics[scale=0.4]{/home/tec/.emacs.d/xkcd/378.png}
\end{figure}
\end{frame}
\begin{frame}[label={sec:memes-1}]{Memes --- 1}
\begin{center}
\includegraphics[width=.9\linewidth]{vim-emacs-nano.png}
\end{center}
\end{frame}
\begin{frame}[label={sec:memes-2}]{Memes --- 2}
\begin{center}
\includegraphics[width=.9\linewidth]{emacs-at-work.jpg}
\end{center}
\end{frame}
\begin{frame}[label={sec:memes-3}]{Memes --- 3}
\begin{center}
\includegraphics[width=.9\linewidth]{learning-curves.jpg}
\end{center}
\end{frame}
\begin{frame}[label={sec:memes-4}]{Memes --- 4}
\begin{center}
\includegraphics[width=.9\linewidth]{emacs-vim-airline.png}
\end{center}
\end{frame}
\section{So\ldots{} what is Emacs?}
\label{sec:so-what-emacs}
\begin{frame}[label={sec:what-do-memes}]{What do the memes tell us?}
\begin{itemize}
\item Emacs is a thing which edits text
\item Emacs gets compared to Vim a lot
\item Emacs is versatile, it does a lot
\item Emacs is weird
\end{itemize}
\end{frame}
\begin{frame}[label={sec:common-misconception}]{A common misconception}
``Emacs is a thing which edits text'' \ldots{} so, a text editor?
\pause
\alert{nope}
\pause
\begin{center}
\includegraphics[width=0.5\linewidth]{emacs-anything.png}
\end{center}
\end{frame}
\begin{frame}[label={sec:what-then}]{What then?}
\begin{block}{A definition of Emacs}
\begin{quote}
Emacs is a generic user-centric text manipulation

environment.
\end{quote}
\pause
\end{block}
\begin{block}{A simpler definition}
This does sound quite jargony though, let's rephrase.

\begin{quote}
Emacs is an 'app platform' for anything text
\end{quote}
\end{block}
\end{frame}
\begin{frame}[label={sec:that-still-sounds}]{That still sounds like a text editor}
Indeed. \pause
However while that definition matches a text editor, it also applies to a:
\pause
\begin{itemize}
\item \href{https://orgmode.org/}{Task planner \pause}
\item \href{https://www.gnu.org/software/emacs/manual/html\_node/emacs/Dired.html}{File editor} \pause
\item \href{https://github.com/akermu/emacs-libvterm}{Terminal Emulator} \pause
\item \href{https://www.djcbsoftware.nl/code/mu/mu4e.html}{Email Client} \pause
\item \href{https://www.gnu.org/software/tramp/}{Remote server tool} (\textls*[70]{\textsc{ssh}}, \textls*[70]{\textsc{ftp}}) \pause
\item \href{https://magit.vc/}{Git frontend} \pause
\item \textls*[70]{\textsc{http}} \href{https://github.com/pashky/restclient.el}{client} / \href{https://github.com/skeeto/emacs-web-server}{server} \pause
\end{itemize}

Emacs can do all of that. Yep.
\end{frame}
\begin{frame}[label={sec:oh-yes-theres}]{Oh yes, there's a lot you can do}
Ever wanted to \href{https://lars.ingebrigtsen.no/2016/06/27/an-emacs-meme-generator/}{generate memes} without leaving your current app?

\begin{center}
\includegraphics[width=0.55\linewidth]{generate-memes.png}
\end{center}
\end{frame}
\begin{frame}[label={sec:emacs--perfect}]{Emacs is \ldots{} perfect?}
Nope. Not by a long shot.

Emacs has it's own (large) collection of issues.

\begin{itemize}
\item Emacs has annoying quirks
\item Areas of Emacs are showing their age (naming conventions, \textls*[70]{\textsc{api}\protect\scalebox{.91}[.84]{s}})
\item Emacs is single threaded.
When something holds that thread up \emph{the whole of Emacs freezes}
\item And more\ldots{} :(
\end{itemize}

However, Emacs has managed to stay competitive thanks to an unparalleled
ability to be tinkered with, and adapt.
\end{frame}
\begin{frame}[label={sec:emacs-lisp-machine}]{Emacs is a Lisp machine}
\begin{block}{Lisp?}
A versatile programming language with just
two ingredients
\begin{itemize}
\item Atoms
\item Lists
\end{itemize}
\end{block}
\begin{block}{Lisp machine?}
The core of Emacs is a Lisp dialect, with extensions to support text editing.
\end{block}
\end{frame}
\begin{frame}[label={sec:how-useful-it}]{How useful is it?}
\begin{itemize}
\item Emacs has terrible defaults
\item Emacs is often a huge time sink for customisation
\item Other applications can be seen as an ``off the shelf'' tool, while Emacs is a
raw piece of steel which must be forged and tailored for your needs
\begin{itemize}
\item The effort can be great, but so is the reward
\end{itemize}
\end{itemize}
\end{frame}
\section{Doom Emacs}
\label{sec:doom-emacs}
\begin{frame}[label={sec:what-it}]{What is it?}
A fancy configuration base to make Emacs nicer to use and easier to work with.
\end{frame}
\begin{frame}[label={sec:duplication-effort}]{Duplication of effort}
\begin{block}{The effort}
Just now:
\begin{quote}
\begin{itemize}
\item Other applications can be seen as an ``off the shelf'' tool, while Emacs is a
raw piece of steel which must be forged and tailored for your needs
\begin{itemize}
\item The effort can be great, but so is the reward
\end{itemize}
\end{itemize}
\end{quote}
\end{block}

\begin{block}{Duplication}
Does this mean that for everything you have to start from scratch?

What about common use cases?

Most people want a similar setup, are they doomed
to start from nothing, and independently struggle with the same issues?
\end{block}
\end{frame}
\begin{frame}[label={sec:de-duplication-effort}]{De-duplication of effort}
Doom solves this by providing \alert{modules} for common use cases.
\begin{quote}
e.g. JavaScript, c++, \LaTeX, markdown, \ldots{}
\end{quote}
\end{frame}
\begin{frame}[label={sec:modal-editing},fragile]{Modal Editing}
 \begin{block}{The first talk}
Recall all those nice things I said about modal editing and Vim?
\end{block}
\begin{block}{Going to the evil side}
Emacs has a fantastic package called \textls*[70]{\textsc{evil}}, for ``Extensible \textls*[70]{\textsc{vi}} Layer''.
Most popular packages (e.g. \texttt{magit}) have an 'evil' companion developed (e.g.
\texttt{evil-magit}) which adds modal functionality.

From the \texttt{spacemacs} project homepage:
\begin{quote}
The best editor is neither Emacs nor Vim, it's Emacs and Vim!
\end{quote}
\end{block}
\end{frame}
\section{Let's get started}
\label{sec:lets-get-started}
\begin{frame}[label={sec:install}]{Install}
Follow the \href{https://github.com/hlissner/doom-emacs/blob/develop/docs/getting\_started.org}{getting started guide}. Say \emph{yes} to every prompt.
\begin{quote}
\tiny \url{https://github.com/hlissner/doom-emacs/blob/develop/docs/getting\_started.org}
\end{quote}
\end{frame}

\begin{frame}[label={sec:join-discord-server}]{Join the discord server}
People there are quite useful.
\url{https://discord.gg/qvGgnVx}
\end{frame}
\begin{frame}[label={sec:what-have-you},fragile]{What have you got?}
 Let's look at how Emacs is now. Open the Emacs app.

Expect it to appear with your other applications.
On Linux/Mac you can call \texttt{emacs} in a terminal.
\end{frame}
\begin{frame}[label={sec:doom-binary},fragile]{The doom binary}
 Doom has a executable which is used for some updating doom, installing packages,
troubleshooting, and more.
\begin{description}
\item[{Mac/Linux}] \verb,~/.emacs.d/bin/doom,
\item[{Windows}] \verb~C:\Users\USERNAME\.emacs.d\bin\doom~
\end{description}

Consider either adding the \verb~bin~ folder to your \texttt{PATH}, or (on Mac/Linux) using an
alias with:
\begin{minted}[]{shell}
alias doom=~/.emacs.d/bin/doom
\end{minted}
\end{frame}
\begin{frame}[label={sec:configuration},fragile]{Configuration}
 Doom has three configuration files.
\begin{itemize}
\item \texttt{init.el}
\item \texttt{config.el}
\item \texttt{packages.el}
\end{itemize}

On Mac/Linux these will probably be in \verb,~/.doom.d,. On windows try
\verb~C:\Users\USERNAME\.doom.d~ as long as you set your \href{https://mywindowshub.com/how-to-edit-system-environment-variables-for-a-user-in-windows-10/}{\textls*[70]{\textsc{home}}}, else try
\verb~C:\Users\USERNAME\AppData\Roaming~.
\end{frame}
\begin{frame}[label={sec:configuration-initel},fragile]{Configuration --- \texttt{init.el}}
 Remember those 'modules' I mentioned?

\begin{minted}[,fontsize=\tiny,firstnumber=79]{common-lisp}
       :checkers
       syntax              ; tasing you for every semicolon you forget
       ;;spell             ; tasing you for misspelling mispelling
       ;;grammar           ; tasing grammar mistake every you make
\end{minted}

\begin{minted}[,fontsize=\tiny,firstnumber=107]{common-lisp}
       :lang
       ;;agda              ; types of types of types of types...
       ;;cc                ; C/C++/Obj-C madness
\end{minted}

\begin{minted}[,fontsize=\tiny,firstnumber=135]{common-lisp}
       ;;latex             ; writing papers in Emacs has never been so fun
       ;;lean
       ;;factor
       ;;ledger            ; an accounting system in Emacs
       ;;lua               ; one-based indices? one-based indices
       markdown          ; writing docs for people to ignore
       ;;nim               ; python + lisp at the speed of c
       ;;nix               ; I hereby declare "nix geht mehr!"
       ;;ocaml             ; an objective camel
       org               ; organize your plain life in plain text
       ;;php               ; perl's insecure younger brother
\end{minted}
\end{frame}
\begin{frame}[label={sec:configuration-modules},fragile]{Configuration --- modules}
 \begin{enumerate}
\item Uncomment the ones you like the look of --- like \texttt{latex}, which we'll be looking at
next week.
\item Once you've done that call \texttt{doom sync} and all the required packages will be
downloaded etc.
\end{enumerate}

Want to read about modules? Press \verb~SPC h d m~ and you'll be presented with a list
of modules, picking one gives you the documentation.
\end{frame}
\begin{frame}[label={sec:configuration-configel},fragile]{Configuration --- \texttt{config.el}}
 Basically everything. All your configuration beyond \texttt{init.el}.
We'll go over some example stuff later.
\end{frame}
\begin{frame}[label={sec:configuration-packagesel},fragile]{Configuration --- \texttt{packages.el}}
 Any packages you want to use other than those installed from modules.

Read the comments for details, but often you'll use something of the form:
\begin{minted}[]{common-lisp}
(package! something)
\end{minted}

Just remember to run \texttt{doom sync}.
\end{frame}
\begin{frame}[label={sec:aside-why-are}]{Aside: why are we so obsessed with using a keyboard}
This can be explained quite simply.
Most people can type 50 wpm. Assuming an average word length of 5, that's 250
keystrokes per minute!

\begin{enumerate}
\item Try comparing that to how many actions/clicks you can preform with a mouse.
\item Enabling a fully keyboard-driven workflow meas you never have to take your
hands off the keyboard.
\end{enumerate}
\end{frame}
\begin{frame}[label={sec:leader-key},fragile]{Leader key}
 Take a menu bar.
\begin{center}
\includegraphics[width=0.6\linewidth]{app-menu-bar.png}
\end{center}

How might you access those items with a keyboard?
Perhaps following some trigger you could use \verb~f~ to get to \emph{file}, \verb~e~ to \emph{edit}, \verb~v~ to
\emph{view}, etc.

Doom does this, using \verb~SPC~ as a trigger.
\begin{center}
\includegraphics[width=.9\linewidth]{doom-leaders.png}
\end{center}
\end{frame}
\begin{frame}[label={sec:basic-actions},fragile]{Basic actions}
 \begin{itemize}
\item \verb~SPC f f~ find (and open) file
\item \verb~SPC f s~ save file
\item \verb~SPC b b~ switch buffer
\item \verb~SPC b k~ kill (close) buffer
\item \verb~SPC p p~ switch project
\end{itemize}
\end{frame}
\begin{frame}[label={sec:fumbling-around},fragile]{Fumbling around}
 The help is great.
\begin{itemize}
\item \verb~SPC h~ has a lot of help under it
\item \verb~SPC h v~ look at variables
\item \verb~M-x~ call an interactive function
\end{itemize}

Want to set a variable in your config? Add something like this to your
\texttt{config.el}.
\begin{minted}[]{common-lisp}
(setq variable value)
\end{minted}
\end{frame}
\section{Try it out}
\label{sec:try-it-out}
\begin{frame}[label={sec:killer-apps}]{Killer apps}
\begin{description}
\item[{magit}] a fantastic git interface
\item[{org-mode}] an exceptionally versatile plaintext format
\item[{dired}] powerful file manager
\item[{tramp}] lets you act on remote servers with ease
\end{description}
\end{frame}
\begin{frame}[label={sec:elisp}]{Elisp}
It's the language used by everything in Emacs.
It's a Lisp, so it probably looks a bit strange.
Consider reading a bit about the syntax if/when you feel like configuring Emacs :)
\end{frame}
\end{document}
