Fix robe keybinds, extends projectile-rails, & minor refactors

Closes #2719
This commit is contained in:
Henrik Lissner 2020-03-13 12:08:25 -04:00
parent 2c2df9df8c
commit 4b20c7206e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 11 additions and 12 deletions

View file

@ -39,13 +39,13 @@ This module add Ruby and optional Ruby on Rails support to Emacs.
+ [[https://github.com/dgutov/robe][robe]] + [[https://github.com/dgutov/robe][robe]]
+ [[https://github.com/endofunky/bundler.el/tree/43efb6be4ed118b06d787ce7fbcffd68a31732a7][bundler]] + [[https://github.com/endofunky/bundler.el/tree/43efb6be4ed118b06d787ce7fbcffd68a31732a7][bundler]]
+ [[https://github.com/asok/rake][rake]] + [[https://github.com/asok/rake][rake]]
+ [[https://github.com/senny/rbenv.el][rbenv]] + [[https://github.com/senny/rbenv.el][rbenv]] (=+rbenv=)
+ [[https://github.com/senny/rvm.el][rvm]] + [[https://github.com/senny/rvm.el][rvm]] (=+rvm=)
+ [[https://github.com/pezra/rspec-mode][rspec-mode]] + [[https://github.com/pezra/rspec-mode][rspec-mode]]
+ [[https://github.com/arthurnn/minitest-emacs][minitest]] + [[https://github.com/arthurnn/minitest-emacs][minitest]]
+ [[https://github.com/asok/projectile-rails][projectile-rails]] + [[https://github.com/asok/projectile-rails][projectile-rails]] (=+rails=)
+ [[https://github.com/eschulte/jump.el/tree/e4f1372cf22e811faca52fc86bdd5d817498a4d8][inflections]] + [[https://github.com/eschulte/jump.el/tree/e4f1372cf22e811faca52fc86bdd5d817498a4d8][inflections]]
+ [[https://github.com/plexus/chruby.el][chruby]] + [[https://github.com/plexus/chruby.el][chruby]] (=+chruby=)
* Prerequisites * Prerequisites
Many of this modules plugins require ruby with some version manager (RVM or Many of this modules plugins require ruby with some version manager (RVM or

View file

@ -11,7 +11,7 @@
;; Other extensions are already registered in `auto-mode-alist' by `ruby-mode' ;; Other extensions are already registered in `auto-mode-alist' by `ruby-mode'
:mode "\\.\\(?:a?rb\\|aslsx\\)\\'" :mode "\\.\\(?:a?rb\\|aslsx\\)\\'"
:mode "/\\(?:Brew\\|Fast\\)file\\'" :mode "/\\(?:Brew\\|Fast\\)file\\'"
:interpreter "j?ruby\\([0-9.]+\\)" :interpreter "j?ruby\\(?:[0-9.]+\\)"
:config :config
(setq ruby-insert-encoding-magic-comment nil) (setq ruby-insert-encoding-magic-comment nil)
@ -21,9 +21,6 @@
(when (featurep! +lsp) (when (featurep! +lsp)
(add-hook 'ruby-mode-local-vars-hook #'lsp!)) (add-hook 'ruby-mode-local-vars-hook #'lsp!))
(after! company-dabbrev-code
(pushnew 'company-dabbrev-code-modes 'ruby-mode))
(after! inf-ruby (after! inf-ruby
;; switch to inf-ruby from compile if we detect a breakpoint has been hit ;; switch to inf-ruby from compile if we detect a breakpoint has been hit
(add-hook 'compilation-filter-hook #'inf-ruby-auto-enter)) (add-hook 'compilation-filter-hook #'inf-ruby-auto-enter))
@ -43,15 +40,17 @@
(add-hook! 'ruby-mode-hook (add-hook! 'ruby-mode-hook
(defun +ruby-init-robe-mode-maybe-h () (defun +ruby-init-robe-mode-maybe-h ()
"Start `robe-mode' if `lsp-mode' isn't active." "Start `robe-mode' if `lsp-mode' isn't active."
(unless (or (bound-and-true-p lsp-mode) (or (bound-and-true-p lsp-mode)
(bound-and-true-p lsp--buffer-deferred)) (bound-and-true-p lsp--buffer-deferred)
(robe-mode +1)))) (robe-mode +1))))
:config :config
(set-repl-handler! 'ruby-mode #'robe-start) (set-repl-handler! 'ruby-mode #'robe-start)
(set-company-backend! 'ruby-mode 'company-robe 'company-dabbrev-code) (set-company-backend! 'ruby-mode 'company-robe 'company-dabbrev-code)
(set-lookup-handlers! 'ruby-mode (set-lookup-handlers! 'ruby-mode
:definition #'robe-jump :definition #'robe-jump
:documentation #'robe-doc) :documentation #'robe-doc)
(when (featurep! :editor evil)
(add-hook 'robe-mode-hook #'evil-normalize-keymaps))
(map! :localleader (map! :localleader
:map robe-mode-map :map robe-mode-map
"'" #'robe-start "'" #'robe-start
@ -173,7 +172,7 @@
(use-package! projectile-rails (use-package! projectile-rails
:when (featurep! +rails) :when (featurep! +rails)
:hook (ruby-mode . projectile-rails-mode) :hook ((ruby-mode inf-ruby-mode projectile-rails-server-mode) . projectile-rails-mode)
:init :init
(setq inf-ruby-console-environment "development") (setq inf-ruby-console-environment "development")
(when (featurep! :lang web) (when (featurep! :lang web)