Add gitignore-mode

This commit is contained in:
Gergely Polonkai 2015-01-28 16:55:24 +01:00
parent 7e081a860b
commit dbc098e028
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,24 @@
;;; gitignore-mode-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
;;;### (autoloads nil "gitignore-mode" "gitignore-mode.el" (21633
;;;;;; 45694 775043 851000))
;;; Generated autoloads from gitignore-mode.el
(autoload 'gitignore-mode "gitignore-mode" "\
A major mode for editing .gitconfig files.
\(fn)" t nil)
(setq auto-mode-alist (append '(("/\\.gitignore\\'" . gitignore-mode) ("/\\.git/info/exclude\\'" . gitignore-mode)) auto-mode-alist))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; End:
;;; gitignore-mode-autoloads.el ends here

View File

@ -0,0 +1 @@
(define-package "gitignore-mode" "0.1" "Major mode for editing .gitconfig files" 'nil)

View File

@ -0,0 +1,60 @@
;;; gitignore-mode.el --- Major mode for editing .gitconfig files
;;; -*- coding: utf-8; lexical-binding: t -*-
;; Copyright (c) 2012 Sebastian Wiesner <lunaryorn@gmail.com>
;;
;; Author: Sebastian Wiesner <lunaryorn@gmail.com>
;; URL: https://github.com/lunaryorn/git-modes
;; Version: 0.1
;; Keywords: convenience vc git
;; This file is not part of GNU Emacs.
;; 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 2 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, write to the Free Software Foundation, Inc., 51
;; Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;; A major mode for editing .gitignore files.
;;; Code:
(require 'conf-mode)
(defvar gitignore-mode-font-lock-keywords
'(("^\\s<.*$" . 'font-lock-comment-face)
("^\\(!?\\)" (1 'font-lock-negation-char-face)) ; Negated patterns
("/" . 'font-lock-constant-face) ; Directory separators
("\\(?:\\*\\|\\?\\)" . 'font-lock-keyword-face) ; Glob patterns
("\\[.+?\\]" . 'font-lock-keyword-face) ; Ranged glob patterns
))
;;;###autoload
(define-derived-mode gitignore-mode conf-unix-mode "Gitignore"
"A major mode for editing .gitconfig files."
(conf-mode-initialize "#")
;; Disable syntactic font locking, because comments are only valid at
;; beginning of line.
(setq font-lock-defaults '(gitignore-mode-font-lock-keywords t t))
(set (make-local-variable 'conf-assignment-sign) nil))
;;;###autoload
(setq auto-mode-alist
(append '(("/\\.gitignore\\'" . gitignore-mode)
("/\\.git/info/exclude\\'" . gitignore-mode))
auto-mode-alist))
(provide 'gitignore-mode)
;;; gitignore-mode.el ends here