ini-mode.el: init
This commit is contained in:
parent
b3a94e4013
commit
d1533e0048
1 changed files with 51 additions and 0 deletions
51
ini-mode.el
Normal file
51
ini-mode.el
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
;;; ini-mode.el --- major mode for INI -*- lexical-binding:t -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2024 Jeremy Baxter
|
||||||
|
|
||||||
|
;; Author: Jeremy Baxter <jeremy@baxters.nz>
|
||||||
|
;; Maintainer: Jeremy Baxter <jeremy@baxters.nz>
|
||||||
|
;; Created: July 2024
|
||||||
|
;; Keywords: ini
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;; ini-mode.el 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.
|
||||||
|
;;
|
||||||
|
;; ini-mode.el 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 ini-mode.el. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; ini-mode.el provides `ini-mode', an implementation of a simple
|
||||||
|
;; font-locking major mode for INI.
|
||||||
|
|
||||||
|
;; TODO: fix section keys refusing to highlight initially
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'font-lock)
|
||||||
|
|
||||||
|
(defvar ini-mode-font-lock-keywords
|
||||||
|
'(("\\([#;].*$\\)" . font-lock-comment-face)
|
||||||
|
("[ \t]*\\[\\(.+\\)\\]" . 'font-lock-type-face)
|
||||||
|
("\\(^[^=]+\\)" . 'font-lock-keyword-face)
|
||||||
|
("=\\(.+$\\)" 1 'font-lock-string-face))
|
||||||
|
"Keywords for font locking in `ini-mode'.")
|
||||||
|
|
||||||
|
(define-derived-mode ini-mode nil "INI"
|
||||||
|
"Major mode for editing INI."
|
||||||
|
|
||||||
|
(font-lock-mode)
|
||||||
|
(font-lock-add-keywords nil ini-mode-font-lock-keywords))
|
||||||
|
|
||||||
|
(provide 'ini-mode)
|
||||||
|
|
||||||
|
;;; ini-mode.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue