summaryrefslogtreecommitdiff
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-01-02 17:27:32 +0800
committerChong Yidong <cyd@gnu.org>2012-01-02 17:27:32 +0800
commitf75bfc33d63f5087993e9954a71663287ff6ea5c (patch)
tree929eeeefd7a5bbb0dd30aaa58a65172b021c79f1 /lisp/shell.el
parent651e947eb84b9201faa63ff6dc855a8c99ac8018 (diff)
downloademacs-f75bfc33d63f5087993e9954a71663287ff6ea5c.tar.gz
Move shell-dir-cookie-re feature into Dirtrack mode.
* lisp/dirtrack.el (dirtrack-list): Eliminate unused third element. (dirtrack): Merge code for handling relative filenames in prompt from shell-dir-cookie-watcher. (dirtrack-debug-message): New arg to avoid excess format calls. * lisp/shell.el (shell-dir-cookie-re): Variable deleted. (shell-dir-cookie-watcher): Function deleted. (shell-mode): Don't use shell-dir-cookie-re, since it is redundant with dirtrack-mode.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el30
1 files changed, 0 insertions, 30 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index fdfc8b3cf19..7da1add8e9a 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -372,18 +372,6 @@ Thus, this does not include the shell's current directory.")
;;; Basic Procedures
-(defcustom shell-dir-cookie-re nil
- "Regexp matching your prompt, including some part of the current directory.
-If your prompt includes the current directory or the last few elements of it,
-set this to a pattern that matches your prompt and whose subgroup 1 matches
-the directory part of it.
-This is used by `shell-dir-cookie-watcher' to try and use this info
-to track your current directory. It can be used instead of or in addition
-to `dirtrack-mode'."
- :group 'shell
- :type '(choice (const nil) regexp)
- :version "24.1")
-
(defun shell-parse-pcomplete-arguments ()
"Parse whitespace separated arguments in the current region."
(let ((begin (save-excursion (shell-backward-command 1) (point)))
@@ -546,10 +534,6 @@ buffer."
(when (string-equal shell "bash")
(add-hook 'comint-preoutput-filter-functions
'shell-filter-ctrl-a-ctrl-b nil t)))
- (when shell-dir-cookie-re
- ;; Watch for magic cookies in the output to track the current dir.
- (add-hook 'comint-output-filter-functions
- 'shell-dir-cookie-watcher nil t))
(comint-read-input-ring t)))
(defun shell-filter-ctrl-a-ctrl-b (string)
@@ -710,20 +694,6 @@ Otherwise, one argument `-i' is passed to the shell.
;; replace it with a process filter that watches for and strips out
;; these messages.
-(defun shell-dir-cookie-watcher (text)
- ;; This is fragile: the TEXT could be split into several chunks and we'd
- ;; miss it. Oh well. It's a best effort anyway. I'd expect that it's
- ;; rather unusual to have the prompt split into several packets, but
- ;; I'm sure Murphy will prove me wrong.
- (when (and shell-dir-cookie-re (string-match shell-dir-cookie-re text))
- (let ((dir (match-string 1 text)))
- (cond
- ((file-name-absolute-p dir) (shell-cd dir))
- ;; Let's try and see if it seems to be up or down from where we were.
- ((string-match "\\`\\(.*\\)\\(?:/.*\\)?\n\\(.*/\\)\\1\\(?:/.*\\)?\\'"
- (setq text (concat dir "\n" default-directory)))
- (shell-cd (concat (match-string 2 text) dir)))))))
-
(defun shell-directory-tracker (str)
"Tracks cd, pushd and popd commands issued to the shell.
This function is called on each input passed to the shell.