emacs-ess / ESS

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

Emacs 29.1 compatibility issues with Emacs ESS #1271

Open parvizfarnia opened 5 months ago

parvizfarnia commented 5 months ago

Hello everyone,

My environment:

OS: Windows 11
Emacs version: 29.1
R version: 4.2.2 (64 bit)
ESS version downloaded from Melpa: ess-20231218.1256

I have been using Emacs ESS since several years for R programming. The last time I installed ESS was in march 2023 using Emacs version 28. I installed it via M-x package-install [RET] ess [RET] which downloaded from Melpa a package named ess-20230302.2111.

However this week I installed Emacs 29.1 and so far, I have encountered serious issues with ESS which is simply not working at all.

Here is what I have in my ~/.emacs.d/init.el for ESS configuration:


(setq inferior-ess-r-program "R")

(require 'ess-r-mode)

(add-to-list 'auto-mode-alist '("\\.R\\'" . ess-r-mode))

(require 'ess-view)

(setq ess-view--spreadsheet-program "C:/Program Files/LibreOffice/program/scalc.exe")

(require 'ess-R-data-view)

(setq ess-ask-for-ess-directory nil)

(setq display-buffer-alist
      `(("*R Dired"
         (display-buffer-reuse-window display-buffer-in-side-window)
         (side . right)
         (slot . -1)
         (window-width . 0.33)
         (reusable-frames . nil))
        ("*R"
         (display-buffer-reuse-window display-buffer-at-bottom)
         (window-width . 0.5)
         (reusable-frames . nil))
        ("*Help"
         (display-buffer-reuse-window display-buffer-in-side-window)
         (side . right)
         (slot . 1)
         (window-width . 0.33)
         (reusable-frames . nil))))
(show-paren-mode)

(setq inferior-R-args "--no-restore-history --no-save")

(global-set-key (kbd "C-;")  (lambda () (interactive) (insert " <- ")))

(setq ess-use-flymake nil)
(require 'flycheck)
(add-hook 'ess-r-mode-hook
          (lambda () (flycheck-mode t))
)

Using the above-mentioned configuration, when I run M-x R [RET] to open a new R session, I get the following error message:

Error (ess): Rterm could not be found on the system. Try running 'run-ess-r-newest' instead, which searches your system for R.

Now, this is strange given that I haven't changed anything since last year on my R installation, and I never got this message using previous versions of ESS with Emacs 28. I have already the absolute path to R executable in my PATH environment variable. After adding also the x64 directory to my path, which is the directory in the bin directory of R including Rterm.exe, finally I managed to start a new R session using Emacs 29. However, it seems that starting R in this way, my Emacs init file is either not read at all or not completely:

Warning [flymake Test.R]: Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)

I would like to know whether there is a compatibility issue between ESS and Emacs 29 or its just me who doesn't know how to configure it properly with this new version of Emacs.

Thanks in advance.

pwaltman commented 5 months ago

Are you running this via WSL2? I'm getting an error after recently upgrading my Ubuntu instance to v.23.10.

My setup is: windows 11 WSL2 Ubuntu 23.10 (upgraded from 22.10 -> 23.04 -> 23.10, if that matters at all) emacs v.29.1 elpa-ess (Ubuntu maintained package) v.18.10.2, I believe (18.10.2+git20230419.5c4ae91-1)

my .emacs only has the following in it: (require 'ess-site)

and I get the following error: Wrong type argument: stringp, nil

parvizfarnia commented 5 months ago

No I don't use WSL2. As I indicated in my original post I use Windows 11. But it is rather reassuring that others have encountered compatibility issues and I'm not the only one dealing with this. Personally I installed only once WSL2 and it took me less than five minutes to remove it. I stick for now to virtual machines with VirtualBox although even that has sometimes its own stability problems.

rsparapa commented 5 months ago

Can you try with the most recent ESS release? 24.01.0?

parvizfarnia commented 5 months ago

The version you're talking about is available on MELPA ?

mmaechler commented 5 months ago

Yes, and even ELPA (which is the standard package repos). So, everybody with an emacs version that is not older than say 5 years, should be able to do M-x package-install and then type ess at the Install package: prompt

mmaechler commented 5 months ago

... well, we have been told (and I have experienced once, ~ 0.5 years ago) that Emacs on the Mac does not support the whole emacs packaging, because it does not support the TLS communication protocol which emacs somehow seems to assume working.. If there's a web page / video / ... helping people to fix their emacs such that this hurdle can be taken, we'd be very grateful if you can post a link here.

rsparapa commented 5 months ago

Emacs 29.1 for macOS from https://emacs-modified.gitlab.io/ has TLS support but it is a little flaky. M-x package-install does NOT work in my experience. However, M-x package-list-packages does work and you can install ESS that way (but then you will have two versions of ESS installed so beware).

mmaechler commented 5 months ago

.. well so the web access and installation then does work; very strange that M-x package-install would not work when interactive installation via package list does work.. as I' 99.9% confident that they both use the same underlying functionality..

parvizfarnia commented 4 months ago

Can you try with the most recent ESS release? 24.01.0?

So here is how I proceeded:

This didn't change anything and all the problems described in my original post persist.

Also here is what M-x describe-package [RET] ess [RET] returns (in the case where it might be helpful to see what possibly went wrong) :


Package ess is installed.

     Status: Installed in ‘ess-20240131.1037/’ (unsigned).
    Version: 20240131.1037
     Commit: d8472e00da8fde3224d4512641093b526601af39
    Summary: Emacs Speaks Statistics
   Requires: emacs-25.1
Required by: ess-view-data-20230503.643, ess-view-20181001.1730, ess-smart-underscore-20190309.101, ess-smart-equals-20210411.1333, ess-r-insert-obj-20220610.1406, ess-R-data-view-20130509.1158
    Website: https://ess.r-project.org/
 Maintainer: ESS Core Team <ESS-core@r-project.org>
    Authors: David Smith <dsmith@stats.adelaide.edu.au>
             A.J. Rossini <blindglobe@gmail.com>
             Richard M. Heiberger <rmh@temple.edu>
             Kurt Hornik <Kurt.Hornik@R-project.org>
             Martin Maechler <maechler@stat.math.ethz.ch>
             Rodney A. Sparapani <rsparapa@mcw.edu>
             Stephen Eglen <stephen@gnu.org>
             Sebastian P. Luque <spluque@gmail.com>
             Henning Redestig <henning.red@googlemail.com>
             Vitalie Spinu <spinuvit@gmail.com>
             Lionel Henry <lionel.hry@gmail.com>
             J. Alexander Branham <alex.branham@gmail.com>
Other versions: 20240131.1037 (melpa), 24.1.1 (gnu).

Emacs Speaks Statistics (ESS) is a package designed to support editing of
scripts and interaction with various statistical analysis programs such as R,
S-Plus, SAS, Stata and OpenBUGS/JAGS. For more details please visit ESS home
page at https://ess.r-project.org/
mihamn commented 2 months ago

I had similar version upgrade issues (Mac OSX but to the same Emacs & ESS versions) - see below.

Do (ess-send-string ...) and (ess-command ...) work in your set-up? This is my issue, and these are the functions which most justify using ESS over the Posit offer, because you can work with the command-history in Elisp.

https://github.com/emacs-ess/ESS/issues/1287