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!

1 Answer 1

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)))
Sign up to request clarification or add additional context in comments.

3 Comments

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?
Yes, put it in your ~/.emacs. Personally, I like to make ~/.emacs.d and use ~/.emacs.d/init.el instead of ~/.emacs.
You can also put it in *scratch* and evaluate it with C-M-x or C-x C-e.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.