(defvar diff-default-directory)
+(defun diff-check-labels (&optional force)
+ (if (not (or force (eq 'check diff-use-labels)))
+ diff-use-labels
+ (setq diff-use-labels
+ (with-temp-buffer
+ (when (ignore-errors
+ (call-process diff-command nil t nil "--help"))
+ (if (search-backward "--label" nil t) t))))))
+
(defun diff-no-select (old new &optional switches no-async buf)
;; Noninteractive helper for creating and reverting diff buffers
(unless (bufferp new) (setq new (expand-file-name new)))
(or switches (setq switches diff-switches)) ; If not specified, use default.
(unless (listp switches) (setq switches (list switches)))
(or buf (setq buf (get-buffer-create "*Diff*")))
- (when (eq 'check diff-use-labels)
- (setq diff-use-labels
- (with-temp-buffer
- (when (ignore-errors (call-process diff-command nil t nil "--help"))
- (if (search-backward "--label" nil t) t)))))
+ (diff-check-labels)
(let* ((old-alt (diff-file-local-copy old))
(new-alt (diff-file-local-copy new))
(command
;;; Code:
(eval-when-compile (require 'cl-lib))
+(require 'diff) ;For diff-check-labels.
(require 'diff-mode) ;For diff-refine.
(require 'newcomment)
(let ((status
(apply 'call-process diff-command nil t nil
(append smerge-diff-switches
- (list "-L" (concat name1 "/" file)
- "-L" (concat name2 "/" file)
- file1 file2)))))
+ (and (diff-check-labels)
+ (list "--label"
+ (concat name1 "/" file)
+ "--label"
+ (concat name2 "/" file)))
+ (list file1 file2)))))
(if (eq status 0) (insert "No differences found.\n"))))
(goto-char (point-min))
(diff-mode)