Last active
September 3, 2019 19:10
-
-
Save nucholab/c440fe335e8a81962c53a8453860e3b9 to your computer and use it in GitHub Desktop.
emacs-lisp code to set up package mgmt and Rmarkdown editing with syntax highlighting and shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This code will do two things: | |
;; 1) Will set you up with use-package for emacs package management | |
;; 2) Will set your emacs for Rmarkdown editing with syntax highlighting and shortcuts | |
;; It assummes the following: | |
;; 1) You have a recent Emacs (>=24.4 or so) and have minimal customizations | |
;; | |
;; TODO: Add functions to knit and preview | |
;; | |
;; To use: copy the code below and add it to your .init.el file or equivalent | |
;; Configuring Package Management | |
(require 'package) | |
(setq package-enable-at-startup nil) | |
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") | |
("melpa-stable" . "https://stable.melpa.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
(setq package-archive-priorities '(("melpa-stable" . 20) | |
("gnu" . 10) | |
("melpa" . 0))) | |
(setq package-menu-async t) | |
(package-initialize) | |
; Bootstrap `use-package' | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) | |
(package-install 'use-package)) | |
; Enable use-package | |
(eval-when-compile | |
(require 'use-package)) | |
;; Use markdown mode for Rmd files | |
(use-package markdown-mode | |
:ensure t | |
:defer t | |
:mode (("\\.md\\'" . markdown-mode))) | |
(use-package poly-R | |
:ensure t) | |
(use-package poly-markdown | |
:ensure t | |
:commands (poly-markdown-mode) | |
:mode (("\\.rmd\\'" . poly-markdown+r-mode) | |
("\\.Rmd\\'" . poly-markdown+r-mode))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment