Article View: gnu.emacs.bug
Article #99921emacs shell pwd enhancement
From: David Anderson
Date: Tue, 03 Apr 1990 21:00
Date: Tue, 03 Apr 1990 21:00
47 lines
2196 bytes
2196 bytes
This mail is going here because (obviously) I don't know of a better
place to send it. marick@gswd-vms.arpa, as suggested in shell.el
doesn't seem to exist, and neither does a mailing address for
enhancements. I have a number of other enhancements, which I will
send here unless someone says otherwise. Who is the librarian for
emacs, anyway?
We have a shell script/alias called "xd" that changes the shell's
current directory. Since this confuses emacs' idea of where the shell
is, I added a "shell-pwd-regexp" and function that installs a filter
to parse command output and set the directory appropriately. If this
seems a useful addition to shell-mode, please add it. If not, please
let me know why.
It goes like this:
In shell.el:
(defvar shell-pwd-regexp "pwd"
"*Regexp to match subshell commands equivalent to pwd.")
A new ending for shell-set-directory:
...
((looking-at shell-pwd-regexp)
(set-process-filter (get-buffer-process (current-buffer))
'shell-pwd-filter))))
and a new function:
(defun shell-pwd-filter (proc output)
"Parse a directory from output, \"cd\" to it, and deinstall self"
(goto-char last-input-end)
(insert output)
(move-marker (process-mark (get-buffer-process
(current-buffer))) (point))
(set-process-filter proc nil)
(let ((dir (progn (string-match "\n" output)
(substring output 0 (1- (match-end 0))))))
(if (file-directory-p (setq dir
(expand-file-name dir)))
(cd dir)
(message "dir %s" dir))))
dca@verity.com
Technical Details
Message-ID:
<9004032100.AA23860@aton.verity.com.sun.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!tut.cis.ohio-state.edu!ATON.VERITY.COM!dcaShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,ee41c6d6463cc965,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-04-04 08:32:13 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!tut.cis.ohio-state.edu!ATON.VERITY.COM!dca From: dca@ATON.VERITY.COM (David Anderson) Newsgroups: gnu.emacs.bug Subject: emacs shell pwd enhancement Message-ID: <9004032100.AA23860@aton.verity.com.sun.com> Date: 3 Apr 90 21:00:47 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 47 Posted: Tue Apr 3 22:00:47 1990