0
@@ -157,20 +157,16 @@ view at which CONTROLLER#FUNCTION points."
0
(defadvice ruby-run-w/compilation (around rinari-run-w/compilation activate)
0
"Set default directory to the root of the rails application
0
before running ruby processes."
0
- (let* ((root (rinari-root))
0
- (default-directory (or root
0
+ (let ((default-directory (or (rinari-root) default-directory)))
0
- (
if root (rinari-minor-mode))))
0
(defadvice ruby-rake-w/compilation (around rinari-rake-w/compilation activate)
0
"Set default directory to the root of the rails application
0
before running rake processes."
0
- (let* ((root (rinari-root))
0
- (default-directory (or root
0
+ (let ((default-directory (or (rinari-root) default-directory)))
0
- (
if root (rinari-minor-mode))))
0
(defun rinari-rake (&optional task edit)
0
@@ -195,7 +191,7 @@ view at which CONTROLLER#FUNCTION points."
0
(save-excursion (pop-to-buffer "*ruby*")
0
(set (make-local-variable 'inferior-ruby-first-prompt-pattern) "^>> ")
0
(set (make-local-variable 'inferior-ruby-prompt-pattern) "^>> ")
0
- (rinari-
minor-mode))))
0
(defun rinari-server ()
0
@@ -276,6 +272,19 @@ editing of the url."
0
(eval (list rinari-browse-url-func url))))
0
+(defun rinari-run-what (&optional arg)
0
+ "Allows the user to run a function selected from amongst all of
0
+the rinari functions displaying their names and keybindings."
0
+ (let* ((rinari-commands (mapcar (lambda (el)
0
+ (format "%s (\\C-c'%s)"
0
+ rinari-minor-mode-keybindings))
0
+ (rinari-command (car (split-string
0
+ (completing-read "run rinari function: "
0
+ (call-interactively (intern rinari-command))))
0
;;--------------------------------------------------------------------
0
;; minor mode and keymaps
0
@@ -284,19 +293,21 @@ editing of the url."
0
(let ((map (make-sparse-keymap)))
0
"Key map for Rinari minor mode.")
0
-(define-key rinari-minor-mode-map "\C-c'r" 'rinari-rake)
0
-(define-key rinari-minor-mode-map "\C-c's" 'rinari-script)
0
-(define-key rinari-minor-mode-map "\C-c'c" 'rinari-console)
0
-(define-key rinari-minor-mode-map "\C-c'w" 'rinari-server)
0
-(define-key rinari-minor-mode-map "\C-c'v" 'rinari-find-view)
0
-(define-key rinari-minor-mode-map "\C-c'a" 'rinari-find-action)
0
-(define-key rinari-minor-mode-map "\C-c'b" 'rinari-browse-view)
0
-(define-key rinari-minor-mode-map "\C-c'e" 'rinari-insert-erb-skeleton)
0
-(define-key rinari-minor-mode-map "\C-c't" 'rinari-test-function)
0
-(define-key rinari-minor-mode-map "\C-c'o" 'toggle-buffer)
0
+(defvar rinari-minor-mode-keybindings
0
+ '(("\t" . 'rinari-run-what) ("o" . 'toggle-buffer)
0
+ ("e" . 'rinari-insert-erb-skeleton) ("t" . 'rinari-test-function)
0
+ ("r" . 'rinari-rake) ("c" . 'rinari-console) ("b" . 'rinari-browse-view)
0
+ ("v" . 'rinari-find-view) ("a" . 'rinari-find-action) ("w" . 'rinari-server))
0
+ "alist mapping of keys to functions in `rinari-minor-mode'")
0
+ (eval `(define-key rinari-minor-mode-map ,(format "\C-c'%s" (car el)) ,(cdr el))))
0
+ rinari-minor-mode-keybindings)
0
(defun rinari-launch ()
0
- "Run `rinari-minor-mode' if inside of a rails projcect"
0
+ "Run `rinari-minor-mode' if inside of a rails projcect,
0
+otherwise turn `rinari-minor-mode' off if it is on."
0
;; customize toggle.el for rinari
0
@@ -309,7 +320,9 @@ editing of the url."
0
("lib/\\1.rb" . "test/unit/test_\\1.rb"))))
0
(setq toggle-mapping-style 'rinari)
0
(setq toggle-mappings (toggle-style toggle-mapping-style))
0
- (if (rinari-root) (rinari-minor-mode t)))
0
+ (unless rinari-minor-mode (rinari-minor-mode t))
0
+ (if rinari-minor-mode (rinari-minor-mode))))
0
(add-hook 'ruby-mode-hook
0
(lambda () (rinari-launch)))
0
@@ -317,6 +330,14 @@ editing of the url."
0
(add-hook 'mumamo-after-change-major-mode-hook
0
(lambda () (rinari-launch)))
0
+(add-hook 'dired-mode-hook
0
+ (lambda () (rinari-launch)))
0
+(defadvice cd (after rinari-on-cd activate)
0
+ "Active/Deactive rinari-minor-node when changing into and out
0
+ of raills project directories"
0
(define-minor-mode rinari-minor-mode
0
"Enable Rinari minor mode providing Emacs support for working
0
with the Ruby on Rails framework."
Comments
No one has commented yet.