diff --git a/documents/tuto_emacs_windows/.gitkeep b/documents/tuto_emacs_windows/.gitkeep deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/documents/tuto_emacs_windows/images/.gitkeep b/documents/tuto_emacs_windows/images/.gitkeep deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/documents/tuto_emacs_windows/images/completion.png b/documents/tuto_emacs_windows/images/completion.png deleted file mode 100755 index 90d4782532cb4ef231d8aee89ef52ed46d9c3a54..0000000000000000000000000000000000000000 Binary files a/documents/tuto_emacs_windows/images/completion.png and /dev/null differ diff --git a/documents/tuto_emacs_windows/images/install_matplotlib.png b/documents/tuto_emacs_windows/images/install_matplotlib.png deleted file mode 100755 index 2a699f6b2c443dd6d82572844c2f04a65669fbe6..0000000000000000000000000000000000000000 Binary files a/documents/tuto_emacs_windows/images/install_matplotlib.png and /dev/null differ diff --git a/documents/tuto_emacs_windows/images/matplotlib.png b/documents/tuto_emacs_windows/images/matplotlib.png deleted file mode 100755 index 25c8c417019af25b8c9d84845844d23939762f8b..0000000000000000000000000000000000000000 Binary files a/documents/tuto_emacs_windows/images/matplotlib.png and /dev/null differ diff --git a/documents/tuto_emacs_windows/images/scratch.png b/documents/tuto_emacs_windows/images/scratch.png deleted file mode 100755 index 14e13a41dddcebab6c6767e07648a959994cb87c..0000000000000000000000000000000000000000 Binary files a/documents/tuto_emacs_windows/images/scratch.png and /dev/null differ diff --git a/documents/tuto_emacs_windows/tuto_emacs_windows.md b/documents/tuto_emacs_windows/tuto_emacs_windows.md deleted file mode 100755 index f5412344307788f2a64ffbb2273c1cacf3a734dd..0000000000000000000000000000000000000000 --- a/documents/tuto_emacs_windows/tuto_emacs_windows.md +++ /dev/null @@ -1,175 +0,0 @@ -Table des matières -================= -- [1 Installation et configuration des différents outils](#1-installation-et-configuration-des-diff%C3%A9rents-outils) - - [1.1 Installer et configurer Emacs](#11-installer-et-configurer-emacs) - - [1.2 Ajouter les chemins de R et Python dans dans la variable PATH de Windows](#12-ajouter-les-chemins-de-r-et-python-dans-dans-la-variable-path-de-windows) - - [1.3 Installer et configurer matplotlib (librairie graphique Python)](#13-installer-et-configurer-matplotlib-librairie-graphique-python) -- [2 Utilisation d'Emacs](#2-utilisation-demacs) - - [2.1 Exécuter des commandes dos](#21-exécuter-des-commandes-dos) - - [2.2 Exécuter du code R](#22-exécuter-du-code-r) - - [2.3 Exécuter du code Python](#23-exécuter-du-code-python) - - [2.4 Écrire dans le journal](#24-écrire-dans-le-journal) - -# 1 Installation et configuration des différents outils - -## 1.1 Installer et configurer Emacs - -- Installer [Emacs modifié pour Windows](https://vigou3.github.io/emacs-modified-windows/) - - version 26.1 pour Windows 64 bits - - version 25.2 pour Windows 32 bits - -- Télécharger le fichier [rr_org_archive.tgz](https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org_archive.tgz) - -*NB : Avec 7z il faut décompresser l'archive deux fois : une première fois crée une archive `rr_org_archive.tar` et une deuxième fois crée un dossier `rr_org` contenant les fichiers `init.el` et `journal.org`.* - -- Lancer Emacs - -![emacs](documents/tuto_emacs_windows/images/emacs.png) - -- Emacs crée le répertoire `C:\Users\***\.emacs.d` - -*NB : Le répertoire est créé au premier lancement d'Emacs.* - -- Placer le fichier `init.el` dedans - -- Lancer Emacs - -![scratch](documents/tuto_emacs_windows/images/scratch.png) - -- Exécuter la commande suivante pour installer `htmlize` - -``` -M-x package-install RET htmlize RET -``` - -- Créer un dossier `C:\Users\***\org` dans l'explorateur Windows - -- Placer le fichier `journal.org` dedans - ---- - -## 1.2 Ajouter les chemins de R et Python dans dans la variable PATH de Windows - -La façon de procéder est très bien expliquée [ici](http://sametmax.com/ajouter-un-chemin-a-la-variable-denvironnement-path-sous-windows/). - ---- - -## 1.3 Installer et configurer matplotlib (librairie graphique Python) - -- Installer la librairie `matplotlib` - - - Ouvrir une invite de commande dos - - Exécuter la commande suivante - -``` -python -m pip install -U matplotlib -``` - -![install_matplotlib](documents/tuto_emacs_windows/images/install_matplotlib.png) - -- Désactiver les plots interactifs dans matplotlib - -Pour ce faire, il faut d'abord savoir où se trouve le fichier de configuration de matplotlib sous Windows. - -Exécuter le code suivant sous Python - -``` -import matplotlib -matplotlib.matplotlib_fname() -``` - -![matplotlib](documents/tuto_emacs_windows/images/matplotlib.png) - -Ouvrir le fichier `matplotlibrc` et ajouter un `#` devant la ligne qui commence par `backend`, ce qui correspond à utiliser la valeur par défaut `Agg` - ---- - -## 1.4 Installer MiKTeX - -Télécharger et installer [MiKTeX](https://miktex.org/download) en choisissant le bon système d'exploitation. -Vous serez amené à installer différents packages lors du premier export pdf. - ---- ---- - -# 2 Utilisation d'Emacs - -## 2.1 Exécuter des commandes dos - -- Lancer Emacs - -- Créer un fichier toto.org dans l'explorateur Windows - -- Ouvrir le fichier toto.org dans Emacs et saisir `&1 | head -n 1 -#+end_src - -#+RESULTS: -: GNU Emacs 25.2.2 - -Likewise, you'll want to check you have a recent version of org-mode: -#+begin_src sh :results output :exports both -emacs -batch --funcall "org-version" 2>&1 | grep version -#+end_src - -#+RESULTS: -: Org mode version 9.1.11 (9.1.11-dist @ /usr/share/emacs/25.2/site-lisp/elpa/org-9.1.11/) - -The version numbers you get will depend on the distribution you are -running. _You really want to make sure you do not rely on org-mode 8_, -which is now deprecated. -** macOS -*Note:* macOS comes with a prehistoric command-line-only version of Emacs located at =/usr/bin/emacs=. It's best to forget about it. - -The Web site https://emacsformacosx.com/ proposes precompiled Emacs versions for macOS. Download the latest version (the one that figures prominently on the page) and install it like you would install any other macOS application, by copying =Emacs.app= from the downloaded disk image to a convenient location on your computer. - -This Emacs version contains everything used in the MOOC except the packages [[https://ess.r-project.org/][ESS]] (for working with the R language) and [[https://www.gnu.org/software/auctex/][AUCTeX]] (for editing LaTeX). If you use the configuration described under [[#a-simple-reproducible-research-emacs-configuration][A simple "reproducible research" emacs configuration]], these packages will be installed automatically the first time you start Emacs. - -In case you need to run Emacs from the command line (note: this is not required in the MOOC), you have to enter the full path to the executable. Assuming that you have copied =Emacs.app= to =/path/to/emacs=, this is =/path/to/emacs/Emacs.app/Contents/MacOS/Emacs=. Note that if you just type =emacs=, you will use the prehistoric command-line-only version at =/usr/bin/emacs= provided by Apple. - -** Windows -Install the =.exe= file from [[http://vgoulet.act.ulaval.ca/][Vincent Goulet]]: -[[https://vigou3.gitlab.io/emacs-modified-windows/][https://vigou3.gitlab.io/emacs-modified-windows/]]. It ships with recent -versions: -- Emacs 26.1 -- Org-mode 9.1.13 -- ESS 17.11 - -*** Directory naming conventions -In the following instructions, we refer to your home -directory through the (UNIX) =~/= notation. On Windows, your home -directory should be something like =C:\Users\yourname=. Therefore, -whenever we mention the =~/org/= (resp. the =~/.emacs.d/=) directory this -means we are referring to =C:\Users\yourname\org= (resp. -=C:\Users\yourname\.emacs.d\=). -*** Making R and Python available to the console -When running a command, Windows will look for the command in the -directories indicated in the =PATH= environment variable. If none of -these directories contains the command, Windows will stop and indicate -the command does not exist. To make sure R (which may be in -something like =C:/Program Files/R/R-3.5.1/bin/x64/=) and Python (which may be in something like =C:/Program Files/Python/Python37/=) can -easily be run from Emacs, you should thus configure the =PATH= variable -accordingly. - -This requires to go through the "Environment Variable" editor as -explained [[http://sametmax.com/ajouter-un-chemin-a-la-variable-denvironnement-path-sous-windows/][here]]. -*** Installing and configuring Matplotlib (graphic python library) -Open an DOS console and type the following command: -#+begin_src shell :results output :exports both -python -m pip install -U matplotlib -#+end_src -[[file:emacs_orgmode_images/install_matplotlib.png]] - -Then you will want to deactivate interactive plots in matplotlib. To -this end, you first need to know where the matplotlib configuration is -located. Open a python console the type the following code: -#+begin_src python :results output :exports both -import matplotlib -matplotlib.matplotlib_fname() -#+end_src -[[file:emacs_orgmode_images/matplotlib.png]] - -Open the =matplotlibrc= file and modify the line starting with =backend= -to make it =backend : Agg=. - -** All platforms: pretty code in HTML export -To have code pretty printing when exporting to HTML, you should -install the =htmlize= package, which is done by opening emacs and -typing the following command: -#+BEGIN_EXAMPLE -M-x package-install RET htmlize RET # where M-x means pressing the "Esc" key then the "x" key -#+END_EXAMPLE - -* A simple "reproducible research" emacs configuration -This section is illustrated in a [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4][video tutorial]] (/"Mise en place -Emacs/Orgmode"/ in French). Watching it before following the -instructions given in this section may help. - -Emacs comes with very basic default configuration and it appears like -everyone has its own taste. You will for example find [[https://www.emacswiki.org/emacs/StarterKits][here]] several -default Emacs configurations that reflect the preferences of their -creators. Likewise the configuration of Org-Mode is incredibly -flexible (see for example [[https://orgmode.org/worg/org-configs/index.html][the org-mode website]] for more -references). In the context of this MOOC, we propose you a relatively -minimalist one that is rather "/reproducible research/" oriented by -adding a few org-mode specific configurations. - -** Step 0: Backup and download our configuration -The procedure we propose will wipe your already existing custom Emacs -configuration if you have one. *You should thus beforehand make a -backup* of =~/.emacs= and of =~/.emacs.d/init.el= (if these files exist). - -#+begin_src shell :results output :exports none -export FILE_LIST="rr_org/init.el rr_org/journal.org" -tar zcf rr_org_archive.tgz $FILE_LIST -#+end_src - -#+RESULTS: - -Then download [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/tree/master/module2/ressources/rr_org_archive.tgz][this archive]] and uncompress it. It contains the -following files and we will refer to them in the following: - -#+begin_src shell :results output :exports results -tar tzf rr_org_archive.tgz -#+end_src - -#+RESULTS: -: rr_org/init.el -: rr_org/journal.org - -Alternatively, [[file:rr_org/][the files you are looking for are available here]]. -** Step 1: Prepare your journal -Create an =org/= directory in the top of your home: -#+begin_src sh :results output :exports both -mkdir -p ~/org/ -#+end_src -Then copy =rr_org/journal.org= file in your =~/org/= directory. This -file will be your laboratory notebook and all the notes you will -capture with =C-c c= will go automatically go in this file. The first -entry of this notebook is populated with [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][many Emacs shortcuts]] that you -should give a try. -** Step 2: Set up Emacs configuration -Copy =rr_org/init.el= in your =~/.emacs.d/= directory. - -Alternatively, if you do not want to mess with your already existing -emacs configuration, you may launch emacs with this specific -configuration with the following command: =emacs -q -l rr_org/init.el=. -** Step 3: Adapt the configuration to your specific needs if required -There are two situations in which it might be necessary to modify -=init.el=: -1. Your network environment forces you to use a proxy for access - to Web sites (HTTP(S) protocol). -2. You have multiple installations of Python or R on your computer, - or they are in unusual places and not fully configured. - If you can run - - "python3" and "R" under Linux and macOS - - "Python" and "R" under Windows - in a terminal without getting an error message, then you should - not have to do anything. - -If you do have to modify =init.el=, check the comments at the -beginning of the file for instructions. -** Step 4: Check whether the installation is working or not -Open a new instance of Emacs and open a =foo.org= file. Copy the -following lines in this file: - : #+begin_src shell :session foo :results output :exports both - : ls -la # or dir under windows - : #+end_src - -Put your cursor inside this code block and execute it with the -following command: =C-c C-c= (If you are not familiar with Emacs -commands, this one means '=Ctrl + C=' twice) - -A =#+RESULTS:= block with the result of the command should appear if it -worked. - -In the video, we already have demonstrated the main features and -shortcuts of emacs/org-mode that will help you maintain a document and -benefit from literate programming. The list of features and shortcuts -is demonstrated in the [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][first entry of your labbook]]. -** Step 5: Open and play with your journal: -In step 1, you were told to create an journal in -=~org/journal.org=. First you probably want to make sure this file is -stored in a version control system like git. We leave it up to you -to set this up but if you have any trouble, feel free to ask on the -FUN forums. -* A stub of a replicable article -This section is illustrated in a [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4][video tutorial]] (/"Écrire un article -réplicable avec Emacs/Orgmode"/ in French). Watching it before -following the instructions given in this section may help. - -Remember, you need a working LaTeX and R environment. If you can't -open a terminal and run the commands =R=, =pdflatex=, and =python=, you will not be -able to generate this document. When being compiled, the article downloads the -corresponding LaTeX packages so you also need to have a working =wget= -command (alternatively, it uses =curl=). Once downloaded, you may still read the -source ([[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/replicable_article/article.org]]) and understand how it works though. - -#+begin_src shell :results output :exports none -make -C replicable_article/ all ../replicable_article.tgz -#+end_src - -#+RESULTS: - -Download the following [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/replicable_article.tgz][archive]], uncompress it and simply =make= to generate the -article. You should then be able to open the [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/replicable_article/article.pdf][resulting article]]. This -is summarized in the following command: -#+begin_src sh :results output :exports both -wget --no-check-certificate -O replicable_article.tgz https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/replicable_article.tgz -tar zxf replicable_article.tgz; cd replicable_article; make ; evince article.pdf -#+end_src - -*Possible issues*: -- If the =make= command fails (especially on Mac), it may be because - Emacs or something else is not correctly installed. In that case, - open the article directly with the following command: - #+begin_src sh :results output :exports both - emacs -q --eval "(setq enable-local-eval t)" --eval "(setq enable-local-variables t)" article.org - #+end_src - and export it to pdf with the following shortcut: =C-c C-e l o= -- If it still doesn't work and emacs complains about not finding ESS, - it may be because you installed ESS in your home instead of - system-wide. In that case, try to remove the =-q= in the previous - command line to load your personal emacs configuration. - -Finally, when you'll be tired of always re-executing all the source -code when exporting, just look for the following line in [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/replicable_article/article.org][article.org]]: -#+BEGIN_EXAMPLE -# #+PROPERTY: header-args :eval never-export -#+END_EXAMPLE -If you remove the =# = in the beginning of the line, it will not be a -comment anymore and will indicate org-mode to stop evaluating every -chunk of code when exporting. - -* Emacs tips and tricks -** Cheat-sheets -Learning Emacs and Org-Mode can be difficult as there is an inordinate -amount of shortcuts. Many people have thus come up with -cheat-sheats. Here is a selection in case it helps: -*** Emacs -- [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][Common and step-by-step Emacs shortcuts for our /reproducible research/ configuration]] -- [[https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf][The official GNU emacs refcard]] -- Two graphical cheat-sheats by Sacha Chua on [[http://sachachua.com/blog/wp-content/uploads/2013/05/How-to-Learn-Emacs-v2-Large.png][how to learn Emacs]] and on - [[http://sachachua.com/blog/wp-content/uploads/2013/08/20130830-Emacs-Newbie-How-to-Learn-Emacs-Keyboard-Shortcuts.png][how to learn Emacs shortcuts]]. -*** Org-mode -- [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][Common and step-by-step org-mode shortcuts for our /reproducible research/ configuration]] -- [[https://orgmode.org/worg/orgcard.html][The official org-mode refcard]] -- [[https://orgmode.org/worg/dev/org-syntax.html][The official description of the org-mode syntax]] and a [[https://gist.github.com/hoeltgman/3825415][relatively concise description of the org-mode syntax]]. -** Video tutorials -For those of you who prefer video explanations, here is a [[https://www.youtube.com/playlist?list=PL9KxKa8NpFxIcNQa9js7dQQIHc81b0-Xg][Youtube -channel with many step by step emacs tutorials]]. -** Additional useful emacs packages -*** Company-mode -[[http://company-mode.github.io/][Company-mode]] is a text completion framework for Emacs. It allows to -have smart completion in emacs for the most common languages. If you -feel this is needed, you should follow the instructions from the -official Web page: [[http://company-mode.github.io/][http://company-mode.github.io/]] -*** Magit -[[https://magit.vc/][Magit]] is an Emacs interface for Git. Its usage is briefly illustrated -in the context of this MOOC in a [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+session02/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4][video tutorial]] -("/Utilisation Emacs/git/" in French). - -It is very powerful and we use it on a daily basis but you should -definitely understand what git does behind the scenes beforehand. If -you feel this would be useful for you, you should follow [[https://magit.vc/screenshots/][this visual -walk-through]] or [[https://www.emacswiki.org/emacs/Magit][this really short "crash course"]]. If you installed the -previous "/reproducible research/" emacs configuration, you can easily -invoke magit by using ~C-x g~. -** Other resources -- [[https://orgmode.org/orgguide.pdf][The compact Org-mode Guide]] -- [[https://github.com/dfeich/org-babel-examples][Many examples illustrating the use of different languages in org-mode]] +See the English version. French translation in progress. diff --git a/documents/tuto_emacs_windows/images/commandeR1.png b/module2/ressources/emacs_orgmode_images/commandeR1.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/commandeR1.png rename to module2/ressources/emacs_orgmode_images/commandeR1.png diff --git a/documents/tuto_emacs_windows/images/commandeR2.png b/module2/ressources/emacs_orgmode_images/commandeR2.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/commandeR2.png rename to module2/ressources/emacs_orgmode_images/commandeR2.png diff --git a/documents/tuto_emacs_windows/images/commande_python.png b/module2/ressources/emacs_orgmode_images/commande_python.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/commande_python.png rename to module2/ressources/emacs_orgmode_images/commande_python.png diff --git a/documents/tuto_emacs_windows/images/ctrl_c_c.png b/module2/ressources/emacs_orgmode_images/ctrl_c_c.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/ctrl_c_c.png rename to module2/ressources/emacs_orgmode_images/ctrl_c_c.png diff --git a/documents/tuto_emacs_windows/images/emacs.png b/module2/ressources/emacs_orgmode_images/emacs.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/emacs.png rename to module2/ressources/emacs_orgmode_images/emacs.png diff --git a/module2/ressources/emacs_orgmode_images/git1.png b/module2/ressources/emacs_orgmode_images/git1.png old mode 100755 new mode 100644 diff --git a/documents/tuto_emacs_windows/images/graphiqueR.png b/module2/ressources/emacs_orgmode_images/graphiqueR.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/graphiqueR.png rename to module2/ressources/emacs_orgmode_images/graphiqueR.png diff --git a/documents/tuto_emacs_windows/images/org_mode.png b/module2/ressources/emacs_orgmode_images/org_mode.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/org_mode.png rename to module2/ressources/emacs_orgmode_images/org_mode.png diff --git a/documents/tuto_emacs_windows/images/python1.png b/module2/ressources/emacs_orgmode_images/python1.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/python1.png rename to module2/ressources/emacs_orgmode_images/python1.png diff --git a/documents/tuto_emacs_windows/images/python2.png b/module2/ressources/emacs_orgmode_images/python2.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/python2.png rename to module2/ressources/emacs_orgmode_images/python2.png diff --git a/documents/tuto_emacs_windows/images/python3.png b/module2/ressources/emacs_orgmode_images/python3.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/python3.png rename to module2/ressources/emacs_orgmode_images/python3.png diff --git a/documents/tuto_emacs_windows/images/python4.png b/module2/ressources/emacs_orgmode_images/python4.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/python4.png rename to module2/ressources/emacs_orgmode_images/python4.png diff --git a/documents/tuto_emacs_windows/images/shell.png b/module2/ressources/emacs_orgmode_images/shell.png old mode 100755 new mode 100644 similarity index 100% rename from documents/tuto_emacs_windows/images/shell.png rename to module2/ressources/emacs_orgmode_images/shell.png