-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrote a really simple mode for interacting with a gosu prompt, based …
…on comint.
- Loading branch information
0 parents
commit 9c97c6b
Showing
1 changed file
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
;; This is just a simple mode for interacting with an inferior Gosu process. | ||
;; | ||
;; This mode is based on comint, which is the base on which all respectable | ||
;; interactive process modes like shell and ielm are based. This mode is really | ||
;; simple--it only sets the appropriate command ("gosu -i") and the name of the | ||
;; buffer. | ||
(require 'comint) | ||
|
||
(defvar inferior-gosu-mode-map nil) | ||
(unless inferior-gosu-mode-map | ||
(setq inferior-gosu-mode-map (copy-keymap comint-mode-map))) | ||
|
||
(defvar gosu-executable "gosu") | ||
|
||
(put 'inferior-gosu-mode 'mode-class 'special) | ||
|
||
(defun inferior-gosu-mode () | ||
(interactive) | ||
(comint-mode) | ||
(setq comint-prompt-regex inferior-gosu-prompt) | ||
(setq major-mode 'inferior-gosu-mode) | ||
(setq mode-name "Inferior Gosu") | ||
(setq mode-line-process '(":%s")) | ||
(use-local-map 'inferior-gosu-mode-map)) | ||
|
||
(defun inferior-gosu () | ||
(interactive) | ||
(message gosu-executable) | ||
(if (not (comint-check-proc "*inferior-gosu*")) | ||
(progn (set-buffer (apply (function make-comint) "inferior-gosu" | ||
gosu-executable nil '("-i"))))) | ||
(pop-to-buffer "*inferior-gosu*")) | ||
|
||
(defalias 'run-gosu 'inferior-gosu) | ||
|
||
(provide 'inferior-gosu-mode) |