+ :config
+ (defun ess-change-directory (path)
+ "Set the current working directory to PATH for both *R* and Emacs."
+ (interactive "DDirectory to change to: ")
+
+ (when (file-exists-p path)
+ (ess-command (concat "setwd(\"" path "\")\n"))
+ ;; use file-name-as-directory to ensure it has trailing /
+ (setq default-directory (file-name-as-directory path))))
+ (add-hook 'ess-mode-hook 'flyspell-prog-mode)
+ ;; outlining support for ess modes
+ (add-hook
+ 'ess-mode-hook
+ '(lambda ()
+ (outline-minor-mode)
+ (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function\\)")
+ (defun outline-level ()
+ (cond ((looking-at "^##### ") 1)
+ ((looking-at "^#### ") 2)
+ ((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3)
+ (t 1000)))
+ ))
+ (add-hook 'ess-mode-hook
+ '(lambda ()
+ (local-set-key (kbd "C-c C-R")
+ 'dla/ess-region-remote-eval)))
+
+ ;; Don't restore history or save workspace image
+ '(inferior-R-args "--no-restore-history --no-save")
+ )