{"id":20857639,"url":"https://github.com/sdm-lang/emacs-sdml-mode","last_synced_at":"2025-05-12T08:30:56.664Z","repository":{"id":166213809,"uuid":"641117768","full_name":"sdm-lang/emacs-sdml-mode","owner":"sdm-lang","description":"Emacs major mode for the Simple Domain Modeling Language (SDML)","archived":false,"fork":false,"pushed_at":"2024-11-04T17:06:08.000Z","size":729,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-04T18:19:53.641Z","etag":null,"topics":["emacs","sdml","tree-sitter"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdm-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-15T20:19:20.000Z","updated_at":"2024-11-04T17:06:11.000Z","dependencies_parsed_at":"2024-03-06T01:29:53.469Z","dependency_job_id":"07b173ec-a758-4511-a85e-1e00b080eb79","html_url":"https://github.com/sdm-lang/emacs-sdml-mode","commit_stats":null,"previous_names":["sdm-lang/emacs-sdml-mode"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdm-lang%2Femacs-sdml-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdm-lang%2Femacs-sdml-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdm-lang%2Femacs-sdml-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdm-lang%2Femacs-sdml-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdm-lang","download_url":"https://codeload.github.com/sdm-lang/emacs-sdml-mode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225130736,"owners_count":17425506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","sdml","tree-sitter"],"created_at":"2024-11-18T04:42:08.410Z","updated_at":"2025-05-12T08:30:56.644Z","avatar_url":"https://github.com/sdm-lang.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDML Mode for Emacs\n\n![SDML Logo Text](https://raw.githubusercontent.com/sdm-lang/.github/main/profile/horizontal-text.svg)\n\nThis package provides an Emacs tree-sitter based major mode for SDML - the\n[Simple Domain Modeling Language](https://github.com/sdm-lang/tree-sitter-sdml).\n\n[![MELPA](https://melpa.org/packages/sdml-mode-badge.svg)](https://melpa.org/#/sdml-mode)\n\n## Installing\n\nInstall is easiest from MELPA, here's how with `use-package`.\n\n```elisp\n(use-package sdml-mode)\n```\n\nOr, interactively; `M-x package-install RET sdml-mode RET`\n\n### Install manually\n\nFirst clone the Git repository to a local path.\n\n```bash\ngit clone https://github.com/sdm-lang/emacs-sdml-mode.git\n```\n\nThe following uses `use-package` but any equivalent package manager should work.\n\n```elisp\n(use-package sdml-mode\n  :load-path \"/path/to/repo\")\n```\n\n### Tree-Sitter Parser\n\nAdditionally you will need to manually install the parser at this time. Start by\ncloning the repository.\n\n```bash\ngit clone https://github.com/sdm-lang/tree-sitter-sdml.git\n```\n\nBuild just the parser dynamic library, but importantly you need to select a\nspecific ABI version.\n\n```bash\nTS_GENERATE_ABI=13 make build_parser\n```\n\nFinally copy the dynamic library to a location in the path specified by the\nEmacs variable `tree-sitter-load-path`.\n\n```bash\ncp build/libtree-sitter-sdml.dylib ~/.tree-sitter/bin/sdml.dylib\n```\n\n## Usage\n\nOnce installed the major mode should be used for any file ending in `.sdm` or\n`.sdml` with highlighting and indentation support.\n\n### Highlighting\n\nSyntax highlighting is provided by the `tree-sitter-hl-mode` minor mode based on\nthe configuration in the constant `sdml-mode-tree-sitter-hl-patterns`.\n\nThe `sdml-mode` also adds to the `prettify-symbols-alist` list, the set of symbols\nis in the custom variable `sdml-prettify-symbols-alist`.\n\n![Syntax Highlighting](./images/emacs-editing.png)\n\n### Indentation\n\nLine indentation is provided by the `tree-sitter-indent-mode` minor mode based on\nthe configuration in the constant `sdml-mode-folding-definitions`.\n\nDefault indentation is two spaces, although this can be overridden by the custom\nvariable `sdml-mode-indent-offset`.\n\n## Ctags Support\n\nUsing [Universal Ctags](https://ctags.io) and the [sdml-ctags](https://github.com/sdm-lang/sdml-ctags) package provides a tagging solution for\nSDML source. The `sdml-mode-ctags-mode` will determine if [`company-mode`](https://company-mode.github.io/) installed\nand add SDML as a supported tag backend. Additionally, this minor mode provides\na command to re-create the project's tag file. The image below shows company\nused as the completion UI for type completion when editing.\n\n![Completion](./images/emacs-completion.png)\n\nCommand `sdml-mode-ctags-generate` has the default binding `C-c C-s T`. It uses the\nvariables `sdml-mode-ctags-command` and `sdml-mode-ctags-output-file-name` to\ngenerate the tag file.\n\n## Tool Commands\n\nA number of the tools provided by the SDML command-line tool are exposed as\nEmacs commands. The following image shows two tools in use, the module\ndependency tree and the validation tool.\n\n![Tool Commands](./images/emacs-tools.png)\n\n### Dependency Tree\n\n* Command `sdml-mode-current-buffer-dependency-tree` has the default binding `C-c\n  C-s t`.\n* The command will prompt for the maximum depth of the tree where 0 means\n  unbounded. This is a command prefix and can therefore be specified with the\n  usual `C-u` binding.\n* The resulting tree view can be refreshed using the common binding of `g` and\n  quit with `q`.\n  \n### Dependency Graph\n\nIf running under a `window-sytem` it is also possible to display the current\nbuffer's dependencies as a directed graph. The tool will generate an SVG and\ndisplay in a read-only window.\n\n* Command `sdml-mode-current-buffer-dependency-graph` has the default binding `C-c\n  C-s M-t`.\n\n### Full Validation\n\n* Command `sdml-mode-validate-current-buffer` has the default binding `C-c C-s v`.\n* Command `sdml-mode-validate-file` has the default binding `C-c C-s M-v`.\n* The variable `sdml-mode-validation-level` denotes the level of messages produced\n  by the validator, with a default of `warnings`.\n* The output uses the standard `compilation-mode` with all the common bindings are\n  available.\n\n### Abbreviations and Skeletons\n\nThis package creates a new `abbrev-table`, named `sdml-mode-abbrev-table`, which\nprovides a number of useful skeletons for the following. `abbrev-mode` is enabled\nby `sdml-mode` and when typing one of the abbreviations below type space to\nexpand.\n\nTyping `d t SPC` will prompt for a name and expand into the SDML declaration\n`datatype MyName ← opaque _` where the underscore character represents the new\ncursor position.\n\n**Declarations**: `mo`=module, `dt`=datatype, `en`=enum, `ev`=event, `pr`=property,\n`st`=structure, `un`=union\n\n**Annotation Properties**: `pal`=skos:altLabel, `pdf`=skos:definition,\n`ped`=skos:editorialNote, `ppl`=skos:prefLabel, `pco`=rdfs:comment\n\n**Constraints**: `ci`=informal, `cf`=formal, `all`=universal, `any`=existential\n\n**Datatypes**: `db`=boolean, `dd`=decimal, `df`=double, `dh`=binary, `di`=integer, `sd`=string,\n`du`=unsigned\n\nNote that for annotation properties with language string values the skeletons\nwill add the value of the Emacs variable `locale-language` as the language tag.\n\n## Prettify Symbol\n\nThe variable `sdml-mode-prettify-symbols-alist` specifies a set of symbols that\nmay visually replace certain keywords or multi-character symbols in SDML source.\nFor example the characters `\"-\u003e\"` may be replaced by the Unicode character `→`\nor the keyword `\"forall\"` replaced with the Unicode `∀`.\n\n### Default Key Bindings\n\n* `C-c C-s d` -- open the tree-sitter debug view\n* `C-c C-s q` -- open the tree-sitter query builder\n* `C-c C-s t` -- open a dependency tree view for the current buffer\n* `C-c C-s M-t` -- open a dependency graph image for the current buffer\n* `C-c C-s v` -- run the validator, on the current buffer, and show the results in\n  a compilation window\n* `C-c C-s M-v` -- run the validator, on a specified file, and show the results in\n  a compilation window\n* `C-c C-s g` -- run u-ctags for the current project\n\n## Add-Ons\n\n* [emacs-sdml-fold](https://github.com/sdm-lang/emacs-sdml-fold) provides code-folding support to collapse and expand\n  definitions.\n* [emacs-sdml-ispell](https://github.com/sdm-lang/emacs-sdml-ispell) provides *selective* spell checking by only checking selected\n  nodes in the tree.\n* [emacs-flycheck-sdml](https://github.com/sdm-lang/emacs-flycheck-sdml) provides on-the-fly linting for SDML buffers.\n* [emacs-ob-sdml](https://github.com/sdm-lang/emacs-ob-sdml) provides the ability to call the SDML [command-line tool](https://github.com/sdm-lang/rust-sdml) to\n  produce diagrams and more.\n\n## Contributing\n\nThis package includes an [Eldev](https://github.com/emacs-eldev/eldev) file and the following MUST be run before\ncreating any PR.\n\n* `eldev lint`\n* `eldev doctor`\n* `eldev package --load-before-compiling --stop-on-failure --warnings-as-errors`\n* `eldev test`\n* `eldev test --undercover auto,coveralls,merge,dontsent -U simplecov.json`\n* `eldev release -nU 9.9.9`\n\nThe script [eldev-check.sh](https://gist.github.com/johnstonskj/6af5ef6866bfb1288f4962a6ba3ef418) may be useful to you if you do not have your own Eldev\nworkflow.\n\n## License\n\nThis package is released under the Apache License, Version 2.0. See the LICENSE\nfile in the repository for details.\n\n## Changes\n\n### Version 0.2.1\n\n* Feature: update the grammar support for the underlying 0.4.8 release of\n  tree-sitter-sdml.\n\n### Version 0.2.0\n\n* Feature: update the grammar support for the underlying 0.4.0 release of\n  tree-sitter-sdml.\n\n### Version 0.1.9\n\n* Feature: added new `sdml-mode-ctags-mode` minor mode that provides a command to\n  generate tag files using [Universal Ctags](https://ctags.io/).\n* Feature: added a refresh command, bound to `g`, to the dependency tree view.\n* Refactor: module `sdml-mode-cli` now more generic for other clients.\n* Build: reworked the Eldev workflow for Github actions.\n* Fix: regex for compilation mode, error tracking in validation command now\n  working correctly.\n* Fix: added guard to commands to be relevant only in `sdml-mode`.\n* Fix: removed `property_def` rule from highlighting.\n\n### Version 0.1.8\n\n* Feature: update to latest tree-sitter grammar (0.3.2).\n* Feature: no setup functions required, just `use-package` or `require`.\n* Feature: highlighting and indentation implemented as minor modes.\n* Feature: now available on melpa.\n\n### Versions 0.1.0 - 0.1.7\n\nThese versions are all pre-release and do not appear in ELPA/MELPA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdm-lang%2Femacs-sdml-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdm-lang%2Femacs-sdml-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdm-lang%2Femacs-sdml-mode/lists"}