Skip to content

Commit 2a4d87f

Browse files
Add URL for video tutorial
1 parent 8ac21a8 commit 2a4d87f

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- [[https://github.com/ess-intro/presentation-ess-customization/blob/main/tutorial/ess-customization.org][Raw org file]]
1313
- [[https://github.com/ess-intro/presentation-ess-customization/blob/main/tutorial/ess-customization.pdf][Tutorial in PDF format]]
1414
- [[https://github.com/ess-intro/presentation-ess-customization/blob/main/tutorial/slides-ess-customization.pdf][Tutorial as beamer slides]] (superceded by the above PDF tutorial)
15-
- Video tutorial: soon.
15+
- [[https://www.youtube.com/watch?v=Lf8qrLuvYp8][Video tutorial]]
1616

1717
*** Emacs initialization file
1818
[[https://github.com/ess-intro/presentation-ess-customization/blob/main/tutorial/ess-init.el][A minimal init file]] for some possible customization of ESS is also provided. It should be adapted [[https://github.com/ess-intro/presentation-ess-customization/blob/4b4e388ce0b496b396d090f0121e3fb4785d640a/tutorial/ess-init.el#L127][(in particular for ~yasnippet~)]] according to your own setup and habits.

tutorial/ess-customization.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This tutorial is for R-users beginning to use Emacs Speaks Statistics (ESS). We
5353
This document is a written companion for the video tutorial available at:
5454

5555
#+begin_center
56-
http://toto
56+
https://www.youtube.com/watch?v=Lf8qrLuvYp8
5757
#+end_center
5858

5959

tutorial/ess-customization.pdf

781 Bytes
Binary file not shown.

tutorial/ess-customization.tex

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% Created 2021-02-25 jeu. 11:07
1+
% Created 2021-03-31 mer. 09:27
22
% Intended LaTeX compiler: pdflatex
33
\documentclass[11pt]{article}
44
\usepackage[utf8]{inputenc}
@@ -51,7 +51,7 @@
5151
pdftitle={Customizing and extending Emacs Speaks Statistics},
5252
pdfkeywords={},
5353
pdfsubject={},
54-
pdfcreator={Emacs 27.1 (Org mode 9.4.4)},
54+
pdfcreator={Emacs 27.1 (Org mode 9.4.5)},
5555
pdflang={English}}
5656
\begin{document}
5757

@@ -60,44 +60,44 @@
6060

6161

6262
\section{Introductory words}
63-
\label{sec:org01f47bc}
63+
\label{sec:org795d064}
6464
\subsection{A short tutorial for customizing ESS}
65-
\label{sec:org38c3ffc}
65+
\label{sec:orgf7080c5}
6666
This document is a part of the ESS-Intro tutorial series. A full list of tutorials is available online at \url{https://github.com/ess-intro}.
6767

6868
If you are are totally new to Emacs, you should probably begin with the tutorial ``\href{https://github.com/ess-intro/presentation-first-steps}{First steps with Emacs}'' by Dirk Eddelbuettel.
6969

7070
\subsubsection{Target audience}
71-
\label{sec:org8ad5028}
71+
\label{sec:org45650b4}
7272
This tutorial is for R-users beginning to use Emacs Speaks Statistics (ESS). We only assume that you have mild familiarity with Emacs, and that you know how to customize Emacs by filling your \texttt{.emacs} or \texttt{init.el} file.
7373

7474
\subsubsection{Goals}
75-
\label{sec:orgae3c8f9}
75+
\label{sec:orgec96ced}
7676
\begin{itemize}
7777
\item Helping newcomers and beginners to have a more friendly and efficient setup
7878
\item Helping users migrating from other IDEs to keep behaviours and habits they are used to
7979
\item Showcasing some other Emacs packages that play well with ESS and may improve your coding experience
8080
\end{itemize}
8181

8282
\subsubsection{Video tutorial}
83-
\label{sec:org112b66c}
83+
\label{sec:org7d8cb0c}
8484
This document is a written companion for the video tutorial available at:
8585

8686
\begin{center}
87-
\url{http://toto}
87+
\url{https://www.youtube.com/watch?v=Lf8qrLuvYp8}
8888
\end{center}
8989

9090

9191
\subsubsection{An opinionated tutorial?}
92-
\label{sec:org67ea909}
92+
\label{sec:orgaedb8ab}
9393
Some parts of this tutorial (e.g., replacing \texttt{Flymake} by \texttt{Flycheck} for syntax checking, or using \texttt{company} instead of other solutions for auto-completion) might be seen as quite opinionated. However, when several options or approaches were available for a given task, the most widespread and efficient (I hope!) was presented.
9494

9595
If you prefer other approaches, or simply want to give a try to some other ones, the ESS manual remains the canonical and exhaustive documentation: \url{http://ess.r-project.org/Manual/ess.html}
9696

9797
Feedbacks, fixes and contributions are welcome, and can be addressed \href{https://github.com/ess-intro/presentation-ess-customization/issues}{through the Github repository}.
9898

9999
\subsection{A word about \texttt{use-package}}
100-
\label{sec:org48c369a}
100+
\label{sec:org1e31867}
101101
In this document, several pieces of Emacs Lisp code will be proposed so that you can use them in your init file. Because it will provide a more reproducible setup in the following steps, it is assumed that you use \href{https://jwiegley.github.io/use-package/}{\texttt{use-package}} for your init file. The Emacs Lisp code can be adapted in a straightforward manner if you do not use it.
102102

103103
As a reminder, this is the minimal code to add in your init file so as to use \texttt{use-package}, once it has been installed:
@@ -113,9 +113,9 @@ \subsection{A word about \texttt{use-package}}
113113
\end{minted}
114114

115115
\section{ESS customization}
116-
\label{sec:org3838954}
116+
\label{sec:org5c6aa43}
117117
\subsection{Visibility of code evaluation}
118-
\label{sec:orgbe9037b}
118+
\label{sec:org0cde447}
119119
From an R source file (i.e., an ESS[R] buffer), you can send code to the underlying R process with shortcuts like \texttt{C-c C-b} (\texttt{ess-eval-buffer}), \texttt{C-RET} (\texttt{ess-eval-region-or-line-and-step}), etc.
120120

121121
In the inferior R process buffer, ESS can display either both the commands sent and their results, or only the results. The choice between the two can be made through the variable \texttt{ess-eval-visibly}.
@@ -129,13 +129,13 @@ \subsection{Visibility of code evaluation}
129129
\end{minted}
130130

131131
\subsection{Syntactic highlighting in ESS R source buffers}
132-
\label{sec:org3581de8}
132+
\label{sec:org8fa3961}
133133
By default, ESS highlights literals, assignments, source functions and reserved words. An example of default syntactic highlighting is as follows:
134134

135135
\begin{figure}[htbp]
136136
\centering
137137
\includegraphics[width=0.5 \textwidth]{./images/highlight_default.png}
138-
\caption{\label{fig:org60b5049}Default patterns for syntactic highlighting.}
138+
\caption{\label{fig:orgdc616d0}Default patterns for syntactic highlighting.}
139139
\end{figure}
140140

141141
You can add more patterns to be highlighted, or remove some of them, by customizing the variable \texttt{ess-R-font-lock-keywords}.
@@ -164,13 +164,13 @@ \subsection{Syntactic highlighting in ESS R source buffers}
164164
\begin{figure}[htbp]
165165
\centering
166166
\includegraphics[width=0.55 \textwidth]{./images/highlight_custom.png}
167-
\caption{\label{fig:orgddb6ca3}More custom patterns for syntactic highlighting.}
167+
\caption{\label{fig:orgc94beae}More custom patterns for syntactic highlighting.}
168168
\end{figure}
169169

170170
\subsection{Parenthesis matching}
171-
\label{sec:orga35b965}
171+
\label{sec:org8ef6990}
172172
\subsubsection{Seeing matching parentheses}
173-
\label{sec:org98180e4}
173+
\label{sec:org0c63349}
174174
Directly taken from the ESS manual (\url{http://ess.r-project.org/Manual/ess.html\#Parens}):
175175

176176
\begin{quote}
@@ -185,7 +185,7 @@ \subsubsection{Seeing matching parentheses}
185185
\end{minted}
186186

187187
\subsubsection{Navigating through matching parentheses}
188-
\label{sec:org28c9199}
188+
\label{sec:org6b91289}
189189
Here are some convenient tricks for navigating through parenthetical groups (this can be useful when dealing with large paren groups, e.g. when developing a shiny UI):
190190

191191
\begin{table}[htbp]
@@ -207,9 +207,9 @@ \subsubsection{Navigating through matching parentheses}
207207
For instance, when the point is over a closing parenthesis, \texttt{C-M-p} brings you to the matching opening parenthesis. Then, \texttt{C-M-k} kills to whole paren group.
208208

209209
\subsection{Syntax checker}
210-
\label{sec:orgddd3478}
210+
\label{sec:org1595182}
211211
\subsubsection{Syntax checking: \texttt{Flycheck} vs. \texttt{Flymake}}
212-
\label{sec:org05b6c78}
212+
\label{sec:org20eddbe}
213213
ESS has facilities for on-the-fly syntax checking. Instead of using \texttt{Flymake}, which is the default choice, using \href{https://www.flycheck.org/en/latest/}{\texttt{Flycheck}} appears to be a better and more stable option. The \texttt{Flycheck} documentation allows for a comparison between those two packages:
214214
\url{https://www.flycheck.org/en/latest/user/flycheck-versus-flymake.html}
215215

@@ -226,7 +226,7 @@ \subsubsection{Syntax checking: \texttt{Flycheck} vs. \texttt{Flymake}}
226226
\end{minted}
227227

228228
\subsubsection{On-the-fly syntax checking with \texttt{Flycheck}}
229-
\label{sec:org41ed33e}
229+
\label{sec:orge85a15b}
230230
Using \texttt{Flycheck} with ESS first requires you to install the R package \texttt{lintr}:
231231

232232
\begin{minted}[]{r}
@@ -249,18 +249,18 @@ \subsubsection{On-the-fly syntax checking with \texttt{Flycheck}}
249249
\item unmatched parentheses
250250
\end{itemize}
251251

252-
The following screenshot (Fig. \ref{fig:org4b9f253}) gives some examples of such checks. To display all syntax error in a dedicated buffer, use \texttt{M-x flycheck-list-errors} (bound to \texttt{C-c ! l} by default).
252+
The following screenshot (Fig. \ref{fig:org50cdeac}) gives some examples of such checks. To display all syntax error in a dedicated buffer, use \texttt{M-x flycheck-list-errors} (bound to \texttt{C-c ! l} by default).
253253

254254
\begin{figure}[htbp]
255255
\centering
256256
\includegraphics[width=\textwidth]{./images/lintr.png}
257-
\caption{\label{fig:org4b9f253}An example of syntax errors detected by \texttt{lintr} and displayed in a dedicated \texttt{Flycheck} buffer.}
257+
\caption{\label{fig:org50cdeac}An example of syntax errors detected by \texttt{lintr} and displayed in a dedicated \texttt{Flycheck} buffer.}
258258
\end{figure}
259259

260260
\subsection{Some more steps towards an R IDE}
261-
\label{sec:org75af747}
261+
\label{sec:org1fe77c0}
262262
\subsubsection{Rdired buffer}
263-
\label{sec:org14d0ebc}
263+
\label{sec:org7c0a814}
264264
\href{http://ess.r-project.org/Manual/ess.html\#Rdired}{From the ESS manual:}
265265

266266
\begin{quote}
@@ -269,12 +269,12 @@ \subsubsection{Rdired buffer}
269269

270270
All the R objects of the current R sessions are thus listed in the Rdired buffer, and it is possible to interact with them easily. For instance, type \texttt{p} for plotting an object, \texttt{d} for deleting it, etc.
271271

272-
The screenshot in Figure \ref{fig:orgff7aa8b} shows the contents of an Rdired buffer for the R session associated to a small piece of code.
272+
The screenshot in Figure \ref{fig:org065fea9} shows the contents of an Rdired buffer for the R session associated to a small piece of code.
273273

274274
\begin{figure}[htbp]
275275
\centering
276276
\includegraphics[width=0.75 \textwidth]{./images/rdired.png}
277-
\caption{\label{fig:orgff7aa8b}An example of Rdired buffer (bottom window).}
277+
\caption{\label{fig:org065fea9}An example of Rdired buffer (bottom window).}
278278
\end{figure}
279279

280280
Rdired buffers can be triggered manually with \texttt{M-x ess-rdired}, which might not be really convenient in practice. With the following piece of Emacs Lisp code, you will be able to use \texttt{F9} for both opening and closing the Rdired buffer, so that you can consult and display it only when necessary:
@@ -291,7 +291,7 @@ \subsubsection{Rdired buffer}
291291
\end{minted}
292292
293293
\subsubsection{Window management}
294-
\label{sec:org224d12c}
294+
\label{sec:orgb6fd085}
295295
Users coming from other R IDEs may be used to a given window (or \emph{pane}) configuration, e.g.:
296296
\begin{itemize}
297297
\item R source code window at the top left
@@ -300,12 +300,12 @@ \subsubsection{Window management}
300300
\item R help window at the bottom right
301301
\end{itemize}
302302
303-
This is only an arbitrary example, but quite a reasonable one. You will find in Figure \ref{fig:orgda5106e} a screenshot of such a window configuration. The corresponding Emacs Lisp code to add in your init file follows.
303+
This is only an arbitrary example, but quite a reasonable one. You will find in Figure \ref{fig:orgf85260e} a screenshot of such a window configuration. The corresponding Emacs Lisp code to add in your init file follows.
304304
305305
\begin{figure}[htbp]
306306
\centering
307307
\includegraphics[width=\textwidth]{./images/window_config.png}
308-
\caption{\label{fig:orgda5106e}An example of window configuration: ESS as an R IDE.}
308+
\caption{\label{fig:orgf85260e}An example of window configuration: ESS as an R IDE.}
309309
\end{figure}
310310
311311
@@ -334,9 +334,9 @@ \subsubsection{Window management}
334334
\pagebreak
335335
336336
\section{Some useful Emacs packages}
337-
\label{sec:org4208b38}
337+
\label{sec:orgfdb4589}
338338
\subsection{Completion with company}
339-
\label{sec:org5abf485}
339+
\label{sec:org22a5943}
340340
As mentioned \href{https://ess.r-project.org/Manual/ess.html\#Completion}{in the ESS manual}, there are several completion frameworks for writing R code with ESS. The Emacs package \href{https://company-mode.github.io/}{\texttt{company}} is an elegant solution, which also supports many other programming languages. Here is a minimal piece of Elisp code to add in your init file to install and load \texttt{company}:
341341
342342
\begin{minted}[]{common-lisp}
@@ -352,10 +352,10 @@ \subsection{Completion with company}
352352
\begin{figure}[htbp]
353353
\centering
354354
\includegraphics[width=0.64 \textwidth]{./images/company.png}
355-
\caption{\label{fig:orgeb11286}An example of code completion with \texttt{company}: various candidates are proposed for the arguments of the function \texttt{car::Anova()}.}
355+
\caption{\label{fig:org7bf7e39}An example of code completion with \texttt{company}: various candidates are proposed for the arguments of the function \texttt{car::Anova()}.}
356356
\end{figure}
357357
358-
\texttt{company} offers completion candidates in various contexts: function name, argument name within a function call (as in Fig. \ref{fig:orgeb11286}), object name. It may seem preferable to adopt a non-intrusive workflow. For functions or objects names, completion starts automatically after you type a few letters. For arguments names within a function call, it is suggested that you trigger manually the completion only when you need it. This can be done with \texttt{M-x company-complete}, or more conveniently, by binding this function to a convenient shortcut. For example, to bind it to \texttt{F12}, add the following to your init file:
358+
\texttt{company} offers completion candidates in various contexts: function name, argument name within a function call (as in Fig. \ref{fig:org7bf7e39}), object name. It may seem preferable to adopt a non-intrusive workflow. For functions or objects names, completion starts automatically after you type a few letters. For arguments names within a function call, it is suggested that you trigger manually the completion only when you need it. This can be done with \texttt{M-x company-complete}, or more conveniently, by binding this function to a convenient shortcut. For example, to bind it to \texttt{F12}, add the following to your init file:
359359
360360
\begin{minted}[]{common-lisp}
361361
;; Use F12 to trigger manually completion on R function args:
@@ -382,7 +382,7 @@ \subsection{Completion with company}
382382
\end{minted}
383383
384384
\subsection{Documentation popups with company-quickhelp}
385-
\label{sec:org5777fd6}
385+
\label{sec:org1fac874}
386386
\href{https://github.com/company-mode/company-quickhelp}{\texttt{company-quickhelp}} allows for documentation popups, e.g. to further describe function arguments.
387387
388388
\begin{figure}[htbp]
@@ -406,9 +406,9 @@ \subsection{Documentation popups with company-quickhelp}
406406
By default, the documentation popup is shown automatically. You can adjust the time before the popup shows up by customizing the variable \texttt{company-quickhelp-delay}.
407407
408408
\subsection{Code snippets with yasnippet}
409-
\label{sec:org9fa23ba}
409+
\label{sec:org261b148}
410410
\subsubsection{Key features}
411-
\label{sec:orgf626078}
411+
\label{sec:org94d8013}
412412
\href{https://github.com/joaotavora/yasnippet}{\texttt{yasnippet}} is an Emacs package allowing for the expansion of whole pieces of code you often use (\emph{snippets}) from one given abbreviation.
413413
414414
\begin{itemize}
@@ -418,7 +418,7 @@ \subsubsection{Key features}
418418
\end{itemize}
419419
420420
\subsubsection{Setting up \texttt{yasnippet}}
421-
\label{sec:orgc310081}
421+
\label{sec:orgfe8386b}
422422
To set up \texttt{yasnippet}, proceed through the following steps:
423423
424424
\begin{enumerate}
@@ -457,7 +457,7 @@ \subsubsection{Setting up \texttt{yasnippet}}
457457
\end{enumerate}
458458
459459
\subsubsection{Using \texttt{yasnippet} in an ESS[R] buffer}
460-
\label{sec:orgbe0d91a}
460+
\label{sec:orgcb772f3}
461461
While you are editing an R source file with ESS, each snippet can be triggered by typing its \texttt{key} and then pressing \texttt{TAB}. You can then navigate through the placeholders of the expanded template by pressing \texttt{TAB} again.
462462
463463
For instance, with our previously defined snippet, typing \texttt{fun} followed by \texttt{TAB} will expand the full \texttt{function} template; you will then be able to specify easily a value for each of the three placeholders (the function's \texttt{name}, its \texttt{args} and \texttt{body}).

0 commit comments

Comments
 (0)