diff options
| author | Richard M. Stallman | 2002-01-13 04:43:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-01-13 04:43:12 +0000 |
| commit | 004a541d3a42f8f1930f4228e0ae705a61b9b6bf (patch) | |
| tree | 09e6c0fc013860bc1fcbb7188768cc51fb64f00f | |
| parent | e9cd25fe9de33da7e2fdd905647ec31ae1b8a231 (diff) | |
| download | emacs-004a541d3a42f8f1930f4228e0ae705a61b9b6bf.tar.gz emacs-004a541d3a42f8f1930f4228e0ae705a61b9b6bf.zip | |
(comint-input-sender): Doc fix.
(comint-input-sender-no-newline): New variable.
(comint-simple-send): If comint-input-sender-no-newline,
don't output newline, but maybe send eof.
(comint-send-input): New arg NO-NEWLINE.
(comint-send-eof): Call comint-send-eof with NO-NEWLINE.
| -rw-r--r-- | lisp/comint.el | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index e289166fe94..19046a3b769 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -364,11 +364,15 @@ See also `comint-preoutput-filter-functions'. | |||
| 364 | 364 | ||
| 365 | This variable is buffer-local.") | 365 | This variable is buffer-local.") |
| 366 | 366 | ||
| 367 | (defvar comint-input-sender-no-newline nil | ||
| 368 | "Non-nil directs the `comint-input-sender' function not to send a newline.") | ||
| 369 | |||
| 367 | (defvar comint-input-sender (function comint-simple-send) | 370 | (defvar comint-input-sender (function comint-simple-send) |
| 368 | "Function to actually send to PROCESS the STRING submitted by user. | 371 | "Function to actually send to PROCESS the STRING submitted by user. |
| 369 | Usually this is just `comint-simple-send', but if your mode needs to | 372 | Usually this is just `comint-simple-send', but if your mode needs to |
| 370 | massage the input string, put a different function here. | 373 | massage the input string, put a different function here. |
| 371 | `comint-simple-send' just sends the string plus a newline. | 374 | `comint-simple-send' just sends the string plus a newline. |
| 375 | \(If `comint-input-sender-no-newline' is non-nil, it omits the newline.) | ||
| 372 | This is called from the user command `comint-send-input'.") | 376 | This is called from the user command `comint-send-input'.") |
| 373 | 377 | ||
| 374 | (defcustom comint-eol-on-send t | 378 | (defcustom comint-eol-on-send t |
| @@ -1365,7 +1369,7 @@ Ignore duplicates if `comint-input-ignoredups' is non-nil." | |||
| 1365 | cmd)))) | 1369 | cmd)))) |
| 1366 | (ring-insert comint-input-ring cmd))) | 1370 | (ring-insert comint-input-ring cmd))) |
| 1367 | 1371 | ||
| 1368 | (defun comint-send-input () | 1372 | (defun comint-send-input (&optional no-newline) |
| 1369 | "Send input to process. | 1373 | "Send input to process. |
| 1370 | After the process output mark, sends all text from the process mark to | 1374 | After the process output mark, sends all text from the process mark to |
| 1371 | point as input to the process. Before the process output mark, calls | 1375 | point as input to the process. Before the process output mark, calls |
| @@ -1440,15 +1444,17 @@ Similarly for Soar, Scheme, etc." | |||
| 1440 | (delete-region pmark start) | 1444 | (delete-region pmark start) |
| 1441 | copy)))) | 1445 | copy)))) |
| 1442 | 1446 | ||
| 1443 | (insert ?\n) | 1447 | (unless no-newline |
| 1448 | (insert ?\n)) | ||
| 1444 | 1449 | ||
| 1445 | (comint-add-to-input-history history) | 1450 | (comint-add-to-input-history history) |
| 1446 | 1451 | ||
| 1447 | (run-hook-with-args 'comint-input-filter-functions | 1452 | (run-hook-with-args 'comint-input-filter-functions |
| 1448 | (concat input "\n")) | 1453 | (if no-newline input |
| 1454 | (concat input "\n"))) | ||
| 1449 | 1455 | ||
| 1450 | (let ((beg (marker-position pmark)) | 1456 | (let ((beg (marker-position pmark)) |
| 1451 | (end (1- (point)))) | 1457 | (end (if no-newline (point) (1- (point))))) |
| 1452 | (when (not (> beg end)) ; handle a special case | 1458 | (when (not (> beg end)) ; handle a special case |
| 1453 | ;; Make an overlay for the input field | 1459 | ;; Make an overlay for the input field |
| 1454 | (let ((over (make-overlay beg end nil nil t))) | 1460 | (let ((over (make-overlay beg end nil nil t))) |
| @@ -1484,7 +1490,8 @@ Similarly for Soar, Scheme, etc." | |||
| 1484 | (set-marker (process-mark proc) (point)) | 1490 | (set-marker (process-mark proc) (point)) |
| 1485 | ;; clear the "accumulation" marker | 1491 | ;; clear the "accumulation" marker |
| 1486 | (set-marker comint-accum-marker nil) | 1492 | (set-marker comint-accum-marker nil) |
| 1487 | (funcall comint-input-sender proc input) | 1493 | (let ((comint-input-sender-no-newline no-newline)) |
| 1494 | (funcall comint-input-sender proc input)) | ||
| 1488 | 1495 | ||
| 1489 | ;; Optionally delete echoed input (after checking it). | 1496 | ;; Optionally delete echoed input (after checking it). |
| 1490 | (when comint-process-echoes | 1497 | (when comint-process-echoes |
| @@ -1842,7 +1849,10 @@ If this takes us past the end of the current line, don't skip at all." | |||
| 1842 | This just sends STRING plus a newline. To override this, | 1849 | This just sends STRING plus a newline. To override this, |
| 1843 | set the hook `comint-input-sender'." | 1850 | set the hook `comint-input-sender'." |
| 1844 | (comint-send-string proc string) | 1851 | (comint-send-string proc string) |
| 1845 | (comint-send-string proc "\n")) | 1852 | (if comint-input-sender-no-newline |
| 1853 | (if (not (string-equal input "")) | ||
| 1854 | (process-send-eof)) | ||
| 1855 | (comint-send-string proc "\n"))) | ||
| 1846 | 1856 | ||
| 1847 | (defun comint-line-beginning-position () | 1857 | (defun comint-line-beginning-position () |
| 1848 | "Returns the buffer position of the beginning of the line, after any prompt. | 1858 | "Returns the buffer position of the beginning of the line, after any prompt. |
| @@ -2125,7 +2135,7 @@ Sends an EOF only if point is at the end of the buffer and there is no input." | |||
| 2125 | (defun comint-send-eof () | 2135 | (defun comint-send-eof () |
| 2126 | "Send an EOF to the current buffer's process." | 2136 | "Send an EOF to the current buffer's process." |
| 2127 | (interactive) | 2137 | (interactive) |
| 2128 | (comint-snapshot-last-prompt) | 2138 | (comint-send-input t) |
| 2129 | (process-send-eof)) | 2139 | (process-send-eof)) |
| 2130 | 2140 | ||
| 2131 | 2141 | ||