diff options
Diffstat (limited to 'xroff.el')
-rw-r--r-- | xroff.el | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/xroff.el b/xroff.el deleted file mode 100644 index 38272fd..0000000 --- a/xroff.el +++ /dev/null @@ -1,103 +0,0 @@ -;;; xroff.el --- major mode for xroff -*- lexical-binding: t; -*- - -;; Copyright (C) 2022 John Ankarström - -;; Author: John Ankarström <john@ankarstrom.se> -;; Created: 10 Jul 2022 -;; Version: 0.1 - -;; Keywords: troff groff -;; URL: http://ankarstrom.se/~john/etc/xroff - -;; This file is not part of GNU Emacs. - -;; Permission to use, copy, modify and/or distribute this software for -;; any purpose with or without fee is hereby granted. - -;;; Commentary: - -;; Major mode for xroff, an alternative, XML-like syntax for troff. - -;;; Code: - -(defvar xroff--request-regexp - (rx "<" - (group (+ (or "\\>" (not (in "> "))))) - (group (* (or "\\>" (not ?>)))) - ">")) - -(defvar xroff--single-escape-regexp - (rx "\\" any)) - -(defvar xroff--identifier-escape-regexp - (rx "\\" - (any "FfgkmnOsYZ*$") - (? (any "+-")) - (or (not (any "([+-")) - (seq "(" any any) - (seq "[" (* (not "]")) "]")))) - -(defvar xroff--parameter-escape-regexp - (rx "\\" - (any "ABbCDHhLlMNoRSVvwXxz") - "'" (* (not "'")) "'")) - -(defconst xroff-font-lock-keywords - `(;; Comment. - ("<!--.*-->" - (0 font-lock-comment-face)) - ;; Request. - (,(concat xroff--request-regexp) - (1 font-lock-keyword-face keep) - (2 font-lock-string-face keep)) - (,(concat "\\\\" xroff--request-regexp) - (1 nil t) - (2 nil t)) - ;; Parameter escape (e.g., \l'...'). - (,xroff--parameter-escape-regexp - (0 xroff-escape-face)) - (,(concat "\\\\" xroff--parameter-escape-regexp) - (0 nil t)) - ;; Identifier escape (e.g., \n(PI). - (,xroff--identifier-escape-regexp - (0 xroff-escape-face)) - (,(concat "\\\\" xroff--identifier-escape-regexp) - (0 nil t)) - ;; Single escape (e.g., \%). - (,xroff--single-escape-regexp - (0 xroff-escape-face)) - (,(concat "\\\\" xroff--single-escape-regexp) - (0 nil t)) - ;; Escaped backslash. - (,"\\\\\\\\" - (0 xroff-escape-face t)))) - -(defface xroff-escape - '((t (:foreground "gray"))) - "`xroff-mode' face used to highlight backslash escapes." - :group 'xroff) -(defvar xroff-escape-face 'xroff-escape) - -;;;###autoload -(define-derived-mode xroff-mode text-mode "Xroff" - "Major mode for editing documents with xroff syntax." - ;; A start or end tag by itself on a line separates a paragraph. - ;; This is desirable because SGML discards a newline that appears - ;; immediately after a start tag or immediately before an end tag. - (setq-local paragraph-start "<\\([^>]\\)+>") - (setq-local paragraph-separate "$\\|\\]>") - (setq-local adaptive-fill-regexp "[ \t]*") - ;; (add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t) - ;; (setq-local indent-line-function 'sgml-indent-line) - (setq-local comment-start "<!-- ") - (setq-local comment-end " -->") - ;; (setq-local comment-indent-function 'sgml-comment-indent) - ;; (setq-local comment-line-break-function 'sgml-comment-indent-new-line) - (setq-local font-lock-defaults '((xroff-font-lock-keywords))) - ;; (setq-local font-lock-multiline t) - (setq-local comment-start-skip "<!--[ \t]*") - (setq-local comment-end-skip "[ \t]*--[ \t\n]*>") - (visual-line-mode 1)) - -(provide 'xroff) -;;; xroff.el ends here |