/[emacs]/emacs/lisp/comint.el
ViewVC logotype

Diff of /emacs/lisp/comint.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.257 by rms, Sat Jan 12 06:59:02 2002 UTC revision 1.258 by rms, Sun Jan 13 04:43:12 2002 UTC
# Line 364  See also `comint-preoutput-filter-functi Line 364  See also `comint-preoutput-filter-functi
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
# Line 1365  Ignore duplicates if `comint-input-ignor Line 1369  Ignore duplicates if `comint-input-ignor
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
# Line 1440  Similarly for Soar, Scheme, etc." Line 1444  Similarly for Soar, Scheme, etc."
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)))
# Line 1484  Similarly for Soar, Scheme, etc." Line 1490  Similarly for Soar, Scheme, etc."
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
# Line 1842  If this takes us past the end of the cur Line 1849  If this takes us past the end of the cur
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.
# Line 2125  Sends an EOF only if point is at the end Line 2135  Sends an EOF only if point is at the end
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    

Legend:
Removed from v.1.257  
changed lines
  Added in v.1.258

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26