From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: ediff-diff(3)-options Date: Thu, 25 Oct 2007 08:45:52 +0200 Message-ID: <47203BA0.1080605@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030705090700080007070902" X-Trace: ger.gmane.org 1193294848 2541 80.91.229.12 (25 Oct 2007 06:47:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Oct 2007 06:47:28 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 25 08:47:30 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IkwV7-0005Cg-Nf for ged-emacs-devel@m.gmane.org; Thu, 25 Oct 2007 08:47:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IkwUz-0004cF-71 for ged-emacs-devel@m.gmane.org; Thu, 25 Oct 2007 02:47:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IkwUu-0004bk-6h for emacs-devel@gnu.org; Thu, 25 Oct 2007 02:47:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IkwUt-0004bX-DO for emacs-devel@gnu.org; Thu, 25 Oct 2007 02:47:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IkwUt-0004bU-9K for emacs-devel@gnu.org; Thu, 25 Oct 2007 02:47:15 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IkwUs-0000Tw-NG for emacs-devel@gnu.org; Thu, 25 Oct 2007 02:47:15 -0400 Original-Received: (qmail invoked by alias); 25 Oct 2007 06:47:12 -0000 Original-Received: from N768P013.adsl.highway.telekom.at (EHLO [62.47.39.237]) [62.47.39.237] by mail.gmx.net (mp040) with SMTP; 25 Oct 2007 08:47:12 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18CDchpj8gC4YfsAqXuaNOyoJz0X+dqc0tjcANvui 0zcxzJNXrE9WAV User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:81686 Archived-At: This is a multi-part message in MIME format. --------------030705090700080007070902 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit I conjecture that `ediff-diff-options' and `ediff-diff3-options' are not implemented correctly on Windows systems for the following reasons: (1) Trying to customize these options gives something like ediff-diff-options: Hide Value --binary State: CHANGED outside Customize; operating on it here may be unreliable. before I even tried to do anything here. FWIW (set symb (concat mandatory-option val)) in `ediff-reset-diff-options' should become (set-default symb (concat mandatory-option val)) (2) When customizing `ediff-diff-options', `ediff-reset-diff-options' will, via `ediff-diff-mandatory-option', always prepend one "--binary" to the actual value. Eventually, this will prepend as many "--binary" to the option's value as the option has been customized. (3) "--binary" is not supported by diff3 (at least not by version 2.8.7 which is the one I'm using). According to the diffutils manual: If diff3 thinks that any of the files it is comparing is binary (a non-text file), it normally reports an error, because such comparisons are usually not useful. Hence I don't understand why this should be set at all. Does anyone have a diff3 supporting the "--binary" option? (4) Although "--binary" is not supported on my system `ediff-test-utility' still returns 0 in the diff3 case. I suspect that this test is rather useless on Windows systems in its current form. In my opinion most measurements are much too drastic to deal with the trivial problem that some Windows users don't set "--binary" for diff. I'd therefore propose to simplify the code as in the attached patch. --------------030705090700080007070902 Content-Type: text/plain; name="ediff.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ediff.patch" *** ediff-diff.el.~1.61.~ Tue Sep 25 12:45:50 2007 --- ediff-diff.el Wed Oct 24 23:16:24 2007 *************** *** 62,107 **** ;; The following functions must precede all defcustom-defined variables. - ;; 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) - (condition-case nil - (eq 0 (apply 'call-process - (append (list diff-util nil nil nil option) files))) - (error (format "Cannot execute program %S." diff-util))) - ) - - (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 "")))) - - - ;; must be before ediff-reset-diff-options to avoid compiler errors (fset 'ediff-set-actual-diff-options '(lambda () nil)) - ;; 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))) - (set symb (concat mandatory-option val)) - (ediff-set-actual-diff-options) - )) - - (defcustom ediff-shell (cond ((eq system-type 'emx) "cmd") ; OS/2 ((memq system-type '(ms-dos windows-nt windows-95)) --- 62,69 ---- *************** *** 130,136 **** :type '(repeat string) :group 'ediff-diff) ! (defcustom ediff-diff-options "" "*Options to pass to `ediff-diff-program'. If Unix diff is used as `ediff-diff-program', then a useful option is `-w', to ignore space. --- 92,103 ---- :type '(repeat string) :group 'ediff-diff) ! (defun ediff-set-diff-options (symbol value) ! (set symbol value) ! (ediff-set-actual-diff-options)) ! ! (defcustom ediff-diff-options ! (if (memq system-type '(ms-dos windows-nt windows-95)) "--binary" "") "*Options to pass to `ediff-diff-program'. If Unix diff is used as `ediff-diff-program', then a useful option is `-w', to ignore space. *************** *** 140,146 **** This variable is not for customizing the look of the differences produced by the command \\[ediff-show-diff-output]. Use the variable `ediff-custom-diff-options' for that." ! :set 'ediff-reset-diff-options :type 'string :group 'ediff-diff) --- 107,113 ---- This variable is not for customizing the look of the differences produced by the command \\[ediff-show-diff-output]. Use the variable `ediff-custom-diff-options' for that." ! :set 'ediff-set-diff-options :type 'string :group 'ediff-diff) *************** *** 179,185 **** "Pattern to match lines produced by diff3 that describe differences.") (defcustom ediff-diff3-options "" "*Options to pass to `ediff-diff3-program'." ! :set 'ediff-reset-diff-options :type 'string :group 'ediff-diff) --- 146,152 ---- "Pattern to match lines produced by diff3 that describe differences.") (defcustom ediff-diff3-options "" "*Options to pass to `ediff-diff3-program'." ! :set 'ediff-set-diff-options :type 'string :group 'ediff-diff) --------------030705090700080007070902 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------030705090700080007070902--