|
1 | 1 | (require 's) |
2 | 2 |
|
3 | | -;; TODO: make a sepl-send-command-to-process or something that all eval style funcs can use |
4 | | - |
5 | 3 | (defun sepl-eval-sexp () |
6 | 4 | (interactive) |
7 | 5 | (let* ((start (point)) |
|
40 | 38 | (set (make-local-variable 'sepl-repl-process) |
41 | 39 | (get-buffer-process "*SEPL REPL*"))) |
42 | 40 |
|
43 | | -;; TODO: maybe some sort of error message if we try to start two proceses? Only one allowed at the moment. To make life simpler for myself. |
44 | 41 | (define-derived-mode sepl-repl-mode comint-mode |
45 | 42 | "SEPL REPL" |
46 | 43 | "Mode used inside the repl to the SEPL process. Dr. Seuss would be proud." |
47 | 44 |
|
48 | | - ;; TODO: rest of the buffer should be read only, except the prompt |
49 | 45 | (setq-local comint-use-prompt-regexp t |
50 | 46 | comint-prompt-regexp "> " |
51 | 47 | comint-prompt-read-only t) |
52 | 48 |
|
53 | | - ;; TODO: could we activate highlight of scheme keywords? |
54 | 49 | (require 'scheme) |
55 | 50 | (setq-local font-lock-keywords scheme-font-lock-keywords) |
56 | 51 |
|
|
61 | 56 | :group 'sepl |
62 | 57 | :type 'string) |
63 | 58 |
|
64 | | -(defun sepl-repl-start () |
| 59 | +(defun sepl-repl-connect () |
| 60 | + "Connects to an existing SEPL instance, and starts a REPL interface." |
65 | 61 | (interactive) |
66 | | - (let ((buffer (get-buffer-create "*SEPL REPL*")) |
67 | | - (glsl-file (buffer-file-name (current-buffer)))) |
68 | | - (start-process "sepl" "*SEPL-STDOUT*" sepl-program-bin glsl-file) |
69 | | - ;; give process 2 seconds to start |
70 | | - (sleep-for 2) |
71 | | - ;; TODO: open the comint buffer in a split. |
72 | | - ;; TODO: setup the special mode for the buffer. |
73 | | - ;; |
| 62 | + (let ((buffer (get-buffer-create "*SEPL REPL*"))) |
74 | 63 | (with-current-buffer buffer |
75 | 64 | (apply 'make-comint-in-buffer "SEPL" buffer '("localhost" . 42069) nil '()) |
76 | 65 | (sepl-repl-mode) |
77 | 66 | (pop-to-buffer buffer)))) |
78 | 67 |
|
| 68 | +(defun sepl-repl-start () |
| 69 | + "Starts a new SEPL instance and starts a REPL interface." |
| 70 | + (interactive) |
| 71 | + (let ((glsl-file (buffer-file-name (current-buffer)))) |
| 72 | + (start-process "sepl" "*SEPL-STDOUT*" sepl-program-bin glsl-file) |
| 73 | + ;; give process 2 seconds to start |
| 74 | + (sleep-for 2) |
| 75 | + (sepl-repl-connect))) |
79 | 76 |
|
80 | | - |
81 | | -;; TODO: some keywords we cna |
| 77 | +(provide 'sepl-mode) |
0 commit comments