I have helm enabled in an Org file that init.el calls. The code looks like the following:

(use-package helm
     :config (require 'helm-config))
(global-set-key (kbd "M-x") #'helm-M-x)
(global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") #'helm-find-files)
(helm-mode 1)

Without this code, if I open up an R script and, let's call it foo.R, that contains just:

2 + 2

And I navigate to the line with 2 + 2 on it and type C-<return>, R is launched.

However, if the helm code is enabled, then I get this message in wrong-type-argument window-live-p nil message and R is not launched. Looking at *Backtrace* I see the following:

Debugger entered--Lisp error: (error "Running helm command outside of context")
  signal(error ("Running helm command outside of context"))
  error("Running helm command outside of context")
  call-interactively(helm-resume-previous-session-after-quit nil nil)

However, if I have an R terminal open via, M-x R, then I can use C-<return> and it will send code to R. However, this is not how I typically work and I'm wondering why enabling helm interfered with this.

EDIT: In the case where C-<return> isn't working, when I run C-h k C-<return>, I get the following:

C-<return> runs the command ess-eval-region-or-line-visibly-and-step,
which is an interactive compiled Lisp function in ‘ess-inf.el’.

It is bound to C-<return>, <menu-bar> <ess> <Eval region | line>,
<menu-bar> <ess> <ESS Eval> <Eval region | line & step>.


Evaluate region if active, otherwise the current line and step.
Evaluation is done visibly.

Note that when inside a package and namespaced evaluation is in
place (see ‘ess-r-set-evaluation-env’) evaluation of multiline
input will fail.

  • In the bad situation, what is C-<return> bound to? Do C-h k C-<return> to find out and report back. Commented Jun 3, 2022 at 16:33
  • 1
    The issue is with read-directory-name in ess-prompt-for-directory. I'm not sure how to fix the error, but to bypass it you could set ess-ask-for-ess-directory to nil, or start R before pressing C-<return>.
    – jagrg
    Commented Jun 3, 2022 at 18:40
  • @jagrg, that solved it. Should I open a bug report with helm or ESS?
    – cdd
    Commented Jun 3, 2022 at 18:57
  • I don't know. I'd start with Helm and move on from there.
    – jagrg
    Commented Jun 3, 2022 at 21:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.