]> code.delx.au - gnu-emacs/blobdiff - lisp/ediff.el
*** empty log message ***
[gnu-emacs] / lisp / ediff.el
index 3e0be86b18b612b8b289b5be1624a50f472422df..cdfb66d9c0037790bddfc3a9a9a662d076afaef5 100644 (file)
@@ -1,21 +1,21 @@
 ;;; ediff.el --- a comprehensive visual interface to diff & patch
 
 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-;;   2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;;   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Created: February 2, 1994
 ;; Keywords: comparing, merging, patching, tools, unix
 
-(defconst ediff-version "2.81" "The current version of Ediff")
-(defconst ediff-date "February 18, 2006" "Date of last update")
+(defconst ediff-version "2.81.2" "The current version of Ediff")
+(defconst ediff-date "January 09, 2008" "Date of last update")
 
 
 ;; This file is part of GNU Emacs.
 
 ;; 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,
 (defvar ediff-last-dir-patch)
 (defvar ediff-patch-default-directory)
 
-(and noninteractive
-     (eval-when-compile
-        (load-library "dired")
-        (load-library "info")
-        (load "pcl-cvs" 'noerror)))
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest  r))))
+
+
 (eval-when-compile
+  (and noninteractive
+       (load "dired" nil t))
   (let ((load-path (cons (expand-file-name ".") load-path)))
     (provide 'ediff) ; to break recursive load cycle
     (or (featurep 'ediff-init)
-       (load "ediff-init.el" nil nil 'nosuffix))
+       (load "ediff-init.el" nil t 'nosuffix))
     (or (featurep 'ediff-mult)
-       (load "ediff-mult.el" nil nil 'nosuffix))
+       (load "ediff-mult.el" nil t 'nosuffix))
     (or (featurep 'ediff-ptch)
-       (load "ediff-ptch.el" nil nil 'nosuffix))
+       (load "ediff-ptch.el" nil t 'nosuffix))
     (or (featurep 'ediff-vers)
-       (load "ediff-vers.el" nil nil 'nosuffix))
+       (load "ediff-vers.el" nil t 'nosuffix))
     ))
 ;; end pacifier
 
                                           ediff-last-dir-B
                                         (file-name-directory f)))
                                 (progn
-                                  (add-to-history 'file-name-history
-                                                  (ediff-abbreviate-file-name
-                                                   (expand-file-name
-                                                    (file-name-nondirectory f)
-                                                    dir-B)))
+                                  (ediff-add-to-history
+                                   'file-name-history
+                                   (ediff-abbreviate-file-name
+                                    (expand-file-name
+                                     (file-name-nondirectory f)
+                                     dir-B)))
                                   (ediff-get-default-file-name f 1)))
           )))
   (ediff-files-internal file-A
                                                    ediff-last-dir-B
                                                  (file-name-directory f)))
                                          (progn
-                                           (add-to-history 'file-name-history
-                                                           (ediff-abbreviate-file-name
-                                                            (expand-file-name
-                                                             (file-name-nondirectory f)
-                                                             dir-B)))
+                                           (ediff-add-to-history
+                                            'file-name-history
+                                            (ediff-abbreviate-file-name
+                                             (expand-file-name
+                                              (file-name-nondirectory f)
+                                              dir-B)))
                                            (ediff-get-default-file-name f 1))))
           (ediff-read-file-name "File C to compare"
                                 (setq dir-C (if ediff-use-last-dir
                                                 ediff-last-dir-C
                                               (file-name-directory ff)))
                                 (progn
-                                  (add-to-history 'file-name-history
-                                                  (ediff-abbreviate-file-name
-                                                   (expand-file-name
-                                                    (file-name-nondirectory ff)
-                                                    dir-C)))
+                                  (ediff-add-to-history
+                                   'file-name-history
+                                   (ediff-abbreviate-file-name
+                                    (expand-file-name
+                                     (file-name-nondirectory ff)
+                                     dir-C)))
                                   (ediff-get-default-file-name ff 2)))
           )))
   (ediff-files-internal file-A
                 (list (cons 'ediff-job-name job-name))
                 merge-buffer-file)))
 
+(declare-function diff-latest-backup-file "diff" (fn))
 
 ;;;###autoload
 (defalias 'ediff 'ediff-files)
@@ -919,10 +924,7 @@ If WIND-B is nil, use window next to WIND-A."
 ;;;###autoload
 (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks)
   "Run Ediff on a pair of regions in specified buffers.
-Regions \(i.e., point and mark\) are assumed to be set in advance except
-for the second region in the case both regions are from the same buffer.
-In such a case the user is asked to interactively establish the second
-region.
+Regions \(i.e., point and mark\) can be set in advance or marked interactively.
 This function is effective only for relatively small regions, up to 200
 lines.  For large regions, use `ediff-regions-linewise'."
   (interactive
@@ -963,10 +965,7 @@ lines.  For large regions, use `ediff-regions-linewise'."
 ;;;###autoload
 (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks)
   "Run Ediff on a pair of regions in specified buffers.
-Regions \(i.e., point and mark\) are assumed to be set in advance except
-for the second region in the case both regions are from the same buffer.
-In such a case the user is asked to interactively establish the second
-region.
+Regions \(i.e., point and mark\) can be set in advance or marked interactively.
 Each region is enlarged to contain full lines.
 This function is effective for large regions, over 100-200
 lines.  For small regions, use `ediff-regions-wordwise'."
@@ -1103,11 +1102,12 @@ lines.  For small regions, use `ediff-regions-wordwise'."
                                           ediff-last-dir-B
                                         (file-name-directory f)))
                                 (progn
-                                  (add-to-history 'file-name-history
-                                                  (ediff-abbreviate-file-name
-                                                   (expand-file-name
-                                                    (file-name-nondirectory f)
-                                                    dir-B)))
+                                  (ediff-add-to-history
+                                   'file-name-history
+                                   (ediff-abbreviate-file-name
+                                    (expand-file-name
+                                     (file-name-nondirectory f)
+                                     dir-B)))
                                   (ediff-get-default-file-name f 1)))
           )))
   (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
@@ -1146,11 +1146,12 @@ lines.  For small regions, use `ediff-regions-wordwise'."
                                                    ediff-last-dir-B
                                                  (file-name-directory f)))
                                          (progn
-                                           (add-to-history 'file-name-history
-                                                           (ediff-abbreviate-file-name
-                                                            (expand-file-name
-                                                             (file-name-nondirectory f)
-                                                             dir-B)))
+                                           (ediff-add-to-history
+                                            'file-name-history
+                                            (ediff-abbreviate-file-name
+                                             (expand-file-name
+                                              (file-name-nondirectory f)
+                                              dir-B)))
                                            (ediff-get-default-file-name f 1))))
           (ediff-read-file-name "Ancestor file"
                                 (setq dir-ancestor
@@ -1158,11 +1159,12 @@ lines.  For small regions, use `ediff-regions-wordwise'."
                                           ediff-last-dir-ancestor
                                         (file-name-directory ff)))
                                 (progn
-                                  (add-to-history 'file-name-history
-                                                  (ediff-abbreviate-file-name
-                                                   (expand-file-name
-                                                    (file-name-nondirectory ff)
-                                                    dir-ancestor)))
+                                  (ediff-add-to-history
+                                   'file-name-history
+                                   (ediff-abbreviate-file-name
+                                    (expand-file-name
+                                     (file-name-nondirectory ff)
+                                     dir-ancestor)))
                                   (ediff-get-default-file-name ff 2)))
           )))
   (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
@@ -1303,20 +1305,6 @@ buffer."
      (intern (format "ediff-%S-merge-internal" ediff-version-control-package))
      rev1 rev2 ancestor-rev startup-hooks merge-buffer-file)))
 
-;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs
-;;;###autoload
-(defun run-ediff-from-cvs-buffer (pos)
-  "Run Ediff-merge on appropriate revisions of the selected file.
-First run after `M-x cvs-update'.  Then place the cursor on a line describing a
-file and then run `run-ediff-from-cvs-buffer'."
-  (interactive "d")
-  (ediff-load-version-control)
-  (let ((tin (tin-locate cvs-cookie-handle pos)))
-    (if tin
-       (cvs-run-ediff-on-file-descriptor tin)
-      (error "There is no file to merge"))))
-
-
 ;;; Apply patch
 
 ;;;###autoload
@@ -1395,8 +1383,8 @@ Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'."
                                'no-dirs)))
   (find-file file)
   (if (and (buffer-modified-p)
-          (y-or-n-p (message "Buffer %s is modified. Save buffer? "
-                             (buffer-name))))
+          (y-or-n-p (format "Buffer %s is modified. Save buffer? "
+                             (buffer-name))))
       (save-buffer (current-buffer)))
   (let (rev1 rev2)
     (setq rev1
@@ -1438,9 +1426,11 @@ Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'."
 When called interactively, displays the version."
   (interactive)
   (if (interactive-p)
-      (message (ediff-version))
+      (message "%s" (ediff-version))
     (format "Ediff %s of %s" ediff-version ediff-date)))
 
+;; info is run first, and will autoload info.el.
+(declare-function Info-goto-node "info" (nodename &optional fork))
 
 ;;;###autoload
 (defun ediff-documentation (&optional node)
@@ -1454,7 +1444,7 @@ With optional NODE, goes to that node."
     (condition-case nil
        (progn
          (pop-to-buffer (get-buffer-create "*info*"))
-         (info (if ediff-xemacs-p "ediff.info" "ediff"))
+         (info (if (featurep 'xemacs) "ediff.info" "ediff"))
          (if node
              (Info-goto-node node)
            (message "Type `i' to search for a specific topic"))