ess

Emacs ESS error ess-toggle-S-assign wrong number of arguments


After installing Emacs and Emacs Speaks Statistics (ESS) on a new machine, I am receiving the following error when I open an R buffer: ess-toggle-S-assign wrong number of arguments. I believe that this occurs due to the following section in my .emacs file where I reassign the assignment key from _ to ;, as shown below. Why does my .emacs file no longer work?

;; ESS hook additions.  Note that the duplicate calls to `(ess-toggle-S-assign
;; nil)` are correct: the first call clears the default `ess-smart-S-assign`
;; assignment and the second line re-assigns it to the customized setting.
(add-hook 'ess-mode-hook
      (lambda ()
        (setq ess-smart-S-assign-key ";")  ; reassign ' <- ' to ';'
        (ess-toggle-S-assign nil)          ; see above comment
        (ess-toggle-S-assign nil)))        ; see above comment

Solution

  • According to the ESS documentation https://ess.r-project.org/Manual/ess.html#New-features

    Customization of ess-smart-S-assign-key has been reworked. You should now set the value before ESS is loaded.

    So to reassign the assignment key as before, simply remove the existing lines of code from the ESS mode hook, and instead include the following lines in your .emacs file.

    (setq ess-smart-S-assign-key ";")
    (require 'ess-site)