[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/racket-mode 46707179d2: racket-send-last-sexp: Don't inser
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/racket-mode 46707179d2: racket-send-last-sexp: Don't insert \n; fixes #745 |
Date: |
Thu, 20 Mar 2025 16:01:59 -0400 (EDT) |
branch: elpa/racket-mode
commit 46707179d2e1f114811652fb588ccb45e5f8de9b
Author: Greg Hendershott <git@greghendershott.com>
Commit: Greg Hendershott <git@greghendershott.com>
racket-send-last-sexp: Don't insert \n; fixes #745
Note: This drops an option that "echoes" the expression to the REPL.
Doing so proactively is wrong for the same reason it's wrong to insert
a newline proactively. To revive such a feature, the back end would
need to hold onto this expression text in the interactions queue, and
send it back later using repl-output-comment just prior to the
repl-output-value. At the moment this seems like too much work for a
an option that I don't know if anyone is even using, so I'm taking the
approach of waiting to see if anyone actually notices or cares.
---
doc/racket-mode.texi | 4 ----
racket-repl.el | 35 +++++++++--------------------------
2 files changed, 9 insertions(+), 30 deletions(-)
diff --git a/doc/racket-mode.texi b/doc/racket-mode.texi
index b03fe7a339..7c6fc26fab 100644
--- a/doc/racket-mode.texi
+++ b/doc/racket-mode.texi
@@ -2772,10 +2772,6 @@ The expression may be either an at-expression or an
s-expression.
When the expression is a sexp comment, the sexp itself is sent,
without the #; prefix.
-With a prefix argument (e.g. @kbd{C-u} @kbd{C-x C-e} ), the sexp is copied
-into the REPL, followed by a ``=>'' line, to distinguish it
-from the zero or more values to which it evaluates.
-
@node Collections
@section Collections
diff --git a/racket-repl.el b/racket-repl.el
index 90644be7e0..c095f227d6 100644
--- a/racket-repl.el
+++ b/racket-repl.el
@@ -278,13 +278,13 @@ live prompt this marker will be at `point-max'.")
(setq moving t) ;leave point after, for tests
(setq racket--repl-session-id nil))
('value
- (insert-faced value 'racket-repl-value t))
+ (insert-faced value 'racket-repl-value))
('value-special
(pcase value
(`(image . ,file)
(racket--repl-insert-image file))
(value
- (insert-faced (format "%s" value) 'racket-repl-value t))))
+ (insert-faced (format "%s" value) 'racket-repl-value))))
('error
(pcase value
(`(,msg ,srclocs (,context-kind . ,context-names-and-locs))
@@ -336,6 +336,7 @@ live prompt this marker will be at `point-max'.")
;; When stdout/stderr output ends with prompt following on
;; same line, push the prompt down to its own line.
(when (and (memq kind '(stdout stderr))
+ (not (equal "\n" (substring value -1 nil)))
racket--repl-prompt-mark
(equal (point) (marker-position
racket--repl-prompt-mark)))
(insert (propertize "\n"
@@ -990,7 +991,7 @@ If no buffer is visting the file, `find-file' it in
`other-window'."
;;; send to REPL
-(defun racket--send-region-to-repl (start end &optional echo-p)
+(defun racket--send-region-to-repl (start end)
"Internal function to send the region to the Racket REPL.
Requires the REPL already to be started, e.g. from a run command.
@@ -1009,19 +1010,7 @@ see the results."
(let ((source-buffer (current-buffer)))
(racket--repl-forget-errors)
(with-racket-repl-buffer
- (save-excursion
- (racket--repl-delete-prompt-mark nil)
- (goto-char (point-max))
- (insert ?\n)
- (when echo-p
- (insert (with-current-buffer source-buffer
- (buffer-substring start end)))
- (insert (propertize "\n=>\n"
- 'font-lock-face 'racket-repl-message)))
- (add-text-properties racket--repl-output-mark (point)
- (list 'field 'send
- 'read-only t))
- (set-marker racket--repl-output-mark (point))))
+ (racket--repl-delete-prompt-mark nil))
(racket--cmd/async (racket--repl-session-id)
`(repl-submit ,(with-current-buffer source-buffer
(buffer-substring-no-properties start
end))))
@@ -1045,23 +1034,17 @@ see the results."
(beginning-of-defun)
(racket--send-region-to-repl (point) end))))
-(defun racket-send-last-sexp (&optional prefix)
+(defun racket-send-last-sexp ()
"Send the expression before point to the Racket REPL.
The expression may be either an at-expression or an s-expression.
When the expression is a sexp comment, the sexp itself is sent,
-without the #; prefix.
-
-\\<racket-mode-map>
-With a prefix argument (e.g. \\[universal-argument]
\\[racket-send-last-sexp]), the sexp is copied
-into the REPL, followed by a \"=>\" line, to distinguish it
-from the zero or more values to which it evaluates."
- (interactive "P")
+without the #; prefix."
+ (interactive)
(racket--assert-sexp-edit-mode)
(racket--send-region-to-repl (racket--start-of-previous-expression)
- (point)
- prefix))
+ (point)))
(defun racket-eval-last-sexp ()
"Eval the expression before point asynchronously.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/racket-mode 46707179d2: racket-send-last-sexp: Don't insert \n; fixes #745,
ELPA Syncer <=