Function: dired-hide-subdir

dired-hide-subdir is an autoloaded, interactive and byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-hide-subdir ARG)

Documentation

Hide or unhide the current subdirectory and move to next directory.

Optional prefix arg is a repeat factor. Use M-x dired-hide-all (dired-hide-all) to (un)hide all directories.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;; Hiding

;;;###autoload
(defun dired-hide-subdir (arg)
  "Hide or unhide the current subdirectory and move to next directory.
Optional prefix arg is a repeat factor.
Use \\[dired-hide-all] to (un)hide all directories."
  (interactive "p" dired-mode)
  (with-silent-modifications
    (while (>=  (setq arg (1- arg)) 0)
      (let* ((cur-dir (dired-current-directory))
	     (hidden-p (dired-subdir-hidden-p cur-dir))
	     (elt (assoc cur-dir dired-subdir-alist))
	     (end-pos (1- (dired-get-subdir-max elt)))
	     buffer-read-only)
	;; keep header line visible, hide rest
	(goto-char (cdr elt))
	(end-of-line)
	(if hidden-p
	    (dired--unhide (point) end-pos)
	  (dired--hide (point) end-pos)))
      (dired-next-subdir 1 t))))