help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: shell mode, changing directory


From: Alan Shutko
Subject: Re: shell mode, changing directory
Date: Fri, 21 Mar 2003 19:53:02 GMT
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50 (gnu/linux)

>>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).

Here's a sample for this request.  It shouldn't be too hard to
generalize this.

(defun change-shell-wd-to-current ()
  "Change the directory of the *shell* buffer to the current directory"
  (interactive)
  (save-excursion
    (let ((command (concat "cd " default-directory))
          (process (get-buffer-process "*shell*")))
      (set-buffer "*shell*")
      (goto-char (point-max))
      (insert command)
      (comint-send-input))))

-- 
Alan Shutko <ats@acm.org> - I am the rocks.
Looking for a developer in St. Louis? http://web.springies.com/~ats/
"Why should I stop just because I've had more than enough?" Draco F.


reply via email to

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