]> code.delx.au - gnu-emacs/blobdiff - lisp/comint.el
(rmail-summary-get-new-mail): Don't call rmail-summary-goto-msg if msg is 0.
[gnu-emacs] / lisp / comint.el
index de0d63a50dbe8c624a4896341fce5472a7289296..4d5d1a14bfe0979d6b3562bfefe4f3e19536e6eb 100644 (file)
 ;;;     comint-input-filter-functions - hook     process-in-a-buffer
 ;;;     comint-output-filter-functions - hook    function modes.
 ;;;     comint-input-filter     - function         ...
-;;;     comint-input-send      - function         ...
+;;;     comint-input-sender    - function         ...
 ;;;     comint-eol-on-send     - boolean          ...
 ;;;     comint-process-echoes   - boolean          ...
 ;;;     comint-scroll-to-bottom-on-input - symbol For scroll behavior
@@ -226,7 +226,7 @@ appears in the buffer.
 This variable is buffer-local.")
 
 (defvar comint-password-prompt-regexp
-  "\\(^[Pp]assword\\|pass phrase\\):\\s *\\'"
+  "\\(\\([Oo]ld \\|[Nn]ew \\|^\\)[Pp]assword\\|pass phrase\\):\\s *\\'"
   "*Regexp matching prompts for passwords in the inferior process.
 This is used by `comint-watch-for-password-prompt'.")
 
@@ -376,10 +376,10 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
   (make-local-variable 'comint-input-autoexpand)
   (make-local-variable 'comint-input-ignoredups)
   (make-local-variable 'comint-delimiter-argument-list)
-  (make-local-variable 'comint-dynamic-complete-functions)
+  (make-local-hook 'comint-dynamic-complete-functions)
   (make-local-variable 'comint-completion-fignore)
   (make-local-variable 'comint-get-old-input)
-  (make-local-variable 'comint-input-filter-functions)
+  (make-local-hook 'comint-input-filter-functions)
   (make-local-variable 'comint-input-filter)
   (make-local-variable 'comint-input-sender)
   (make-local-variable 'comint-eol-on-send)
@@ -388,7 +388,7 @@ Entry to this mode runs the hooks on `comint-mode-hook'."
   (make-local-variable 'comint-scroll-show-maximum-output)
   (make-local-variable 'pre-command-hook)
   (add-hook 'pre-command-hook 'comint-preinput-scroll-to-bottom)
-  (make-local-variable 'comint-output-filter-functions)
+  (make-local-hook 'comint-output-filter-functions)
   (make-local-variable 'comint-ptyp)
   (make-local-variable 'comint-exec-hook)
   (make-local-variable 'comint-process-echoes)
@@ -587,10 +587,11 @@ buffer.  The hook `comint-exec-hook' is run after each exec."
          ;; Some programs that use terminfo get very confused
          ;; if TERM is not a valid terminal type.
          (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
-             (list "EMACS=t" "TERM=unknown"
+             (list "TERM=unknown"
                    (format "COLUMNS=%d" (frame-width)))
-           (list "EMACS=t" "TERM=emacs"
+           (list "TERM=emacs"
                  (format "TERMCAP=emacs:co#%d:tc=unknown:" (frame-width))))
+         (if (getenv "EMACS") nil (list "EMACS=t"))
          process-environment))
        (default-directory
          (if (file-directory-p default-directory)
@@ -1176,10 +1177,8 @@ Similarly for Soar, Scheme, etc."
                       (not (string-equal (ring-ref comint-input-ring 0)
                                          history))))
              (ring-insert comint-input-ring history))
-         (let ((functions comint-input-filter-functions))
-           (while functions
-             (funcall (car functions) (concat input "\n"))
-             (setq functions (cdr functions))))
+         (run-hook-with-args 'comint-input-filter-functions
+                             (concat input "\n"))
          (setq comint-input-ring-index nil)
          ;; Update the markers before we send the input
          ;; in case we get output amidst sending the input.
@@ -1229,10 +1228,7 @@ Similarly for Soar, Scheme, etc."
 
          (narrow-to-region obeg oend)
          (goto-char opoint)
-         (let ((functions comint-output-filter-functions))
-           (while functions
-             (funcall (car functions) string)
-             (setq functions (cdr functions))))
+         (run-hook-with-args 'comint-output-filter-functions string)
          (set-buffer obuf)))))
 
 (defun comint-preinput-scroll-to-bottom ()
@@ -1478,7 +1474,7 @@ Does not delete the prompt."
                          (beginning-of-line nil)
                          (point-marker))))
        (delete-region comint-last-input-end pmark)
-       (comint-skip-prompt)
+       (goto-char (process-mark proc))
        (setq replacement (concat "*** output flushed ***\n"
                                  (buffer-substring pmark (point))))
        (delete-region pmark (point))))
@@ -1848,10 +1844,15 @@ inside of a \"[...]\" (see `skip-chars-forward')."
     (let ((non-word-chars (concat "[^\\\\" word-chars "]")) (here (point)))
       (while (and (re-search-backward non-word-chars nil 'move)
                  ;(memq (char-after (point)) shell-file-name-quote-list)
-                 (not (bolp)) (eq (char-after (1- (point))) ?\\))
+                 (eq (preceding-char) ?\\))
        (backward-char 1))
-      (forward-char 1)
-      (and (< (point) here) (buffer-substring (point) here)))))
+      ;; Don't go forward over a word-char (this can happen if we're at bob).
+      (if (or (not (bobp)) (looking-at non-word-chars))
+         (forward-char 1))
+      ;; Set match-data to match the entire string.
+      (if (< (point) here)
+         (progn (store-match-data (list (point) here))
+                (match-string 0))))))
 
 
 (defun comint-match-partial-filename ()
@@ -1890,9 +1891,7 @@ Calls the functions in `comint-dynamic-complete-functions' to perform
 completion until a function returns non-nil, at which point completion is
 assumed to have occurred."
   (interactive)
-  (let ((functions comint-dynamic-complete-functions))
-    (while (and functions (null (funcall (car functions))))
-      (setq functions (cdr functions)))))
+  (run-hook-with-args-until-success 'comint-dynamic-complete-functions))
 
 
 (defun comint-dynamic-complete-filename ()