Function: dired-up-directory

dired-up-directory is an interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired-up-directory &optional OTHER-WINDOW)

Documentation

Run Dired on parent directory of current directory.

Find the parent directory either in this buffer or another buffer. Creates a buffer if necessary. If OTHER-WINDOW (the optional prefix arg), display the parent directory in another window.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-up-directory (&optional other-window)
  "Run Dired on parent directory of current directory.
Find the parent directory either in this buffer or another buffer.
Creates a buffer if necessary.
If OTHER-WINDOW (the optional prefix arg), display the parent
directory in another window."
  (interactive "P" dired-mode)
  (let* ((dir (dired-current-directory))
	 (up (file-name-directory (directory-file-name dir))))
    (or (dired-goto-file (directory-file-name dir))
	;; Only try dired-goto-subdir if buffer has more than one dir.
	(and (cdr dired-subdir-alist)
	     (dired-goto-subdir up))
	(progn
	  (if other-window
	      (dired-other-window up)
	    (dired--find-possibly-alternative-file up))
	  (dired-goto-file dir)))))