The motion-mode provides some convenient features when you write codes in RubyMotion. The features are the following:
- Recognize RubyMotion projects
- You can open *.rb files by motion-mode in RubyMotion projects.
- Syntax Highlight by ruby-mode
- Code completion of defined words by auto-complete-mode
- You can make a dictionary with make_dict.rb which includes this repository.
- Execution of rake tasks in Emacs
- You can execute all rake tasks in Emacs with prefix keybinds
- In particular, support operation of interactive-debugger in emacs by comint-mode
- When you execute a rake task by motion-execute-rake, it executes 'rake' in default that is build command.
- Syntax check by flymake-mode
- The flymake-mode is the default syntax - check feature in Emacs.
- Support it in motion-mode by macruby interpreter.
- Document search by Dash.app
- Dash.app is a convenient document tool which supports RubyMotion's one.
- When you want search documents by keywords on emacs's cursol, you can use motion-dash-at-point.
- Code converter to convert a part of code from Objective-C to Ruby-style sentence
The motion-mode provides some convenient commands(motion-execute-rake, motion-dash-at-point, etc...), but the motion-mode dosen't provide key-binds. You can setup key-binds as you like.
Write the following codes in your init.el
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
and then "M-x package-install".
$ cd ~/.emacs.d/path/to/motion-mode
$ find /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks -name "*.h" | xargs ruby bin/make_dict.rb
$ cp ./motion-mode ~/.emacs.d/ac-dict
$ emacs ~/.emacs.d/init.el # add following setting
(add-to-list 'load-path "~/.emacs.d/elisp/motion-mode")
(require 'motion-mode)
;; following add-hook is very important.
(add-hook 'ruby-mode-hook 'motion-recognize-project)
(add-to-list 'ac-modes 'motion-mode)
(add-to-list 'ac-sources 'ac-source-dictionary)
;; set key-binds as you like
(define-key motion-mode-map (kbd "C-c C-c") 'motion-execute-rake)
(define-key motion-mode-map (kbd "C-c C-d") 'motion-dash-at-point)
You can set key-binds of the following commands. The motion-mode dosen't provide default key bindings.
- motion-execute-rake
- Execution of rake tasks in Emacs
- motion-dash-at-point
- Document search by Dash.app
- motion-convert-code-region
- Code converter to convert a part of code from Objective-C to Ruby-style sentence
(define-key motion-mode-map (kbd "C-c C-c") 'motion-execute-rake)
(define-key motion-mode-map (kbd "C-c C-d") (lambda () (interactive) (motion-execute-rake-command "device")))
(define-key motion-mode-map (kbd "C-c C-o") 'motion-dash-at-point)
(define-key motion-mode-map (kbd "C-c C-p") 'motion-convert-code-region)
- motion-execute-rake-command TASK
- execute rake task of TASK
- motion-flymake (default is t)
- The motion-flymake variable is the flag which your emacs opens rubymotion-source with flymake-mode or not.
- make_dict.rb cite from roupam/yasobjc.
- code_conveter.rb cite from kyamaguchi/SublimeObjC2RubyMotion