aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-02-01 20:26:01 +0000
committerRichard M. Stallman1997-02-01 20:26:01 +0000
commit8e717a4544299147028b7dcabfba51bc8a66a0ac (patch)
tree4a6a6580b71e4cfd7cf4b6c61449df9e1fac2f3d
parent35f58ede930834a5bb44aea3434234155e07078b (diff)
downloademacs-8e717a4544299147028b7dcabfba51bc8a66a0ac.tar.gz
emacs-8e717a4544299147028b7dcabfba51bc8a66a0ac.zip
(dirtrack-debug-message): Put output at end of buffer.
(dirtrack): Check that directory exists before trying to cd to it. Go to point-max (not comint-last-output-start) before looking for the prompt.
-rw-r--r--lisp/dirtrack.el33
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index 9f289f31fba..e5c8eb1e9df 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -5,7 +5,7 @@
5;; Author: Peter Breton 5;; Author: Peter Breton
6;; Created: Sun Nov 17 1996 6;; Created: Sun Nov 17 1996
7;; Keywords: processes 7;; Keywords: processes
8;; Time-stamp: <96/12/26 09:23:01 peter> 8;; Time-stamp: <97/02/01 20:35:06 peter>
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -170,6 +170,7 @@ forward ones."
170 (debug-buf (get-buffer-create dirtrack-debug-buffer)) 170 (debug-buf (get-buffer-create dirtrack-debug-buffer))
171 ) 171 )
172 (set-buffer debug-buf) 172 (set-buffer debug-buf)
173 (goto-char (point-max))
173 (insert (concat string "\n")) 174 (insert (concat string "\n"))
174 (set-buffer buf) 175 (set-buffer buf)
175 )) 176 ))
@@ -181,7 +182,7 @@ forward ones."
181 (let ((prompt-path) 182 (let ((prompt-path)
182 (current-dir default-directory) 183 (current-dir default-directory)
183 (matched) 184 (matched)
184 (dirtrack-regexp (nth 0 dirtrack-list)) 185 (dirtrack-regexp (nth 0 dirtrack-list))
185 (match-num (nth 1 dirtrack-list)) 186 (match-num (nth 1 dirtrack-list))
186 (multi-line (nth 2 dirtrack-list)) 187 (multi-line (nth 2 dirtrack-list))
187 ) 188 )
@@ -189,16 +190,14 @@ forward ones."
189 (if (eq (point) (point-min)) 190 (if (eq (point) (point-min))
190 nil 191 nil
191 (save-excursion 192 (save-excursion
192 (goto-char comint-last-output-start) 193 (goto-char (point-max))
193 ;; Look for the prompt 194 ;; Look for the prompt
194 (if multi-line 195 (if multi-line
195 (and 196 (setq matched
196 (goto-char (point-max)) 197 (re-search-backward
197 (setq matched 198 dirtrack-regexp
198 (re-search-backward 199 comint-last-output-start
199 dirtrack-regexp 200 t))
200 comint-last-output-start
201 t)))
202 (beginning-of-line) 201 (beginning-of-line)
203 (setq matched (looking-at dirtrack-regexp))) 202 (setq matched (looking-at dirtrack-regexp)))
204 ;; No match 203 ;; No match
@@ -232,11 +231,15 @@ forward ones."
232 (and dirtrack-debug 231 (and dirtrack-debug
233 (dirtrack-debug-message 232 (dirtrack-debug-message
234 (format "Not changing directory"))) 233 (format "Not changing directory")))
235 ;; Change directory 234 ;; It's possible that Emacs will think the directory
236 (shell-process-cd prompt-path) 235 ;; won't exist (eg, rlogin buffers)
237 (and dirtrack-debug 236 (if (file-accessible-directory-p prompt-path)
238 (dirtrack-debug-message 237 ;; Change directory
239 (format "Changing directory to %s" prompt-path)))) 238 (and (shell-process-cd prompt-path)
239 dirtrack-debug
240 (dirtrack-debug-message
241 (format "Changing directory to %s" prompt-path)))
242 (error "Directory %s does not exist" prompt-path)))
240 ))))))) 243 )))))))
241 244
242(provide 'dirtrack) 245(provide 'dirtrack)