Function: Man-default-directory

Man-default-directory is a byte-compiled function defined in man.el.gz.

Signature

(Man-default-directory)

Documentation

Return a default directory according to Man-support-remote-systems.

Source Code

;; Defined in /usr/src/emacs/lisp/man.el.gz
;; ======================================================================
;; utilities

(defun Man-default-directory ()
  "Return a default directory according to `Man-support-remote-systems'."
  ;; Ensure that `default-directory' exists and is readable.
  ;; We assume, that this function is always called inside the `man'
  ;; command, so that we can check `current-prefix-arg' for reverting
  ;; `Man-support-remote-systems'.
  (let ((result default-directory)
        (remote (if current-prefix-arg
                    (not Man-support-remote-systems)
                  Man-support-remote-systems)))

    ;; Use a local directory if remote isn't possible.
    (when (and (file-remote-p default-directory)
               (not (and remote
                         ;; TODO:: Test that remote processes are supported.
                         )))
      (setq result (expand-file-name "~/")))

    ;; Check, whether the directory is accessible.
    (if (file-accessible-directory-p result)
        result
      (expand-file-name (concat (file-remote-p result) "~/")))))