comparison lisp/shell.el @ 82765:a8c46cf3e7aa

* comint.el (comint-exec-1): Raise an error if `start-file-process' does not return a process object. * shell.el (shell): Prompt for `default-directory' if it is a remote file name, and if called with a prefix arg.
author Michael Albinus <michael.albinus@gmx.de>
date Wed, 22 Aug 2007 19:47:57 +0000
parents b98604865ea0
children 63012e03e1d4 b83d0dadb2a7
comparison
equal deleted inserted replaced
82764:c865c404d660 82765:a8c46cf3e7aa
509 509
510 ;;;###autoload 510 ;;;###autoload
511 (defun shell (&optional buffer) 511 (defun shell (&optional buffer)
512 "Run an inferior shell, with I/O through BUFFER (which defaults to `*shell*'). 512 "Run an inferior shell, with I/O through BUFFER (which defaults to `*shell*').
513 Interactively, a prefix arg means to prompt for BUFFER. 513 Interactively, a prefix arg means to prompt for BUFFER.
514 If `default-directory' is a remote file name, it is also prompted
515 to change if called with a prefix arg.
516
514 If BUFFER exists but shell process is not running, make new shell. 517 If BUFFER exists but shell process is not running, make new shell.
515 If BUFFER exists and shell process is running, just switch to BUFFER. 518 If BUFFER exists and shell process is running, just switch to BUFFER.
516 Program used comes from variable `explicit-shell-file-name', 519 Program used comes from variable `explicit-shell-file-name',
517 or (if that is nil) from the ESHELL environment variable, 520 or (if that is nil) from the ESHELL environment variable,
518 or (if that is nil) from `shell-file-name'. 521 or (if that is nil) from `shell-file-name'.
538 \(Type \\[describe-mode] in the shell buffer for a list of commands.)" 541 \(Type \\[describe-mode] in the shell buffer for a list of commands.)"
539 (interactive 542 (interactive
540 (list 543 (list
541 (and current-prefix-arg 544 (and current-prefix-arg
542 (read-buffer "Shell buffer: " 545 (read-buffer "Shell buffer: "
543 (generate-new-buffer-name "*shell*"))))) 546 (generate-new-buffer-name "*shell*"))
547 (file-remote-p default-directory)
548 ;; It must be possible to declare a local default-directory.
549 (setq default-directory
550 (expand-file-name
551 (read-file-name
552 "Default directory: " default-directory default-directory
553 t nil 'file-directory-p))))))
544 (setq buffer (get-buffer-create (or buffer "*shell*"))) 554 (setq buffer (get-buffer-create (or buffer "*shell*")))
545 ;; Pop to buffer, so that the buffer's window will be correctly set 555 ;; Pop to buffer, so that the buffer's window will be correctly set
546 ;; when we call comint (so that comint sets the COLUMNS env var properly). 556 ;; when we call comint (so that comint sets the COLUMNS env var properly).
547 (pop-to-buffer buffer) 557 (pop-to-buffer buffer)
548 (unless (comint-check-proc buffer) 558 (unless (comint-check-proc buffer)