diff --git a/module2/ressources/emacs_orgmode.org b/module2/ressources/emacs_orgmode.org index 857287ac9e31d2cf68b6176e60a4dc97e88cf212..ba9ecc9a1dd38d243c2a9397c8a8d199be858070 100644 --- a/module2/ressources/emacs_orgmode.org +++ b/module2/ressources/emacs_orgmode.org @@ -36,14 +36,23 @@ The next section provides information on how to install emacs. - [[#additional-useful-emacs-packages][Additional useful emacs packages]] - [[#other-resources][Other resources]] -* Installing emacs, org-mode, ess, and auctex. +* Installing Emacs +The [[https://www.gnu.org/software/emacs/download.html][Emacs Web site]] explains various methods to install Emacs on your computer. Any of them will be fine for our purposes. In the following we describe the method that we consider most convenient for each platform, but feel free to use another one. + +For this MOOC, you need one of + 1. Emacs 26 (the latest version) + 2. Emacs 25 plus Org-Mode 9 + +Emacs 25 comes with Org-Mode 8, which is not compatible with our examples. So if you use Emacs 25, you must separately install Org-Mode 9. + +Our MOOC also requires a few extra Emacs packages: [[https://ess.r-project.org/][ESS]] (for working with the R language) and [[https://www.gnu.org/software/auctex/][AUCTeX]] (for editing LaTeX). They will be installed automatically the first time you start Emacs if you use the configuration described under [[#a-simple-reproducible-research-emacs-configuration][A simple "reproducible research" emacs configuration]]. + ** Linux (Debian, Ubuntu) We provide here only instructions for Debian-based distributions. Feel free to contribute to this document to provide up-to-date information for other distributions (e.g.n redhat, fedora). -Today, the stable versions of the most common distributions provide -recent enough versions of emacs and org-mode: +These are the versions of Emacs that various distributions provide: - Debian (stretch) ships with [[https://packages.debian.org/stretch/emacs25][emacs 25.1]] and [[https://packages.debian.org/stretch/org-mode][org-mode 9.0.3]] - Ubuntu (bionic 18.04) ships with [[https://packages.ubuntu.com/bionic/emacs25][emacs 25.2]] and [[https://packages.ubuntu.com/bionic/org-mode][org-mode 9.1.6]] - Ubuntu (artful 17.04) ships with [[https://packages.ubuntu.com/artful/emacs25][emacs 25.2]] and [[https://packages.ubuntu.com/artful/org-mode][org-mode 9.0.9]] @@ -55,7 +64,7 @@ Simply run (as root): apt-get update ; apt-get install emacs25 org-mode #+end_src -Then make sure you have a sufficiently recent version of emacs. +Then verify that you have a sufficiently recent version of Emacs. #+begin_src sh :results output :exports both emacs --version 2>&1 | head -n 1 #+end_src @@ -63,7 +72,7 @@ emacs --version 2>&1 | head -n 1 #+RESULTS: : GNU Emacs 25.2.2 -Likewise, you'll want to check you have a recent version of org-mode: +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 @@ -75,24 +84,15 @@ 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. -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) will be installed automatically the first time you start Emacs if you use the configuration described under [[#a-simple-reproducible-research-emacs-configuration][A simple "reproducible research" emacs configuration]]. ** 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 - +Download the [[https://ftp.gnu.org/gnu/emacs/windows/emacs-26/emacs-26.1-i686.zip][precompiled Emacs 26.1]] and unzip the zip file preserving the directory structure, and run bin\runemacs.exe. Alternatively, create a desktop shortcut to bin\runemacs.exe, and start Emacs by double-clicking on that shortcut's icon. *** Directory naming conventions In the following instructions, we refer to your home directory through the (UNIX) =~/= notation. On Windows, your home diff --git a/module2/ressources/rr_org/init.el b/module2/ressources/rr_org/init.el index 67d7d8cae1b64f4633f705eec3265118b6bde479..434ad12e2b583b6620f5701aaee8a7cad73a2fac 100644 --- a/module2/ressources/rr_org/init.el +++ b/module2/ressources/rr_org/init.el @@ -59,19 +59,14 @@ (setq package-archive-priorities '(("gnu" . 100) ("melpa-stable" . 10))) -(when (equal system-type 'darwin) - (unless (package-installed-p 'exec-path-from-shell) - (package-install 'exec-path-from-shell))) - -(unless (package-installed-p 'ess) - (package-install 'ess)) - -(unless (package-installed-p 'auctex) - (package-install 'auctex)) - -(when (equal system-type 'darwin) - (exec-path-from-shell-initialize) - (exec-path-from-shell-copy-env "PYTHONPATH")) +(dolist (pkg '(ess + auctex + exec-path-from-shell)) + (when (not (package-installed-p pkg)) + (package-install pkg))) + +(exec-path-from-shell-initialize) +(exec-path-from-shell-copy-env "PYTHONPATH") (require 'org) diff --git a/module2/ressources/rr_org/init.org b/module2/ressources/rr_org/init.org index b2844b66808f3fe58fc65795c8c2d6ccd4d48c64..65fb72736542beee4362e5a98091a7ef906cba6e 100644 --- a/module2/ressources/rr_org/init.org +++ b/module2/ressources/rr_org/init.org @@ -6,13 +6,9 @@ #+LANGUAGE: en This is a "minimal" =.emacs= configuration file. For this configuration -to work, you'll need: -- emacs25 (>25.2) (this way installing through elpa will save you some - time) and emacs-goodies (e.g., for color themes) -- org-mode > 9.0 (there has been several major compatibility breakage - so need to stay away from old versions) -- ess and R -- texlive and auctex +to work, you'll need one of: + - Emacs 26 (preferred) + - Emacs 25 plus Org-Mode 9 * Installation Instructions Backup you own =.emacs= if you have one and replace it with [[file:init.el][the content @@ -75,7 +71,7 @@ document, simply =M-x org-babel-tangle=. #+end_src * Package sources -** Use melpa-stable (preferred) and melpa +** Use melpa-stable (preferred) and melpa in addition to the default GNU archive #+BEGIN_SRC emacs-lisp :tangle init.el (package-initialize) (add-to-list 'package-archives @@ -87,27 +83,17 @@ document, simply =M-x org-babel-tangle=. ("melpa-stable" . 10))) #+END_SRC * Install missing packages -** For macOS: #+begin_src emacs-lisp -(when (equal system-type 'darwin) - (unless (package-installed-p 'exec-path-from-shell) - (package-install 'exec-path-from-shell))) +(dolist (pkg '(ess + auctex + exec-path-from-shell)) + (when (not (package-installed-p pkg)) + (package-install pkg))) #+end_src -** ESS +* Import environment variables #+begin_src emacs-lisp -(unless (package-installed-p 'ess) - (package-install 'ess)) -#+end_src -** AucTeX -#+begin_src emacs-lisp -(unless (package-installed-p 'auctex) - (package-install 'auctex)) -#+end_src -* Import environment variables (macOS) -#+begin_src emacs-lisp -(when (equal system-type 'darwin) - (exec-path-from-shell-initialize) - (exec-path-from-shell-copy-env "PYTHONPATH")) +(exec-path-from-shell-initialize) +(exec-path-from-shell-copy-env "PYTHONPATH") #+end_src * Loading files: ** Loading babel: :ARNAUD: