Emacs ESS错误ess-toggle-S-assign wrong number of arguments

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

在新机器上安装 Emacs 和 Emacs Speaks Statistics (ESS) 后,我在打开 R 缓冲区时收到以下错误:ess-toggle-S-assign wrong number of arguments。我认为这是由于我的 .emacs 文件中的以下部分引起的,我在其中将分配键从 _ 重新分配给 ;,如下所示。为什么我的 .emacs 文件不再有效?

;; 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

根据 ESS 文档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.

因此,要像以前一样重新分配分配键,只需从 ESS 模式挂钩中删除现有的代码行,然后将以下行包含在您的 .emacs 文件中。

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