emacs-ess / ESS

Emacs Speaks Statistics: ESS
https://ess.r-project.org/
GNU General Public License v3.0
613 stars 160 forks source link

iESS entering extra lines and freezing #1226

Open cddesja opened 1 year ago

cddesja commented 1 year ago

I am encountering two issues that I managed to capture in the GIF below.

  1. iESS enters a newline or hits "Enter". You can see this early in the GIF if you want the little blue arrow on the left move from the 2nd to the last row to the 3rd to the last row.
  2. Occasionally running commands, like head(data_name) makes iESS non-responsive. Hitting C-c C-c does nothing and I have to close Emacs.

Not sure how to troubleshoot these issues or provide more information, but I'm happy to if someone can help me. This happens pretty frequently every 5 minutes or so, making ESS/iESS unusable for long.

Screen Recording 2022-09-29 at 4 16 13 PM

lionel- commented 1 year ago

Is this with the latest dev version?

cddesja commented 1 year ago

@lionel- , this bug persists, but I think I know a little more about what might be the culprit. I originally reported this as a bug in corfu (#234), which itself was a duplicate of #229. The author of CORFU said it was a bug with the ESS Capf. CORFU works fine for me when I don't have auto-completion enabled (corfu-auto t). When I have that enabled this happens consistently and quickly.

atanasj commented 1 year ago

I think I'm actually experiencing the same error. I posted the referenced issue. The inferior buffer and R process seems to crash during completions in the ESS buffer when writing code.

cddesja commented 1 year ago

@atanasj, if you want to use corfu with ESS/iESS, I have found it works fine with the following configuration (if you use use-package):

(use-package corfu
  ;; Optional customizations
   :custom
   (corfu-cycle t)                ;; Enable cycling for `corfu-next/previous'

  ;; Recommended: Enable Corfu globally.
  :init
  (global-corfu-mode))

;; A few more useful configurations...
(use-package emacs
  :init
  ;; TAB cycle if there are only few candidates
  (setq completion-cycle-threshold 3)

  ;; Emacs 28: Hide commands in M-x which do not apply to the current mode.
  ;; Corfu commands are hidden, since they are not supposed to be used via M-x.
  ;; (setq read-extended-command-predicate
  ;;       #'command-completion-default-include-p)

  ;; Enable indentation+completion using the TAB key.
  ;; `completion-at-point' is often bound to M-TAB.
  (setq tab-always-indent 'complete))

I have also not experienced this problem with company.

atanasj commented 1 year ago

Thanks @cddesja, I'll give that config a try and hopefully that sorts it out. I too had no issues when using company, with or without lsp-mode. However, corfu seems faster and works with every other language without issue, so if I can get a config with corfu working with ESS I'd rather do that than go back to company.

atanasj commented 1 year ago

@cddesja, that worked! Thanks! Hopefully the issue can be fixed here and this is just a temporary work around.