syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.57k stars 4.9k forks source link

Problem with starting R process by C+n or C+b from within R mode #15049

Open olssol opened 2 years ago

olssol commented 2 years ago

Description :octocat:

Problem with starting R process by C+n or C+b from within R mode

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: Receive message "wrong-type-argument window-live-p nil"

Expected behaviour: :heart: :smile: Expect an R session to be started in a new buffer

System Info :computer:

Backtrace :paw_prints:

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil nil)
  ad-Advice-select-window(#<subr select-window> nil)
  apply(ad-Advice-select-window #<subr select-window> nil)
  select-window(nil)
  helm-internal((((name . "run-ess-r") (header-name . #f(compiled-function (name) #<bytecode 0x1fe74ef54011>))  run-ess-r(nil)
  R()
  ess-start-process-specific("S" "R")
  ess-request-a-process("Process to use: " no-switch nil)
  ess-force-buffer-current()
  ess-eval-region-or-line-visibly-and-step()
  funcall-interactively(ess-eval-region-or-line-visibly-and-step)
  call-interactively(ess-eval-region-or-line-visibly-and-step nil nil)
  command-execute(ess-eval-region-or-line-visibly-and-step)
lebensterben commented 2 years ago

@olssol Neither C-n nor C-b is the binding to open a new process. C-n: evil-mc-make-and-goto-next-match C-b: evil-scroll-page-up

olssol commented 2 years ago

@olssol Neither C-n nor C-b is the binding to open a new process. C-n: evil-mc-make-and-goto-next-match C-b: evil-scroll-page-up

Thank you. Please see the updated issue.

lebensterben commented 2 years ago

Confirmed.

lebensterben commented 2 years ago

It's working okay in vanilla Emacs.

olssol commented 2 years ago

It's working okay in vanilla Emacs.

Seems like a problem with helm, but I am not certain. Can you advise what I should try or where I should report the issue?

lebensterben commented 2 years ago

@olssol Before evaluating anything, can you try SPC ' to start an R process first.

Then both key bindings seem to work.

dankessler commented 2 years ago

This is indeed an issue with the way that helm and ess interact. In brief, when trying to spawn a new process, ess inhibits the creation of new windows, but when ess tries to figure out what you want your initial working directory to be, helm swoops in to provide completion but it tries to do so in a new window (which is not allowed), and thus you get a problem. It's discussed at more length here, where I also propose a simple workaround. That issue is "closed" although AFAICT, the specific helm + ess interaction issue is not resolved.

I think it could be fixed upstream (in probably a somewhat hacky way) in either helm or ess, but I haven't found the time to dive in to try to fix either, in part because the approach @lebensterben proposes (just start an R process first using SPC m ') is essentially muscle-memory to me by now.

dankessler commented 2 years ago

I have opened emacs-ess/ESS#1183 upstream which will hopefully resolve this.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

dankessler commented 4 months ago

Fixed upstream, so this issue can be closed