(Glossary): Treat Transient Mark mode as the default.
[bpt/emacs.git] / lisp / diff.el
index 534a84d..d8de7c2 100644 (file)
@@ -1,7 +1,7 @@
 ;;; diff.el --- run `diff' in compilation-mode
 
 ;; Copyright (C) 1992, 1994, 1996, 2001, 2002, 2003, 2004,
-;;   2005, 2006 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: unix, tools
@@ -10,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -62,7 +62,8 @@
 
 (defun diff-sentinel (code)
   "Code run when the diff process exits.
-CODE is the exit code of the process.  It should be 0 iff no diffs were found."
+CODE is the exit code of the process.  It should be 0 only if no diffs
+were found."
   (if diff-old-temp-file (delete-file diff-old-temp-file))
   (if diff-new-temp-file (delete-file diff-new-temp-file))
   (save-excursion
@@ -72,6 +73,10 @@ CODE is the exit code of the process.  It should be 0 iff no diffs were found."
                      (if (equal 0 code) " (no differences)" "")
                      (current-time-string))))))
 
+(defvar diff-old-file nil)
+(defvar diff-new-file nil)
+(defvar diff-extra-args nil)
+
 ;;;###autoload
 (defun diff (old new &optional switches no-async)
   "Find and display the differences between OLD and NEW files.
@@ -124,9 +129,13 @@ With prefix arg, prompt for diff switches."
        (erase-buffer))
       (buffer-enable-undo (current-buffer))
       (diff-mode)
+      ;; Use below 2 vars for backward-compatibility.
+      (set (make-local-variable 'diff-old-file) old)
+      (set (make-local-variable 'diff-new-file) new)
+      (set (make-local-variable 'diff-extra-args) (list switches no-async))
       (set (make-local-variable 'revert-buffer-function)
-          `(lambda (ignore-auto noconfirm)
-             (diff ',old ',new ',switches ',no-async)))
+          (lambda (ignore-auto noconfirm)
+             (apply 'diff diff-old-file diff-new-file diff-extra-args)))
       (set (make-local-variable 'diff-old-temp-file) old-alt)
       (set (make-local-variable 'diff-new-temp-file) new-alt)
       (setq default-directory thisdir)
@@ -186,5 +195,5 @@ With prefix arg, prompt for diff switches."
 
 (provide 'diff)
 
-;;; arch-tag: 7de2c29b-7ea5-4b85-9b9d-72dd860de2bd
+;; arch-tag: 7de2c29b-7ea5-4b85-9b9d-72dd860de2bd
 ;;; diff.el ends here