emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/forth-mode 3047dfa37a 008/153: Run a subprocess Forth for


From: ELPA Syncer
Subject: [nongnu] elpa/forth-mode 3047dfa37a 008/153: Run a subprocess Forth for interaction.
Date: Sat, 29 Jan 2022 08:02:12 -0500 (EST)

branch: elpa/forth-mode
commit 3047dfa37a82e3f0f188b0926c92f50a2699f71c
Author: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Commit: Lars Brinkhoff <lars.brinkhoff@delphi.com>

    Run a subprocess Forth for interaction.
---
 forth-interaction-mode.el | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/forth-interaction-mode.el b/forth-interaction-mode.el
index 74dc7696b7..ad298bf172 100644
--- a/forth-interaction-mode.el
+++ b/forth-interaction-mode.el
@@ -1,3 +1,34 @@
+(require 'comint)
+
+(defvar forth-interaction-mode-map
+  (let ((map (copy-keymap forth-mode-map)))
+    (set-keymap-parent map comint-mode-map)
+    (define-key map (kbd "C-c C-k") 'forth-interaction-kill)
+    map)
+  "Keymap for Forth interaction.")
+
 (define-derived-mode forth-interaction-mode comint-mode "Forth Interaction"
   "Major mode for interacting with Forth."
-  :syntax-table forth-interaction-mode-syntax-table)
+  :syntax-table forth-mode-syntax-table
+  (use-local-map forth-interaction-mode-map))
+
+(defun forth-interaction-kill (&optional buffer)
+  (interactive)
+  (kill-buffer (or buffer (current-buffer))))
+
+(defun forth-interaction-sentinel (proc arg)
+  (message "Forth: %s" arg)
+  (forth-interaction-kill (process-buffer proc)))
+
+;;;### autoload
+(defun forth ()
+  "Start an interactive forth session."
+  (interactive)
+  (let ((buffer (get-buffer-create "*forth*")))
+    (pop-to-buffer-same-window buffer)
+    (unless (comint-check-proc buffer)
+      (make-comint-in-buffer "forth" buffer "forth")
+      (set-process-sentinel (get-buffer-process buffer)
+                           'forth-interaction-sentinel)
+      (forth-interaction-mode))))
+      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]