;;; vcard-mode.el --- Major mode for viewing vCard files -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Free Software Foundation, Inc.
;; Version: 0
;; Package-Requires: ((emacs "25.1"))
;; Author: Eric Abrahamsen
;; Maintainer: Eric Abrahamsen
;; 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:
;; This file contains `vcard-mode', for viewing vcard files.
;;; Code:
(defface vcard-property-face
'((t :inherit font-lock-function-name-face))
"Face for highlighting property names."
:group 'vcard)
(defface vcard-parameter-key-face
'((t :inherit font-lock-comment-face))
"Face for highlighting parameter keys."
:group 'vcard)
(defface vcard-parameter-value-face
'((t :inherit font-lock-type-face))
"Face for highlighting parameter values."
:group 'vcard)
(defvar vcard-font-lock-keywords
'("BEGIN:VCARD" "END:VCARD"
("^[^;:]+" . 'vcard-property-face)
(";\\([^=]+\\)=" (1 'vcard-parameter-key-face))
("=\\([^;:]+\\)[;:]" (1 'vcard-parameter-value-face))))
;;;###autoload
(define-derived-mode vcard-mode text-mode "vCard"
"Major mode for viewing vCard files."
(turn-off-auto-fill)
(set (make-local-variable 'paragraph-start) "BEGIN:VCARD")
(setq font-lock-defaults '(vcard-font-lock-keywords)))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.[Vv][Cc][Ff]\\'" . vcard-mode))
(provide 'vcard-mode)
;;; vcard-mode.el ends here