├── .gitignore ├── README.md └── flymake-ruby.el /.gitignore: -------------------------------------------------------------------------------- 1 | /flymake-ruby.elc 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | flymake-ruby.el 2 | =============== 3 | 4 | An Emacs flymake handler for syntax-checking Ruby source code. 5 | 6 | Installation 7 | ============= 8 | 9 | If you choose not to use one of the convenient packages in 10 | [Melpa][melpa] and [Marmalade][marmalade], you'll need to add the 11 | directory containing `flymake-ruby.el` to your `load-path`, and then 12 | `(require 'flymake-ruby)`. You'll also need to install 13 | [flymake-easy](https://github.com/purcell/flymake-easy). 14 | 15 | Usage 16 | ===== 17 | 18 | Add the following to your emacs init file: 19 | 20 | (require 'flymake-ruby) 21 | (add-hook 'ruby-mode-hook 'flymake-ruby-load) 22 | 23 | 24 | [marmalade]: http://marmalade-repo.org 25 | [melpa]: http://melpa.org 26 | 27 |
28 | 29 | [![](http://api.coderwall.com/purcell/endorsecount.png)](http://coderwall.com/purcell) 30 | 31 | [![](http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.png)](http://uk.linkedin.com/in/stevepurcell) 32 | 33 | [Steve Purcell's blog](http://www.sanityinc.com/) // [@sanityinc on Twitter](https://twitter.com/sanityinc) 34 | -------------------------------------------------------------------------------- /flymake-ruby.el: -------------------------------------------------------------------------------- 1 | ;;; flymake-ruby.el --- A flymake handler for ruby-mode files 2 | 3 | ;; Copyright (c) 2011-2017 Steve Purcell 4 | 5 | ;; Author: Steve Purcell 6 | ;; URL: https://github.com/purcell/flymake-ruby 7 | ;; Package-Version: 0 8 | ;; Package-Requires: ((flymake-easy "0.1")) 9 | 10 | ;; This program is free software; you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation, either version 3 of the License, or 13 | ;; (at your option) any later version. 14 | 15 | ;; This program is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with this program. If not, see . 22 | 23 | ;;; Commentary: 24 | 25 | ;; Usage: 26 | ;; (require 'flymake-ruby) 27 | ;; (add-hook 'ruby-mode-hook 'flymake-ruby-load) 28 | ;; 29 | ;; Uses flymake-easy, from https://github.com/purcell/flymake-easy 30 | 31 | ;;; Code: 32 | 33 | (require 'flymake-easy) 34 | 35 | (defconst flymake-ruby-err-line-patterns 36 | '(("^\\(.*\.rb\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3))) 37 | 38 | (defvar flymake-ruby-executable "ruby" 39 | "The ruby executable to use for syntax checking.") 40 | 41 | ;; Invoke ruby with '-c' to get syntax checking 42 | (defun flymake-ruby-command (filename) 43 | "Construct a command that flymake can use to check ruby source in FILENAME." 44 | (list flymake-ruby-executable "-w" "-c" filename)) 45 | 46 | ;;;###autoload 47 | (defun flymake-ruby-load () 48 | "Configure flymake mode to check the current buffer's ruby syntax." 49 | (interactive) 50 | (flymake-easy-load 'flymake-ruby-command 51 | flymake-ruby-err-line-patterns 52 | 'tempdir 53 | "rb")) 54 | 55 | (provide 'flymake-ruby) 56 | ;;; flymake-ruby.el ends here 57 | --------------------------------------------------------------------------------