Function: multi-file-diff-no-select

multi-file-diff-no-select is a byte-compiled function defined in misearch.el.gz.

Signature

(multi-file-diff-no-select OLD NEW &optional SWITCHES BUF LABEL-OLD LABEL-NEW)

Documentation

Compare the OLD and NEW file/buffer.

If the optional SWITCHES is nil, the switches specified in the variable diff-switches(var)/diff-switches(fun) are passed to the diff command, otherwise SWITCHES is used. SWITCHES can be a string or a list of strings. BUF should be non-nil. LABEL-OLD and LABEL-NEW specify labels to use for file names.

Source Code

;; Defined in /usr/src/emacs/lisp/misearch.el.gz
(defun multi-file-diff-no-select (old new &optional switches buf label-old label-new)
  ;; Based on `diff-no-select' tailored to multi-file diffs.
  "Compare the OLD and NEW file/buffer.
If the optional SWITCHES is nil, the switches specified in the
variable `diff-switches' are passed to the diff command,
otherwise SWITCHES is used.  SWITCHES can be a string or a list
of strings.  BUF should be non-nil.  LABEL-OLD and LABEL-NEW
specify labels to use for file names."
  (require 'diff)
  (unless (bufferp new) (setq new (expand-file-name new)))
  (unless (bufferp old) (setq old (expand-file-name old)))
  (or switches (setq switches diff-switches)) ; If not specified, use default.
  (setq switches (ensure-list switches))
  (diff-check-labels)
  (let* ((old-alt (diff-file-local-copy old))
         (new-alt (diff-file-local-copy new))
         (command
          (mapconcat #'identity
                     `(,diff-command
                       ;; Use explicitly specified switches
                       ,@switches
                       ,@(mapcar #'shell-quote-argument
                                 (nconc
                                  (and (or old-alt new-alt)
                                       (eq diff-use-labels t)
                                       (list "--label"
                                             (cond ((stringp label-old) label-old)
                                                   ((stringp old) old)
                                                   ((prin1-to-string old)))
                                             "--label"
                                             (cond ((stringp label-new) label-new)
                                                   ((stringp new) new)
                                                   ((prin1-to-string new)))))
                                  (list (or old-alt old)
                                        (or new-alt new)))))
                     " ")))
    (with-current-buffer buf
      (let ((inhibit-read-only t)
            (coding-system-for-read (or diff--coding-system-for-buffer
                                        coding-system-for-read)))
        (insert command "\n")
        (call-process shell-file-name nil buf nil
                      shell-command-switch command))
      (if old-alt (delete-file old-alt))
      (if new-alt (delete-file new-alt)))))