-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
query before installing grammar dylib
- Loading branch information
Showing
4 changed files
with
127 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
;;; slime-coalton.el --- coalton-mode lisp integration -*- lexical-binding: t; -*- | ||
;; | ||
;; Slime extension via `define-slime-contrib' for interaction with a | ||
;; Coalton instance running in a Slime-managed Lisp subprocess. | ||
|
||
(require 'slime) | ||
|
||
(defun coalton-available-p () | ||
(and (not (null slime-net-processes)) | ||
(fboundp 'xxx))) | ||
|
||
(cl-defmacro slime-coalton--show ((name) &body body) | ||
(declare (indent 1)) | ||
`(with-current-buffer (get-buffer-create ,name) | ||
(erase-buffer) | ||
,@body | ||
(display-buffer (current-buffer)) | ||
(current-buffer))) | ||
|
||
(defun slime-coalton--buffer-name (type) | ||
(format "*coalton-%s*" (symbol-name type))) | ||
|
||
(defun slime-coalton--popup-buffer (type) | ||
(let ((name (slime-coalton--buffer-name type))) | ||
(slime-coalton--show (name) | ||
(current-buffer)))) | ||
|
||
(defun slime-coalton--popup (type value) | ||
(pop-to-buffer (slime-coalton--popup-buffer type)) | ||
(erase-buffer) | ||
(insert value) | ||
(goto-char (point-min))) | ||
|
||
(defun slime-coalton--eval (sexp cont) | ||
(declare (indent 1)) | ||
(slime-rex (cont) | ||
(sexp "swank") | ||
((:ok result) | ||
(when cont | ||
(funcall cont result))) | ||
((:abort condition) | ||
(message "Evaluation aborted on %s." condition)))) | ||
|
||
(defun slime-coalton--ast () | ||
"Display the AST of the definition at point." | ||
(interactive) | ||
(let ((form (coalton-definition-at-point)) | ||
(package (coalton-package))) | ||
(slime-coalton--eval `(swank:swank-coalton-ast `,form `,package) | ||
(lambda (result) | ||
(slime-coalton--popup 'ast result))))) | ||
|
||
|
||
;;; Initialization | ||
|
||
(defun slime-coalton-init () | ||
(message "slime-coalton.el: slime-coalton-init")) | ||
|
||
(define-slime-contrib slime-coalton | ||
"Support Coalton language" | ||
(:authors "Jesse Bouwman <[email protected]>") | ||
(:swank-dependencies swank-coalton)) | ||
|
||
(defun coalton () | ||
(interactive) | ||
(message "slime-coalton.el: coalton")) | ||
|
||
(provide 'slime-coalton) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
;;; swank-coalton.lisp | ||
|
||
(in-package :swank) | ||
|
||
(defun system-loaded-p (system-designator) | ||
(find system-designator (asdf:already-loaded-systems) | ||
:test #'string=)) | ||
|
||
(defun system-available-p (system-designator) | ||
(asdf:find-system system-designator)) | ||
|
||
(defun system-status (system-designator) | ||
(cond ((system-loaded-p system-designator) | ||
:loaded) | ||
((system-available-p system-designator) | ||
:available) | ||
(t | ||
:unavailable))) | ||
|
||
|
||
(defslimefun swank-coalton-status () | ||
(system-status "coalton")) | ||
|
||
(defslimefun swank-coalton-init () | ||
(asdf:load-system "coalton")) | ||
|
||
|
||
(defslimefun swank-coalton--ast (form package) | ||
:xyz) | ||
|
||
(provide :swank-coalton) | ||
|
||
|
||
|
||
(swank-coalton--ast "(define (symbol-name sym) | ||
(match sym | ||
((Symbol s) s)))" | ||
"(package diff-example)") | ||
|