Mercurial > emacs
comparison lisp/shell.el @ 14476:63540fa43674
Resync directories properly for the ksh.
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Sat, 03 Feb 1996 13:38:32 +0000 |
parents | 8871d870be84 |
children | 2c508f2c884d |
comparison
equal
deleted
inserted
replaced
14475:d08e488ceb2e | 14476:63540fa43674 |
---|---|
1 ;;; shell.el --- specialized comint.el for running the shell. | 1 ;;; shell.el --- specialized comint.el for running the shell. |
2 | 2 |
3 ;; Copyright (C) 1988, 1993, 1994, 1995 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1988, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Olin Shivers <shivers@cs.cmu.edu> | 5 ;; Author: Olin Shivers <shivers@cs.cmu.edu> |
6 ;; Maintainer: Simon Marshall <simon@gnu.ai.mit.edu> | 6 ;; Maintainer: Simon Marshall <simon@gnu.ai.mit.edu> |
7 ;; Keywords: processes | 7 ;; Keywords: processes |
8 | 8 |
112 Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well. | 112 Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well. |
113 This variable is used to initialise `comint-prompt-regexp' in the | 113 This variable is used to initialise `comint-prompt-regexp' in the |
114 shell buffer. | 114 shell buffer. |
115 | 115 |
116 The pattern should probably not match more than one line. If it does, | 116 The pattern should probably not match more than one line. If it does, |
117 shell-mode may become confused trying to distinguish prompt from input | 117 Shell mode may become confused trying to distinguish prompt from input |
118 on lines which don't start with a prompt. | 118 on lines which don't start with a prompt. |
119 | 119 |
120 This is a fine thing to set in your `.emacs' file.") | 120 This is a fine thing to set in your `.emacs' file.") |
121 | 121 |
122 (defvar shell-completion-fignore nil | 122 (defvar shell-completion-fignore nil |
339 (t "~/.history")))) | 339 (t "~/.history")))) |
340 (if (or (equal comint-input-ring-file-name "") | 340 (if (or (equal comint-input-ring-file-name "") |
341 (equal (file-truename comint-input-ring-file-name) "/dev/null")) | 341 (equal (file-truename comint-input-ring-file-name) "/dev/null")) |
342 (setq comint-input-ring-file-name nil)) | 342 (setq comint-input-ring-file-name nil)) |
343 (setq shell-dirstack-query | 343 (setq shell-dirstack-query |
344 (if (string-match "^k?sh$" shell) "pwd" "dirs"))) | 344 (cond ((string-equal shell "sh") "pwd") |
345 ((string-equal shell "ksh") "echo $PWD ~-") | |
346 (t "dirs")))) | |
345 (run-hooks 'shell-mode-hook) | 347 (run-hooks 'shell-mode-hook) |
346 (comint-read-input-ring t)) | 348 (comint-read-input-ring t)) |
347 | 349 |
348 ;;;###autoload | 350 ;;;###autoload |
349 (defun shell () | 351 (defun shell () |
514 (cond (shell-pushd-tohome | 516 (cond (shell-pushd-tohome |
515 (shell-process-pushd (concat comint-file-name-prefix "~"))) | 517 (shell-process-pushd (concat comint-file-name-prefix "~"))) |
516 (shell-dirstack | 518 (shell-dirstack |
517 (let ((old default-directory)) | 519 (let ((old default-directory)) |
518 (shell-cd (car shell-dirstack)) | 520 (shell-cd (car shell-dirstack)) |
519 (setq shell-dirstack | 521 (setq shell-dirstack (cons old (cdr shell-dirstack))) |
520 (cons old (cdr shell-dirstack))) | |
521 (shell-dirstack-message))) | 522 (shell-dirstack-message))) |
522 (t | 523 (t |
523 (message "Directory stack empty.")))) | 524 (message "Directory stack empty.")))) |
524 ((numberp num) | 525 ((numberp num) |
525 ;; pushd +n | 526 ;; pushd +n |
615 ds)) | 616 ds)) |
616 (setq i (match-end 0))) | 617 (setq i (match-end 0))) |
617 (let ((ds (nreverse ds))) | 618 (let ((ds (nreverse ds))) |
618 (condition-case nil | 619 (condition-case nil |
619 (progn (shell-cd (car ds)) | 620 (progn (shell-cd (car ds)) |
620 (setq shell-dirstack (cdr ds)) | 621 (setq shell-dirstack (cdr ds) |
622 shell-last-dir (car shell-dirstack)) | |
621 (shell-dirstack-message)) | 623 (shell-dirstack-message)) |
622 (error (message "Couldn't cd."))))))) | 624 (error (message "Couldn't cd."))))))) |
623 | 625 |
624 ;;; For your typing convenience: | 626 ;;; For your typing convenience: |
625 (defalias 'dirs 'shell-resync-dirs) | 627 (defalias 'dirs 'shell-resync-dirs) |