changeset 65573:eadf85208391

(shell-resync-dirs): Handle echoing processes more reliably. Don't insert resync command if `comint-process-echoes' is non-nil.
author Romain Francoise <romain@orebokech.com>
date Sat, 17 Sep 2005 18:20:40 +0000
parents 92c9e729c767
children 0ef0421e76a9
files lisp/ChangeLog lisp/shell.el
diffstat 2 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 17 11:36:28 2005 +0000
+++ b/lisp/ChangeLog	Sat Sep 17 18:20:40 2005 +0000
@@ -1,3 +1,9 @@
+2005-09-17  Romain Francoise  <romain@orebokech.com>
+
+	* shell.el (shell-resync-dirs): Handle echoing processes more
+	reliably.  Don't insert resync command if `comint-process-echoes'
+	is non-nil.
+
 2005-09-17  Magnus Henoch  <mange@freemail.hu>
 
 	* textmodes/ispell.el (ispell-aspell-supports-utf8): New variable.
--- a/lisp/shell.el	Sat Sep 17 11:36:28 2005 +0000
+++ b/lisp/shell.el	Sat Sep 17 18:20:40 2005 +0000
@@ -797,19 +797,26 @@
   (let* ((proc (get-buffer-process (current-buffer)))
 	 (pmark (process-mark proc)))
     (goto-char pmark)
-    (insert shell-dirstack-query) (insert "\n")
+    ;; If the process echoes commands, don't insert a fake command in
+    ;; the buffer or it will appear twice.
+    (unless comint-process-echoes
+      (insert shell-dirstack-query) (insert "\n"))
     (sit-for 0) ; force redisplay
     (comint-send-string proc shell-dirstack-query)
     (comint-send-string proc "\n")
     (set-marker pmark (point))
-    (let ((pt (point))) ; wait for 1 line
+    (let ((pt (point))
+	  (regexp
+	   (concat
+	    (if comint-process-echoes
+		;; Skip command echo if the process echoes
+		(concat "\\(" (regexp-quote shell-dirstack-query) "\n\\)")
+	      "\\(\\)")
+	    "\\(.+\n\\)")))
       ;; This extra newline prevents the user's pending input from spoofing us.
       (insert "\n") (backward-char 1)
-      (while (not (looking-at
-		   (concat "\\(" ; skip literal echo in case of stty echo
-			   (regexp-quote shell-dirstack-query)
-			   "\n\\)?" ; skip if present
-			   "\\(" ".+\n" "\\)")) ) ; what to actually look for
+      ;; Wait for one line.
+      (while (not (looking-at regexp))
 	(accept-process-output proc)
 	(goto-char pt)))
     (goto-char pmark) (delete-char 1) ; remove the extra newline