Emacs and Ruby on Rails

written by admin on juin 13th, 2006 @ 04:36

;;;
;; css mode
(setq cssm-indent-function 'cssm-c-style-indenter)

;;;
;; mmm mode for editing rhtml files
(require 'mmm-mode)
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(setq mmm-submode-decoration-level 2)
(set-face-background 'mmm-output-submode-face  "LemonChiffon2")
(set-face-background 'mmm-code-submode-face    "LavenderBlush2")
(set-face-background 'mmm-comment-submode-face "tan1")
(set-face-foreground 'mmm-output-submode-face "Black")
(set-face-foreground 'mmm-code-submode-face "Black")
(set-face-foreground 'mmm-comment-submode-face "Red")
(mmm-add-classes
 '((erb-code
    :submode ruby-mode
    :match-face (("<%#" . mmm-comment-submode-face)
                 ("<%=" . mmm-output-submode-face)
                 ("<%"  . mmm-code-submode-face))
    :front "<%[#=]?" 
    :back "%>" 
    :insert ((?% erb-code       nil @ "<%"  @ " " _ " " @ "%>" @)
             (?# erb-comment    nil @ "<%#" @ " " _ " " @ "%>" @)
             (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))
    )))
(add-hook 'html-mode-hook
          (lambda ()
            (setq mmm-classes '(erb-code))
            (mmm-mode-on)))
(add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode))

;;;
;; yaml mode
(autoload 'yaml-mode "yaml-mode" "YAML" t)
(setq auto-mode-alist
      (append '(("\\.yml$" . yaml-mode)) auto-mode-alist))

;;;
;; rails mode
(defun try-complete-abbrev (old)
  (if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list
      '(try-complete-abbrev
    try-complete-file-name
    try-expand-dabbrev))

(require 'rails)
(setq rails-use-mongrel t)

Comments

  • Ruby on Rails DEV on 07 déc 23:14

    Pretty Cool stuff... I like the blog, is it in Ruby? lol? just kidding. Keep up the good stuff, is hard in french though. Jenn

Post a comment

Options:

Size

Colors