[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode 6ab334684b 010/153: Send a string to an interac
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode 6ab334684b 010/153: Send a string to an interactive Forth session. |
Date: |
Sat, 29 Jan 2022 08:02:12 -0500 (EST) |
branch: elpa/forth-mode
commit 6ab334684b0694a4dfdac668617580d1567886c0
Author: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Commit: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Send a string to an interactive Forth session.
---
forth-interaction-mode.el | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/forth-interaction-mode.el b/forth-interaction-mode.el
index ad298bf172..2d2f7784c8 100644
--- a/forth-interaction-mode.el
+++ b/forth-interaction-mode.el
@@ -1,5 +1,8 @@
(require 'comint)
+(defvar forth-interaction-buffer nil)
+(defvar forth-interaction-callback nil)
+
(defvar forth-interaction-mode-map
(let ((map (copy-keymap forth-mode-map)))
(set-keymap-parent map comint-mode-map)
@@ -12,9 +15,16 @@
:syntax-table forth-mode-syntax-table
(use-local-map forth-interaction-mode-map))
+(defun forth-interaction-preoutput-filter (text)
+ (if forth-interaction-callback
+ (prog1 (funcall forth-interaction-callback text)
+ (setq forth-interaction-callback nil))
+ text))
+
(defun forth-interaction-kill (&optional buffer)
(interactive)
- (kill-buffer (or buffer (current-buffer))))
+ (kill-buffer (or buffer (current-buffer)))
+ (setq forth-interaction-buffer nil))
(defun forth-interaction-sentinel (proc arg)
(message "Forth: %s" arg)
@@ -30,5 +40,19 @@
(make-comint-in-buffer "forth" buffer "forth")
(set-process-sentinel (get-buffer-process buffer)
'forth-interaction-sentinel)
- (forth-interaction-mode))))
+ (forth-interaction-mode)
+ (add-hook 'comint-preoutput-filter-functions
+ 'forth-interaction-preoutput-filter nil t)
+ (setq forth-interaction-buffer buffer))))
+(defun ensure-forth ()
+ (unless forth-interaction-buffer
+ (forth))
+ (get-buffer-process forth-interaction-buffer))
+
+;;;### autoload
+(defun forth-interaction-send (string callback)
+ (let ((proc (ensure-forth)))
+ (setq forth-interaction-callback callback)
+ (comint-send-string proc string)
+ (comint-send-string proc "\n")))
- [nongnu] elpa/forth-mode b455a556fe 056/153: Add C-M-x, forth-eval-defun., (continued)
- [nongnu] elpa/forth-mode b455a556fe 056/153: Add C-M-x, forth-eval-defun., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 973481a1c5 007/153: Add some autoloads., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 244c416c4d 013/153: Variable for secifying Forth executable., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode cdab2e4ec1 038/153: Also recognise .4th., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 695bb04ebc 002/153: A humble beginning., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 24d3d052fe 003/153: More work. Font lock and navigation somewhat usable., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 93756ec224 005/153: Some basic and flawed support for block files., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode bca8f01218 004/153: Make it work in older Emacsen without prog-mode., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode effb52b8e0 009/153: Load files from load-path., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 3047dfa37a 008/153: Run a subprocess Forth for interaction., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 6ab334684b 010/153: Send a string to an interactive Forth session.,
ELPA Syncer <=
- [nongnu] elpa/forth-mode b6b1f049b0 017/153: Restart an interactive Forth session., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 7c75c452e9 022/153: Correct autoload cookie format, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e4ed4a8acf 050/153: Test with both Emacs 23 and 24., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode cc267b4b85 043/153: Symbol completion. Candidates come from a running Forth., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 50adf0d552 024/153: Remove byte-compile warnings., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 85ce58e93e 020/153: Correct package header format, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d972e9fc7a 019/153: Escape some character constants., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d09313f19c 035/153: Add forth-eval-region., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 89b9904ceb 119/153: Add some tests for font-lock faces, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d47662b187 037/153: Add some installation and usage instrutions., ELPA Syncer, 2022/01/29