Skip to content

Commit

Permalink
Command I/O via sockets
Browse files Browse the repository at this point in the history
Send commands and receive responses via sockets.

Fixes #132.
Fixes #203.
Fixes #228.

Uses some code from the old, stale `old-command-socket` branch.

Also:

- Some commands -- like profiling and test coverage -- need to
  racket-run, then issue a command to get results about the run. Provide
  a way for them to see if the REPL is waiting at the Racket prompt.

- Make the previous point for racket-check-syntax-mode by simplifying it
  to supply a path.

- Separate find and kill of requires. Wait to kill until we're ready to
  insert the new requires. This simplifies error recovery. Also it means
  something like `accept-process-output' won't make a new undo history
  point, so both our kill and insert will be in a single undo step.
  • Loading branch information
Greg Hendershott committed Oct 23, 2016
1 parent f98ee53 commit aceb302
Show file tree
Hide file tree
Showing 13 changed files with 419 additions and 348 deletions.
35 changes: 15 additions & 20 deletions Reference.md
Expand Up @@ -666,18 +666,6 @@ Macro expand again the previous expansion done by one of:
- [`racket-expand-last-sexp`](#racket-expand-last-sexp)
- [`racket-expand-again`](#racket-expand-again)

### racket-gui-macro-stepper
<kbd>M-x racket-gui-macro-stepper</kbd>

Run the DrRacket GUI macro stepper.

Runs on the active region, if any, else the entire buffer.

EXPERIMENTAL: May be changed or removed.

BUGGY: The first-ever invocation might not display a GUI window.
If so, try again.

# Variables

> Note: You may also set these via Customize.
Expand All @@ -687,6 +675,12 @@ If so, try again.
### racket-racket-program
Pathname of the racket executable.

### racket-command-port
Port number for Racket REPL command server.

### racket-command-timeout
Timeout for Racket REPL command server.

### racket-raco-program
Pathname of the raco executable.

Expand Down Expand Up @@ -727,7 +721,15 @@ List of command-line arguments to supply to your Racket program.
Accessible in your Racket program in the usual way -- the
parameter `current-command-line-arguments` and friends.

The value must be an unquoted list of strings such as:
This is an Emacs buffer-local variable -- convenient to set as a
file local variable. For example at the end of your .rkt file:

;; Local Variables:
;; racket-user-command-line-arguments: ("-f" "bar")
;; End:

Set this way the value must be an unquoted list of strings such
as:

("-f" "bar")

Expand All @@ -736,13 +738,6 @@ but NOT:
'("-f" "bar")
(list "-f" "bar")

This is an Emacs buffer-local variable -- convenient to set as a
file local variable. For example at the end of your .rkt file:

;; Local Variables:
;; racket-user-command-line-arguments: ("-f" "bar")
;; End:


## REPL

Expand Down
8 changes: 4 additions & 4 deletions channel.rkt
Expand Up @@ -4,7 +4,7 @@
racket/contract
"mod.rkt")

(provide the-channel
(provide main-channel
(struct-out msg)
(struct-out load-gui)
(struct-out rerun)
Expand Down Expand Up @@ -42,8 +42,8 @@
(define (profile/coverage-level? v)
(memq? v profile/coverage-levels))

;; Messages via a channel from the repl thread to the main thread.
(define the-channel (make-channel))
;; Messages to the main thread via a channel
(define main-channel (make-channel))
(define-struct/contract msg ())
(define-struct/contract [load-gui msg] ())
(define-struct/contract [rerun msg]
Expand All @@ -63,5 +63,5 @@
;; the channel, and blocks itself; main thread will kill the REPL
;; thread. Effectively "exit the thread with a return value".
(define (put/stop v) ;; msg? -> void?
(channel-put the-channel v)
(channel-put main-channel v)
(void (sync never-evt)))

0 comments on commit aceb302

Please sign in to comment.