[ESS] rewire C-RET to M-RET
Andreas Leha
andreas.leha at med.uni-goettingen.de
Wed Nov 6 23:17:23 CET 2013
Hi all,
what is the correct way to rewire C-RET to M-RET?
In a recent thread [fn:1], two possibilities were given:
(1) by Keith Ponting
--8<---------------cut here---------------start------------->8---
;;; 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)
))
--8<---------------cut here---------------end--------------->8---
(2) by Vitalie Spinu
--8<---------------cut here---------------start------------->8---
(eval-after-load "ess-mode"
'(progn
(define-key ess-mode-map [(control return)] nil)
(define-key ess-mode-map [(meta return)] 'ess-eval-region-or-line-and-step)
))
--8<---------------cut here---------------end--------------->8---
Both of them work for me [fn:2] in 'emacs' but *not* in 'emacs -nw'.
That is a pity, because 'emacs -nw' is one of the best use cases for
such rewiring.
Note that in 'emacs -nw', if I run
M-x local-set-key M-RET ess-eval-region-or-line-and-step
it works. But I have to do it every time I open a new ess-mode buffer,
i.e. (many) dozen times a day.
I also tried with 'emacs -Q -l .emacs-only-loading-ess -nw', so I guess
it's not conflicting configuration on my side.
Do I miss something here?
Regards,
Andreas
Footnotes:
[fn:1] http://permalink.gmane.org/gmane.emacs.ess.general/7673
[fn:2]
- GNU Emacs 24.3.1
- ess-version: 13.09
More information about the ESS-help
mailing list