Function: rlogin-directory-tracking-mode

rlogin-directory-tracking-mode is an interactive and byte-compiled function defined in rlogin.el.gz.

Signature

(rlogin-directory-tracking-mode &optional PREFIX)

Documentation

Do remote or local directory tracking, or disable entirely.

If called with no prefix argument or a unspecified prefix argument (just C-u (universal-argument) with no number) do remote directory tracking via ange-ftp. If called as a function, give it no argument.

If called with a negative prefix argument, disable directory tracking entirely.

If called with a positive, numeric prefix argument, for example C-u (universal-argument) 1 M-x rlogin-directory-tracking-mode (rlogin-directory-tracking-mode), then do directory tracking but assume the remote filesystem is the same as the local system. This only works in general if the remote machine and the local one share the same directories (e.g. through NFS).

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/rlogin.el.gz
(defun rlogin-directory-tracking-mode (&optional prefix)
  "Do remote or local directory tracking, or disable entirely.

If called with no prefix argument or a unspecified prefix argument (just
`\\[universal-argument]' with no number) do remote directory tracking via
ange-ftp.  If called as a function, give it no argument.

If called with a negative prefix argument, disable directory tracking
entirely.

If called with a positive, numeric prefix argument, for example
\\[universal-argument] 1 \\[rlogin-directory-tracking-mode],
then do directory tracking but assume the remote filesystem is the same as
the local system.  This only works in general if the remote machine and the
local one share the same directories (e.g. through NFS)."
  (interactive "P")
  (cond
   ((or (null prefix)
        (consp prefix))
    (setq rlogin-directory-tracking-mode t)
    (setq shell-dirtrackp t)
    (setq comint-file-name-prefix
          (concat "/-:" rlogin-remote-user "@" rlogin-host ":")))
   ((< prefix 0)
    (setq rlogin-directory-tracking-mode nil)
    (setq shell-dirtrackp nil))
   (t
    (setq rlogin-directory-tracking-mode 'local)
    (setq comint-file-name-prefix "")
    (setq shell-dirtrackp t)))
  (cond
   (shell-dirtrackp
    (let* ((proc (get-buffer-process (current-buffer)))
           (proc-mark (process-mark proc))
           (current-input (buffer-substring proc-mark (point-max)))
           (orig-point (point))
           (offset (and (>= orig-point proc-mark)
                        (- (point-max) orig-point))))
      (unwind-protect
          (progn
            (delete-region proc-mark (point-max))
            (goto-char (point-max))
            (shell-resync-dirs))
        (goto-char proc-mark)
        (insert current-input)
        (if offset
            (goto-char (- (point-max) offset))
          (goto-char orig-point)))))))