From dcf91d07130ac214770b8eb4d95b458d0384711d Mon Sep 17 00:00:00 2001 From: Konrad Hinsen Date: Thu, 21 Feb 2019 17:05:51 +0100 Subject: [PATCH] Nouvelles instructions pour Emacs sous macOS --- module2/ressources/emacs_orgmode.org | 38 ++++--------------------- module2/ressources/emacs_orgmode_fr.org | 38 ++++--------------------- module2/ressources/rr_org/init.el | 19 +++++++++++++ module2/ressources/rr_org/init.org | 30 ++++++++++++++++++- 4 files changed, 60 insertions(+), 65 deletions(-) diff --git a/module2/ressources/emacs_orgmode.org b/module2/ressources/emacs_orgmode.org index d2e00fc..7ecb19e 100644 --- a/module2/ressources/emacs_orgmode.org +++ b/module2/ressources/emacs_orgmode.org @@ -77,38 +77,12 @@ 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. -- *Option 1*: Install the =.dmg= file from [[http://vgoulet.act.ulaval.ca/][Vincent Goulet]]: - [[https://vigou3.gitlab.io/emacs-modified-macos/][https://vigou3.gitlab.io/emacs-modified-macos/]]. It ships with recent - versions: - - Emacs 26.1 - - Org-mode 9.1.13 - - ESS 17.11 - - If you install this version of Emacs, or in fact any other version of - Emacs distributed as a clickable application in a =.dmg= file, - you must type the full path to the executable if you want to run - Emacs from a terminal. For example, if your clickable application - is at =/Applications/Emacs.app=, then the executable is at - =/Applications/Emacs.app/Contents/MacOS/Emacs= - -- *Option 2*: If you use [[https://docs.brew.sh/][Homebrew]], do the following: - #+begin_src sh :results output :exports both - brew update - brew install emacs --with-cocoa - brew linkapps emacs - brew install wget - brew tap dunn/emacs - brew install auctex - brew tap brewsci/science - brew install ess - #+end_src - This provides an =emacs= command for use from the command line, plus a clickable application at =Cellar/emacs/26.1_1/Emacs.app= inside your Homebrew directory. If - you installed Homebrew at the default location =/usr/local=, then this is =/usr/local/Cellar/emacs/26.1_1/Emacs.app=. - If you installed Homebrew on an account with administrator privileges, you can add - #+begin_src sh :results output :exports both - brew linkapps emacs - #+end_src - in order to make Emacs accessible directly from =/Applications=. +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 diff --git a/module2/ressources/emacs_orgmode_fr.org b/module2/ressources/emacs_orgmode_fr.org index 2a7630f..48da180 100644 --- a/module2/ressources/emacs_orgmode_fr.org +++ b/module2/ressources/emacs_orgmode_fr.org @@ -77,38 +77,12 @@ 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. -- *Option 1*: Install the =.dmg= file from [[http://vgoulet.act.ulaval.ca/][Vincent Goulet]]: - [[https://vigou3.gitlab.io/emacs-modified-macos/][https://vigou3.gitlab.io/emacs-modified-macos/]]. It ships with recent - versions: - - Emacs 26.1 - - Org-mode 9.1.13 - - ESS 17.11 - - If you install this version of Emacs, or in fact any other version of - Emacs distributed as a clickable application in a =.dmg= file, - you must type the full path to the executable if you want to run - Emacs from a terminal. For example, if your clickable application - is at =/Applications/Emacs.app=, then the executable is at - =/Applications/Emacs.app/Contents/MacOS/Emacs= - -- *Option 2*: If you use [[https://docs.brew.sh/][Homebrew]], do the following: - #+begin_src sh :results output :exports both - brew update - brew install emacs --with-cocoa - brew linkapps emacs - brew install wget - brew tap dunn/emacs - brew install auctex - brew tap brewsci/science - brew install ess - #+end_src - This provides an =emacs= command for use from the command line, plus a clickable application at =Cellar/emacs/26.1_1/Emacs.app= inside your Homebrew directory. If - you installed Homebrew at the default location =/usr/local=, then this is =/usr/local/Cellar/emacs/26.1_1/Emacs.app=. - If you installed Homebrew on an account with administrator privileges, you can add - #+begin_src sh :results output :exports both - brew linkapps emacs - #+end_src - in order to make Emacs accessible directly from =/Applications=. +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 diff --git a/module2/ressources/rr_org/init.el b/module2/ressources/rr_org/init.el index eb4974f..67d7d8c 100644 --- a/module2/ressources/rr_org/init.el +++ b/module2/ressources/rr_org/init.el @@ -53,6 +53,25 @@ (package-initialize) (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/")) +(add-to-list 'package-archives + '("melpa" . "http://melpa.org/packages/")) +(package-refresh-contents) +(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")) (require 'org) diff --git a/module2/ressources/rr_org/init.org b/module2/ressources/rr_org/init.org index ba1ed7f..b2844b6 100644 --- a/module2/ressources/rr_org/init.org +++ b/module2/ressources/rr_org/init.org @@ -75,12 +75,40 @@ document, simply =M-x org-babel-tangle=. #+end_src * Package sources -** Use melpa-stable +** Use melpa-stable (preferred) and melpa #+BEGIN_SRC emacs-lisp :tangle init.el (package-initialize) (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/")) +(add-to-list 'package-archives + '("melpa" . "http://melpa.org/packages/")) +(package-refresh-contents) +(setq package-archive-priorities '(("gnu" . 100) + ("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))) +#+end_src +** ESS +#+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")) +#+end_src * Loading files: ** Loading babel: :ARNAUD: #+begin_src emacs-lisp :tangle init.el -- 2.18.1