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.

96 lines
2.9 KiB

  1. ;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
  2. ;;
  3. ;; Copyright (c) 2011 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
  6. ;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
  7. ;; Version: 1.0.0
  8. ;; Keywords: convenience
  9. ;; This file is not part of GNU Emacs.
  10. ;;; Commentary:
  11. ;; Some basic configuration for Ruby and Rails development.
  12. ;;; License:
  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 3
  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 GNU Emacs; see the file COPYING. If not, write to the
  25. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  26. ;; Boston, MA 02110-1301, USA.
  27. ;;; Code:
  28. (defgroup ruby nil
  29. "Emacs Prelude Ruby support"
  30. :group 'prelude)
  31. (defcustom prelude-enable-ruby-hook t
  32. "Enable Prelude's Ruby hook"
  33. :type 'boolean
  34. :group 'ruby)
  35. ;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles.
  36. (add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
  37. (add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
  38. (add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode))
  39. (add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode))
  40. (add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
  41. (add-to-list 'auto-mode-alist '("Guardfile$" . ruby-mode))
  42. ;; We never want to edit Rubinius bytecode
  43. (add-to-list 'completion-ignored-extensions ".rbc")
  44. (autoload 'run-ruby "inf-ruby"
  45. "Run an inferior Ruby process")
  46. (autoload 'inf-ruby-keys "inf-ruby"
  47. "Set local key defs for inf-ruby in ruby-mode")
  48. ;; yari provides a nice Emacs interface to ri
  49. (require 'yari)
  50. ;; yaml-mode
  51. (require 'yaml-mode)
  52. (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
  53. ; TODO fix ruby-end and package ruby-block for marmalade
  54. (require 'ruby-block)
  55. (require 'ruby-end)
  56. (defun prelude-ruby-mode-hook ()
  57. (prelude-coding-hook)
  58. (inf-ruby-keys)
  59. ;; turn off the annoying input echo in irb
  60. (setq comint-process-echoes t)
  61. (ruby-block-mode t)
  62. (local-set-key (kbd "C-h r") 'yari))
  63. (when prelude-enable-ruby-hook
  64. (add-hook 'ruby-mode-hook 'prelude-ruby-mode-hook))
  65. (require 'haml-mode)
  66. (require 'scss-mode)
  67. ;; most of the time the scss auto compilation is useless
  68. (setq scss-compile-at-save nil)
  69. ;; cucumber support
  70. (require 'feature-mode)
  71. (add-to-list 'auto-mode-alist '("\.feature$" . feature-mode))
  72. ;; load bundle snippets
  73. (yas/load-directory (concat prelude-vendor-dir "feature-mode/snippets"))
  74. (provide 'prelude-ruby)
  75. ;;; prelude-ruby.el ends here