[ESS] Emacs sends > to R console (causing error)
chell
hollandlucas at gmail.com
Sat Jun 7 19:56:40 CEST 2014
Hello,
I've got the following modifications in my .emacs file which allow me to
open a .R file, press shift+enter and get an R prompt. It works but
apparently ">" gets send to the console; I get the following error message:
> >
Error: Unexpected '>' in ">"
>
after that I can enter R commands just fine. I can't figure out what's
causing this so any help would be appreciated!
(autoload 'R-mode "ess-site.el" "" t)
(add-to-list 'auto-mode-alist '("\\.R\\'" . R-mode))
(eval-after-load "comint"
'(progn
(define-key comint-mode-map [up]
'comint-previous-matching-input-from-input)
(define-key comint-mode-map [down]
'comint-next-matching-input-from-input)
;; also recommended for ESS use --
(setq comint-scroll-to-bottom-on-output 'others)
(setq comint-scroll-show-maximum-output t)
;; somewhat extreme, almost disabling writing in *R*, *shell* buffers
above prompt:
(setq comint-scroll-to-bottom-on-input 'this)
))
(setq ess-ask-for-ess-directory nil)
(setq ess-local-process-name "R")
(setq ansi-color-for-comint-mode 'filter)
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)
(defun my-ess-start-R ()
(interactive)
(if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
(progn
(delete-other-windows)
(setq w1 (selected-window))
(setq w1name (buffer-name))
(setq w2 (split-window w1 nil t))
(R)
(set-window-buffer w2 "*R*")
(set-window-buffer w1 w1name))))
(defun my-ess-eval ()
(interactive)
(my-ess-start-R)
(if (and transient-mark-mode mark-active)
(call-interactively 'ess-eval-region)
(call-interactively 'ess-eval-line-and-step)))
(add-hook 'ess-mode-hook
'(lambda()
(local-set-key [(shift return)] 'my-ess-eval)))
(add-hook 'inferior-ess-mode-hook
'(lambda()
(local-set-key [C-up] 'comint-previous-input)
(local-set-key [C-down] 'comint-next-input)))
(add-hook 'Rnw-mode-hook
'(lambda()
(local-set-key [(shift return)] 'my-ess-eval)))
(require 'ess-site)
--
View this message in context: http://emacs.1067599.n5.nabble.com/Emacs-sends-to-R-console-causing-error-tp324084.html
Sent from the ESS - Help mailing list archive at Nabble.com.
More information about the ESS-help
mailing list