|
1 | 1 | ;;; sdml-mode.el --- Major mode for SDML -*- lexical-binding: t; -*-
|
2 | 2 |
|
3 | 3 | ;; Author: Simon Johnston <[email protected]>
|
4 |
| -;; Version: 0.1.9 |
5 |
| -;; Package-Requires: ((emacs "28.1") (tree-sitter "0.18.0") (tree-sitter-indent "0.3")) |
| 4 | +;; Version: 0.2.0 |
| 5 | +;; Package-Requires: ((emacs "28.1") (tree-sitter "0.18.0") (tree-sitter-indent "0.4")) |
6 | 6 | ;; URL: https://github.com/johnstonskj/emacs-sdml-mode
|
7 | 7 | ;; Keywords: languages tools
|
8 | 8 |
|
@@ -180,7 +180,7 @@ platform-specific extension in `tree-sitter-load-suffixes'."
|
180 | 180 | '(sdml-mode . sdml))))
|
181 | 181 |
|
182 | 182 | ;; --------------------------------------------------------------------------
|
183 |
| -;; Buffer Commands Validation |
| 183 | +;; Commands Validation |
184 | 184 | ;; --------------------------------------------------------------------------
|
185 | 185 |
|
186 | 186 | (defconst sdml-mode-validation-error-regexp
|
@@ -239,7 +239,7 @@ usual."
|
239 | 239 |
|
240 | 240 |
|
241 | 241 | ;; --------------------------------------------------------------------------
|
242 |
| -;; Buffer Commands Dependencies |
| 242 | +;; Commands Dependencies |
243 | 243 | ;; --------------------------------------------------------------------------
|
244 | 244 |
|
245 | 245 |
|
@@ -285,6 +285,103 @@ using the key `q', and it's content may be refreshed with the key
|
285 | 285 | (sdml-mode-cli-run-command cmd-line "*SDML Dependencies*" nil t))))
|
286 | 286 |
|
287 | 287 |
|
| 288 | +;; -------------------------------------------------------------------------- |
| 289 | +;; Commands Placeholders |
| 290 | +;; -------------------------------------------------------------------------- |
| 291 | + |
| 292 | +(defun sdml-mode-document-module () |
| 293 | + "Generate standard documentation for module in current buffer." |
| 294 | + (interactive nil sdml-mode) |
| 295 | + (let* ((inp-file (buffer-file-name)) |
| 296 | + (out-file (if (null inp-file) "-" |
| 297 | + (concat (file-name-sans-extension inp-file) ".org"))) |
| 298 | + (out-buffer (if (null inp-file) "*SDML Documentation*" nil))) |
| 299 | + (let ((cmd-line (sdml-mode-cli-make-command |
| 300 | + "doc" |
| 301 | + (sdml-mode-cli-make-arg 'output-format 'org-mode) |
| 302 | + (sdml-mode-cli-make-arg 'output out-file) |
| 303 | + 'current-buffer))) |
| 304 | + (when cmd-line |
| 305 | + (sdml-mode-cli-run-command cmd-line out-buffer nil t) |
| 306 | + (cond |
| 307 | + ((not (null out-buffer)) |
| 308 | + (with-current-buffer out-buffer |
| 309 | + (org-mode))) |
| 310 | + ((not (eq out-file "-")) |
| 311 | + (find-file out-file))))))) |
| 312 | + |
| 313 | +(defun sdml-mode-document-project () |
| 314 | + "Do something." |
| 315 | + (interactive nil sdml-mode) |
| 316 | + t) |
| 317 | + |
| 318 | +(defun sdml-mode-draw-concept () |
| 319 | + "Do something." |
| 320 | + (interactive nil sdml-mode) |
| 321 | + t) |
| 322 | + |
| 323 | +(defun sdml-mode-draw-entities () |
| 324 | + "Do something." |
| 325 | + (interactive nil sdml-mode) |
| 326 | + t) |
| 327 | + |
| 328 | +(defun sdml-mode-draw-uml () |
| 329 | + "Do something." |
| 330 | + (interactive nil sdml-mode) |
| 331 | + t) |
| 332 | + |
| 333 | +(defun sdml-mode-generate-rdf () |
| 334 | + "Do something." |
| 335 | + (interactive nil sdml-mode) |
| 336 | + t) |
| 337 | + |
| 338 | +(defun sdml-mode-generate-scheme () |
| 339 | + "Generate Scheme representation of the current buffer." |
| 340 | + (interactive nil sdml-mode) |
| 341 | + (let* ((inp-file (buffer-file-name)) |
| 342 | + (out-file (if (null inp-file) "-" |
| 343 | + (concat (file-name-sans-extension inp-file) ".scm"))) |
| 344 | + (out-buffer (if (null inp-file) "*SDML Parse-tree Scheme*" nil))) |
| 345 | + (let ((cmd-line (sdml-mode-cli-make-command |
| 346 | + "convert" |
| 347 | + (sdml-mode-cli-make-arg 'output-format 's-expr) |
| 348 | + (sdml-mode-cli-make-arg 'output out-file) |
| 349 | + 'current-buffer))) |
| 350 | + (when cmd-line |
| 351 | + (sdml-mode-cli-run-command cmd-line out-buffer nil t) |
| 352 | + (cond |
| 353 | + ((and (not (null out-buffer)) (featurep 'scheme-mode)) |
| 354 | + (with-current-buffer out-buffer |
| 355 | + (scheme-mode))) |
| 356 | + ((not (eq out-file "-")) |
| 357 | + (find-file out-file))))))) |
| 358 | + |
| 359 | +(defun sdml-mode-generate-json () |
| 360 | + "Generate JSON representation of current buffer." |
| 361 | + (interactive nil sdml-mode) |
| 362 | + (let* ((inp-file (buffer-file-name)) |
| 363 | + (out-file (if (null inp-file) "-" |
| 364 | + (concat (file-name-sans-extension inp-file) ".json"))) |
| 365 | + (out-buffer (if (null inp-file) "*SDML Parse-tree JSON*" nil))) |
| 366 | + (let ((cmd-line (sdml-mode-cli-make-command |
| 367 | + "convert" |
| 368 | + (sdml-mode-cli-make-arg 'output-format 'json-pretty) |
| 369 | + (sdml-mode-cli-make-arg 'output out-file) |
| 370 | + 'current-buffer))) |
| 371 | + (when cmd-line |
| 372 | + (sdml-mode-cli-run-command cmd-line out-buffer nil t) |
| 373 | + (cond |
| 374 | + ((and (not (null out-buffer)) (featurep 'json-mode)) |
| 375 | + (with-current-buffer out-buffer |
| 376 | + (json-mode))) |
| 377 | + ((not (eq out-file "-")) |
| 378 | + (find-file out-file))))))) |
| 379 | + |
| 380 | +(defun sdml-mode-generate-with-tera () |
| 381 | + "Do something." |
| 382 | + (interactive nil sdml-mode) |
| 383 | + t) |
| 384 | + |
288 | 385 | ;; --------------------------------------------------------------------------
|
289 | 386 | ;; Key Bindings
|
290 | 387 | ;; --------------------------------------------------------------------------
|
|
0 commit comments