Path: utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!+ From: shivers@cs.cmu.edu (Olin Shivers) Newsgroups: comp.emacs Subject: Re: cmushell-mode Message-ID: Date: 25 Feb 90 06:34:17 GMT Organization: Carnegie Mellon, Pittsburgh, PA Lines: 57 From: scott@grlab.UUCP (Scott Blachowicz) Newsgroups: comp.emacs Date: 21 Feb 90 15:35:59 GMT Is it possible to have the shell mode re-sync its current-directory on a pwd command? Either by recognizing that a pwd command was typed or by a key-binding that somehow figures it out (send a pwd command and get the response)? Maybe there could be a regexp that describes what a "pwd" command will look like that gets matched against the command. Now, I don't know enough to know how possible it would be to grab the command's output (if it can even be reliably identified). It is not possible to reliably track the current working directory %100 of the time. Forget it. You can always run some random program under your shell that takes "cd" or "pwd" arguments and does strange things with them; the gnumacs code will never know this. FTP's "cd" command is one example. Stuffing a "dirs" or "pwd" command to the shell and analysing the result is just as ugly and fragile a hack, for similar reasons. That's why I haven't put these things into cmushell mode. The attitude you have to take in situations like this is that simple heuristics like cd/pushd/popd tracking will get you 95% of the cases, and for the rest, you just have to reset the buffer's idea of where you are with a M-x cd command. Don't stress out about it. Does the new directory tracking stuff allow me to say "cd -" to "goto the previous directory"? My ksh allows that (actually, I think it's a bunch of functions that get loaded up that do it). I don't use ksh, so I'm not familiar enough with it to hack in ksh-specific things. That's a fine idea, though, and you should not find it very hard to modify the standard directory-tracking function to handle this case. -Could it recognize a "Password:" prompt at the beginning of a line and not echo the chars? or is there a better way to get a super-user shell? Comint provides a general send-invisible command for entering text that should be sent to a process but should not be echoed. M-x send-invisible return is what you do when you're prompted for your password, for instance. -A lot of times, when I run an interactive command I start getting commands echoed back at me, and sometimes "^M" at the end of each line... Would this be because the command is doing some stty/ioctl commands? Anyone know of the magic incantation to give stty to correct things? Either the command or your shell has decided to do echoing in raw/cbreak mode. If you can turn this off, you win. At CMU, we run a locally-developed shell that does line-editing, command history and filename completion. There are a lot of shells like it: ksh, tcsh, I don't know -- a bunch. The point is, this shell puts the tty in raw mode, so when you run it under emacs in cmushell mode, it echoes everything, and tosses in ^M's as well. The solution is make sure that cmushell runs the vanilla /bin/csh that doesn't do any of this stuff, which you arrange with (setq explicit-shell-file-name "/bin/csh") in your .emacs. -Olin