aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/shell.el
diff options
context:
space:
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.")
372 372
373;;; Basic Procedures 373;;; Basic Procedures
374 374
375(defcustom shell-dir-cookie-re nil
376 "Regexp matching your prompt, including some part of the current directory.
377If your prompt includes the current directory or the last few elements of it,
378set this to a pattern that matches your prompt and whose subgroup 1 matches
379the directory part of it.
380This is used by `shell-dir-cookie-watcher' to try and use this info
381to track your current directory. It can be used instead of or in addition
382to `dirtrack-mode'."
383 :group 'shell
384 :type '(choice (const nil) regexp)
385 :version "24.1")
386
387(defun shell-parse-pcomplete-arguments () 375(defun shell-parse-pcomplete-arguments ()
388 "Parse whitespace separated arguments in the current region." 376 "Parse whitespace separated arguments in the current region."
389 (let ((begin (save-excursion (shell-backward-command 1) (point))) 377 (let ((begin (save-excursion (shell-backward-command 1) (point)))
@@ -546,10 +534,6 @@ buffer."
546 (when (string-equal shell "bash") 534 (when (string-equal shell "bash")
547 (add-hook 'comint-preoutput-filter-functions 535 (add-hook 'comint-preoutput-filter-functions
548 'shell-filter-ctrl-a-ctrl-b nil t))) 536 'shell-filter-ctrl-a-ctrl-b nil t)))
549 (when shell-dir-cookie-re
550 ;; Watch for magic cookies in the output to track the current dir.
551 (add-hook 'comint-output-filter-functions
552 'shell-dir-cookie-watcher nil t))
553 (comint-read-input-ring t))) 537 (comint-read-input-ring t)))
554 538
555(defun shell-filter-ctrl-a-ctrl-b (string) 539(defun shell-filter-ctrl-a-ctrl-b (string)
@@ -710,20 +694,6 @@ Otherwise, one argument `-i' is passed to the shell.
710;; replace it with a process filter that watches for and strips out 694;; replace it with a process filter that watches for and strips out
711;; these messages. 695;; these messages.
712 696
713(defun shell-dir-cookie-watcher (text)
714 ;; This is fragile: the TEXT could be split into several chunks and we'd
715 ;; miss it. Oh well. It's a best effort anyway. I'd expect that it's
716 ;; rather unusual to have the prompt split into several packets, but
717 ;; I'm sure Murphy will prove me wrong.
718 (when (and shell-dir-cookie-re (string-match shell-dir-cookie-re text))
719 (let ((dir (match-string 1 text)))
720 (cond
721 ((file-name-absolute-p dir) (shell-cd dir))
722 ;; Let's try and see if it seems to be up or down from where we were.
723 ((string-match "\\`\\(.*\\)\\(?:/.*\\)?\n\\(.*/\\)\\1\\(?:/.*\\)?\\'"
724 (setq text (concat dir "\n" default-directory)))
725 (shell-cd (concat (match-string 2 text) dir)))))))
726
727(defun shell-directory-tracker (str) 697(defun shell-directory-tracker (str)
728 "Tracks cd, pushd and popd commands issued to the shell. 698 "Tracks cd, pushd and popd commands issued to the shell.
729This function is called on each input passed to the shell. 699This function is called on each input passed to the shell.