*** empty log message ***
[bpt/emacs.git] / lisp / ediff-util.el
index feb7b69..f39663c 100644 (file)
@@ -1,7 +1,7 @@
 ;;; ediff-util.el --- the core commands and utilities of ediff
 
 ;; 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>
 
@@ -9,7 +9,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,
@@ -26,7 +26,6 @@
 
 ;;; Code:
 
-(provide 'ediff-util)
 
 ;; Compiler pacifier
 (defvar ediff-patch-diagnostics)
@@ -49,6 +48,7 @@
 
 (eval-when-compile
   (let ((load-path (cons (expand-file-name ".") load-path)))
+    (provide 'ediff-util) ; to break recursive load cycle
     (or (featurep 'ediff-init)
        (load "ediff-init.el" nil nil 'nosuffix))
     (or (featurep 'ediff-help)
@@ -234,6 +234,7 @@ to invocation.")
   (define-key ediff-mode-map "#"  nil)
   (define-key ediff-mode-map "#h"  'ediff-toggle-regexp-match)
   (define-key ediff-mode-map "#f"  'ediff-toggle-regexp-match)
+  (define-key ediff-mode-map "#c"  'ediff-toggle-ignore-case)
   (or ediff-word-mode
       (define-key ediff-mode-map "##"  'ediff-toggle-skip-similar))
   (define-key ediff-mode-map "o"   nil)
@@ -1133,7 +1134,7 @@ of the current buffer."
 ;;       ))
 
 
-(defsubst ediff-file-checked-out-p (file)
+(defun ediff-file-checked-out-p (file)
   (or (not (featurep 'vc-hooks))
       (and (vc-backend file)
           (if (fboundp 'vc-state)
@@ -1143,7 +1144,7 @@ of the current buffer."
             (vc-locking-user file))
           )))
 
-(defsubst ediff-file-checked-in-p (file)
+(defun ediff-file-checked-in-p (file)
   (and (featurep 'vc-hooks)
        ;; CVS files are considered not checked in
        (not (memq (vc-backend file) '(nil CVS)))
@@ -3079,7 +3080,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
        )))
 
 
-(defsubst ediff-highlight-diff (n)
+(defun ediff-highlight-diff (n)
   "Put face on diff N.  Invoked for X displays only."
   (ediff-highlight-diff-in-one-buffer n 'A)
   (ediff-highlight-diff-in-one-buffer n 'B)
@@ -3088,7 +3089,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
   )
 
 
-(defsubst ediff-unhighlight-diff ()
+(defun ediff-unhighlight-diff ()
   "Remove overlays from buffers A, B, and C."
   (ediff-unhighlight-diff-in-one-buffer 'A)
   (ediff-unhighlight-diff-in-one-buffer 'B)
@@ -3097,7 +3098,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
   )
 
 ;; delete highlighting overlays, restore faces to their original form
-(defsubst ediff-unhighlight-diffs-totally ()
+(defun ediff-unhighlight-diffs-totally ()
   (ediff-unhighlight-diffs-totally-in-one-buffer 'A)
   (ediff-unhighlight-diffs-totally-in-one-buffer 'B)
   (ediff-unhighlight-diffs-totally-in-one-buffer 'C)
@@ -3345,13 +3346,14 @@ Without an argument, it saves customized diff argument, if available
     (setq wind (ediff-get-visible-buffer-window cloned-buff))
     (select-window wind)
     (delete-other-windows)
+    (ediff-activate-mark)
     (split-window-vertically)
     (ediff-select-lowest-window)
     (setq other-wind (selected-window))
     (with-temp-buffer
       (erase-buffer)
       (insert
-       (format "\n   *******  Mark a region in buffer %s  *******\n"
+       (format "\n   *******  Mark a region in buffer %s (or confirm the existing one)  *******\n"
               (buffer-name cloned-buff)))
       (insert
        (ediff-with-current-buffer buff
@@ -3686,7 +3688,7 @@ Ediff Control Panel to restore highlighting."
            (>= (point) end))))))
 
 
-(defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end)
+(defun ediff-get-region-contents (n buf-type ctrl-buf &optional start end)
   (ediff-with-current-buffer
       (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type))
     (buffer-substring
@@ -3945,6 +3947,7 @@ Ediff Control Panel to restore highlighting."
        (ediff-device-type (ediff-device-type))
        varlist salutation buffer-name)
     (setq varlist '(ediff-diff-program ediff-diff-options
+                    ediff-diff3-program ediff-diff3-options
                    ediff-patch-program ediff-patch-options
                    ediff-shell
                    ediff-use-faces
@@ -4057,7 +4060,11 @@ Mail anyway? (y or n) ")
 (defun ediff-activate-mark ()
   (ediff-cond-compile-for-xemacs-or-emacs
    (zmacs-activate-region) ; xemacs
-   (setq mark-active t) ; emacs
+   (progn
+     (make-local-variable 'transient-mark-mode)
+     (setq mark-active t
+          transient-mark-mode t) ; emacs
+     )
    ))
 
 (cond ((fboundp 'nuke-selective-display)
@@ -4279,6 +4286,11 @@ Mail anyway? (y or n) ")
       (setq lis1 (cdr lis1)))
     (cdr result)))
 
+(defun ediff-add-to-history (history-var newelt)
+  (if (fboundp 'add-to-history)
+      (add-to-history history-var newelt)
+    (set history-var (cons newelt (symbol-value history-var)))))
+
 (if (fboundp 'copy-sequence)
     (defalias 'ediff-copy-list 'copy-sequence)
   (defun ediff-copy-list (list)
@@ -4300,6 +4312,8 @@ Mail anyway? (y or n) ")
 
 (run-hooks 'ediff-load-hook)
 
+(provide 'ediff-util)
+
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)