Function: dired-map-over-marks-check

dired-map-over-marks-check is a byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-map-over-marks-check FUN ARG OP-SYMBOL &optional SHOW-PROGRESS)

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
(defun dired-map-over-marks-check (fun arg op-symbol &optional show-progress)
  ;;  "Map FUN over marked files (with second ARG like in dired-map-over-marks)
  ;; and display failures.

  ;; FUN takes zero args.  It returns non-nil (the offending object, e.g.
  ;; the short form of the filename) for a failure and probably logs a
  ;; detailed error explanation using function `dired-log'.

  ;; OP-SYMBOL is a symbol describing the operation performed (e.g.
  ;; `compress').  It is used with `dired-mark-pop-up' to prompt the user
  ;; (e.g. with `Compress * [2 files]? ') and to display errors (e.g.
  ;; `Failed to compress 1 of 2 files - type W to see why ("foo")')

  ;; SHOW-PROGRESS if non-nil means redisplay dired after each file."
  (if (dired-mark-confirm op-symbol arg)
      (let* ((total-list;; all of FUN's return values
	      (dired-map-over-marks (funcall fun) arg show-progress))
	     (total (length total-list))
	     (failures (delq nil total-list))
	     (count (length failures))
	     (string (if (eq op-symbol 'compress) "Compress or uncompress"
		       (capitalize (symbol-name op-symbol)))))
	(if (not failures)
	    (message (ngettext "%s: %d file." "%s: %d files." total)
		     string total)
	  ;; end this bunch of errors:
	  (dired-log-summary
	   (format (ngettext "Failed to %s %d of %d file"
                             "Failed to %s %d of %d files"
                             total)
		   (downcase string) count total)
	   failures)))))