forked from rejeep/emacs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rejeep-flymake.el
37 lines (31 loc) · 1.45 KB
/
rejeep-flymake.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
;;; rejeep-flymake.el --- Flymake stuff
(require 'flymake)
;; Ruby
(eval-after-load 'ruby-mode
'(progn
;; 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 ()
(when (and buffer-file-name
(file-writable-p
(file-name-directory buffer-file-name))
(file-writable-p buffer-file-name)
(if (fboundp 'tramp-list-remote-buffers)
(not (subsetp
(list (current-buffer))
(tramp-list-remote-buffers)))
t))
(local-set-key (kbd "C-c d") 'flymake-display-err-menu-for-current-line)
(flymake-mode t))))))
(provide 'rejeep-flymake)