2023-10-11 scdoc mode

I'm writing man pages using scdoc, these days.

scdoc

This is what I use for minimal highlighting. Plenty of features that one might add, but I think these are good enough for me.

(define-derived-mode scdoc-mode text-mode "SC"
  "A mode to write scdoc files in."
  :group 'text
  (font-lock-add-keywords nil
    '(("^# .*" . 'info-title-2)
      ("^## .*" . 'info-title-3)
      ("^\\( \\|   +\\)\\b" . 'makefile-space); two spaces is ok in list item continuation
      ("\\*[^*]+\\*" . 'bold)
      ("\\B_[^_ ]*_([0-9]+)" . 'info-xref); don't do it inside words
      ("\\B_[^_]*_" . 'underline)))
  (setq fill-column 80))

;; The text files in man folders are scdoc sources
(add-to-list 'auto-mode-alist '("man/.*\\.[0-9]+.txt\\'" . scdoc-mode))

​#Emacs

2023-10-12: I spent 20min trying to figure out how to add xref support to follow links to man pages in the same directory (that is, their source files). Sadly, it is to complicated for me.