diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/dirtrack.el | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el index d9bd8d3ef39..44185690e9e 100644 --- a/lisp/dirtrack.el +++ b/lisp/dirtrack.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Peter Breton <pbreton@cs.umb.edu> | 5 | ;; Author: Peter Breton <pbreton@cs.umb.edu> |
| 6 | ;; Created: Sun Nov 17 1996 | 6 | ;; Created: Sun Nov 17 1996 |
| 7 | ;; Keywords: processes | 7 | ;; Keywords: processes |
| 8 | ;; Time-stamp: <1998-03-14 09:24:38 pbreton> | 8 | ;; Time-stamp: <1999-02-16 20:48:21 pbreton> |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | 11 | ||
| @@ -258,9 +258,9 @@ forward ones." | |||
| 258 | (defun dirtrack (input) | 258 | (defun dirtrack (input) |
| 259 | (if (null dirtrackp) | 259 | (if (null dirtrackp) |
| 260 | nil | 260 | nil |
| 261 | (let ((prompt-path) | 261 | (let (prompt-path |
| 262 | matched | ||
| 262 | (current-dir default-directory) | 263 | (current-dir default-directory) |
| 263 | (matched) | ||
| 264 | (dirtrack-regexp (nth 0 dirtrack-list)) | 264 | (dirtrack-regexp (nth 0 dirtrack-list)) |
| 265 | (match-num (nth 1 dirtrack-list)) | 265 | (match-num (nth 1 dirtrack-list)) |
| 266 | (multi-line (nth 2 dirtrack-list)) | 266 | (multi-line (nth 2 dirtrack-list)) |
| @@ -269,16 +269,7 @@ forward ones." | |||
| 269 | (if (eq (point) (point-min)) | 269 | (if (eq (point) (point-min)) |
| 270 | nil | 270 | nil |
| 271 | (save-excursion | 271 | (save-excursion |
| 272 | (goto-char (point-max)) | 272 | (setq matched (string-match dirtrack-regexp input))) |
| 273 | ;; Look for the prompt | ||
| 274 | (if multi-line | ||
| 275 | (setq matched | ||
| 276 | (re-search-backward | ||
| 277 | dirtrack-regexp | ||
| 278 | comint-last-output-start | ||
| 279 | t)) | ||
| 280 | (beginning-of-line) | ||
| 281 | (setq matched (looking-at dirtrack-regexp))) | ||
| 282 | ;; No match | 273 | ;; No match |
| 283 | (if (null matched) | 274 | (if (null matched) |
| 284 | (and dirtrack-debug | 275 | (and dirtrack-debug |
| @@ -287,7 +278,7 @@ forward ones." | |||
| 287 | "Input `%s' failed to match regexp: %s" | 278 | "Input `%s' failed to match regexp: %s" |
| 288 | input dirtrack-regexp))) | 279 | input dirtrack-regexp))) |
| 289 | (setq prompt-path | 280 | (setq prompt-path |
| 290 | (buffer-substring-no-properties | 281 | (substring input |
| 291 | (match-beginning match-num) (match-end match-num))) | 282 | (match-beginning match-num) (match-end match-num))) |
| 292 | ;; Empty string | 283 | ;; Empty string |
| 293 | (if (not (> (length prompt-path) 0)) | 284 | (if (not (> (length prompt-path) 0)) |
| @@ -320,7 +311,7 @@ forward ones." | |||
| 320 | (dirtrack-debug-message | 311 | (dirtrack-debug-message |
| 321 | (format "Changing directory to %s" prompt-path))) | 312 | (format "Changing directory to %s" prompt-path))) |
| 322 | (error "Directory %s does not exist" prompt-path))) | 313 | (error "Directory %s does not exist" prompt-path))) |
| 323 | ))))))) | 314 | )))))) |
| 324 | 315 | ||
| 325 | (provide 'dirtrack) | 316 | (provide 'dirtrack) |
| 326 | 317 | ||