[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/j-mode ebf94ae 03/56: Added the beginning of j-console int
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/j-mode ebf94ae 03/56: Added the beginning of j-console integration |
Date: |
Sun, 29 Aug 2021 11:20:43 -0400 (EDT) |
branch: elpa/j-mode
commit ebf94aec7639019eec27a27c631a448e095dc0f8
Author: Zachary Elliott <zach@nyu.edu>
Commit: Zachary Elliott <zach@nyu.edu>
Added the beginning of j-console integration
---
j-mode.el | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/j-mode.el b/j-mode.el
index 96ebd61..b473e15 100644
--- a/j-mode.el
+++ b/j-mode.el
@@ -33,6 +33,9 @@
;;; Code:
+(require 'comint)
+
+
(defconst j-mode-version "0.0.1"
"`j-mode' version")
@@ -213,4 +216,74 @@
(run-mode-hooks 'j-mode-hook))
+
+
+(defcustom j-command "jconsole"
+ ""
+ :type 'string
+ :group 'j-)
+
+(defcustom j-command-args '()
+ ""
+ :type 'string
+ :group 'j-)
+
+(defcustom j-command-conf nil
+ ""
+ :type 'string
+ :group 'j-)
+
+
+(defun j-create-interpreter ()
+ (apply 'make-comint "J" j-command j-command-conf j-command-args))
+
+(defun j-ensure-interpreter ()
+ (or (get-process "J")
+ (progn
+ (j-create-interpreter)
+ (get-process "J"))))
+
+
+;; with process
+(defmacro w-p ( binding &rest body )
+ `(let* ((,binding (j-ensure-interpreter)))
+ ,@body))
+
+
+(defun j-execute-line ()
+ (interactive)
+ (w-p interpreter
+ (let* ((line (buffer-substring-no-properties (point-at-bol)
+ (point-at-eol))))
+ (pop-to-buffer (process-buffer interpreter))
+ (goto-char (point-max))
+ (insert-string line)
+ (comint-send-input))))
+
+(defun j-execute-region (start end)
+ (interactive "r")
+ (w-p interpreter
+ (and (= start end) (error "Region is empty"))
+ (let* ((region (buffer-substring-no-properties start end))
+ (block-size (if (and (= start (point-min)) (= end (point-max)))
+ "buffer" "region"))
+ (region (concat "\nNB. Sending " block-size "...\n" region)))
+ (pop-to-buffer (process-buffer interpreter))
+ (insert-string (concat "\n" region))
+ (dolist (line (split-string region "[\r\n]" nil))
+ (comint-send-string interpreter (concat line "\n"))))))
+
+(defun j-execute-buffer ()
+ (interactive)
+ (j-execute-region (point-min) (point-max)))
+
+;;(add-hook 'comint-mode-hook
+;; (lambda ()
+;; (setq comint-process-echoes t)))
+
+;;;###autoload
+(defun j-console ()
+ (interactive)
+ (switch-to-buffer-other-window (process-buffer (j-ensure-interpreter))))
+
(provide 'j-mode)
- [nongnu] branch elpa/j-mode created (now e8725ac), ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode ad688ee 01/56: Initial code base, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 01e8c39 02/56: Removing todo, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode cedc335 04/56: Updates to face macro, to j-console handling. Added key-bindings, added drop down., ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode ebf94ae 03/56: Added the beginning of j-console integration,
ELPA Syncer <=
- [nongnu] elpa/j-mode 14327d8 05/56: Adding font-lock for variable assignment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode c6865b5 07/56: Initial commit for help documentation look-up functionality., ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 529cf67 06/56: Swaping progn with eval-when-compile in faces macro, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode d6fd35d 08/56: Updating README with information about the new faces added from j-mode, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 41218f6 10/56: Doc-string updates, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 140c2b6 12/56: Updated README and cleaned up docs a bit, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 50b6ad1 13/56: Updating doc strings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode f4ede4b 18/56: Fixing unbalanced parenthesis, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 2e1ffe7 17/56: Merge branch 'modulate' of github.com:zellio/j-mode into modulate, ELPA Syncer, 2021/08/29
- [nongnu] elpa/j-mode 0bf1acd 35/56: Fix "\\." (Suffix / Outfix) for `j-help-voc-alist', ELPA Syncer, 2021/08/29