364 |
|
|
365 |
This variable is buffer-local.") |
This variable is buffer-local.") |
366 |
|
|
367 |
|
(defvar comint-input-sender-no-newline nil |
368 |
|
"Non-nil directs the `comint-input-sender' function not to send a newline.") |
369 |
|
|
370 |
(defvar comint-input-sender (function comint-simple-send) |
(defvar comint-input-sender (function comint-simple-send) |
371 |
"Function to actually send to PROCESS the STRING submitted by user. |
"Function to actually send to PROCESS the STRING submitted by user. |
372 |
Usually this is just `comint-simple-send', but if your mode needs to |
Usually this is just `comint-simple-send', but if your mode needs to |
373 |
massage the input string, put a different function here. |
massage the input string, put a different function here. |
374 |
`comint-simple-send' just sends the string plus a newline. |
`comint-simple-send' just sends the string plus a newline. |
375 |
|
\(If `comint-input-sender-no-newline' is non-nil, it omits the newline.) |
376 |
This is called from the user command `comint-send-input'.") |
This is called from the user command `comint-send-input'.") |
377 |
|
|
378 |
(defcustom comint-eol-on-send t |
(defcustom comint-eol-on-send t |
1369 |
cmd)))) |
cmd)))) |
1370 |
(ring-insert comint-input-ring cmd))) |
(ring-insert comint-input-ring cmd))) |
1371 |
|
|
1372 |
(defun comint-send-input () |
(defun comint-send-input (&optional no-newline) |
1373 |
"Send input to process. |
"Send input to process. |
1374 |
After the process output mark, sends all text from the process mark to |
After the process output mark, sends all text from the process mark to |
1375 |
point as input to the process. Before the process output mark, calls |
point as input to the process. Before the process output mark, calls |
1444 |
(delete-region pmark start) |
(delete-region pmark start) |
1445 |
copy)))) |
copy)))) |
1446 |
|
|
1447 |
(insert ?\n) |
(unless no-newline |
1448 |
|
(insert ?\n)) |
1449 |
|
|
1450 |
(comint-add-to-input-history history) |
(comint-add-to-input-history history) |
1451 |
|
|
1452 |
(run-hook-with-args 'comint-input-filter-functions |
(run-hook-with-args 'comint-input-filter-functions |
1453 |
(concat input "\n")) |
(if no-newline input |
1454 |
|
(concat input "\n"))) |
1455 |
|
|
1456 |
(let ((beg (marker-position pmark)) |
(let ((beg (marker-position pmark)) |
1457 |
(end (1- (point)))) |
(end (if no-newline (point) (1- (point))))) |
1458 |
(when (not (> beg end)) ; handle a special case |
(when (not (> beg end)) ; handle a special case |
1459 |
;; Make an overlay for the input field |
;; Make an overlay for the input field |
1460 |
(let ((over (make-overlay beg end nil nil t))) |
(let ((over (make-overlay beg end nil nil t))) |
1490 |
(set-marker (process-mark proc) (point)) |
(set-marker (process-mark proc) (point)) |
1491 |
;; clear the "accumulation" marker |
;; clear the "accumulation" marker |
1492 |
(set-marker comint-accum-marker nil) |
(set-marker comint-accum-marker nil) |
1493 |
(funcall comint-input-sender proc input) |
(let ((comint-input-sender-no-newline no-newline)) |
1494 |
|
(funcall comint-input-sender proc input)) |
1495 |
|
|
1496 |
;; Optionally delete echoed input (after checking it). |
;; Optionally delete echoed input (after checking it). |
1497 |
(when comint-process-echoes |
(when comint-process-echoes |
1849 |
This just sends STRING plus a newline. To override this, |
This just sends STRING plus a newline. To override this, |
1850 |
set the hook `comint-input-sender'." |
set the hook `comint-input-sender'." |
1851 |
(comint-send-string proc string) |
(comint-send-string proc string) |
1852 |
(comint-send-string proc "\n")) |
(if comint-input-sender-no-newline |
1853 |
|
(if (not (string-equal input "")) |
1854 |
|
(process-send-eof)) |
1855 |
|
(comint-send-string proc "\n"))) |
1856 |
|
|
1857 |
(defun comint-line-beginning-position () |
(defun comint-line-beginning-position () |
1858 |
"Returns the buffer position of the beginning of the line, after any prompt. |
"Returns the buffer position of the beginning of the line, after any prompt. |
2135 |
(defun comint-send-eof () |
(defun comint-send-eof () |
2136 |
"Send an EOF to the current buffer's process." |
"Send an EOF to the current buffer's process." |
2137 |
(interactive) |
(interactive) |
2138 |
(comint-snapshot-last-prompt) |
(comint-send-input t) |
2139 |
(process-send-eof)) |
(process-send-eof)) |
2140 |
|
|
2141 |
|
|