3

I am used to "C-c C-r" command to send code to the interpreter in R with Emacs speaks statistics. How can I set python-mode to use "C-c C-r" rather than "C-c |" to evaulate code?

Thanks!

doniyor
  • 36,596
  • 57
  • 175
  • 260
retrot
  • 311
  • 4
  • 10

1 Answers1

1

It's already bound to C-c C-r in the built-in python.el, but here's a command that binds the key. If you're using python-mode.el, you'll have to change the library name, the command, and maybe the map.

(eval-after-load "python"
  '(progn
     (define-key python-mode-map (kbd "C-c C-r") 'python-shell-send-region)))
jpkotta
  • 9,237
  • 3
  • 29
  • 34
  • 1
    Thanks for the response, but I am a begginer, so I dont know exactly where to do what you say? Do I have to add this command in .emacs? – retrot Aug 10 '14 at 10:38
  • 1
    Yes, put it in your ~/.emacs. Personally, I like to make ~/.emacs.d and use ~/.emacs.d/init.el instead of ~/.emacs. – jpkotta Aug 10 '14 at 15:33
  • 1
    You can also put it in `*scratch*` and evaluate it with `C-M-x` or `C-x C-e`. – jpkotta Aug 10 '14 at 15:42