6

I am currently running R 3.3.1 in emacs 25.1.1, ESS 16.10, and polymode 20160805.448 installed via MELPA on Mac OS Sierra. Whenever I try to open an interactive R console using M-x R, it freezes immediately upon startup and I have to force quit emacs.

The bottom bar says "ess-tracebug mode enabled" and the R console initially runs if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))).

My .emacs file has the following code related to ESS:

;ESS mode configuration
(autoload 'R-mode "ess-site.el" "ESS" t)
(add-to-list 'auto-mode-alist '("\\.R$" . R-mode))
(setq inferior-R-program-name "/usr/local/bin/R")

;;R stuff
(setq ess-eval-visibly-p nil)
(setq ess-ask-for-ess-directory nil)
(require 'ess-eldoc)

;;compile the first target in the Makefile in the current directory using F9
(global-set-key [f9] 'compile)
(setq compilation-read-command nil)

(require 'poly-R) ;; Load polymode for Rmd and Rnw
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))


;; The following four lines set C-; to automatically add " -> " in ESS,
;; and causes _ to insert a normal underscore.
(setq ess-S-assign-key (kbd "C-;"))
(ess-toggle-S-assign-key t) ; enable above key definition
;; leave my underscore key alone!
(ess-toggle-underscore nil)
;; Map C-' to the pipe operator %>%
(defun then_R_operator ()
  "R - %>% operator or 'then' pipe operator"
  (interactive)
  (just-one-space 1)
  (insert "%>%")
  (just-one-space 1))
(define-key ess-mode-map (kbd "C-'") 'then_R_operator)
(define-key inferior-ess-mode-map (kbd "C-'") 'then_R_operator)

EDIT: Also I'm not sure if this helps, but I copied a .emacs file from a computer with a functioning R mode to try to fix this issue and it still failed.

**EDIT 2: Completely copied over a .emacs and a .emacs.d from the same working computer. Upon startup, the first line on the frozen computer is if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))), but on the original, working computer, it is:

 if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # rather take the ESS one
+       options(pager='cat')
> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
  • Do you have the same problem if you start Emacs without your init file (`emacs -Q`)? – Dan Nov 03 '16 at 16:34
  • If I start Emacs without my init file, then I can't open R at all because `M-x R` isn't enabled. – Brandon Sherman Nov 03 '16 at 16:45
  • 1
    Evaluate the lines in your `init` file one by one from the top. Just the first one (that loads R) should be enough. Alternately, just evaluate `(require 'ess-site)`. – Dan Nov 03 '16 at 16:48
  • I'm attempting to do this by following the instructions [here](https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Eval.html), but can't seem to evaluate lines one by one. – Brandon Sherman Nov 03 '16 at 16:57
  • I just tried evaluating it line by line. Just doing `(require 'ess-site)` and trying `M-x R` froze with the same error as in the original post. – Brandon Sherman Nov 06 '16 at 22:51
  • Update: I can unfreeze it with `C-g C-c C-c`, but I'd still like to be able to not have to do that upon startup. Plus it gives me `Error: could not find function ".ess.eval"` – Brandon Sherman Nov 06 '16 at 23:01
  • I have the same exact issues on Linux, R 3.2.2 and no polymode, i.e. this seems to be recent problem directly in ESS 16.10. The only solution is `keyboard-quit` on startup. – user673592 Dec 11 '16 at 22:11

1 Answers1

2

I had the same issue but now it should be fixed in the development version.

Luca Braglia
  • 121
  • 4