diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-15 17:25:47 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-05-15 19:40:46 -0400 |
| commit | d0cd8444fa69269803d9cda8af6277d2cdbecaee (patch) | |
| tree | 6e7d34e1e0774dcc684dd93459d1b4df94fe1083 /sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el | |
| parent | ssp test-abstraction-ssp.sh script minor (diff) | |
editors syntax highlighting ...
- emacs syntax: add tree-sitter major mode for SiSU spine markup
New file sisu-spine-ts-mode.el is a sibling of the existing regex
mode, backed by Emacs 29+'s built-in treesit.el and the
tree-sitter-sisu grammar. It replaces the long font-lock keyword list
with treesit-font-lock-rules grouped into eight features (comment,
header, heading, block, inline, note, link, index, misc) so users
can dial verbosity via treesit-font-lock-level. It also wires up:
- treesit-simple-imenu-settings for a heading outline,
- treesit-thing-settings for sentence / paragraph motions,
- treesit-defun-type-regexp so C-M-a / C-M-e jump heading-to-heading,
- a sisu-spine-ts-install-grammar command that registers
treesit-language-source-alist and runs
treesit-install-language-grammar so users can install the parser
from inside Emacs without leaving the editor.
- the original sisu-spine-mode.el is unchanged and supported for
Emacs < 29 and for users who prefer regex highlighting.
- nvim drop-in: point parser fetch at tools/tree-sitter-sisu
sundry/editor-syntax-etc/nvim/
The nvim-treesitter install_info now fetches the parser from
https://git.sisudoc.org/projects/tree-sitter-sisu which can be cloned
via git://git.sisudoc.org/tools/tree-sitter-sisu The fetched paths:
files = { "src/parser.c", "src/scanner.c" }
submission of the sisu parser to nvim-treesitter's parsers.lua should
be a near-trivial one-liner.
- the original vim regex highlighter remains as before
- sundry/editor-syntax-etc/vim/syntax/sisu-spine.vim
- sundry/editor-syntax-etc/vim/templates/{sst,ssm,ssi}.tpl
new skeleton templates for the three SiSU markup file types
sets up the YAML header (title, creator, date, rights, classify,
identfier)
- .gitignore - whitelist the new files
(assisted by Claude-Code)
Diffstat (limited to 'sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el')
| -rw-r--r-- | sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el b/sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el index 4cc6332..098a28c 100644 --- a/sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el +++ b/sundry/editor-syntax-etc/emacs/sisu-spine-mode-autoloads.el @@ -1,10 +1,28 @@ (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) +;; Regex / font-lock major mode. Fallback for Emacs < 29 and for users +;; who have not installed the tree-sitter-sisu parser. (autoload 'sisu-spine-mode "sisu-spine-mode" "\ Major mode for editing SiSU (spine) markup files. SiSU (https://www.sisudoc.org/) document structuring, publishing and search. \(fn)" t nil) -(add-to-list 'auto-mode-alist '("\\.sst\\'" . sisu-spine-mode)) -(add-to-list 'auto-mode-alist '("\\.ssm\\'" . sisu-spine-mode)) -(add-to-list 'auto-mode-alist '("\\.ssi\\'" . sisu-spine-mode)) + +;; Tree-sitter major mode (Emacs 29+). When the parser is installed it +;; is selected by `auto-mode-alist'; otherwise the regex mode is used. +(autoload 'sisu-spine-ts-mode "sisu-spine-ts-mode" "\ +Tree-sitter major mode for editing SiSU (spine) markup files. + +\(fn)" t nil) +(autoload 'sisu-spine-ts-install-grammar "sisu-spine-ts-mode" "\ +Install the tree-sitter-sisu grammar for `sisu-spine-ts-mode'. +\(fn)" t nil) +(defun sisu-spine-auto-mode () + "Choose `sisu-spine-ts-mode' if the parser is installed, else fall back." + (if (and (fboundp 'treesit-ready-p) (treesit-ready-p 'sisu t)) + (sisu-spine-ts-mode) + (sisu-spine-mode))) + +(add-to-list 'auto-mode-alist '("\\.sst\\'" . sisu-spine-auto-mode)) +(add-to-list 'auto-mode-alist '("\\.ssm\\'" . sisu-spine-auto-mode)) +(add-to-list 'auto-mode-alist '("\\.ssi\\'" . sisu-spine-auto-mode)) |
