[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shell.el: M-x dirs can't cope with stty echo mode

From: era eriksson
Subject: shell.el: M-x dirs can't cope with stty echo mode
Date: Thu, 5 Jun 2003 09:32:53 +0300

This bug report will be sent to the Free Software Foundation,
 not to your local site managers!!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

In GNU Emacs 20.7.2 (i386-debian-linux-gnu, X toolkit)
 of Fri Apr  5 2002 on cyberhq modified by Debian
configured using `configure  i386-debian-linux-gnu --prefix=/usr 
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib 
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --with-x=yes 

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I find myself running shell under script(1) inside emacs a lot. In this
setting, getting a copy of my own typing into the typescript requires
that I issue a "stty echo" before I start script(1). [Maybe other
workarounds are possible. Any suggestions gratefully accepted.]

Unfortunately, the shell.el directory tracking is hardwired to always
read the first line of output from the `shell-dirstack-query' command;
however, when stty echo mode is active, the first line of apparent
output is of course the echo itself, not actual output from the

I have created a small patch which teaches `shell-resync-dirs' to
tolerate an extra line of output before the list of directories from
`shell-dirstack-query'. It looks for, and ignores, a literal copy of
the value of shell-dirstack-query, which may not be general enough for
all cases, but it works for me.

The patch is against 20.7, which is of course not the newest version.
I checked on Savannah and it appears that this part of shell.el is
still the same in your CVS, although the line number offsets are
obviously likely to be different.

Hope this helps,

/* era */

--- 20.7/lisp/shell.el  Mon May 17 09:14:36 1999
+++ mine/lisp/shell.el  Thu Jun  5 09:29:11 2003
@@ -691,12 +691,16 @@
     (let ((pt (point))) ; wait for 1 line
       ;; This extra newline prevents the user's pending input from spoofing us.
       (insert "\n") (backward-char 1)
-      (while (not (looking-at ".+\n"))
+      (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
        (accept-process-output proc)
        (goto-char pt)))
     (goto-char pmark) (delete-char 1) ; remove the extra newline
     ;; That's the dirlist. grab it & parse it.
-    (let* ((dl (buffer-substring (match-beginning 0) (1- (match-end 0))))
+    (let* ((dl (buffer-substring (match-beginning 2) (1- (match-end 2))))
           (dl-len (length dl))
           (ds '())                     ; new dir stack
           (i 0))
Join the civilized world -- ban spam like we did! <http://www.euro.cauce.org/>
   tee -a $HOME/.signature <$HOME/.plan >http://www.iki.fi/era/index.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]