commit cef305eaf955c780acb62bfe6d7bb11f1d0b130d Author: Tom Willemse Date: Sat Apr 12 14:23:46 2014 +0200 Initial commit diff --git a/README.org b/README.org new file mode 100644 index 0000000..00ebf9c --- /dev/null +++ b/README.org @@ -0,0 +1,69 @@ +#+STARTUP: showall +#+OPTIONS: toc:nil + +* flycheck-commit-check v0.1.0 + + This is the flycheck-commit-check project. It is a [[http://flycheck.readthedocs.org/en/latest/][Flycheck]] checker + that uses [[http://code.ryuslash.org/commit-check/about/][commit-check]] to provide syntax checking for git commit + messages. + + The code can be found in ~flycheck-commit-check.el~ in the project + source tree. + +** Installation + + As with all Emacs packages installation can be done in a number of + ways. The only dependencies it has are flycheck and + [[https://github.com/magit/git-modes][git-commit-mode]]. + + You must, of course, also have commit-check installed on your + system and available in your =PATH=. + +*** Manual installation + + If you don't (yet) use the Emacs package manager you can install + it manually by downloading the code somewhere, adding the path to + your =load-path= and either =require=-ing or =eval-after-load=-ing the + package, like so: + + #+BEGIN_SRC emacs-lisp + (add-to-list 'load-path "/path/to/flycheck-commit-message") + + ;;; Option 1 + (require 'flycheck-commit-check) + + ;;; Option 2 + (eval-after-load 'flycheck + `(require 'flycheck-commit-check)) + + ;;; Option 3 --- Only for Emacs 24 and up + (with-eval-after-load 'flycheck + (require 'flycheck-commit-check)) + #+END_SRC + +*** Installation with package manager + + To install this package with the Emacs package manager, download + the ~flycheck-commit-message.el~ file and call =package-install-file= + and then pick the downloaded file. Afterwards you should add + something like the following to your Emacs init file: + + #+BEGIN_SRC emacs-lisp + (eval-after-load 'flycheck + (require 'flycheck-commit-check)) + #+END_SRC + +** Usage + + After installing the package you will have to setup flycheck for + git commits, which is easy: + + #+BEGIN_SRC emacs-lisp + (add-hook 'git-commit-mode-hook #'flycheck-mode) + #+END_SRC + +** License + + This project is licensed under the GNU GPLv3, its terms and + conditions can be found in the file =COPYING= in the project source + tree. diff --git a/flycheck-commit-check.el b/flycheck-commit-check.el new file mode 100644 index 0000000..1dcd979 --- /dev/null +++ b/flycheck-commit-check.el @@ -0,0 +1,43 @@ +;;; flycheck-commit-check.el --- Flycheck checker for commit-check -*- lexical-binding: t; -*- + +;; Copyright (C) 2014 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: convenience +;; Version: 0.1.0 + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; A flycheck checker that uses commit-check to provide checking for +;; git commit messages. Read the README for more information, or go to +;; http://code.ryuslash.org/flycheck-commit-check/about/ + +;;; Code: + +(require 'flycheck) + +(flycheck-define-checker git-commit-check + "A git commit checker" + :command ("commit-check" "-0" source) + :error-patterns ((error line-start "Error on line " + (one-or-more digit) " (actual line " + line "): " (message) line-end)) + :modes git-commit-mode) + +(add-to-list 'flycheck-checkers 'git-commit-check) + +(provide 'flycheck-commit-check) +;;; flycheck-commit-check.el ends here