]> code.delx.au - gnu-emacs/blobdiff - lisp/comint.el
(compilation-error-regexp-alist): Make separate
[gnu-emacs] / lisp / comint.el
index 010889678ff340406aef6217ccac74e2af21067a..d8c51121de07728e297071364b457c9ad32fa124 100644 (file)
@@ -69,8 +69,8 @@
 ;;; 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
@@ -219,6 +219,10 @@ appears in the buffer.
 
 This variable is buffer-local.")
 
+(defvar comint-password-prompt-regexp "\\b[Pp]assword:\\s *\\'"
+  "*Regexp matching prompts for passwords in the inferior process.
+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)
   "Function that returns old text in comint mode.
@@ -396,7 +400,7 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
   (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)
@@ -1137,11 +1141,13 @@ Similarly for Soar, Scheme, etc."
            (while functions
              (funcall (car functions) (concat input "\n"))
              (setq functions (cdr functions))))
-         (funcall comint-input-sender proc input)
          (setq comint-input-ring-index nil)
+         ;; Update the markers before we send the input
+         ;; in case we get output amidst sending the input.
          (set-marker comint-last-input-start pmark)
          (set-marker comint-last-input-end (point))
          (set-marker (process-mark proc) (point))
+         (funcall comint-input-sender proc input)
          (comint-output-filter proc "")))))
 
 ;; The purpose of using this filter for comint processes
@@ -1309,10 +1315,7 @@ set the hook `comint-input-sender'."
 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)))
@@ -1387,10 +1390,11 @@ Security bug: your string can still be temporarily recovered with
 (defun comint-watch-for-password-prompt (string) 
   "Prompt in the minibuffer for password and send without echoing.
 This function uses `send-invisible' to read and send a password to the buffer's
-process if STRING contains a password prompt (matches \"^[Pp]assword:\\\\s *\\\\'\").
+process if STRING contains a password prompt defined by 
+`comint-password-prompt-regexp'.
 
 This function could be in the list `comint-output-filter-functions'."
-  (if (string-match "^[Pp]assword:\\s *\\'" string)
+  (if (string-match comint-password-prompt-regexp string)
       (send-invisible nil)))
 \f
 ;;; Low-level process communication
@@ -1987,7 +1991,7 @@ Typing SPC flushes the help buffer."
            (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
 ;;; ===========================================================================