Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.8 KiB

  1. ;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
  2. ;;
  3. ;; Copyright (c) 2011-2012 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar@batsov.com>
  6. ;; URL: http://batsov.com/emacs-prelude
  7. ;; Version: 1.0.0
  8. ;; Keywords: convenience
  9. ;; Package-Requires: ((prelude-programming "1.0.0") (ruby-tools "0.0.1") (inf-ruby "2.2.3") (yari "0.5") (ruby-end "0.0.1") (ruby-block "0.0.11"))
  10. ;; This file is not part of GNU Emacs.
  11. ;;; Commentary:
  12. ;; Some basic configuration for Ruby and Rails development.
  13. ;;; License:
  14. ;; This program is free software; you can redistribute it and/or
  15. ;; modify it under the terms of the GNU General Public License
  16. ;; as published by the Free Software Foundation; either version 3
  17. ;; of the License, or (at your option) any later version.
  18. ;;
  19. ;; This program is distributed in the hope that it will be useful,
  20. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. ;; GNU General Public License for more details.
  23. ;;
  24. ;; You should have received a copy of the GNU General Public License
  25. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  26. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  27. ;; Boston, MA 02110-1301, USA.
  28. ;;; Code:
  29. (require 'prelude-programming)
  30. (prelude-ensure-module-deps '(ruby-tools inf-ruby yari ruby-end ruby-block))
  31. (require 'ruby-block)
  32. ;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles.
  33. (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
  34. (add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode))
  35. (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
  36. (add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
  37. (add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode))
  38. (add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-mode))
  39. (add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode))
  40. (add-to-list 'auto-mode-alist '("\\.thor\\'" . ruby-mode))
  41. (add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode))
  42. (add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode))
  43. ;; We never want to edit Rubinius bytecode
  44. (add-to-list 'completion-ignored-extensions ".rbc")
  45. (define-key 'help-command (kbd "R") 'yari)
  46. (eval-after-load 'ruby-mode
  47. '(progn
  48. (defun prelude-ruby-mode-defaults ()
  49. (inf-ruby-setup-keybindings)
  50. ;; turn off the annoying input echo in irb
  51. (setq comint-process-echoes t)
  52. (ruby-block-mode t)
  53. (ruby-end-mode +1)
  54. (ruby-tools-mode +1)
  55. ;; CamelCase aware editing operations
  56. (subword-mode +1))
  57. (setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
  58. (add-hook 'ruby-mode-hook (lambda ()
  59. (run-hooks 'prelude-ruby-mode-hook)))))
  60. (provide 'prelude-ruby)
  61. ;;; prelude-ruby.el ends here