-;; The following functions needed for setting diff/diff3 options
-;; test if diff supports the --binary option
-(defsubst ediff-test-utility (diff-util option &optional files)
- (eq 0 (apply 'call-process
- (append (list diff-util nil nil nil option) files))))
-
-(defun ediff-diff-mandatory-option (diff-util)
- (let ((file (if (boundp 'null-device) null-device "/dev/null")))
- (cond ((not (memq system-type '(ms-dos windows-nt windows-95)))
- "")
- ((and (string= diff-util ediff-diff-program)
- (ediff-test-utility
- ediff-diff-program "--binary" (list file file)))
- "--binary")
- ((and (string= diff-util ediff-diff3-program)
- (ediff-test-utility
- ediff-diff3-program "--binary" (list file file file)))
- "--binary")
- (t ""))))
-
-;; make sure that mandatory options are added even if the user changes
-;; ediff-diff-options or ediff-diff3-options in the customization widget
-(defun ediff-reset-diff-options (symb val)
- (let* ((diff-program
- (if (eq symb 'ediff-diff-options)
- ediff-diff-program
- ediff-diff3-program))
- (mandatory-option (ediff-diff-mandatory-option diff-program))
- (spacer (if (string-equal mandatory-option "") "" " ")))
- (set symb
- (if (string-match mandatory-option val)
- val
- (concat mandatory-option spacer val)))
- ))
-