]> code.delx.au - gnu-emacs/commitdiff
(diff): Simplify code handling `switch'.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 11 Feb 2004 06:01:50 +0000 (06:01 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 11 Feb 2004 06:01:50 +0000 (06:01 +0000)
lisp/diff.el

index dab3c7ebff33c5d3f68376eacfa33129081577c3..01b9e590a077bb40e0d6eaf53d272abcc1daf0ce 100644 (file)
@@ -220,7 +220,8 @@ With prefix arg, prompt for diff switches."
      (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 @@ With prefix arg, prompt for diff switches."
               (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))