changeset 53917:04ab10f25d5c

(diff): Simplify code handling `switch'.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 11 Feb 2004 06:01:50 +0000
parents 060c23cbd940
children 3619e67b00f4
files lisp/diff.el
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/diff.el	Tue Feb 10 21:59:19 2004 +0000
+++ b/lisp/diff.el	Wed Feb 11 06:01:50 2004 +0000
@@ -220,7 +220,8 @@
      (list oldf newf (diff-switches))))
   (setq new (expand-file-name new)
 	old (expand-file-name old))
-  (let ((old-alt (file-local-copy old))
+  (or switches (setq switches diff-switches)) ; If not specified, use default.
+  (let* ((old-alt (file-local-copy old))
 	(new-alt (file-local-copy new))
 	buf)
     (save-excursion
@@ -229,13 +230,7 @@
 	       (mapconcat 'identity
 			  `(,diff-command
 			    ;; Use explicitly specified switches
-			    ,@(if switches
-				  (if (listp switches)
-				      switches (list switches))
-				;; If not specified, use default.
-				(if (listp diff-switches)
-				    diff-switches
-				  (list diff-switches)))
+			    ,@(if (listp switches) switches (list switches))
 			    ,@(if (or old-alt new-alt)
 				  (list "-L" old "-L" new))
 			    ,(shell-quote-argument (or old-alt old))