[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/poke 4743725592 34/76: poke.el: poke-code send command
From: |
ELPA Syncer |
Subject: |
[elpa] externals/poke 4743725592 34/76: poke.el: poke-code send command |
Date: |
Tue, 5 Apr 2022 14:59:35 -0400 (EDT) |
branch: externals/poke
commit 4743725592e4e02f2b1202be74bdf0446a0f93c2
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Commit: Jose E. Marchesi <jose.marchesi@oracle.com>
poke.el: poke-code send command
---
poke.el | 47 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 36 insertions(+), 11 deletions(-)
diff --git a/poke.el b/poke.el
index 49cf4c901b..808393b199 100644
--- a/poke.el
+++ b/poke.el
@@ -48,6 +48,7 @@
(require 'comint)
(require 'subr-x)
(require 'tabulated-list)
+(require 'poke-mode)
;;;; First, some utilities
@@ -387,12 +388,40 @@ Commands:
(process-send-string poke-code-process string)))
(error "poke-code is not running")))
+(defun poke-code-cmd-send-code ()
+ "Execute Poke code."
+ (interactive)
+ (let ((code-begin (or (save-excursion (re-search-backward "^//--$" nil t))
+ (point-min)))
+ (code-end (or (save-excursion (re-search-forward "^//--$" nil t))
+ (point-max))))
+ (poke-code-send (buffer-substring code-begin code-end))))
+
+(defvar poke-code-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-c" 'poke-code-cmd-send-code)
+ map))
+
+(define-derived-mode poke-code-mode poke-mode "poke-code"
+ "A major mode for Poke code.
+
+Commands:
+\\<poke-code-mode-map>
+\\{poke-code-mode-map}"
+)
+
(defun poke-code ()
(interactive)
(when (not (process-live-p poke-code-process))
(setq poke-code-process (poke-make-pokelet-process
"poke-code" "\x01"))
- (set-process-query-on-exit-flag poke-code-process nil))
+ (set-process-query-on-exit-flag poke-code-process nil)
+ (save-excursion
+ (set-buffer "*poke-code*")
+ (poke-code-mode)
+ (goto-char (point-min))
+ (insert "/* This is a Poke evaluation code. Press C-cC-c to evaluate
the current section. */\n"
+ "/* //-- markers at the beginning of lines separate sections.
*/\n")))
(when (called-interactively-p)
(switch-to-buffer-other-window "*poke-code*")))
@@ -422,7 +451,7 @@ Commands:
(let ((buffer-read-only nil))
(delete-region (point-min) (point-max))
(insert (process-get proc 'poke-vu-output))
- (goto-char (process-get proc 'poke-current-position)))))
+ (poke-vu-goto-byte current-byte))))
(process-put proc 'poke-vu-output ""))
(_ ;; Protocol error
(process-put proc 'pokelet-buf "")
@@ -537,8 +566,7 @@ relative to the beginning of the shown IO space."
;; Scroll so the desired byte is in the first line.
(setq start-byte-offset (- offset
(% offset poke-vu-bytes-per-line)))
- (process-put poke-vu-process 'poke-current-position
- offset)
+ (setq current-byte offset)
(poke-vu-refresh)
(setq byte-pos (poke-vu-byte-pos offset)))
;; Move the point where the byte at the given offset is.
@@ -554,7 +582,7 @@ relative to the beginning of the shown IO space."
1)))
(overlay-put (make-overlay ascii-point (+ ascii-point 1))
'face 'poke-vu-selected-byte-face)))
- (message (format "0x%x#B" offset))))
+ (message (format "0x%x#B" offset)))
(defun poke-vu-cmd-goto-byte (offset)
(interactive "nGoto byte: ")
@@ -617,6 +645,7 @@ Commands:
(setq-local start-byte-offset 0)
(setq-local header-line-format
"76543210 0011 2233 4455 6677 8899 aabb ccdd eeff
0123456789ABCDEF")
+ (setq-local current-byte 0)
(setq mode-name "poke-vu")
(setq major-mode 'poke-vu-mode)
(read-only-mode t))
@@ -628,7 +657,6 @@ Commands:
(poke-make-pokelet-process-new "poke-vu" "\x82"
#'poke-vu-handle-cmd))
(process-put poke-vu-process 'poke-vu-output "")
- (process-put poke-vu-process 'poke-current-position 0)
(save-excursion
(set-buffer "*poke-vu*")
(poke-vu-mode)))
@@ -647,10 +675,6 @@ Commands:
(window (get-buffer-window buffer)))
(when (and (process-live-p poke-vu-process)
window)
- (save-excursion
- (set-buffer buffer)
- (process-put poke-vu-process 'poke-current-position
- (point)))
;; Note we are assuming each VU line contains 0x10 bytes.
(poke-code-send (concat "{vu "
":from " (number-to-string
@@ -988,7 +1012,8 @@ fun quit = void:
(delete-other-windows)
(switch-to-buffer "*poke-vu*")
(switch-to-buffer-other-window "*poke-out*")
- (switch-to-buffer-other-window "*poke-repl*"))
+ (switch-to-buffer-other-window "*poke-repl*")
+ (switch-to-buffer-other-window "*poke-code*"))
(defun poke-exit ()
(interactive)
- [elpa] externals/poke 4e7d779635 13/76: poke.el: convert poke-vu to new infrastructure, (continued)
- [elpa] externals/poke 4e7d779635 13/76: poke.el: convert poke-vu to new infrastructure, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 157431f80e 15/76: emacs.el: remove global state from poke-out, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 7851b82ef7 19/76: poke.el: require subr-ex, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 7bca885bb1 20/76: poke.el: use hooks ios_open_hook and ios_close_hook, ELPA Syncer, 2022/04/05
- [elpa] externals/poke f457341424 22/76: poke.el: command for setting the current IOS in the poke-ios, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 923ec644ba 24/76: poke.el: add size to poke-ios, ELPA Syncer, 2022/04/05
- [elpa] externals/poke e71f9cea1a 26/76: pkl: immutable declarations in compiler bootstrapping, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 224e283c86 27/76: poke.el: transmit flags in a string to poke-ios-open, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 2e6411d56a 29/76: poke.el: improvs, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 84ae4121b9 30/76: poke.el: get unibyte strings in pokelet processes, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 4743725592 34/76: poke.el: poke-code send command,
ELPA Syncer <=
- [elpa] externals/poke 14a8f278b1 37/76: poke.el: poke-settings buffer, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 0c410f656e 39/76: poke.el: factor settings code a bit, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 468f631988 43/76: poke.el: editor with values, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 47a7d4f84d 46/76: poke.el: window placement improvements, ELPA Syncer, 2022/04/05
- [elpa] externals/poke bb294de5b3 52/76: poke.el: select a line when creating IOS menu, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 66fb149542 56/76: poke.el: command C-cV in repl to refresh the VU, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 902b4dd575 59/76: poke.el: docstrings, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 6ceebd3c12 58/76: poke.el: add manual skeleton and fix progrma header for packaging, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 9c00747388 64/76: poke.el: face for highlighting, ELPA Syncer, 2022/04/05
- [elpa] externals/poke 59b5f4c4a6 66/76: foo, ELPA Syncer, 2022/04/05