;;; m-s comint-next-matching-input Next input that matches
;;; m-c-l comint-show-output Show last batch of process output
;;; return comint-send-input
-;;; c-a comint-bol Beginning of line; skip prompt
;;; c-d comint-delchar-or-maybe-eof Delete char unless at end of buff
+;;; c-c c-a comint-bol Beginning of line; skip prompt
;;; c-c c-u comint-kill-input ^u
;;; c-c c-w backward-kill-word ^w
;;; c-c c-c comint-interrupt-subjob ^c
This variable is buffer-local.")
-(defvar comint-password-prompt-regexp "\\b[Pp]assword:\\s *\\'"
+(defvar comint-password-prompt-regexp
+ "\\(^[Pp]assword\\|pass phrase\\):\\s *\\'"
"*Regexp matching prompts for passwords in the inferior process.
-This is used by comint-watch-for-password-prompt.")
+This is used by `comint-watch-for-password-prompt'.")
;;; Here are the per-interpreter hooks.
(defvar comint-get-old-input (function comint-get-old-input-default)
(define-key comint-mode-map "\e\C-l" 'comint-show-output)
(define-key comint-mode-map "\C-m" 'comint-send-input)
(define-key comint-mode-map "\C-d" 'comint-delchar-or-maybe-eof)
- (define-key comint-mode-map "\C-a" 'comint-bol)
+ (define-key comint-mode-map "\C-c\C-a" 'comint-bol)
(define-key comint-mode-map "\C-c\C-u" 'comint-kill-input)
(define-key comint-mode-map "\C-c\C-w" 'backward-kill-word)
(define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob)
Also, a run of one or more of a single character
in `comint-delimiter-argument-list' is a separate argument.
Argument 0 is the command name."
- (let ((arg "\\(\\(\"[^\"]*\"\\|\'[^\']*\'\\|\`[^\`]*\`\\)\\|\\S \\)+")
- (args ()) (pos 0) (str nil))
- ;; We build a list of all the args. Unnecessary, but more efficient, when
- ;; ranges of args are required, than picking out one by one and recursing.
- (while (string-match arg string pos)
- (setq pos (match-end 0)
- str (substring string (match-beginning 0) pos)
- ;; (match-end 2) is non-nil if we found quotes.
- args (if (match-end 2) (cons str args)
- (nconc (comint-delim-arg str) args))))
- (let ((n (or nth (1- (length args))))
- (m (if mth (1- (- (length args) mth)) 0)))
+ (let ((argpart "[^ \n\t\"'`]+\\|\\(\"[^\"]*\"\\|'[^']*'\\|`[^`]*`\\)")
+ (args ()) (pos 0)
+ (count 0)
+ beg str value quotes)
+ ;; Build a list of all the args until we have as many as we want.
+ (while (and (or (null mth) (<= count mth))
+ (string-match argpart string pos))
+ (if (and beg (= pos (match-beginning 0)))
+ ;; It's contiguous, part of the same arg.
+ (setq pos (match-end 0)
+ quotes (or quotes (match-beginning 1)))
+ ;; It's a new separate arg.
+ (if beg
+ ;; Put the previous arg, if there was one, onto ARGS.
+ (setq str (substring string beg pos)
+ args (if quotes (cons str args)
+ (nconc (comint-delim-arg str) args))
+ count (1+ count)))
+ (setq quotes (match-beginning 1))
+ (setq beg (match-beginning 0))
+ (setq pos (match-end 0))))
+ (if beg
+ (setq str (substring string beg pos)
+ args (if quotes (cons str args)
+ (nconc (comint-delim-arg str) args))
+ count (1+ count)))
+ (let ((n (or nth (1- count)))
+ (m (if mth (1- (- count mth)) 0)))
(mapconcat
(function (lambda (a) a)) (nthcdr n (nreverse (nthcdr m args))) " "))))
\f
If prefix argument is given (\\[universal-argument]) the prompt is not skipped.
The prompt skip is done by skipping text matching the regular expression
-`comint-prompt-regexp', a buffer local variable.
-
-If you don't like this command, bind C-a to `beginning-of-line'
-in your hook, `comint-mode-hook'."
+`comint-prompt-regexp', a buffer local variable."
(interactive "P")
(beginning-of-line)
(if (null arg) (comint-skip-prompt)))
\f
;;; Low-level process communication
-(defvar comint-input-chunk-size 512
- "*Long inputs are sent to comint processes in chunks of this size.
-If your process is choking on big inputs, try lowering the value.")
-
-(defun comint-send-string (proc str)
- "Send PROCESS the contents of STRING as input.
-This is equivalent to `process-send-string', except that long input strings
-are broken up into chunks of size `comint-input-chunk-size'. Processes
-are given a chance to output between chunks. This can help prevent processes
-from hanging when you send them long inputs on some OS's."
- (let* ((len (length str))
- (i (min len comint-input-chunk-size)))
- (process-send-string proc (substring str 0 i))
- (while (< i len)
- (let ((next-i (+ i comint-input-chunk-size)))
- (accept-process-output)
- (sit-for 0)
- (process-send-string proc (substring str i (min len next-i)))
- (setq i next-i)))))
-
-(defun comint-send-region (proc start end)
- "Sends to PROC the region delimited by START and END.
-This is a replacement for `process-send-region' that tries to keep
-your process from hanging on long inputs. See `comint-send-string'."
- (comint-send-string proc (buffer-substring start end)))
+(defalias 'comint-send-string 'process-send-string)
+(defalias 'comint-send-region 'process-send-region)
\f
;;; Random input hackage
(set-window-configuration conf))
(if (eq first ?\ )
(set-window-configuration conf)
- (setq unread-command-events (append key nil)))))))
+ (setq unread-command-events (listify-key-sequence key)))))))
\f
;;; Converting process modes to use comint mode
;;; ===========================================================================