[ESS] Windows ESS: trouble re-configuring shortcuts (but Linux OK)

Vitalie Spinu spinuvit at gmail.com
Mon Sep 30 23:23:04 CEST 2013

I am also fan of M- prefix. It is easier to type and it works more
reliably in terminals. We are using C- because other editors, notably
R-studio is using it.

Problems like the one Paul mentioned arise because Vincent's
distribution loads ess after user's init file. There are good and bad
things about it. The workaround is indeed to put initialization in
ess-mode-hook, as Keith pointed, or in on-load hook:

(eval-after-load "ess-mode"
     (define-key ess-mode-map [(control return)] nil)
     (define-key ess-mode-map [(meta return)] 'ess-eval-region-or-line-and-step)


 >>> "Ponting, Keith (Keith)" on Mon, 30 Sep 2013 14:28:02 +0000 wrote:

 > I too avoid C-Ret, but prefer M-Ret for the evaluate as it means I can use my thumb for the modifier key. Therefore I have switched the shortcuts around. The other problem is fixed by using mode hook, so that the mode-map is not accessed until it has been activated:
 > ;;; useful trick from ESS wiki - M-return (hold alt key and return) evaluates line (or selected region) and steps
 > (defun my-ess-eval ()
 >   (interactive)
 >   (if (and transient-mark-mode mark-active)
 >       (call-interactively 'ess-eval-region)
 >     (call-interactively 'ess-eval-line-and-step)))

 > (add-hook 'ess-mode-hook
 >  '(lambda()
 >     (local-set-key (kbd "M-<return>") 'my-ess-eval)
 >     (local-set-key (kbd "C-<return>") 'ess-use-this-dir)
 >     ))

 > HTH,

 > Keith

 > Keith Ponting
 > Avaya Speech Analytics, Malvern WR14 3SZ  UK
 > Any opinions are those of the author not the company.

 >> -----Original Message-----
 >> From: ess-help-bounces at r-project.org [mailto:ess-help-bounces at r-
 >> project.org] On Behalf Of Paul Johnson
 >> Sent: 30 September 2013 15:11
 >> To: ess-help
 >> Subject: [ESS] Windows ESS: trouble re-configuring shortcuts (but Linux
 >> OK)
 >> Greetings.
 >> I think protecting CUA mode C-Ret is important, and have been using S-
 >> Ret instead. For a long time, I had a big-ish function in the init file
 >> to do that.
 >> A few months ago, Vitali gave me these lines that work on Linux with ESS
 >> 13.05
 >> ;; Change shortcut to use Shift-Return
 >> ;; Suggested by Vitalie Spinu ESS-help email 2013-05-15 (define-key ess-
 >> mode-map [(control return)] nil) (define-key ess-mode-map [(shift
 >> return)] 'ess-eval-region-or-line-and-step)
 >> It works in Linux. I gave my init file to some students.
 >> A Windows user just wrote me and said it doesn't work there with Prof
 >> Goulet's Emacs and ESS 13.05. The shortcut is not established, the
 >> Warning(initialization): An error occurred while loading
 >> 'd:/Users/crmda/.emacs.d/init.el'
 >> Symbol's value as variable is void: ess-mode-map
 >> To ensure normal operation, you should investigate and remove the cause
 >> of the error...
 >> Ideas? If there is a workaround for ESS 13.05, I'd really appreciate it
 >> because re-installing Emacs on all those student computers will cause a
 >> collective heart attack at this early point in the semester.
 >> pj
 >> --
 >> Paul E. Johnson
 >> Professor, Political Science      Assoc. Director
 >> 1541 Lilac Lane, Room 504      Center for Research Methods
 >> University of Kansas                 University of Kansas
 >> http://pj.freefaculty.org               http://quant.ku.edu> 
 >> [[alternative HTML version deleted]]
 >> ______________________________________________
 >> ESS-help at r-project.org mailing list
 >> https://stat.ethz.ch/mailman/listinfo/ess-help

 > ______________________________________________
 > ESS-help at r-project.org mailing list
 > https://stat.ethz.ch/mailman/listinfo/ess-help

More information about the ESS-help mailing list