Function: dired-do-redisplay

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

Signature

(dired-do-redisplay &optional ARG TEST-FOR-SUBDIR)

Documentation

Redisplay all marked (or next ARG) files.

If on a subdir line, redisplay that subdirectory. In that case, a prefix arg lets you edit the ls switches used for the new listing.

Dired remembers switches specified with a prefix arg, so that reverting the buffer will not reset them. However, using dired-undo to re-insert or delete subdirectories can bypass this machinery. Hence, you sometimes may have to reset some subdirectory switches after a dired-undo. You can reset all subdirectory switches to the default using M-x dired-reset-subdir-switches (dired-reset-subdir-switches). See Info node (emacs)Subdir switches for more details.

When called from Lisp, if ARG is the symbol marked, redisplay only the marked files, or none if no files are marked.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;;###autoload
(defun dired-do-redisplay (&optional arg test-for-subdir)
  "Redisplay all marked (or next ARG) files.
If on a subdir line, redisplay that subdirectory.  In that case,
a prefix arg lets you edit the `ls' switches used for the new listing.

Dired remembers switches specified with a prefix arg, so that reverting
the buffer will not reset them.  However, using `dired-undo' to re-insert
or delete subdirectories can bypass this machinery.  Hence, you sometimes
may have to reset some subdirectory switches after a `dired-undo'.
You can reset all subdirectory switches to the default using
\\<dired-mode-map>\\[dired-reset-subdir-switches].
See Info node `(emacs)Subdir switches' for more details.

When called from Lisp, if ARG is the symbol `marked', redisplay
only the marked files, or none if no files are marked."
  ;; Moves point if the next ARG files are redisplayed.
  (interactive "P\np" dired-mode)
  (if (and test-for-subdir (dired-get-subdir))
      (let* ((dir (dired-get-subdir))
	     (switches (cdr (assoc-string dir dired-switches-alist))))
	(dired-insert-subdir
	 dir
	 (when arg
	   (read-string "Switches for listing: "
			(or switches
			    dired-subdir-switches
			    dired-actual-switches)))))
    (message "Redisplaying...")
    ;; message much faster than making dired-map-over-marks show progress
    (dired-uncache
     (if (consp dired-directory) (car dired-directory) dired-directory))
    (dired-map-over-marks (let ((fname (dired-get-filename nil t))
				;; Postpone readin hook till we map
				;; over all marked files (Bug#6810).
				(dired-after-readin-hook nil))
			    (if (not fname)
				(error "No file on this line")
			      (message "Redisplaying... %s" fname)
			      (dired-update-file-line fname)))
			  arg)
    (run-hooks 'dired-after-readin-hook)
    (dired-move-to-filename)
    (message "Redisplaying...done")))