-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlang-ruby.el
80 lines (66 loc) · 2.64 KB
/
lang-ruby.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
;; Inferior Ruby mode
(add-to-list 'load-path (expand-file-name "~/emacs/langmode/ruby/ruby"))
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)
))
;; Emacs-rails
(add-to-list 'load-path (expand-file-name "~/emacs/langmode/ruby/emacs-rails"))
(require 'rails)
(setq rails-enable-ruby-electric nil)
(remove-hook 'ruby-mode-hook 'ruby-electric-mode)
;; RHTML-mode
(add-to-list 'load-path (expand-file-name "~/emacs/langmode/ruby/rhtml"))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . rhtml-mode))
(add-to-list 'auto-mode-alist '("\\.rjs\\'" . rhtml-mode))
(require 'rhtml-mode)
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
(autoload 'yaml-mode "yaml-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode))
(defadvice flymake-start-syntax-check-process (after
cheeso-advice-flymake-start-syntax-check-1
(cmd args dir)
activate compile)
;; set flag to allow exit without query on any
;;active flymake processes
(set-process-query-on-exit-flag ad-return-value nil))
;; scss-mode
(add-to-list 'load-path (expand-file-name "~/emacs/langmode/ruby"))
(autoload 'scss-mode "scss-mode")
(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
(setq scss-compile-at-save nil)
;; coffee-mode
(require 'coffee-mode)
(defun coffee-custom ()
"coffee-mode-hook"
(set (make-local-variable 'tab-width) 2))
(add-hook 'coffee-mode-hook
'(lambda() (coffee-custom)))
(setq ruby-deep-indent-paren nil)
;; Fix Ruby indent, see https://gist.github.com/1274520
(defadvice ruby-indent-line (after unindent-closing-paren activate)
(let ((column (current-column))
indent offset)
(save-excursion
(back-to-indentation)
(let ((state (syntax-ppss)))
(setq offset (- column (current-column)))
(when (and (eq (char-after) ?\))
(not (zerop (car state))))
(goto-char (cadr state))
(setq indent (current-indentation)))))
(when indent
(indent-line-to indent)
(when (> offset 0) (forward-char offset)))))
;; slim-mode
(require 'slim-mode)