-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruby-conf.el
More file actions
61 lines (47 loc) · 1.95 KB
/
ruby-conf.el
File metadata and controls
61 lines (47 loc) · 1.95 KB
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
(add-to-list 'ac-modes 'enh-ruby-mode)
(autoload 'enh-ruby-mode "enh-ruby-mode"
"Major mode for ruby files" t)
(add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . enh-ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
;;rvm
;; (eval-when-compile (require 'cl))
;; (defvar eshell-path-env)
;; (defvar persp-mode)
;; (defvar perspectives-hash)
;; (declare-function persp-switch "perspective" (name))
(require 'rvm)
(autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t)
;;(add-hook 'ruby-mode-hook 'inf-ruby-minor-mode)
(add-hook 'enh-ruby-mode-hook 'inf-ruby-minor-mode)
(eval-after-load 'inf-ruby
'(define-key inf-ruby-minor-mode-map
(kbd "C-c C-s") 'inf-ruby-console-auto))
(require 'rinari)
(global-rinari-mode)
(require 'rspec-mode)
(require 'smartparens-ruby)
;;
(add-hook 'enh-ruby-mode-hook 'highlight-indentation-mode)
(add-hook 'enh-ruby-mode-hook
'highlight-indentation-current-column-mode)
(add-hook 'enh-ruby-mode-hook
(lambda () (flyspell-prog-mode)))
;; Invoke ruby with '-c' to get syntax checking
(defun flymake-ruby-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "ruby" (list "-c" local-file))))
(push '(".+\\.rb$" flymake-ruby-init) flymake-allowed-file-name-masks)
(push '("Rakefile$" flymake-ruby-init) flymake-allowed-file-name-masks)
(push '("^\\(.*\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3) flymake-err-line-patterns)
(add-hook 'ruby-mode-hook
'(lambda ()
;; Don't want flymake mode for ruby regions in rhtml files and also on read only files
(if (and (not (null buffer-file-name)) (file-writable-p buffer-file-name))
(flymake-mode))
))