0

Previously when I used the underscore key in my keyboard ESS replaced it for the assigment keys <-. In emacs25 that no longer happens.

I have installed the ESS package from MELPA, as well as, it's dependencies. I have the line

;; initialize all packages at startup
(package-initialize)

at the top of my .emacs file.

How can I replace the _ with the <- when I am trying to assign a variable in R.

  • Inasmuch as the current stable release is Emacs 26.1, does the feature you seek work correctly with a current version of Emacs? – lawlist Mar 2 at 17:05
1

I think it is related to recent changes in ESS. Quote from here: https://ess.r-project.org/Manual/ess.html

The variable ess-smart-S-assign-key is now deprecated and will be removed in the next release. If you would like to continue using ‘_‘ for insterting assign in future releases, please bind ess-insert-assign in ess-mode-map the normal way.

I have the following in my config to achieve exactly what you are asking

(define-key ess-r-mode-map "_" #'ess-insert-assign)
(define-key inferior-ess-r-mode-map "_" #'ess-insert-assign)
  • Thanks, that did the trick. I needed to add (require 'ess-site) to the top of the .emacs file too. I thought (package-initialize) took care of that, but nope. – Usobi Mar 3 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.