diff options
-rw-r--r-- | nrepl-client.el | 29 | ||||
-rw-r--r-- | nrepl-repl.el | 29 |
2 files changed, 29 insertions, 29 deletions
diff --git a/nrepl-client.el b/nrepl-client.el index b67966d6..ef851ad7 100644 --- a/nrepl-client.el +++ b/nrepl-client.el @@ -1567,35 +1567,6 @@ are processed." (defalias 'nrepl-eval 'nrepl-send-string-sync) (defalias 'nrepl-eval-async 'nrepl-send-string) -(defun nrepl-send-input (&optional newline) - "Go to the end of the input and send the current input. -If NEWLINE is true then add a newline at the end of the input." - (unless (nrepl-in-input-area-p) - (error "No input at point")) - (goto-char (point-max)) - (let ((end (point))) ; end of input, without the newline - (nrepl-add-to-input-history (buffer-substring nrepl-input-start-mark end)) - (when newline - (insert "\n") - (nrepl-show-maximum-output)) - (let ((inhibit-modification-hooks t)) - (add-text-properties nrepl-input-start-mark - (point) - `(nrepl-old-input - ,(incf nrepl-old-input-counter)))) - (let ((overlay (make-overlay nrepl-input-start-mark end))) - ;; These properties are on an overlay so that they won't be taken - ;; by kill/yank. - (overlay-put overlay 'read-only t) - (overlay-put overlay 'face 'nrepl-input-face))) - (let* ((input (nrepl-current-input)) - (form (if (and (not (string-match "\\`[ \t\r\n]*\\'" input)) nrepl-use-pretty-printing) - (format "(clojure.pprint/pprint %s)" input) input))) - (goto-char (point-max)) - (nrepl-mark-input-start) - (nrepl-mark-output-start) - (nrepl-send-string form (nrepl-handler (current-buffer)) nrepl-buffer-ns))) - (defun nrepl-find-ns () "Return the ns specified in the buffer, or \"user\" if no ns declaration is found." (or (save-restriction diff --git a/nrepl-repl.el b/nrepl-repl.el index f88bc779..fc9b3985 100644 --- a/nrepl-repl.el +++ b/nrepl-repl.el @@ -689,6 +689,35 @@ the symbol." t))) (t t)))) +(defun nrepl-send-input (&optional newline) + "Go to the end of the input and send the current input. +If NEWLINE is true then add a newline at the end of the input." + (unless (nrepl-in-input-area-p) + (error "No input at point")) + (goto-char (point-max)) + (let ((end (point))) ; end of input, without the newline + (nrepl-add-to-input-history (buffer-substring nrepl-input-start-mark end)) + (when newline + (insert "\n") + (nrepl-show-maximum-output)) + (let ((inhibit-modification-hooks t)) + (add-text-properties nrepl-input-start-mark + (point) + `(nrepl-old-input + ,(incf nrepl-old-input-counter)))) + (let ((overlay (make-overlay nrepl-input-start-mark end))) + ;; These properties are on an overlay so that they won't be taken + ;; by kill/yank. + (overlay-put overlay 'read-only t) + (overlay-put overlay 'face 'nrepl-input-face))) + (let* ((input (nrepl-current-input)) + (form (if (and (not (string-match "\\`[ \t\r\n]*\\'" input)) nrepl-use-pretty-printing) + (format "(clojure.pprint/pprint %s)" input) input))) + (goto-char (point-max)) + (nrepl-mark-input-start) + (nrepl-mark-output-start) + (nrepl-send-string form (nrepl-handler (current-buffer)) nrepl-buffer-ns))) + (defun nrepl-return (&optional end-of-input) "Evaluate the current input string, or insert a newline. Send the current input ony if a whole expression has been entered, |