- (multi-line (nth 2 dirtrack-list))
- )
- ;; No output?
- (if (eq (point) (point-min))
- nil
- (save-excursion
- (goto-char (point-max))
- ;; Look for the prompt
- (if multi-line
- (setq matched
- (re-search-backward
- dirtrack-regexp
- comint-last-output-start
- t))
- (beginning-of-line)
- (setq matched (looking-at dirtrack-regexp)))
- ;; No match
- (if (null matched)
- (and dirtrack-debug
- (dirtrack-debug-message
- (format
- "Failed to match regexp: %s"
- dirtrack-regexp)))
- (setq prompt-path
- (buffer-substring-no-properties
- (match-beginning match-num) (match-end match-num)))
- ;; Empty string
- (if (not (> (length prompt-path) 0))
- (and dirtrack-debug
- (dirtrack-debug-message "Match is empty string"))
- ;; Transform prompts into canonical forms
- (setq prompt-path (funcall dirtrack-directory-function
- prompt-path))
- (setq current-dir (funcall dirtrack-canonicalize-function
- current-dir))
- (and dirtrack-debug
- (dirtrack-debug-message
- (format
- "Prompt is %s\nCurrent directory is %s"
- prompt-path current-dir)))
- ;; Compare them
- (if (or (string= current-dir prompt-path)
- (string= current-dir
- (abbreviate-file-name prompt-path)))
- (and dirtrack-debug
- (dirtrack-debug-message
- (format "Not changing directory")))
- ;; It's possible that Emacs will think the directory
- ;; won't exist (eg, rlogin buffers)
- (if (file-accessible-directory-p prompt-path)
- ;; Change directory
- (and (shell-process-cd prompt-path)
- dirtrack-debug
- (dirtrack-debug-message
- (format "Changing directory to %s" prompt-path)))
- (error "Directory %s does not exist" prompt-path)))
- )))))))
+ ;; Currently unimplemented, it seems. --Stef
+ (multi-line (nth 2 dirtrack-list)))
+ (save-excursion
+ ;; No match
+ (if (not (string-match dirtrack-regexp input))
+ (dirtrack-debug-message
+ (format "Input `%s' failed to match `dirtrack-regexp'" input))
+ (setq prompt-path (match-string match-num input))
+ ;; Empty string
+ (if (not (> (length prompt-path) 0))
+ (dirtrack-debug-message "Match is empty string")
+ ;; Transform prompts into canonical forms
+ (setq prompt-path (funcall dirtrack-directory-function
+ prompt-path)
+ current-dir (funcall dirtrack-canonicalize-function
+ current-dir))
+ (dirtrack-debug-message
+ (format "Prompt is %s\nCurrent directory is %s"
+ prompt-path current-dir))
+ ;; Compare them
+ (if (or (string= current-dir prompt-path)
+ (string= current-dir (abbreviate-file-name prompt-path)))
+ (dirtrack-debug-message (format "Not changing directory"))
+ ;; It's possible that Emacs will think the directory
+ ;; won't exist (eg, rlogin buffers)
+ (if (file-accessible-directory-p prompt-path)
+ ;; Change directory
+ (and (shell-process-cd prompt-path)
+ (run-hooks 'dirtrack-directory-change-hook)
+ (dirtrack-debug-message
+ (format "Changing directory to %s" prompt-path)))
+ (error "Directory %s does not exist" prompt-path)))
+ )))))
+ input)