Function: dired-file-set-difference

dired-file-set-difference is a byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-file-set-difference LIST1 LIST2 PREDICATE)

Documentation

Combine LIST1 and LIST2 using a set-difference operation.

The result list contains all file items that appear in LIST1 but not LIST2. This is a non-destructive function; it makes a copy of the data if necessary to avoid corrupting the original LIST1 and LIST2. PREDICATE (see dired-compare-directories) is an additional match condition. Two file items are considered to match if they are equal
*and* PREDICATE evaluates to t.

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
(defun dired-file-set-difference (list1 list2 predicate)
  "Combine LIST1 and LIST2 using a set-difference operation.
The result list contains all file items that appear in LIST1 but not LIST2.
This is a non-destructive function; it makes a copy of the data if necessary
to avoid corrupting the original LIST1 and LIST2.
PREDICATE (see `dired-compare-directories') is an additional match
condition.  Two file items are considered to match if they are equal
*and* PREDICATE evaluates to t."
  (if (or (null list1) (null list2))
      list1
    (let (res)
      (dolist (file1 list1)
	(unless (let ((list list2))
		  (while (and list
			      (let* ((file2 (car list))
                                     (fa1 (car (cddr file1)))
                                     (fa2 (car (cddr file2))))
                                (or
                                 (not (equal (car file1) (car file2)))
                                 (eval predicate
                                       `((fa1 . ,fa1)
                                         (fa2 . ,fa2)
                                         (size1 . ,(file-attribute-size fa1))
                                         (size2 . ,(file-attribute-size fa2))
                                         (mtime1
                                          . ,(float-time (file-attribute-modification-time fa1)))
                                         (mtime2
                                          . ,(float-time (file-attribute-modification-time fa2)))
                                         )))))
		    (setq list (cdr list)))
		  list)
	  (push file1 res)))
      (nreverse res))))