From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Piet van Oostrum Newsgroups: gmane.emacs.help Subject: Re: shell mode, changing directory Date: 22 Mar 2003 10:42:23 +0100 Organization: Dept of Computer Science, Utrecht University, The Netherlands Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1048333023 30739 80.91.224.249 (22 Mar 2003 11:37:03 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 22 Mar 2003 11:37:03 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 22 12:37:02 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18whJ8-0007zV-00 for ; Sat, 22 Mar 2003 12:37:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18whIX-0002SR-02 for gnu-help-gnu-emacs@m.gmane.org; Sat, 22 Mar 2003 06:36:25 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!uni-erlangen.de!elvis.franken.de!chico.franken.de!news.franken.de!news.nl.linux.org!humbolt.nl.linux.org!phil.uu.nl!cs.uu.nl!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 65 Original-NNTP-Posting-Host: modena.cs.uu.nl Original-X-Trace: june.cs.uu.nl 1048332210 4102 131.211.80.35 (22 Mar 2003 11:23:30 GMT) Original-X-Complaints-To: news@cs.uu.nl Original-NNTP-Posting-Date: Sat, 22 Mar 2003 11:23:30 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:111309 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7808 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7808 --=-=-= >>>>> "Bingham, Jay" (BJ) wrote: BJ> On Friday, March 21, 2003 12:23 PM Alan Shutko wrote: >> Phillip Lord writes: >> Specifically I want to write two commands. The first is "move CWD of shell >> to the same as the file of the current buffer" (currently you can achieve >> this, by killing the *shell* buffer, and typing M-x shell). And secondly I >> want to be able to use the ECB's >> (ecb.sourceforge.net) directory window, to move shells CWD. [snip] BJ> I hope that this helps clarify his needs. I use myself a slightly different approach, which in fact might even be more confortable: I have a command that starts a shell in the current directory which encodes the directory name in the buffer name. If there is already a shell running in the current directory it uses that buffer rather than starting a new one. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=sh.el ;sh.el (require 'shell) (defun sh (dir) "Run an inferior shell. The shell runs in and the buffer name reflects DIRECTORY (default current working directory). Prompts for directory name if interactively called with prefix arg. The buffer is put in cmushell-mode, giving commands for sending input and controlling the subjobs of the shell. See cmushell-mode." (interactive (list (if current-prefix-arg (read-file-name "sh in dir: " nil default-directory t)))) (setq dir (file-name-as-directory (expand-file-name (or dir default-directory)))) (let* ((prog (or explicit-shell-file-name (getenv "ESHELL") shell-file-name "/bin/sh")) (bufname (concat "*" (file-name-nondirectory prog) "-" dir "*")) (buffer (get-buffer-create bufname)) (process-connection-type t)) (shell buffer))) --=-=-= -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: P.van.Oostrum@hccnet.nl --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnu-emacs --=-=-=--