| 1 |
;;; rails-plugin-minor-mode.el --- minor mode for RubyOnRails plugins
|
| 2 |
|
| 3 |
;; Copyright (C) 2006 Dmitry Galinsky <dima dot exe at gmail dot com>
|
| 4 |
|
| 5 |
;; Authors: Dmitry Galinsky <dima dot exe at gmail dot com>
|
| 6 |
|
| 7 |
;; Keywords: ruby rails languages oop
|
| 8 |
;; $URL$
|
| 9 |
;; $Id$
|
| 10 |
|
| 11 |
;;; License
|
| 12 |
|
| 13 |
;; This program is free software; you can redistribute it and/or
|
| 14 |
;; modify it under the terms of the GNU General Public License
|
| 15 |
;; as published by the Free Software Foundation; either version 2
|
| 16 |
;; of the License, or (at your option) any later version.
|
| 17 |
|
| 18 |
;; This program is distributed in the hope that it will be useful,
|
| 19 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 20 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 21 |
;; GNU General Public License for more details.
|
| 22 |
|
| 23 |
;; You should have received a copy of the GNU General Public License
|
| 24 |
;; along with this program; if not, write to the Free Software
|
| 25 |
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 26 |
|
| 27 |
;;; Code:
|
| 28 |
|
| 29 |
(defun rails-plugin-minor-mode:switch-to-init ()
|
| 30 |
(interactive)
|
| 31 |
(rails-core:find-file-if-exist
|
| 32 |
(rails-core:plugin-file (rails-core:current-plugin) "init.rb")))
|
| 33 |
|
| 34 |
(defun rails-plugin-minor-mode:switch-with-menu ()
|
| 35 |
(interactive)
|
| 36 |
(let* ((item)
|
| 37 |
(plugin (rails-core:current-plugin))
|
| 38 |
(menu (rails-core:plugin-files plugin)))
|
| 39 |
(setq item
|
| 40 |
(rails-core:menu
|
| 41 |
(list (concat "Plugin " plugin)
|
| 42 |
(cons "Please select.." (list->alist menu)))))
|
| 43 |
(when item
|
| 44 |
(rails-core:find-file-if-exist
|
| 45 |
(rails-core:plugin-file plugin item)))))
|
| 46 |
|
| 47 |
(define-minor-mode rails-plugin-minor-mode
|
| 48 |
"Minor mode for RubyOnRails plugins."
|
| 49 |
nil
|
| 50 |
" plugin"
|
| 51 |
nil
|
| 52 |
(setq rails-primary-switch-func 'rails-plugin-minor-mode:switch-to-init)
|
| 53 |
(setq rails-secondary-switch-func 'rails-plugin-minor-mode:switch-with-menu))
|
| 54 |
|
| 55 |
(provide 'rails-plugin-minor-mode) |