From c9c34397adbb17afd1b05d2754dead544cf455be Mon Sep 17 00:00:00 2001 From: dimaexe Date: Mon, 9 Apr 2007 15:15:02 +0000 Subject: [PATCH] rails-ui.el (rails-minor-mode-prefix-key): created (rails-key): created git-svn-id: svn+ssh://rubyforge.org/var/svn/emacs-rails/trunk@173 cc5033d0-740f-0410-afc7-949910e492f2 --- ChangeLog | 3 + History | 4 +- rails-controller-layout.el | 12 ++-- rails-model-layout.el | 12 ++-- rails-ruby.el | 2 +- rails-ui.el | 117 ++++++++++++++++++++----------------- rails-view-minor-mode.el | 8 +-- rails.el | 6 +- 8 files changed, 89 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c0e92d..a0659d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-04-09 Dmitry Galinsky + * rails-ui.el (rails-minor-mode-prefix-key): created + (rails-key): created + * predictive-prog-mode.el (predictive-prog-text-faces): fixed compilation warning 2007-04-08 Dmitry Galinsky diff --git a/History b/History index 026b208..2fb96c5 100644 --- a/History +++ b/History @@ -1,7 +1,9 @@ +SVN +* Fixed bug [#9991]: allow setup key prefix for rails-minor-mode + 0.5.99.3 * Added speedbar integration, type [F11] to toogle speedbar * Fixed #9880: the hotkey "C-c ." conflicted with ECB, changed to "C-c C-c ," - * New hotkeys, to easy switch without a popup menu between a controller or a model related files In model layout: diff --git a/rails-controller-layout.el b/rails-controller-layout.el index eb1006b..0b7eeee 100644 --- a/rails-controller-layout.el +++ b/rails-controller-layout.el @@ -141,12 +141,12 @@ If the action is nil, return all views for the controller." rails-controller-layout:switch-to-unit-test :enable (rails-core:current-mailer)))) (define-keys map - ((kbd "\C-c g") 'rails-controller-layout:switch-to-migration) - ((kbd "\C-c m") 'rails-controller-layout:switch-to-model) - ((kbd "\C-c h") 'rails-controller-layout:switch-to-helper) - ((kbd "\C-c f") 'rails-controller-layout:switch-to-functional-test) - ((kbd "\C-c c") 'rails-controller-layout:switch-to-controller) - ((kbd "\C-c u") 'rails-controller-layout:switch-to-unit-test) + ((rails-key "g") 'rails-controller-layout:switch-to-migration) + ((rails-key "m") 'rails-controller-layout:switch-to-model) + ((rails-key "h") 'rails-controller-layout:switch-to-helper) + ((rails-key "f") 'rails-controller-layout:switch-to-functional-test) + ((rails-key "c") 'rails-controller-layout:switch-to-controller) + ((rails-key "u") 'rails-controller-layout:switch-to-unit-test) ([menu-bar rails-controller-layout] (cons name menu)))) map)) diff --git a/rails-model-layout.el b/rails-model-layout.el index 2b4dae9..4b44a01 100644 --- a/rails-model-layout.el +++ b/rails-model-layout.el @@ -56,12 +56,12 @@ rails-model-layout:switch-to-mailer :enable (rails-core:mailer-exist-p (rails-core:current-mailer))))) (define-keys map - ((kbd "\C-c m") 'rails-model-layout:switch-to-model) - ((kbd "\C-c u") 'rails-model-layout:switch-to-unit-test) - ((kbd "\C-c g") 'rails-model-layout:switch-to-migration) - ((kbd "\C-c c") 'rails-model-layout:switch-to-controller) - ((kbd "\C-c x") 'rails-model-layout:switch-to-fixture) - ((kbd "\C-c n") 'rails-model-layout:switch-to-mailer) + ((rails-key "m") 'rails-model-layout:switch-to-model) + ((rails-key "u") 'rails-model-layout:switch-to-unit-test) + ((rails-key "g") 'rails-model-layout:switch-to-migration) + ((rails-key "c") 'rails-model-layout:switch-to-controller) + ((rails-key "x") 'rails-model-layout:switch-to-fixture) + ((rails-key "n") 'rails-model-layout:switch-to-mailer) ([menu-bar rails-model-layout] (cons name menu)))) map)) diff --git a/rails-ruby.el b/rails-ruby.el index cb4f604..b22ccd2 100644 --- a/rails-ruby.el +++ b/rails-ruby.el @@ -165,7 +165,7 @@ See the variable `align-rules-list' for more details.") (setq flymake-err-line-patterns (cons flymake-ruby-error-line-pattern-regexp flymake-err-line-patterns)) (flymake-mode t) - (local-set-key (kbd "\C-c d") 'flymake-display-err-menu-for-current-line))) + (local-set-key (rails-key "d") 'flymake-display-err-menu-for-current-line))) (add-hook 'ruby-mode-hook 'flymake-ruby-load) diff --git a/rails-ui.el b/rails-ui.el index 756e288..576c592 100644 --- a/rails-ui.el +++ b/rails-ui.el @@ -194,9 +194,18 @@ ([rails ws default] '(menu-item "Start/Stop Web Server (With Default Environment)" rails-ws:toggle-start-stop)) ) -(defconst rails-minor-mode-test-current-method-key (kbd "\C-c \C-c ,")) +(defcustom rails-minor-mode-prefix-key "\C-c" + "Key prefix for rails minor mode." + :group 'rails) -(defvar rails-minor-mode-map (make-sparse-keymap)) +(defmacro rails-key (key) + `(kbd ,(concat rails-minor-mode-prefix-key " " key))) + +(defconst rails-minor-mode-test-current-method-key (rails-key "\C-c ,")) + +(defvar rails-minor-mode-map + (let ((map (make-keymap))) + map)) (define-keys rails-minor-mode-map ([menu-bar] rails-minor-mode-menu-bar-map) @@ -204,82 +213,82 @@ ([menu-bar rails-db] (cons "Database" rails-minor-mode-db-menu-bar-map)) ;; Goto - ((kbd "\C-c \C-c g m") 'rails-nav:goto-models) - ((kbd "\C-c \C-c g c") 'rails-nav:goto-controllers) - ((kbd "\C-c \C-c g o") 'rails-nav:goto-observers) - ((kbd "\C-c \C-c g n") 'rails-nav:goto-mailers) - ((kbd "\C-c \C-c g h") 'rails-nav:goto-helpers) - ((kbd "\C-c \C-c g l") 'rails-nav:goto-layouts) - ((kbd "\C-c \C-c g s") 'rails-nav:goto-stylesheets) - ((kbd "\C-c \C-c g j") 'rails-nav:goto-javascripts) - ((kbd "\C-c \C-c g g") 'rails-nav:goto-migrate) - ((kbd "\C-c \C-c g p") 'rails-nav:goto-plugins) - ((kbd "\C-c \C-c g x") 'rails-nav:goto-fixtures) - ((kbd "\C-c \C-c g f") 'rails-nav:goto-functional-tests) - ((kbd "\C-c \C-c g u") 'rails-nav:goto-unit-tests) + ((rails-key "\C-c g m") 'rails-nav:goto-models) + ((rails-key "\C-c g c") 'rails-nav:goto-controllers) + ((rails-key "\C-c g o") 'rails-nav:goto-observers) + ((rails-key "\C-c g n") 'rails-nav:goto-mailers) + ((rails-key "\C-c g h") 'rails-nav:goto-helpers) + ((rails-key "\C-c g l") 'rails-nav:goto-layouts) + ((rails-key "\C-c g s") 'rails-nav:goto-stylesheets) + ((rails-key "\C-c g j") 'rails-nav:goto-javascripts) + ((rails-key "\C-c g g") 'rails-nav:goto-migrate) + ((rails-key "\C-c g p") 'rails-nav:goto-plugins) + ((rails-key "\C-c g x") 'rails-nav:goto-fixtures) + ((rails-key "\C-c g f") 'rails-nav:goto-functional-tests) + ((rails-key "\C-c g u") 'rails-nav:goto-unit-tests) ;; Switch ((kbd "") 'rails-lib:run-primary-switch) ((kbd "") 'rails-lib:run-secondary-switch) - ((kbd "\C-c ") 'rails-lib:run-primary-switch) - ((kbd "\C-c ") 'rails-lib:run-secondary-switch) + ((rails-key "") 'rails-lib:run-primary-switch) + ((rails-key "") 'rails-lib:run-secondary-switch) ((kbd "") 'rails-goto-file-on-current-line) ;; Scripts & SQL - ((kbd "\C-c \C-c e") 'rails-script:generate) - ((kbd "\C-c \C-c x") 'rails-script:destroy) - ((kbd "\C-c \C-c s c") 'rails-script:console) - ((kbd "\C-c \C-c s b") 'rails-script:breakpointer) - ((kbd "\C-c \C-c s s") 'rails-run-sql) - ((kbd "\C-c \C-c w s") 'rails-ws:toggle-start-stop) - ((kbd "\C-c \C-c w d") 'rails-ws:start-development) - ((kbd "\C-c \C-c w p") 'rails-ws:start-production) - ((kbd "\C-c \C-c w t") 'rails-ws:start-test) - ((kbd "\C-c \C-c w i") 'rails-ws:print-status) - ((kbd "\C-c \C-c w a") 'rails-ws:auto-open-browser) + ((rails-key "\C-c e") 'rails-script:generate) + ((rails-key "\C-c x") 'rails-script:destroy) + ((rails-key "\C-c s c") 'rails-script:console) + ((rails-key "\C-c s b") 'rails-script:breakpointer) + ((rails-key "\C-c s s") 'rails-run-sql) + ((rails-key "\C-c w s") 'rails-ws:toggle-start-stop) + ((rails-key "\C-c w d") 'rails-ws:start-development) + ((rails-key "\C-c w p") 'rails-ws:start-production) + ((rails-key "\C-c w t") 'rails-ws:start-test) + ((rails-key "\C-c w i") 'rails-ws:print-status) + ((rails-key "\C-c w a") 'rails-ws:auto-open-browser) ;; Rails finds - ((kbd "\C-c \C-c f m") 'rails-find:models) - ((kbd "\C-c \C-c f c") 'rails-find:controller) - ((kbd "\C-c \C-c f h") 'rails-find:helpers) - ((kbd "\C-c \C-c f l") 'rails-find:layout) - ((kbd "\C-c \C-c f s") 'rails-find:stylesheets) - ((kbd "\C-c \C-c f j") 'rails-find:javascripts) - ((kbd "\C-c \C-c f g") 'rails-find:migrate) - ((kbd "\C-c \C-c f b") 'rails-find:lib) - ((kbd "\C-c \C-c f t") 'rails-find:tasks) - ((kbd "\C-c \C-c f v") 'rails-find:view) - ((kbd "\C-c \C-c f d") 'rails-find:db) - ((kbd "\C-c \C-c f p") 'rails-find:public) - ((kbd "\C-c \C-c f f") 'rails-find:fixtures) - ((kbd "\C-c \C-c f o") 'rails-find:config) - - ((kbd "\C-c \C-c d m") 'rails-rake:migrate) - ((kbd "\C-c \C-c d v") 'rails-rake:migrate-to-version) - ((kbd "\C-c \C-c d p") 'rails-rake:migrate-to-prev-version) + ((rails-key "\C-c f m") 'rails-find:models) + ((rails-key "\C-c f c") 'rails-find:controller) + ((rails-key "\C-c f h") 'rails-find:helpers) + ((rails-key "\C-c f l") 'rails-find:layout) + ((rails-key "\C-c f s") 'rails-find:stylesheets) + ((rails-key "\C-c f j") 'rails-find:javascripts) + ((rails-key "\C-c f g") 'rails-find:migrate) + ((rails-key "\C-c f b") 'rails-find:lib) + ((rails-key "\C-c f t") 'rails-find:tasks) + ((rails-key "\C-c f v") 'rails-find:view) + ((rails-key "\C-c f d") 'rails-find:db) + ((rails-key "\C-c f p") 'rails-find:public) + ((rails-key "\C-c f f") 'rails-find:fixtures) + ((rails-key "\C-c f o") 'rails-find:config) + + ((rails-key "\C-c d m") 'rails-rake:migrate) + ((rails-key "\C-c d v") 'rails-rake:migrate-to-version) + ((rails-key "\C-c d p") 'rails-rake:migrate-to-prev-version) ;; Tests - ((kbd "\C-c \C-c r") 'rails-rake:task) - ((kbd "\C-c \C-c t") 'rails-test:run) - ((kbd "\C-c \C-c .") 'rails-test:run-current) + ((rails-key "\C-c r") 'rails-rake:task) + ((rails-key "\C-c t") 'rails-test:run) + ((rails-key "\C-c .") 'rails-test:run-current) ;; Navigation - ((kbd "\C-c \C-c l") 'rails-log:open) + ((rails-key "\C-c l") 'rails-log:open) ;; Tags - ((kbd "\C-c \C-c \C-t") 'rails-create-tags) + ((rails-key "\C-c \C-t") 'rails-create-tags) ;; Documentation ([f1] 'rails-search-doc) ((kbd "") 'rails-browse-api-at-point) - ((kbd "\C-c ") 'rails-browse-api) - ((kbd "\C-c /") 'rails-script:toggle-output-window) + ((rails-key "") 'rails-browse-api) + ((rails-key "/") 'rails-script:toggle-output-window) ([f9] 'rails-svn-status-into-root)) ;; Global keys and menubar -(global-set-key (kbd "\C-c \C-c j") 'rails-script:create-project) +(global-set-key (rails-key "\C-c j") 'rails-script:create-project) (when-bind (map (lookup-key global-map [menu-bar file])) (define-key-after diff --git a/rails-view-minor-mode.el b/rails-view-minor-mode.el index 82531be..3279168 100644 --- a/rails-view-minor-mode.el +++ b/rails-view-minor-mode.el @@ -106,10 +106,10 @@ (setq rails-secondary-switch-func 'rails-controller-layout:menu) (if (boundp 'mmm-mode-map) (progn - (define-key mmm-mode-map (kbd "\C-c p") 'rails-view-minor-mode:create-partial-from-selection) - (define-key mmm-mode-map (kbd "\C-c b") 'rails-view-minor-mode:create-helper-from-block)) + (define-key mmm-mode-map (rails-key "p") 'rails-view-minor-mode:create-partial-from-selection) + (define-key mmm-mode-map (rails-key "b") 'rails-view-minor-mode:create-helper-from-block)) (progn - (local-set-key (kbd "\C-c p") 'rails-view-minor-mode:create-partial-from-selection) - (local-set-key (kbd "\C-c b") 'rails-view-minor-mode:create-helper-from-block)))) + (local-set-key (rails-key "p") 'rails-view-minor-mode:create-partial-from-selection) + (local-set-key (rails-key "b") 'rails-view-minor-mode:create-helper-from-block)))) (provide 'rails-view-minor-mode) \ No newline at end of file diff --git a/rails.el b/rails.el index dfcee8e..b4a8c73 100644 --- a/rails.el +++ b/rails.el @@ -401,9 +401,9 @@ necessary." (local-set-key (if rails-use-another-define-key (kbd "TAB") (kbd "")) 'indent-or-complete) - (local-set-key (kbd "C-c f") '(lambda() - (interactive) - (mouse-major-mode-menu (rails-core:menu-position)))) + (local-set-key (rails-key "f") '(lambda() + (interactive) + (mouse-major-mode-menu (rails-core:menu-position)))) (local-set-key (kbd "C-:") 'ruby-toggle-string<>simbol) (local-set-key (if rails-use-another-define-key (kbd "RET") (kbd ""))