Use custom faces for everything main
authorArmaan Bhojwani <me@armaanb.net>
Mon, 31 May 2021 00:43:35 +0000 (20:43 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 31 May 2021 00:43:35 +0000 (20:43 -0400)
scdoc-mode.el

index e95af4809fc3153646092ab9ef2a60d99075efe7..ea9877d1466db7a924856c1b1d75e0420951409e 100644 (file)
 
 ;;; Code:
 
-(defvar scdoc-level-1 'org-level-1)
-(defvar scdoc-level-2 'org-level-2)
-(defvar scdoc-level-3 'org-level-3)
+(defface scdoc-level-1-face
+  '((t :inherit org-level-1))
+       "Face for scdoc level 1 headings."
+       :group 'scdoc-faces)
+(defvar scdoc-level-1-face 'scdoc-level-1-face)
+
+(defface scdoc-level-2-face
+  '((t :inherit org-level-2))
+       "Face for scdoc level 2 headings."
+       :group 'scdoc-faces)
+(defvar scdoc-level-2-face 'org-level-2-face)
 
-(defvar scdoc-underline-face 'underline)
+(defface scdoc-line-break-face
+  '((t :inherit font-lock-warning-face))
+       "Face for scdoc manual line break markers."
+       :group 'scdoc-faces)
+(defvar scdoc-line-break-face 'scdoc-line-break-face)
+
+(defface scdoc-underline-face
+  '((t :inherit underline))
+       "Face for scdoc underlined text."
+       :group 'scdoc-faces)
+(defvar scdoc-underline-face 'scdoc-underline)
 
 (defface scdoc-bold-face
-  '((t :weight bold))
-       "Plain bold face."
+  '((t :weight extra-bold))
+       "Face for scdoc bolded text."
        :group 'scdoc-faces)
 (defvar scdoc-bold-face 'scdoc-bold-face)
 
+(defface scdoc-man-face
+  '((t :inherit font-lock-builtin-face
+                        :weight extra-bold))
+       "Face for scdoc references to manpages."
+       :group 'scdoc-faces)
+(defvar scdoc-man-face 'scdoc-man-face)
+
+(defface scdoc-literal-face
+  '((t :inherit font-lock-comment-delimiter-face))
+       "Face for scdoc literal blocks."
+       :group 'scdoc-faces)
+(defvar scdoc-literal-face 'scdoc-literal-face)
+
+(defface scdoc-comment-face
+  '((t :inherit font-lock-comment-face))
+       "Face for scdoc comments."
+       :group 'scdoc-faces)
+(defvar scdoc-comment-face 'scdoc-comment-face)
+
 (defvar scdoc-faces
        '(("^# .*" . scdoc-level-1) ; Heading 1
                ("^## .*" . scdoc-level-2) ; Heading 2
-               ("^### .*" . scdoc-level-3) ; Heading 3
-               ("++$" . font-lock-warning-face) ; Line break
-               ("^```$" . font-lock-comment-delimiter-face) ; Literal text
-               ("^; .*" . font-lock-comment-face) ; Comments
-               ("_.*_" . scdoc-underline-face) ; Undsky blerlines
-               ("\*.*\*" . scdoc-bold-face) ; Bold
+               ("++$" . scdoc-line-break-face) ; Line break
+               ("\\(\\s-\\|^\\)_.*_" . scdoc-underline-face) ; Underlines
+               ("\\*.*\\*" . scdoc-bold-face) ; Bold
+               ("^```$" . scdoc-literal-face) ; Literal text
+               ("^; .*" . scdoc-comment-face) ; Comments
+               ("\\(\\s-\\|^\\)\\sw*\([0-9]\)" . scdoc-man-face) ; References to manpages
                ))
 
 (define-derived-mode scdoc-mode text-mode "scdoc"