Skip to content

Commit

Permalink
Make flymake use system tmp directory, and some align updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpr5 committed Nov 5, 2010
1 parent 0edbd2a commit cf3a4e0
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions .emacs.d/mode-ruby.el
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
;; Flymake for ruby
;; Enable Flymake in Ruby
(require 'flymake)

(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))))

(setq flymake-allowed-file-name-masks (append
'((".+\\.rb$" flymake-ruby-init)
(".+\\.ru$" flymake-ruby-init)
Expand All @@ -20,10 +12,24 @@
'(("^\\(.*\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3))
flymake-err-line-patterns))

; Ensure flymake turds are written to system temp directory
(defun flymake-create-temp-in-system-tempdir (filename prefix)
(make-temp-file (or prefix "flymake-ruby")))

;; Rinari package
(defun flymake-ruby-init ()
(list "ruby" (list "-c" (flymake-init-create-temp-buffer-copy
'flymake-create-temp-in-system-tempdir))))

;(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))))

(setq load-path (add-to-list 'load-path "~/.emacs.d/lib/rinari-rhtml"))
;; Rinari package
(add-to-list 'load-path "~/.emacs.d/lib/rinari-rhtml")
(require 'rhtml-mode)

; add-to-list symbol element
Expand All @@ -44,24 +50,14 @@
(lambda ()
(setq ruby-deep-indent-paren nil)
(setq ruby-indent-level 4)

; Only launch flymake when we could actually write to the temporary file.
(if (and (not (null buffer-file-name))
(file-writable-p (concat (file-name-sans-extension buffer-file-name) "_flymake"
(and (file-name-extension buffer-file-name) (concat "." (file-name-extension buffer-file-name))))))
(flymake-mode))
(flymake-mode t)
))

;; Include rdebug-mode if we've got it
(setq load-path (add-to-list 'load-path "~/.emacs.d/lib/rdebug-mode"))
(require 'rdebug nil 'noerror)

;; Load up cucumber/feature-mode.
(require 'cucumber-mode nil 'noerror)

;; Gank some auto-align stuff from the compuweb.
;;
;; TODO: find a way to "group" '=' and '=>' align targets differently.
(require 'align)

(defconst align-ruby-modes '(ruby-mode)
"align-ruby-modes is a variable defined in `align.el'.")

Expand All @@ -86,4 +82,13 @@
(add-to-list 'align-dq-string-modes 'ruby-mode)
(add-to-list 'align-sq-string-modes 'ruby-mode)
(add-to-list 'align-open-comment-modes 'ruby-mode)

(setq align-indent-before-aligning t)
(setq align-region-separate 'group)

;; Include rdebug-mode if we've got it
(add-to-list 'load-path "~/.emacs.d/lib/rdebug-mode")
(require 'rdebug nil 'noerror)

;; Load up cucumber/feature-mode.
(require 'cucumber-mode nil 'noerror)

0 comments on commit cf3a4e0

Please sign in to comment.