Skip to content

dot emacs #1

@JWiley

Description

@JWiley

This presentation on setting up and using rmarkdown is very helpful.
It would be wonderful if there could be an example or link to a .emacs file that would automatically install and set everything up.
I have something like this, but it was completely hacked together without a real understanding of what/how I'm doing it and I'm afraid is wrong.

;; repos
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(completion-ignore-case t t)
 '(cursor-type 'bar)
 '(ess-R-font-lock-keywords
   '((ess-R-fl-keyword:keywords . t)
     (ess-R-fl-keyword:constants . t)
     (ess-R-fl-keyword:modifiers . t)
     (ess-R-fl-keyword:fun-defs . t)
     (ess-R-fl-keyword:assign-ops . t)
     (ess-R-fl-keyword:%op% . t)
     (ess-fl-keyword:fun-calls . t)
     (ess-fl-keyword:numbers . t)
     (ess-fl-keyword:operators . t)
     (ess-fl-keyword:delimiters . t)
     (ess-fl-keyword:= . t)
     (ess-R-fl-keyword:F&T . t)))
 '(global-hl-line-mode t)
 '(inferior-R-args "--no-restore --no-save")
 '(inferior-R-program-name "c:/usr/R/R-4.1.0/bin/x64/Rterm.exe")
 '(inferior-ess-r-program "c:/usr/R/R-4.1.0/bin/x64/Rterm.exe")
 '(inhibit-startup-screen t)
 '(ispell-program-name "c:/usr/hunspell/bin/hunspell.exe")
 '(markdown-command "C:/usr/Pandoc/pandoc.exe")
 '(package-archives '(("melpa" . "https://melpa.org/packages/")))
 '(package-selected-packages
   '(flycheck color-theme-sanityinc-tomorrow ess treemacs-persp treemacs-magit treemacs-icons-dired treemacs-projectile treemacs yasnippet poly-R poly-markdown markdown-mode magit projectile company helm wc-mode diminish smooth-scrolling use-package))
 '(read-buffer-completion-ignore-case t)
 '(read-file-name-completion-ignore-case t)
 '(send-mail-function 'mailclient-send-it))

;; use-package to auto get packages
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))
(when (not (package-installed-p 'use-package))
  (package-install 'use-package))
(require 'use-package)


;; markdown mode
(use-package markdown-mode
  :ensure t
  :mode ("README\\.md\\'" . gfm-mode)
  :init (setq markdown-command "multimarkdown"))

;; various polymode
(use-package polymode
  :ensure t)

;; sufficient for R + markdown?
(use-package poly-R
  :ensure t)

;; associate the new polymode to Rmd files:
(add-to-list 'auto-mode-alist
             '("\\.[rR]md\\'" . poly-gfm+r-mode))

;; uses braces around code block language strings:
(setq markdown-code-block-braces t)

;; emacs speaks statistics --- central to using R in Emacs!
(use-package ess
  :ensure t
  :config
  ;; RStudio style, like only 2 spaces for indent
  (add-hook 'ess-mode-hook
            (lambda ()
              (ess-set-style 'RStudio)))
  :custom
  (ess-ask-for-ess-directory . nil))

;; only R features, not all ESS by default
(require 'ess-r-mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions