public
Description: Rinari Is Not A Rails IDE
Homepage: http://rinari.rubyforge.org
Clone URL: git://github.com/technomancy/rinari.git
stabilized minor-mode toggling and buffer poping, and added 
rinari-run-what (an introductory function)
eschulte (author)
Fri Jun 27 19:27:46 -0700 2008
commit  f505236b6b8858e8a25280471323f729ae685b27
tree    c3c220d331eda1cd0c3ee51154ad68ca152a8308
parent  a9e16a5fe39e87b7fd373c700c9b1775c7c504cb
...
157
158
159
160
161
162
 
163
164
 
165
166
167
168
169
170
171
 
172
173
 
174
175
176
...
195
196
197
198
 
199
200
201
...
276
277
278
 
 
 
 
 
 
 
 
 
 
 
 
 
279
280
281
...
284
285
286
287
288
289
290
291
292
293
294
295
296
 
 
 
 
 
 
 
 
 
 
 
297
298
299
 
 
300
301
302
...
309
310
311
312
 
 
 
313
314
315
...
317
318
319
 
 
 
 
 
 
 
 
320
321
322
...
157
158
159
 
 
 
160
161
 
162
163
164
165
166
 
 
 
167
168
 
169
170
171
172
...
191
192
193
 
194
195
196
197
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
...
293
294
295
 
 
 
 
 
 
 
 
 
 
296
297
298
299
300
301
302
303
304
305
306
307
308
 
309
310
311
312
313
...
320
321
322
 
323
324
325
326
327
328
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
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
- default-directory)))
0
+ (let ((default-directory (or (rinari-root) default-directory)))
0
     ad-do-it
0
- (if root (rinari-minor-mode))))
0
+ (rinari-launch)))
0
 
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
- default-directory)))
0
+ (let ((default-directory (or (rinari-root) default-directory)))
0
     ad-do-it
0
- (if root (rinari-minor-mode))))
0
+ (rinari-launch)))
0
 
0
 ;;;###autoload
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
+ (rinari-launch))))
0
 
0
 (defun rinari-server ()
0
   "Run script/server."
0
@@ -276,6 +272,19 @@ editing of the url."
0
     base)))
0
     (eval (list rinari-browse-url-func url))))
0
 
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
+ (interactive "P")
0
+ (let* ((rinari-commands (mapcar (lambda (el)
0
+ (format "%s (\\C-c'%s)"
0
+ (caddr el) (car el)))
0
+ rinari-minor-mode-keybindings))
0
+ (rinari-command (car (split-string
0
+ (completing-read "run rinari function: "
0
+ rinari-commands)))))
0
+ (call-interactively (intern rinari-command))))
0
+
0
 ;;--------------------------------------------------------------------
0
 ;;
0
 ;; minor mode and keymaps
0
@@ -284,19 +293,21 @@ editing of the url."
0
   (let ((map (make-sparse-keymap)))
0
     map)
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
+
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
+
0
+(mapcar (lambda (el)
0
+ (eval `(define-key rinari-minor-mode-map ,(format "\C-c'%s" (car el)) ,(cdr el))))
0
+ rinari-minor-mode-keybindings)
0
 
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
   (interactive)
0
   ;; customize toggle.el for rinari
0
   (add-to-list
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
+ (if (rinari-root)
0
+ (unless rinari-minor-mode (rinari-minor-mode t))
0
+ (if rinari-minor-mode (rinari-minor-mode))))
0
 
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
 
0
+(add-hook 'dired-mode-hook
0
+ (lambda () (rinari-launch)))
0
+
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
+ (rinari-launch))
0
+
0
 (define-minor-mode rinari-minor-mode
0
   "Enable Rinari minor mode providing Emacs support for working
0
 with the Ruby on Rails framework."
...
57
58
59
60
61
 
 
62
63
64
...
57
58
59
 
 
60
61
62
63
64
0
@@ -57,8 +57,8 @@
0
    (local-set-key "p" 'previous-error-no-select)
0
    (local-set-key "n" 'next-error-no-select)
0
    (local-set-key "\M-p" 'ruby-compilation-previous-error-group)
0
- (local-set-key "\M-n" 'ruby-compilation-next-error-group))
0
- buffer))))
0
+ (local-set-key "\M-n" 'ruby-compilation-next-error-group))))
0
+ comp-buffer-name))
0
 
0
 (defun ruby-compilation-insertion-filter (proc string)
0
   "Insert text to buffer stripping ansi color codes"
...
132
133
134
135
 
136
137
138
 
 
139
140
141
...
132
133
134
 
135
136
 
 
137
138
139
140
141
0
@@ -132,10 +132,10 @@ matches, it returns nil"
0
 Matches the current buffer against rules in toggle-mappings. If a
0
 match is found, switches to that buffer."
0
   (interactive)
0
- (let* ((function (which-function))
0
+ (let* ((function (ruby-add-log-current-method))
0
    (func-add (if function
0
- (concat "#" (and (string-match "#\\(.+\\)" (which-function))
0
- (match-string 1 (which-function))))
0
+ (concat "#" (and (string-match "#\\(.+\\)" (ruby-add-log-current-method))
0
+ (match-string 1 (ruby-add-log-current-method))))
0
      ""))
0
    (new-name (or (toggle-filename (concat (buffer-file-name) func-add)
0
           toggle-mappings)

Comments

    No one has commented yet.