1
votes

I am using Emacs 23.4.1 on my MacBook as a ruby development environment when I am on the go. Although ruby-mode works, Emacs doesn't appear to recognize ruby specific key bindings. For example, invoking C-c C-r isn't recognized, but manually invoking the command ruby-send-region via M-x will work.

I should note that on my Linux VM using Emacs 23.4.1, the above key binding works, and when I manually invoke the command with M-x Emacs will remind me in the minibuffer that I can instead use the aforementioned key binding. In the case of my OS X machine, do I manually need to define the key bindings in my ruby configuration file? If so, is there someone be kind enough to give me an example of how to do this?

1
I don't know, but have you tried <kbd>Command<kbd/> instead of <kbd>Control<kbd/>? - Linuxios
Ctrl is still used in the OSX version of Emacs. I am using both the Cocoa and command-line versions. - dtg
Have you checked to see if on your mac install there is a conflicting command for that key? - diedthreetimes
@diedthreetimes: as far as I know, there isn't a conflicting command C-c C-r, because Emacs doesn't recognize the command. Or were you asking if the command is used by the operating system? If that is the case, I don't think the above key binding would be used by the Mac/Cocoa API, since Mac API commands use the apple key and not Ctrl ... right? - dtg

1 Answers

1
votes

ruby-send-region comes from inf-ruby. Which version are you running? There are various bastardized versions that load its keys automatically, which is what may be happening on Linux.

The canonical version of this comes from Ruby source. It does not load keys automatically. However, the loading instructions it does provide are suboptimal, since key-binding code is run every time ruby-mode is activated. Instead use this:

(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby" 
"Set local key defs for inf-ruby in ruby-mode")
(eval-after-load "ruby-mode" '(inf-ruby-keys))