aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kifer1997-05-31 01:10:39 +0000
committerMichael Kifer1997-05-31 01:10:39 +0000
commitddc90f39b06e390109df09d7c0a76d42fa7c6e26 (patch)
treeede1a9b155a2bf0f2b31cad39db716e5b7473bc2
parent70bc91bcec0a22c3f7548941716c6c4c2b4cd023 (diff)
downloademacs-ddc90f39b06e390109df09d7c0a76d42fa7c6e26.tar.gz
emacs-ddc90f39b06e390109df09d7c0a76d42fa7c6e26.zip
new version
-rw-r--r--lisp/ediff-diff.el103
-rw-r--r--lisp/ediff-help.el22
-rw-r--r--lisp/ediff-hook.el99
-rw-r--r--lisp/ediff-init.el89
-rw-r--r--lisp/ediff-merg.el40
-rw-r--r--lisp/ediff-mult.el66
-rw-r--r--lisp/ediff-ptch.el58
-rw-r--r--lisp/ediff-util.el331
-rw-r--r--lisp/ediff-vers.el3
-rw-r--r--lisp/ediff-wind.el151
-rw-r--r--lisp/ediff.el67
11 files changed, 678 insertions, 351 deletions
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 31e126c2292..fc288bf933a 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -1,6 +1,6 @@
1;;; ediff-diff.el --- diff-related utilities 1;;; ediff-diff.el --- diff-related utilities
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -23,10 +23,29 @@
23 23
24;;; Code: 24;;; Code:
25 25
26(provide 'ediff-diff)
27
28;; compiler pacifier
29(defvar ediff-default-variant)
30
31(eval-when-compile
32 (let ((load-path (cons (expand-file-name ".") load-path)))
33 (or (featurep 'ediff-init)
34 (load "ediff-init.el" nil nil 'nosuffix))
35 (or (featurep 'ediff-util)
36 (load "ediff-util.el" nil nil 'nosuffix))
37 ))
38;; end pacifier
39
26(require 'ediff-init) 40(require 'ediff-init)
27 41
42(defgroup ediff-diff nil
43 "Diff related utilities"
44 :prefix "ediff-"
45 :group 'ediff)
46
28 47
29(defvar ediff-shell 48(defcustom ediff-shell
30 (cond ((eq system-type 'emx) "cmd") ; OS/2 49 (cond ((eq system-type 'emx) "cmd") ; OS/2
31 ((memq system-type '(ms-dos windows-nt windows-95)) 50 ((memq system-type '(ms-dos windows-nt windows-95))
32 shell-file-name) ; no standard name on MS-DOS 51 shell-file-name) ; no standard name on MS-DOS
@@ -36,37 +55,53 @@
36.cshrc files are set up correctly, any shell will do. However, some people 55.cshrc files are set up correctly, any shell will do. However, some people
37set $prompt or other things incorrectly, which leads to undesirable output 56set $prompt or other things incorrectly, which leads to undesirable output
38messages. These may cause Ediff to fail. In such a case, set ediff-shell 57messages. These may cause Ediff to fail. In such a case, set ediff-shell
39to a shell that you are not using or, better, fix your shell's startup file.") 58to a shell that you are not using or, better, fix your shell's startup file."
59 :type 'string
60 :group 'ediff-diff)
40 61
41 62
42(defvar ediff-diff-program "diff" 63(defcustom ediff-diff-program "diff"
43 "*Program to use for generating the differential of the two files.") 64 "*Program to use for generating the differential of the two files."
44(defvar ediff-diff-options "" 65 :type 'string
66 :group 'ediff-diff)
67(defcustom ediff-diff-options ""
45 "*Options to pass to `ediff-diff-program'. 68 "*Options to pass to `ediff-diff-program'.
46If diff\(1\) is used as `ediff-diff-program', then the most useful options are 69If diff\(1\) is used as `ediff-diff-program', then the most useful options are
47`-w', to ignore space, and `-i', to ignore case of letters. 70`-w', to ignore space, and `-i', to ignore case of letters.
48At present, the option `-c' is ignored, since Ediff doesn't understand this 71At present, the option `-c' is ignored, since Ediff doesn't understand this
49type of output.") 72type of output."
73 :type 'string
74 :group 'ediff-diff)
50 75
51(defvar ediff-custom-diff-program ediff-diff-program 76(defcustom ediff-custom-diff-program ediff-diff-program
52 "*Program to use for generating custom diff output for saving it in a file. 77 "*Program to use for generating custom diff output for saving it in a file.
53This output is not used by Ediff internally.") 78This output is not used by Ediff internally."
54(defvar ediff-custom-diff-options "-c" 79 :type 'string
55 "*Options to pass to `ediff-custom-diff-program'.") 80 :group 'ediff-diff)
81(defcustom ediff-custom-diff-options "-c"
82 "*Options to pass to `ediff-custom-diff-program'."
83 :type 'string
84 :group 'ediff-diff)
56 85
57;;; Support for diff3 86;;; Support for diff3
58 87
59(defvar ediff-match-diff3-line "^====\\(.?\\)$" 88(defvar ediff-match-diff3-line "^====\\(.?\\)$"
60 "Pattern to match lines produced by diff3 that describe differences.") 89 "Pattern to match lines produced by diff3 that describe differences.")
61(defvar ediff-diff3-program "diff3" 90(defcustom ediff-diff3-program "diff3"
62 "*Program to be used for three-way comparison. 91 "*Program to be used for three-way comparison.
63Must produce output compatible with Unix's diff3 program.") 92Must produce output compatible with Unix's diff3 program."
64(defvar ediff-diff3-options "" 93 :type 'string
65 "*Options to pass to `ediff-diff3-program'.") 94 :group 'ediff-diff)
66(defvar ediff-diff3-ok-lines-regexp 95(defcustom ediff-diff3-options ""
96 "*Options to pass to `ediff-diff3-program'."
97 :type 'string
98 :group 'ediff-diff)
99(defcustom ediff-diff3-ok-lines-regexp
67 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" 100 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
68 "*Regexp that matches normal output lines from `ediff-diff3-program'. 101 "*Regexp that matches normal output lines from `ediff-diff3-program'.
69Lines that do not match are assumed to be error messages.") 102Lines that do not match are assumed to be error messages."
103 :type 'regexp
104 :group 'ediff-diff)
70 105
71;; keeps the status of the current diff in 3-way jobs. 106;; keeps the status of the current diff in 3-way jobs.
72;; the status can be =diff(A), =diff(B), or =diff(A+B) 107;; the status can be =diff(A), =diff(B), or =diff(A+B)
@@ -551,13 +586,7 @@ one optional arguments, diff-number to refine.")
551 (whitespace-C (ediff-whitespace-diff-region-p n 'C)) 586 (whitespace-C (ediff-whitespace-diff-region-p n 'C))
552 cumulative-fine-diff-length) 587 cumulative-fine-diff-length)
553 588
554 (cond ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n 'A)) 589 (cond ;; If one of the regions is empty (or 2 in 3way comparison)
555 ;; don't compute fine diffs if diff vector exists
556 (if (ediff-no-fine-diffs-p n)
557 ;;(ediff-message-if-verbose
558 (message
559 "Only white-space differences in region %d" (1+ n))))
560 ;; If one of the regions is empty (or 2 in 3way comparison)
561 ;; then don't refine. 590 ;; then don't refine.
562 ;; If the region happens to be entirely whitespace or empty then 591 ;; If the region happens to be entirely whitespace or empty then
563 ;; mark as such. 592 ;; mark as such.
@@ -586,6 +615,20 @@ one optional arguments, diff-number to refine.")
586 ;; if some regions are white and others don't, then mark as 615 ;; if some regions are white and others don't, then mark as
587 ;; non-white-space-only 616 ;; non-white-space-only
588 (ediff-mark-diff-as-space-only n nil))) 617 (ediff-mark-diff-as-space-only n nil)))
618
619 ;; don't compute fine diffs if diff vector exists
620 ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n 'A))
621 (if (ediff-no-fine-diffs-p n)
622 (message
623 "Only white-space differences in region %d %s"
624 (1+ n)
625 (cond ((eq (ediff-no-fine-diffs-p n) 'A)
626 "in buffers B & C")
627 ((eq (ediff-no-fine-diffs-p n) 'B)
628 "in buffers A & C")
629 ((eq (ediff-no-fine-diffs-p n) 'C)
630 "in buffers A & B")
631 (t "")))))
589 ;; don't compute fine diffs for this region 632 ;; don't compute fine diffs for this region
590 ((eq flag 'skip) 633 ((eq flag 'skip)
591 (or (ediff-get-fine-diff-vector n 'A) 634 (or (ediff-get-fine-diff-vector n 'A)
@@ -666,13 +709,15 @@ one optional arguments, diff-number to refine.")
666 (ediff-message-if-verbose 709 (ediff-message-if-verbose
667 "Only white-space differences in region %d" (1+ n))) 710 "Only white-space differences in region %d" (1+ n)))
668 ((eq cumulative-fine-diff-length 0) 711 ((eq cumulative-fine-diff-length 0)
669 (ediff-mark-diff-as-space-only n t)
670 (ediff-message-if-verbose 712 (ediff-message-if-verbose
671 "Only white-space differences in region %d %s" 713 "Only white-space differences in region %d %s"
672 (1+ n) 714 (1+ n)
673 (cond (whitespace-A "in buffers B & C") 715 (cond (whitespace-A (ediff-mark-diff-as-space-only n 'A)
674 (whitespace-B "in buffers A & C") 716 "in buffers B & C")
675 (whitespace-C "in buffers A & B")))) 717 (whitespace-B (ediff-mark-diff-as-space-only n 'B)
718 "in buffers A & C")
719 (whitespace-C (ediff-mark-diff-as-space-only n 'C)
720 "in buffers A & B"))))
676 (t 721 (t
677 (ediff-mark-diff-as-space-only n nil))) 722 (ediff-mark-diff-as-space-only n nil)))
678 ) 723 )
@@ -1204,7 +1249,5 @@ argument to `skip-chars-forward'."
1204;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 1249;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
1205;;; End: 1250;;; End:
1206 1251
1207(provide 'ediff-diff)
1208
1209 1252
1210;; ediff-diff.el ends here 1253;; ediff-diff.el ends here
diff --git a/lisp/ediff-help.el b/lisp/ediff-help.el
index 6390b98e407..64bb3e5a09d 100644
--- a/lisp/ediff-help.el
+++ b/lisp/ediff-help.el
@@ -1,6 +1,6 @@
1;;; ediff-help.el --- Code related to the contents of Ediff help buffers 1;;; ediff-help.el --- Code related to the contents of Ediff help buffers
2 2
3;; Copyright (C) 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -22,17 +22,21 @@
22;; Boston, MA 02111-1307, USA. 22;; Boston, MA 02111-1307, USA.
23 23
24;;; Code: 24;;; Code:
25 25
26(require 'ediff-init) 26(provide 'ediff-help)
27 27
28;; Compiler pacifier start 28;; Compiler pacifier start
29(defvar ediff-multiframe) 29(defvar ediff-multiframe)
30(and noninteractive 30
31 (eval-when-compile 31(eval-when-compile
32 (let ((load-path (cons (expand-file-name ".") load-path))) 32 (let ((load-path (cons (expand-file-name ".") load-path)))
33 (load-file "ediff-init.el")))) 33 (or (featurep 'ediff-init)
34 (load "ediff-init.el" nil nil 'nosuffix))
35 ))
34;; end pacifier 36;; end pacifier
35 37
38(require 'ediff-init)
39
36;; Help messages 40;; Help messages
37 41
38(defconst ediff-long-help-message-head 42(defconst ediff-long-help-message-head
@@ -178,8 +182,7 @@ the value of this variable and the variables `ediff-help-message-*' in
178 "Explain Ediff commands in more detail." 182 "Explain Ediff commands in more detail."
179 (interactive) 183 (interactive)
180 (ediff-barf-if-not-control-buffer) 184 (ediff-barf-if-not-control-buffer)
181 (let ((ctl-buf (current-buffer)) 185 (let ((pos (ediff-event-point last-command-event))
182 (pos (ediff-event-point last-command-event))
183 overl cmd) 186 overl cmd)
184 187
185 (if ediff-xemacs-p 188 (if ediff-xemacs-p
@@ -306,6 +309,5 @@ the value of this variable and the variables `ediff-help-message-*' in
306 ediff-brief-help-message)) 309 ediff-brief-help-message))
307 (run-hooks 'ediff-display-help-hook)) 310 (run-hooks 'ediff-display-help-hook))
308 311
309(provide 'ediff-help)
310 312
311;;; ediff-help.el ends here 313;;; ediff-help.el ends here
diff --git a/lisp/ediff-hook.el b/lisp/ediff-hook.el
index 25c5afc1d8b..4106ef17c98 100644
--- a/lisp/ediff-hook.el
+++ b/lisp/ediff-hook.el
@@ -1,6 +1,6 @@
1;;; ediff-hook.el --- setup for Ediff's menus and autoloads 1;;; ediff-hook.el --- setup for Ediff's menus and autoloads
2 2
3;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -25,6 +25,8 @@
25 25
26;;; These must be placed in menu-bar.el in Emacs 26;;; These must be placed in menu-bar.el in Emacs
27;; 27;;
28;; (define-key menu-bar-tools-menu [ediff-misc]
29;; '("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
28;; (define-key menu-bar-tools-menu [epatch] 30;; (define-key menu-bar-tools-menu [epatch]
29;; '("Apply Patch" . menu-bar-epatch-menu)) 31;; '("Apply Patch" . menu-bar-epatch-menu))
30;; (define-key menu-bar-tools-menu [ediff-merge] 32;; (define-key menu-bar-tools-menu [ediff-merge]
@@ -36,32 +38,24 @@
36(defvar ediff-menu) 38(defvar ediff-menu)
37(defvar ediff-merge-menu) 39(defvar ediff-merge-menu)
38(defvar epatch-menu) 40(defvar epatch-menu)
41(defvar ediff-misc-menu)
39;; end pacifier 42;; end pacifier
40 43
44;; allow menus to be set up without ediff-wind.el being loaded
45(defvar ediff-window-setup-function)
46
41 47
42(defun ediff-xemacs-init-menus () 48(defun ediff-xemacs-init-menus ()
43 (if (featurep 'menubar) 49 (if (featurep 'menubar)
44 (progn 50 (progn
45 (add-menu-button
46 '("Tools")
47 ["Use separate frame for Ediff control buffer"
48 ediff-toggle-multiframe
49 :style toggle
50 :selected (eq ediff-window-setup-function 'ediff-setup-windows-multiframe)]
51 "00-Browser...")
52 (add-menu-button
53 '("Tools")
54 ["Use a toolbar with Ediff control buffer"
55 ediff-menu-toggle-use-toolbar
56 :style toggle
57 :selected (ediff-use-toolbar-p)]
58 "00-Browser...")
59 (add-submenu 51 (add-submenu
60 '("Tools") ediff-menu "OO-Browser...") 52 '("Tools") ediff-menu "OO-Browser...")
61 (add-submenu 53 (add-submenu
62 '("Tools") ediff-merge-menu "OO-Browser...") 54 '("Tools") ediff-merge-menu "OO-Browser...")
63 (add-submenu 55 (add-submenu
64 '("Tools") epatch-menu "OO-Browser...") 56 '("Tools") epatch-menu "OO-Browser...")
57 (add-submenu
58 '("Tools") ediff-misc-menu "OO-Browser...")
65 (add-menu-button 59 (add-menu-button
66 '("Tools") 60 '("Tools")
67 ["-------" nil nil] "OO-Browser...") 61 ["-------" nil nil] "OO-Browser...")
@@ -88,9 +82,6 @@
88 "---" 82 "---"
89 ["Regions Word-by-word..." ediff-regions-wordwise t] 83 ["Regions Word-by-word..." ediff-regions-wordwise t]
90 ["Regions Line-by-line..." ediff-regions-linewise t] 84 ["Regions Line-by-line..." ediff-regions-linewise t]
91 "---"
92 ["List Ediff Sessions..." ediff-show-registry t]
93 ["Ediff Manual..." ediff-documentation t]
94 )) 85 ))
95 (defvar ediff-merge-menu 86 (defvar ediff-merge-menu
96 '("Merge" 87 '("Merge"
@@ -110,17 +101,28 @@
110 ["Directory Revisions..." ediff-merge-directory-revisions t] 101 ["Directory Revisions..." ediff-merge-directory-revisions t]
111 ["Directory Revisions with Ancestor..." 102 ["Directory Revisions with Ancestor..."
112 ediff-merge-directory-revisions-with-ancestor t] 103 ediff-merge-directory-revisions-with-ancestor t]
113 "---"
114 ["List Ediff Sessions..." ediff-show-registry t]
115 ["Ediff Manual..." ediff-documentation t]
116 )) 104 ))
117 (defvar epatch-menu 105 (defvar epatch-menu
118 '("Apply Patch" 106 '("Apply Patch"
119 ["To a file..." ediff-patch-file t] 107 ["To a file..." ediff-patch-file t]
120 ["To a buffer..." ediff-patch-buffer t] 108 ["To a buffer..." ediff-patch-buffer t]
121 "---" 109 ))
122 ["List Ediff Sessions..." ediff-show-registry t] 110 (defvar ediff-misc-menu
111 '("Ediff Miscellanea"
123 ["Ediff Manual..." ediff-documentation t] 112 ["Ediff Manual..." ediff-documentation t]
113 ["List Ediff Sessions..." ediff-show-registry t]
114 ["Use separate frame for Ediff control buffer..."
115 ediff-toggle-multiframe
116 :style toggle
117 :selected (if (and (featurep 'ediff-util)
118 (boundp 'ediff-window-setup-function))
119 (eq ediff-window-setup-function
120 'ediff-setup-windows-multiframe))]
121 ["Use a toolbar with Ediff control buffer"
122 ediff-toggle-use-toolbar
123 :style toggle
124 :selected (if (featurep 'ediff-tbar)
125 (ediff-use-toolbar-p))]
124 )) 126 ))
125 127
126 ;; put these menus before Object-Oriented-Browser in Tools menu 128 ;; put these menus before Object-Oriented-Browser in Tools menu
@@ -132,6 +134,10 @@
132 ;; Emacs--only if menu-bar is loaded 134 ;; Emacs--only if menu-bar is loaded
133 ((featurep 'menu-bar) 135 ((featurep 'menu-bar)
134 ;; initialize menu bar keymaps 136 ;; initialize menu bar keymaps
137 (defvar menu-bar-ediff-misc-menu
138 (make-sparse-keymap "Ediff Miscellanea"))
139 (fset 'menu-bar-ediff-misc-menu
140 (symbol-value 'menu-bar-ediff-misc-menu))
135 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) 141 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
136 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu)) 142 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
137 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) 143 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
@@ -141,14 +147,6 @@
141 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu)) 147 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
142 148
143 ;; define ediff-menu 149 ;; define ediff-menu
144 (define-key menu-bar-ediff-menu [ediff-doc]
145 '("Ediff Manual..." . ediff-documentation))
146 (define-key menu-bar-ediff-menu [emultiframe]
147 '("Toggle separate control buffer frame..."
148 . ediff-toggle-multiframe))
149 (define-key menu-bar-ediff-menu [eregistry]
150 '("List Ediff Sessions..." . ediff-show-registry))
151 (define-key menu-bar-ediff-menu [separator-ediff-manual] '("--"))
152 (define-key menu-bar-ediff-menu [window] 150 (define-key menu-bar-ediff-menu [window]
153 '("This Window and Next Window" . compare-windows)) 151 '("This Window and Next Window" . compare-windows))
154 (define-key menu-bar-ediff-menu [ediff-windows-linewise] 152 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
@@ -181,15 +179,6 @@
181 '("Two Files..." . ediff-files)) 179 '("Two Files..." . ediff-files))
182 180
183 ;; define merge menu 181 ;; define merge menu
184 (define-key menu-bar-ediff-merge-menu [ediff-doc2]
185 '("Ediff Manual..." . ediff-documentation))
186 (define-key menu-bar-ediff-merge-menu [emultiframe2]
187 '("Toggle separate control buffer frame..."
188 . ediff-toggle-multiframe))
189 (define-key menu-bar-ediff-merge-menu [eregistry2]
190 '("List Ediff Sessions..." . ediff-show-registry))
191 (define-key
192 menu-bar-ediff-merge-menu [separator-ediff-merge-manual] '("--"))
193 (define-key 182 (define-key
194 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor] 183 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
195 '("Directory Revisions with Ancestor..." 184 '("Directory Revisions with Ancestor..."
@@ -223,18 +212,20 @@
223 '("Files..." . ediff-merge-files)) 212 '("Files..." . ediff-merge-files))
224 213
225 ;; define epatch menu 214 ;; define epatch menu
226 (define-key menu-bar-epatch-menu [ediff-doc3]
227 '("Ediff Manual..." . ediff-documentation))
228 (define-key menu-bar-epatch-menu [emultiframe3]
229 '("Toggle separate control buffer frame..."
230 . ediff-toggle-multiframe))
231 (define-key menu-bar-epatch-menu [eregistry3]
232 '("List Ediff Sessions..." . ediff-show-registry))
233 (define-key menu-bar-epatch-menu [separator-epatch] '("--"))
234 (define-key menu-bar-epatch-menu [ediff-patch-buffer] 215 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
235 '("To a Buffer..." . ediff-patch-buffer)) 216 '("To a Buffer..." . ediff-patch-buffer))
236 (define-key menu-bar-epatch-menu [ediff-patch-file] 217 (define-key menu-bar-epatch-menu [ediff-patch-file]
237 '("To a File..." . ediff-patch-file))) 218 '("To a File..." . ediff-patch-file))
219
220 ;; define ediff miscellanea
221 (define-key menu-bar-ediff-misc-menu [emultiframe]
222 '("Toggle use of separate control buffer frame..."
223 . ediff-toggle-multiframe))
224 (define-key menu-bar-ediff-misc-menu [eregistry]
225 '("List Ediff Sessions..." . ediff-show-registry))
226 (define-key menu-bar-ediff-misc-menu [ediff-doc]
227 '("Ediff Manual..." . ediff-documentation))
228 )
238 229
239 ) ; cond 230 ) ; cond
240 231
@@ -338,11 +329,11 @@
338 "ediff-util" 329 "ediff-util"
339 "Toggle the use of separate frame for Ediff control buffer." 330 "Toggle the use of separate frame for Ediff control buffer."
340 t) 331 t)
341 (if (string-match "XEmacs" emacs-version) 332 (autoload 'ediff-toggle-use-toolbar
342 (autoload 'ediff-toggle-use-toolbar 333 "ediff-util"
343 "ediff-tbar" 334 "Toggle the use of Ediff toolbar."
344 "Toggle the use of Ediff toolbar." 335 t)
345 t)) 336
346 ) ; if purify-flag 337 ) ; if purify-flag
347 338
348 339
diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el
index 3da02d7242a..2199146dcc6 100644
--- a/lisp/ediff-init.el
+++ b/lisp/ediff-init.el
@@ -1,6 +1,6 @@
1;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff 1;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -32,6 +32,10 @@
32(defvar ediff-mouse-pixel-threshold) 32(defvar ediff-mouse-pixel-threshold)
33(defvar ediff-whitespace) 33(defvar ediff-whitespace)
34(defvar ediff-multiframe) 34(defvar ediff-multiframe)
35
36(and noninteractive
37 (eval-when-compile
38 (load "ange-ftp" 'noerror)))
35;; end pacifier 39;; end pacifier
36 40
37;; Is it XEmacs? 41;; Is it XEmacs?
@@ -90,7 +94,7 @@ that Ediff doesn't know about.")
90(ediff-defvar-local ediff-buffer-C nil "") 94(ediff-defvar-local ediff-buffer-C nil "")
91;; Ancestor buffer 95;; Ancestor buffer
92(ediff-defvar-local ediff-ancestor-buffer nil "") 96(ediff-defvar-local ediff-ancestor-buffer nil "")
93;; The control buffer of ediff. 97;; The Ediff control buffer
94(ediff-defvar-local ediff-control-buffer nil "") 98(ediff-defvar-local ediff-control-buffer nil "")
95 99
96;;; Macros 100;;; Macros
@@ -125,10 +129,18 @@ that Ediff doesn't know about.")
125 (symbol-value 129 (symbol-value
126 (intern (format "ediff-difference-vector-%S" (, buf-type)))) (, n)))) 130 (intern (format "ediff-difference-vector-%S" (, buf-type)))) (, n))))
127 131
128;; tell if it has been previously determined that the region has 132;; Tell if it has been previously determined that the region has
129;; no diffs other than the white space and newlines 133;; no diffs other than the white space and newlines
130;; The argument, N, is the diff region number used by Ediff to index the 134;; The argument, N, is the diff region number used by Ediff to index the
131;; diff vector. It is 1 less than the number seen by the user. 135;; diff vector. It is 1 less than the number seen by the user.
136;; Returns:
137;; t if the diffs are whitespace in all buffers
138;; 'A (in 3-buf comparison only) if there are only whitespace
139;; diffs in bufs B and C
140;; 'B (in 3-buf comparison only) if there are only whitespace
141;; diffs in bufs A and C
142;; 'C (in 3-buf comparison only) if there are only whitespace
143;; diffs in bufs A and B
132;; 144;;
133;; A difference vector has the form: 145;; A difference vector has the form:
134;; [diff diff diff ...] 146;; [diff diff diff ...]
@@ -625,8 +637,8 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire.")
625 637
626 638
627;;;; warn if it is a wrong version of emacs 639;;;; warn if it is a wrong version of emacs
628;;(if (or (ediff-check-version '< 19 29 'emacs) 640;;(if (or (ediff-check-version '< 19 35 'emacs)
629;; (ediff-check-version '< 19 12 'xemacs)) 641;; (ediff-check-version '< 19 15 'xemacs))
630;; (progn 642;; (progn
631;; (with-output-to-temp-buffer ediff-msg-buffer 643;; (with-output-to-temp-buffer ediff-msg-buffer
632;; (switch-to-buffer ediff-msg-buffer) 644;; (switch-to-buffer ediff-msg-buffer)
@@ -635,9 +647,9 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire.")
635;; 647;;
636;;This version of Ediff requires 648;;This version of Ediff requires
637;; 649;;
638;;\t Emacs 19.29 and higher 650;;\t Emacs 19.35 and higher
639;;\t OR 651;;\t OR
640;;\t XEmacs 19.12 and higher 652;;\t XEmacs 19.15 and higher
641;; 653;;
642;;It is unlikely to work under Emacs version %s 654;;It is unlikely to work under Emacs version %s
643;;that you are using... " emacs-version)) 655;;that you are using... " emacs-version))
@@ -1152,11 +1164,13 @@ More precisely, a regexp to match any one such character.")
1152 1164
1153;;; In-line functions 1165;;; In-line functions
1154 1166
1155(defsubst ediff-file-remote-p (file-name) 1167(or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it
1156 (require 'ange-ftp) 1168 (defun ediff-file-remote-p (file-name)
1157 (car (if ediff-xemacs-p 1169 (car (cond ((featurep 'efs-auto) (efs-ftp-path file-name))
1158 (ange-ftp-ftp-path file-name) 1170 ((fboundp 'file-remote-p) (file-remote-p file-name))
1159 (ange-ftp-ftp-name file-name)))) 1171 (t (require 'ange-ftp)
1172 ;; Can happen only in Emacs, since XEmacs has file-remote-p
1173 (ange-ftp-ftp-name file-name))))))
1160 1174
1161 1175
1162(defsubst ediff-frame-unsplittable-p (frame) 1176(defsubst ediff-frame-unsplittable-p (frame)
@@ -1174,6 +1188,14 @@ More precisely, a regexp to match any one such character.")
1174 (if (ediff-buffer-live-p buf) 1188 (if (ediff-buffer-live-p buf)
1175 (kill-buffer (get-buffer buf)))) 1189 (kill-buffer (get-buffer buf))))
1176 1190
1191(defsubst ediff-background-face (buf-type dif-num)
1192 ;; The value of dif-num is always 1- the one that user sees.
1193 ;; This is why even face is used when dif-num is odd.
1194 (intern (format (if (ediff-odd-p dif-num)
1195 "ediff-even-diff-face-%S"
1196 "ediff-odd-diff-face-%S")
1197 buf-type)))
1198
1177 1199
1178;; activate faces on diff regions in buffer 1200;; activate faces on diff regions in buffer
1179(defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight) 1201(defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight)
@@ -1184,11 +1206,13 @@ More precisely, a regexp to match any one such character.")
1184 (lambda (rec) 1206 (lambda (rec)
1185 (setq overl (ediff-get-diff-overlay-from-diff-record rec) 1207 (setq overl (ediff-get-diff-overlay-from-diff-record rec)
1186 diff-num (ediff-overlay-get overl 'ediff-diff-num)) 1208 diff-num (ediff-overlay-get overl 'ediff-diff-num))
1187 (ediff-set-overlay-face 1209 (if (ediff-overlay-buffer overl)
1188 overl 1210 ;; only if overlay is alive
1189 (if (not unhighlight) 1211 (ediff-set-overlay-face
1190 (ediff-background-face buf-type diff-num)) 1212 overl
1191 ))) 1213 (if (not unhighlight)
1214 (ediff-background-face buf-type diff-num))))
1215 ))
1192 diff-vector))) 1216 diff-vector)))
1193 1217
1194 1218
@@ -1287,14 +1311,6 @@ More precisely, a regexp to match any one such character.")
1287 (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor) 1311 (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor)
1288 ) 1312 )
1289 1313
1290(defsubst ediff-background-face (buf-type dif-num)
1291 ;; The value of dif-num is always 1- the one that user sees.
1292 ;; This is why even face is used when dif-num is odd.
1293 (intern (format (if (ediff-odd-p dif-num)
1294 "ediff-even-diff-face-%S"
1295 "ediff-odd-diff-face-%S")
1296 buf-type)))
1297
1298 1314
1299;; arg is a record for a given diff in a difference vector 1315;; arg is a record for a given diff in a difference vector
1300;; this record is itself a vector 1316;; this record is itself a vector
@@ -1419,6 +1435,18 @@ More precisely, a regexp to match any one such character.")
1419 1435
1420;; Some overlay functions 1436;; Some overlay functions
1421 1437
1438(defsubst ediff-overlay-start (overl)
1439 (if (ediff-overlayp overl)
1440 (if ediff-emacs-p
1441 (overlay-start overl)
1442 (extent-start-position overl))))
1443
1444(defsubst ediff-overlay-end (overl)
1445 (if (ediff-overlayp overl)
1446 (if ediff-emacs-p
1447 (overlay-end overl)
1448 (extent-end-position overl))))
1449
1422(defsubst ediff-empty-overlay-p (overl) 1450(defsubst ediff-empty-overlay-p (overl)
1423 (= (ediff-overlay-start overl) (ediff-overlay-end overl))) 1451 (= (ediff-overlay-start overl) (ediff-overlay-end overl)))
1424 1452
@@ -1583,10 +1611,10 @@ Checks if overlay's buffer exists."
1583 (apply 'message string args))) 1611 (apply 'message string args)))
1584 1612
1585(defun ediff-file-attributes (filename attr-number) 1613(defun ediff-file-attributes (filename attr-number)
1586 (let ((handler (find-file-name-handler filename 'find-file-noselect))) 1614 (if (ediff-file-remote-p filename)
1587 (if (and handler (string-match "ange-ftp" (format "%S" handler))) 1615 -1
1588 -1 1616 (nth attr-number (file-attributes filename))))
1589 (nth attr-number (file-attributes filename))))) 1617
1590(defsubst ediff-file-size (filename) 1618(defsubst ediff-file-size (filename)
1591 (ediff-file-attributes filename 7)) 1619 (ediff-file-attributes filename 7))
1592(defsubst ediff-file-modtime (filename) 1620(defsubst ediff-file-modtime (filename)
@@ -1594,9 +1622,8 @@ Checks if overlay's buffer exists."
1594 1622
1595 1623
1596(defun ediff-convert-standard-filename (fname) 1624(defun ediff-convert-standard-filename (fname)
1597 (if ediff-emacs-p 1625 (if (fboundp 'convert-standard-filename)
1598 (convert-standard-filename fname) 1626 (convert-standard-filename fname)
1599 ;; hopefully, XEmacs adds this functionality
1600 fname)) 1627 fname))
1601 1628
1602 1629
diff --git a/lisp/ediff-merg.el b/lisp/ediff-merg.el
index a07dc8d8c16..7d711cdaf1c 100644
--- a/lisp/ediff-merg.el
+++ b/lisp/ediff-merg.el
@@ -1,6 +1,6 @@
1;;; ediff-merg.el --- merging utilities 1;;; ediff-merg.el --- merging utilities
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -23,14 +23,40 @@
23 23
24;;; Code: 24;;; Code:
25 25
26(provide 'ediff-merg)
27
28(defgroup ediff-merge nil
29 "Merging utilities"
30 :prefix "ediff-"
31 :group 'ediff)
32
33
34;; compiler pacifier
35(defvar ediff-window-A)
36(defvar ediff-window-B)
37(defvar ediff-window-C)
38(defvar ediff-merge-window-share)
39(defvar ediff-window-config-saved)
40
41(eval-when-compile
42 (let ((load-path (cons (expand-file-name ".") load-path)))
43 (or (featurep 'ediff-init)
44 (load "ediff-init.el" nil nil 'nosuffix))
45 (or (featurep 'ediff-util)
46 (load "ediff-util.el" nil nil 'nosuffix))
47 ))
48;; end pacifier
49
26(require 'ediff-init) 50(require 'ediff-init)
27 51
28 52
29(defvar ediff-default-variant 'combined 53(defcustom ediff-default-variant 'combined
30 "*The variant to be used as a default for buffer C in merging. 54 "*The variant to be used as a default for buffer C in merging.
31Valid values are the symbols `default-A', `default-B', and `combined'.") 55Valid values are the symbols `default-A', `default-B', and `combined'."
56 :type '(radio (const default-A) (const default-B) (const combined))
57 :group 'ediff-merge)
32 58
33(defvar ediff-combination-pattern 59(defcustom ediff-combination-pattern
34 '("<<<<<<<<<<<<<< variant A" ">>>>>>>>>>>>>> variant B" "======= end of combination") 60 '("<<<<<<<<<<<<<< variant A" ">>>>>>>>>>>>>> variant B" "======= end of combination")
35 "*Pattern to be used for combining difference regions in buffers A and B. 61 "*Pattern to be used for combining difference regions in buffers A and B.
36The value is (STRING1 STRING2 STRING3). The combined text will look like this: 62The value is (STRING1 STRING2 STRING3). The combined text will look like this:
@@ -40,7 +66,9 @@ diff region from variant A
40STRING2 66STRING2
41diff region from variant B 67diff region from variant B
42STRING3 68STRING3
43") 69"
70 :type '(list string string string)
71 :group 'ediff-merge)
44 72
45(ediff-defvar-local ediff-show-clashes-only nil 73(ediff-defvar-local ediff-show-clashes-only nil
46 "*If t, show only those diff regions where both buffers disagree with the ancestor. 74 "*If t, show only those diff regions where both buffers disagree with the ancestor.
@@ -270,6 +298,4 @@ Combining is done according to the specifications in variable
270;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 298;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
271;;; End: 299;;; End:
272 300
273(provide 'ediff-merg)
274
275;; ediff-merg.el ends here 301;; ediff-merg.el ends here
diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el
index 2920e250e86..c6fa5694612 100644
--- a/lisp/ediff-mult.el
+++ b/lisp/ediff-mult.el
@@ -1,6 +1,6 @@
1;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff 1;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
2 2
3;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -90,7 +90,26 @@
90 90
91;;; Code: 91;;; Code:
92 92
93(provide 'ediff-mult)
94
95(defgroup ediff-mult nil
96 "Multi-file and multi-buffer processing in ediff"
97 :prefix "ediff-"
98 :group 'ediff)
99
100
101;; compiler pacifier
102(eval-when-compile
103 (let ((load-path (cons (expand-file-name ".") load-path)))
104 (or (featurep 'ediff-init)
105 (load "ediff-init.el" nil nil 'nosuffix))
106 (or (featurep 'ediff-util)
107 (load "ediff-util.el" nil nil 'nosuffix))
108 ))
109;; end pacifier
110
93(require 'ediff-init) 111(require 'ediff-init)
112(require 'ediff-util)
94 113
95;; meta-buffer 114;; meta-buffer
96(ediff-defvar-local ediff-meta-buffer nil "") 115(ediff-defvar-local ediff-meta-buffer nil "")
@@ -150,22 +169,34 @@ directories.")
150;; The registry of Ediff sessions. A list of control buffers. 169;; The registry of Ediff sessions. A list of control buffers.
151(defvar ediff-session-registry nil) 170(defvar ediff-session-registry nil)
152 171
153(defvar ediff-registry-setup-hook nil 172(defcustom ediff-registry-setup-hook nil
154 "*Hooks run just after the registry control panel is set up.") 173 "*Hooks run just after the registry control panel is set up."
155(defvar ediff-session-group-setup-hook nil 174 :type 'hook
175 :group 'ediff-mult)
176(defcustom ediff-session-group-setup-hook nil
156 "*Hooks run just after a meta-buffer controlling a session group, such as 177 "*Hooks run just after a meta-buffer controlling a session group, such as
157ediff-directories, is run.") 178ediff-directories, is run."
158(defvar ediff-quit-session-group-hook nil 179 :type 'hook
159 "*Hooks run just before exiting a session group.") 180 :group 'ediff-mult)
160(defvar ediff-show-registry-hook nil 181(defcustom ediff-quit-session-group-hook nil
161 "*Hooks run just after the registry buffer is shown.") 182 "*Hooks run just before exiting a session group."
162(defvar ediff-show-session-group-hook nil 183 :type 'hook
163 "*Hooks run just after a session group buffer is shown.") 184 :group 'ediff-mult)
164(defvar ediff-meta-buffer-keymap-setup-hook nil 185(defcustom ediff-show-registry-hook nil
186 "*Hooks run just after the registry buffer is shown."
187 :type 'hook
188 :group 'ediff-mult)
189(defcustom ediff-show-session-group-hook nil
190 "*Hooks run just after a session group buffer is shown."
191 :type 'hook
192 :group 'ediff-mult)
193(defcustom ediff-meta-buffer-keymap-setup-hook nil
165 "*Hooks run just after setting up the ediff-meta-buffer-map. 194 "*Hooks run just after setting up the ediff-meta-buffer-map.
166This keymap controls key bindings in the meta buffer and is a local variable. 195This keymap controls key bindings in the meta buffer and is a local variable.
167This means that you can set different bindings for different kinds of meta 196This means that you can set different bindings for different kinds of meta
168buffers.") 197buffers."
198 :type 'hook
199 :group 'ediff-mult)
169 200
170;; buffer holding the multi-file patch. local to the meta buffer 201;; buffer holding the multi-file patch. local to the meta buffer
171(ediff-defvar-local ediff-meta-patchbufer nil "") 202(ediff-defvar-local ediff-meta-patchbufer nil "")
@@ -654,7 +685,8 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
654 " `=':\tmark identical files in each session\n\n")) 685 " `=':\tmark identical files in each session\n\n"))
655 686
656 (if (and (stringp regexp) (> (length regexp) 0)) 687 (if (and (stringp regexp) (> (length regexp) 0))
657 (insert (format "Filter-through regular expression: %s\n" regexp))) 688 (insert
689 (format "\n*** Filter-through regular expression: %s\n" regexp)))
658 (if (and ediff-autostore-merges (ediff-merge-metajob) 690 (if (and ediff-autostore-merges (ediff-merge-metajob)
659 (stringp merge-autostore-dir)) 691 (stringp merge-autostore-dir))
660 (insert (format 692 (insert (format
@@ -808,7 +840,8 @@ Useful commands:
808 DEL: previous line\n\n") 840 DEL: previous line\n\n")
809 841
810 (if (and (stringp regexp) (> (length regexp) 0)) 842 (if (and (stringp regexp) (> (length regexp) 0))
811 (insert (format "Filter-through regular expression: %s\n" regexp))) 843 (insert
844 (format "\n*** Filter-through regular expression: %s\n" regexp)))
812 (insert "\n") 845 (insert "\n")
813 (insert (format "\n%-27s%-26s" 846 (insert (format "\n%-27s%-26s"
814 (ediff-truncate-string-left 847 (ediff-truncate-string-left
@@ -1718,7 +1751,4 @@ This is used only for sessions that involve 2 or 3 files at the same time."
1718;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 1751;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
1719;;; End: 1752;;; End:
1720 1753
1721(provide 'ediff-mult)
1722(require 'ediff-util)
1723
1724;;; ediff-mult.el ends here 1754;;; ediff-mult.el ends here
diff --git a/lisp/ediff-ptch.el b/lisp/ediff-ptch.el
index 309316d721e..67c29f98385 100644
--- a/lisp/ediff-ptch.el
+++ b/lisp/ediff-ptch.el
@@ -1,6 +1,6 @@
1;;; ediff-ptch.el --- Ediff's patch support 1;;; ediff-ptch.el --- Ediff's patch support
2 2
3;; Copyright (C) 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -23,6 +23,30 @@
23 23
24 24
25;;; Code: 25;;; Code:
26
27(provide 'ediff-ptch)
28
29(defgroup ediff-ptch nil
30 "Ediff patch support"
31 :tag "Patch"
32 :prefix "ediff-"
33 :group 'ediff)
34
35;; compiler pacifier
36(defvar ediff-window-A)
37(defvar ediff-window-B)
38(defvar ediff-window-C)
39(defvar ediff-use-last-dir)
40(defvar ediff-shell)
41
42(eval-when-compile
43 (let ((load-path (cons (expand-file-name ".") load-path)))
44 (or (featurep 'ediff-init)
45 (load "ediff-init.el" nil nil 'nosuffix))
46 (or (featurep 'ediff)
47 (load "ediff.el" nil nil 'nosuffix))
48 ))
49;; end pacifier
26 50
27(require 'ediff-init) 51(require 'ediff-init)
28 52
@@ -35,7 +59,7 @@
35 "Backup extension used by the patch program. 59 "Backup extension used by the patch program.
36See also `ediff-backup-specs'.") 60See also `ediff-backup-specs'.")
37 61
38(defvar ediff-backup-specs (format "-b %s" ediff-backup-extension) 62(defcustom ediff-backup-specs (format "-b %s" ediff-backup-extension)
39 "*Backup directives to pass to the patch program. 63 "*Backup directives to pass to the patch program.
40Ediff requires that the old version of the file \(before applying the patch\) 64Ediff requires that the old version of the file \(before applying the patch\)
41is saved in a file named `the-patch-file.extension'. Usually `extension' is 65is saved in a file named `the-patch-file.extension'. Usually `extension' is
@@ -49,31 +73,41 @@ Other versions only permit `-b', which assumes some canned extension
49Note that both `ediff-backup-extension' and `ediff-backup-specs' 73Note that both `ediff-backup-extension' and `ediff-backup-specs'
50must be properly set. If your patch program takes the option `-b', 74must be properly set. If your patch program takes the option `-b',
51but not `-b extension', the variable `ediff-backup-extension' must 75but not `-b extension', the variable `ediff-backup-extension' must
52still be set so Ediff will know which extension to use.") 76still be set so Ediff will know which extension to use."
77 :type 'string
78 :group 'ediff-ptch)
53 79
54 80
55(defvar ediff-patch-default-directory nil 81(defcustom ediff-patch-default-directory nil
56 "*Default directory to look for patches.") 82 "*Default directory to look for patches."
83 :type '(choice (const nil) string)
84 :group 'ediff-ptch)
57 85
58(defvar ediff-context-diff-label-regexp 86(defcustom ediff-context-diff-label-regexp
59 (concat "\\(" ; context diff 2-liner 87 (concat "\\(" ; context diff 2-liner
60 "^\\*\\*\\* \\([^ \t]+\\)[^*]+[\t ]*\n--- \\([^ \t]+\\)" 88 "^\\*\\*\\* \\([^ \t]+\\)[^*]+[\t ]*\n--- \\([^ \t]+\\)"
61 "\\|" ; GNU unified format diff 2-liner 89 "\\|" ; GNU unified format diff 2-liner
62 "^--- \\([^ \t]+\\)[\t ]+.*\n\\+\\+\\+ \\([^ \t]+\\)" 90 "^--- \\([^ \t]+\\)[\t ]+.*\n\\+\\+\\+ \\([^ \t]+\\)"
63 "\\)") 91 "\\)")
64 "*Regexp matching filename 2-liners at the start of each context diff.") 92 "*Regexp matching filename 2-liners at the start of each context diff."
93 :type 'regexp
94 :group 'ediff-ptch)
65 95
66(defvar ediff-patch-program "patch" 96(defcustom ediff-patch-program "patch"
67 "*Name of the program that applies patches. 97 "*Name of the program that applies patches.
68It is recommended to use GNU-compatible versions.") 98It is recommended to use GNU-compatible versions."
69(defvar ediff-patch-options "-f" 99 :type 'string
100 :group 'ediff-ptch)
101(defcustom ediff-patch-options "-f"
70 "*Options to pass to ediff-patch-program. 102 "*Options to pass to ediff-patch-program.
71 103
72Note: the `-b' option should be specified in `ediff-backup-specs'. 104Note: the `-b' option should be specified in `ediff-backup-specs'.
73 105
74It is recommended to pass the `-f' option to the patch program, so it won't ask 106It is recommended to pass the `-f' option to the patch program, so it won't ask
75questions. However, some implementations don't accept this option, in which 107questions. However, some implementations don't accept this option, in which
76case the default value for this variable should be changed.") 108case the default value for this variable should be changed."
109 :type 'string
110 :group 'ediff-ptch)
77 111
78;; The buffer of the patch file. Local to control buffer. 112;; The buffer of the patch file. Local to control buffer.
79(ediff-defvar-local ediff-patchbufer nil "") 113(ediff-defvar-local ediff-patchbufer nil "")
@@ -625,6 +659,4 @@ Type any key to continue...
625;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 659;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
626;;; End: 660;;; End:
627 661
628(provide 'ediff-ptch)
629
630;;; ediff-ptch.el ends here 662;;; ediff-ptch.el ends here
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el
index 0a625aa14df..527a9e2972d 100644
--- a/lisp/ediff-util.el
+++ b/lisp/ediff-util.el
@@ -1,6 +1,6 @@
1;;; ediff-util.el --- the core commands and utilities of ediff 1;;; ediff-util.el --- the core commands and utilities of ediff
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -22,27 +22,55 @@
22;; Boston, MA 02111-1307, USA. 22;; Boston, MA 02111-1307, USA.
23 23
24;;; Code: 24;;; Code:
25
26(provide 'ediff-util)
25 27
26;; Pacify compiler and avoid the need in checking for boundp 28;; Compiler pacifier
27(defvar ediff-patch-diagnostics nil) 29(defvar ediff-patch-diagnostics)
28(defvar ediff-patchbufer nil) 30(defvar ediff-patchbufer)
29(and noninteractive 31(defvar ediff-toolbar)
30 (eval-when-compile 32(defvar ediff-toolbar-3way)
31 (let ((load-path (cons (expand-file-name ".") load-path))) 33(defvar bottom-toolbar)
32 (load-file "ediff-init.el") 34(defvar bottom-toolbar-visible-p)
33 (load-file "ediff-help.el")))) 35(defvar bottom-toolbar-height)
36(defvar mark-active)
37
38(eval-when-compile
39 (let ((load-path (cons (expand-file-name ".") load-path)))
40 (or (featurep 'ediff-init)
41 (load "ediff-init.el" nil nil 'nosuffix))
42 (or (featurep 'ediff-help)
43 (load "ediff-help.el" nil nil 'nosuffix))
44 (or (featurep 'ediff-mult)
45 (load "ediff-mult.el" nil nil 'nosuffix))
46 (or (featurep 'ediff-wind)
47 (load "ediff-wind.el" nil nil 'nosuffix))
48 (or (featurep 'ediff-diff)
49 (load "ediff-diff.el" nil nil 'nosuffix))
50 (or (featurep 'ediff-merg)
51 (load "ediff-merg.el" nil nil 'nosuffix))
52 (or (featurep 'ediff)
53 (load "ediff.el" nil nil 'nosuffix))
54 (or (featurep 'ediff-tbar)
55 (load "ediff-tbar.el" 'noerror nil 'nosuffix))
56 ))
34;; end pacifier 57;; end pacifier
35 58
36(require 'ediff-init) 59(require 'ediff-init)
37(require 'ediff-help) 60(require 'ediff-help)
38(require 'ediff-mult) 61(require 'ediff-mult)
62(require 'ediff-wind)
63(require 'ediff-diff)
64(require 'ediff-merg)
39 65
40;;(if ediff-xemacs-p 66
41;; (require 'ediff-tbar) 67;; be careful with ediff-tbar
42;; (defun ediff-use-toolbar-p () nil)) 68(if ediff-xemacs-p
43;; 69 (condition-case nil
44;; for the time being 70 (require 'ediff-tbar)
45(defun ediff-use-toolbar-p () nil) 71 (error
72 (defun ediff-use-toolbar-p () nil)))
73 (defun ediff-use-toolbar-p () nil))
46 74
47 75
48;;; Functions 76;;; Functions
@@ -83,9 +111,6 @@ Commands:
83 (run-hooks 'ediff-mode-hook)) 111 (run-hooks 'ediff-mode-hook))
84 112
85 113
86(require 'ediff-diff)
87(require 'ediff-merg)
88
89 114
90;;; Build keymaps 115;;; Build keymaps
91 116
@@ -218,14 +243,11 @@ to invocation.")
218 243
219;;; Setup functions 244;;; Setup functions
220 245
221(require 'ediff-wind) 246;; Common startup entry for all Ediff functions It now returns control buffer
222 247;; so other functions can do post-processing SETUP-PARAMETERS is a list of the
223;; No longer needed: XEmacs has surrogate minibuffers now. 248;; form ((param .val) (param . val)...) This serves a similar purpose to
224;;(or (boundp 'synchronize-minibuffers) 249;; STARTUP-HOOKS, but these parameters are set in the new control buffer right
225;; (defvar synchronize-minibuffers nil)) 250;; after this buf is created and before any windows are set and such.
226
227;; Common startup entry for all Ediff functions
228;; It now returns control buffer so other functions can do post-processing
229(defun ediff-setup (buffer-A file-A buffer-B file-B buffer-C file-C 251(defun ediff-setup (buffer-A file-A buffer-B file-B buffer-C file-C
230 startup-hooks setup-parameters) 252 startup-hooks setup-parameters)
231 ;; ediff-convert-standard-filename puts file names in the form appropriate 253 ;; ediff-convert-standard-filename puts file names in the form appropriate
@@ -241,6 +263,14 @@ to invocation.")
241 (get-buffer-create control-buffer-name)))) 263 (get-buffer-create control-buffer-name))))
242 (ediff-eval-in-buffer control-buffer 264 (ediff-eval-in-buffer control-buffer
243 (ediff-mode) 265 (ediff-mode)
266
267 (make-local-variable 'ediff-use-long-help-message)
268 (make-local-variable 'ediff-prefer-iconified-control-frame)
269 (make-local-variable 'ediff-split-window-function)
270 (make-local-variable 'ediff-default-variant)
271 (make-local-variable 'ediff-merge-window-share)
272 (make-local-variable 'ediff-window-setup-function)
273 (make-local-variable 'ediff-keep-variants)
244 274
245 ;; unwrap set up parameters passed as argument 275 ;; unwrap set up parameters passed as argument
246 (while setup-parameters 276 (while setup-parameters
@@ -248,6 +278,7 @@ to invocation.")
248 (setq setup-parameters (cdr setup-parameters))) 278 (setq setup-parameters (cdr setup-parameters)))
249 279
250 ;; set variables classifying the current ediff job 280 ;; set variables classifying the current ediff job
281 ;; must come AFTER setup-parameters
251 (setq ediff-3way-comparison-job (ediff-3way-comparison-job) 282 (setq ediff-3way-comparison-job (ediff-3way-comparison-job)
252 ediff-merge-job (ediff-merge-job) 283 ediff-merge-job (ediff-merge-job)
253 ediff-merge-with-ancestor-job (ediff-merge-with-ancestor-job) 284 ediff-merge-with-ancestor-job (ediff-merge-with-ancestor-job)
@@ -256,14 +287,6 @@ to invocation.")
256 ediff-narrow-job (ediff-narrow-job) 287 ediff-narrow-job (ediff-narrow-job)
257 ediff-windows-job (ediff-windows-job) 288 ediff-windows-job (ediff-windows-job)
258 ediff-word-mode-job (ediff-word-mode-job)) 289 ediff-word-mode-job (ediff-word-mode-job))
259
260 (make-local-variable 'ediff-use-long-help-message)
261 (make-local-variable 'ediff-prefer-iconified-control-frame)
262 (make-local-variable 'ediff-split-window-function)
263 (make-local-variable 'ediff-default-variant)
264 (make-local-variable 'ediff-merge-window-share)
265 (make-local-variable 'ediff-window-setup-function)
266 (make-local-variable 'ediff-keep-variants)
267 290
268 ;; Don't delete variants in case of ediff-buffer-* jobs without asking. 291 ;; Don't delete variants in case of ediff-buffer-* jobs without asking.
269 ;; This is because u may loose work---dangerous. 292 ;; This is because u may loose work---dangerous.
@@ -496,8 +519,10 @@ to invocation.")
496 ediff-split-window-function 519 ediff-split-window-function
497 (ediff-multiframe-setup-p) 520 (ediff-multiframe-setup-p)
498 ediff-wide-display-p)) 521 ediff-wide-display-p))
522
523 ;; In multiframe, toolbar is set in ediff-setup-control-frame
499 (if (not (ediff-multiframe-setup-p)) 524 (if (not (ediff-multiframe-setup-p))
500 (ediff-make-bottom-toolbar)) ; checks if toolbar is requested 525 (ediff-make-bottom-toolbar)) ; this checks if toolbar is requested
501 (goto-char (point-min)) 526 (goto-char (point-min))
502 (skip-chars-forward ediff-whitespace))) 527 (skip-chars-forward ediff-whitespace)))
503 528
@@ -1162,33 +1187,59 @@ This is especially useful when comparing buffers side-by-side."
1162 1187
1163;;;###autoload 1188;;;###autoload
1164(defun ediff-toggle-multiframe () 1189(defun ediff-toggle-multiframe ()
1165 "Switch from the multiframe display to single-frame display and back. 1190 "Switch from multiframe display to single-frame display and back.
1166For a permanent change, set the variable `ediff-window-setup-function', 1191To change the default, set the variable `ediff-window-setup-function',
1167which see." 1192which see."
1168 (interactive) 1193 (interactive)
1169 (let (set-func) 1194 (let (window-setup-func)
1170 (or (ediff-window-display-p) 1195 (or (ediff-window-display-p)
1171 (error "%sEmacs is not running as a window application" 1196 (error "%sEmacs is not running as a window application"
1172 (if ediff-emacs-p "" "X"))) 1197 (if ediff-emacs-p "" "X")))
1173
1174 (setq set-func (if (ediff-in-control-buffer-p) 'setq 'setq-default))
1175 1198
1176 (cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe) 1199 (cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe)
1177 (eval 1200 (setq window-setup-func 'ediff-setup-windows-plain))
1178 (list
1179 set-func
1180 'ediff-window-setup-function ''ediff-setup-windows-plain)))
1181 ((eq ediff-window-setup-function 'ediff-setup-windows-plain) 1201 ((eq ediff-window-setup-function 'ediff-setup-windows-plain)
1182 (if (ediff-in-control-buffer-p) 1202 (if (ediff-in-control-buffer-p)
1183 (ediff-kill-bottom-toolbar)) 1203 (ediff-kill-bottom-toolbar))
1184 (eval 1204 (setq window-setup-func 'ediff-setup-windows-multiframe)))
1185 (list 1205
1186 set-func 1206 ;; change default
1187 'ediff-window-setup-function ''ediff-setup-windows-multiframe)))) 1207 (setq-default ediff-window-setup-function window-setup-func)
1208 ;; change in all active ediff sessions
1209 (mapcar (function (lambda(buf)
1210 (ediff-eval-in-buffer buf
1211 (setq ediff-window-setup-function window-setup-func
1212 ediff-window-B nil))))
1213 ediff-session-registry)
1188 (if (ediff-in-control-buffer-p) 1214 (if (ediff-in-control-buffer-p)
1215 (ediff-recenter 'no-rehighlight))))
1216
1217
1218;;;###autoload
1219(defun ediff-toggle-use-toolbar ()
1220 "Enable or disable Ediff toolbar.
1221Works only in versions of Emacs that support toolbars.
1222To change the default, set the variable `ediff-use-toolbar-p', which see."
1223 (interactive)
1224 (if (featurep 'ediff-tbar)
1189 (progn 1225 (progn
1190 (setq ediff-window-B nil) 1226 (or (ediff-window-display-p)
1191 (ediff-recenter 'no-rehighlight))))) 1227 (error "%sEmacs is not running as a window application"
1228 (if ediff-emacs-p "" "X")))
1229 (if (ediff-use-toolbar-p)
1230 (ediff-kill-bottom-toolbar))
1231 ;; do this only after killing the toolbar
1232 (setq ediff-use-toolbar-p (not ediff-use-toolbar-p))
1233
1234 (mapcar (function (lambda(buf)
1235 (ediff-eval-in-buffer buf
1236 ;; force redisplay
1237 (setq ediff-window-config-saved "")
1238 )))
1239 ediff-session-registry)
1240 (if (ediff-in-control-buffer-p)
1241 (ediff-recenter 'no-rehighlight)))))
1242
1192 1243
1193;; if was using toolbar, kill it 1244;; if was using toolbar, kill it
1194(defun ediff-kill-bottom-toolbar () 1245(defun ediff-kill-bottom-toolbar ()
@@ -1203,13 +1254,25 @@ which see."
1203 (set-specifier bottom-toolbar (list (selected-frame) nil)) 1254 (set-specifier bottom-toolbar (list (selected-frame) nil))
1204 (set-specifier bottom-toolbar-visible-p (list (selected-frame) nil))))) 1255 (set-specifier bottom-toolbar-visible-p (list (selected-frame) nil)))))
1205 1256
1206;; if wants to use toolbar, make it 1257;; If wants to use toolbar, make it.
1207(defun ediff-make-bottom-toolbar () 1258;; If not, zero the toolbar for XEmacs.
1208 (if (ediff-use-toolbar-p) 1259;; Do nothing for Emacs.
1260(defun ediff-make-bottom-toolbar (&optional frame)
1261 (if (ediff-window-display-p)
1209 (progn 1262 (progn
1210 (set-specifier bottom-toolbar (list (selected-frame) ediff-toolbar)) 1263 (setq frame (or frame (selected-frame)))
1211 (set-specifier bottom-toolbar-visible-p (list (selected-frame) t)) 1264 (cond ((ediff-use-toolbar-p) ; this checks for XEmacs
1212 (set-specifier bottom-toolbar-height (list (selected-frame) 34))))) 1265 (set-specifier
1266 bottom-toolbar
1267 (list frame (if (ediff-3way-comparison-job)
1268 ediff-toolbar-3way ediff-toolbar)))
1269 (set-specifier bottom-toolbar-visible-p (list frame t))
1270 (set-specifier bottom-toolbar-height
1271 (list frame ediff-toolbar-height)))
1272 (ediff-xemacs-p
1273 (set-specifier bottom-toolbar-height (list frame 0)))
1274 ))
1275 ))
1213 1276
1214;; Merging 1277;; Merging
1215 1278
@@ -1266,7 +1329,7 @@ Used in ediff-windows/regions only."
1266 (narrow-to-region 1329 (narrow-to-region
1267 (ediff-overlay-start overl-B) (ediff-overlay-end overl-B))) 1330 (ediff-overlay-start overl-B) (ediff-overlay-end overl-B)))
1268 1331
1269 (if ediff-3way-comparison-job 1332 (if ediff-3way-job
1270 (ediff-eval-in-buffer ediff-buffer-C 1333 (ediff-eval-in-buffer ediff-buffer-C
1271 (narrow-to-region 1334 (narrow-to-region
1272 (ediff-overlay-start overl-C) (ediff-overlay-end overl-C)))) 1335 (ediff-overlay-start overl-C) (ediff-overlay-end overl-C))))
@@ -1516,6 +1579,7 @@ With a prefix argument, go forward that many differences."
1516 (+ ediff-current-difference arg))) 1579 (+ ediff-current-difference arg)))
1517 regexp-skip) 1580 regexp-skip)
1518 1581
1582 (ediff-visible-region)
1519 (or (>= n ediff-number-of-differences) 1583 (or (>= n ediff-number-of-differences)
1520 (setq regexp-skip (funcall ediff-skip-diff-region-function n)) 1584 (setq regexp-skip (funcall ediff-skip-diff-region-function n))
1521 (ediff-install-fine-diff-if-necessary n)) 1585 (ediff-install-fine-diff-if-necessary n))
@@ -1529,7 +1593,7 @@ With a prefix argument, go forward that many differences."
1529 (or (ediff-get-state-of-merge n) ""))) 1593 (or (ediff-get-state-of-merge n) "")))
1530 ;; skip difference regions that differ in white space 1594 ;; skip difference regions that differ in white space
1531 (and ediff-ignore-similar-regions 1595 (and ediff-ignore-similar-regions
1532 (ediff-no-fine-diffs-p n)))) 1596 (eq (ediff-no-fine-diffs-p n) t))))
1533 (setq n (1+ n)) 1597 (setq n (1+ n))
1534 (if (= 0 (mod n 20)) 1598 (if (= 0 (mod n 20))
1535 (message "Skipped over region %d and counting ..." n)) 1599 (message "Skipped over region %d and counting ..." n))
@@ -1552,6 +1616,7 @@ With a prefix argument, go back that many differences."
1552 (let ((n (max -1 (- ediff-current-difference arg))) 1616 (let ((n (max -1 (- ediff-current-difference arg)))
1553 regexp-skip) 1617 regexp-skip)
1554 1618
1619 (ediff-visible-region)
1555 (or (< n 0) 1620 (or (< n 0)
1556 (setq regexp-skip (funcall ediff-skip-diff-region-function n)) 1621 (setq regexp-skip (funcall ediff-skip-diff-region-function n))
1557 (ediff-install-fine-diff-if-necessary n)) 1622 (ediff-install-fine-diff-if-necessary n))
@@ -1565,7 +1630,7 @@ With a prefix argument, go back that many differences."
1565 (or (ediff-get-state-of-merge n) ""))) 1630 (or (ediff-get-state-of-merge n) "")))
1566 ;; skip difference regions that differ in white space 1631 ;; skip difference regions that differ in white space
1567 (and ediff-ignore-similar-regions 1632 (and ediff-ignore-similar-regions
1568 (ediff-no-fine-diffs-p n)))) 1633 (eq (ediff-no-fine-diffs-p n) t))))
1569 (if (= 0 (mod (1+ n) 20)) 1634 (if (= 0 (mod (1+ n) 20))
1570 (message "Skipped over region %d and counting ..." (1+ n))) 1635 (message "Skipped over region %d and counting ..." (1+ n)))
1571 (setq n (1- n)) 1636 (setq n (1- n))
@@ -2170,13 +2235,15 @@ If it is t, they will be preserved unconditionally. A prefix argument,
2170temporarily reverses the meaning of this variable." 2235temporarily reverses the meaning of this variable."
2171 (interactive "P") 2236 (interactive "P")
2172 (ediff-barf-if-not-control-buffer) 2237 (ediff-barf-if-not-control-buffer)
2173 (if (y-or-n-p (format "Quit this Ediff session%s? " 2238 (let ((ctl-buf (current-buffer)))
2174 (if (ediff-buffer-live-p ediff-meta-buffer) 2239 (if (y-or-n-p (format "Quit this Ediff session%s? "
2175 " & show containing session group" ""))) 2240 (if (ediff-buffer-live-p ediff-meta-buffer)
2176 (progn 2241 " & show containing session group" "")))
2177 (message "") 2242 (progn
2178 (ediff-really-quit reverse-default-keep-variants)) 2243 (message "")
2179 (message ""))) 2244 (set-buffer ctl-buf)
2245 (ediff-really-quit reverse-default-keep-variants))
2246 (message ""))))
2180 2247
2181 2248
2182;; Perform the quit operations. 2249;; Perform the quit operations.
@@ -2319,9 +2386,10 @@ temporarily reverses the meaning of this variable."
2319 (ediff-kill-buffer-carefully ediff-fine-diff-buffer) 2386 (ediff-kill-buffer-carefully ediff-fine-diff-buffer)
2320 (ediff-kill-buffer-carefully ediff-tmp-buffer) 2387 (ediff-kill-buffer-carefully ediff-tmp-buffer)
2321 (ediff-kill-buffer-carefully ediff-error-buffer) 2388 (ediff-kill-buffer-carefully ediff-error-buffer)
2322 (ediff-kill-buffer-carefully ediff-patch-diagnostics)
2323 (ediff-kill-buffer-carefully ediff-msg-buffer) 2389 (ediff-kill-buffer-carefully ediff-msg-buffer)
2324 (ediff-kill-buffer-carefully ediff-debug-buffer) 2390 (ediff-kill-buffer-carefully ediff-debug-buffer)
2391 (if (boundp 'ediff-patch-diagnostics)
2392 (ediff-kill-buffer-carefully ediff-patch-diagnostics))
2325 2393
2326 (if (and (ediff-window-display-p) (frame-live-p ctl-frame)) 2394 (if (and (ediff-window-display-p) (frame-live-p ctl-frame))
2327 (delete-frame ctl-frame)) 2395 (delete-frame ctl-frame))
@@ -2389,27 +2457,33 @@ buffer in another session as well."
2389 (buffer-name ediff-buffer-C))))) 2457 (buffer-name ediff-buffer-C)))))
2390 (ediff-kill-buffer-carefully ediff-buffer-C)))) 2458 (ediff-kill-buffer-carefully ediff-buffer-C))))
2391 2459
2392(defun ediff-maybe-save-and-delete-merge () 2460(defun ediff-maybe-save-and-delete-merge (&optional save-and-continue)
2393 "Default hook to run on quitting a merge job. 2461 "Default hook to run on quitting a merge job.
2462This can also be used to save merge buffer in the middle of an Ediff session.
2463
2464If the optional SAVE-AND-CONTINUE argument is non-nil, save merge buffer and
2465continue. Otherwise:
2394If `ediff-autostore-merges' is nil, this does nothing. 2466If `ediff-autostore-merges' is nil, this does nothing.
2395If it is t, it saves the merge buffer in the file `ediff-merge-store-file' 2467If it is t, it saves the merge buffer in the file `ediff-merge-store-file'
2396or asks the user, if the latter is nil. It then then asks the user whether to 2468or asks the user, if the latter is nil. It then asks the user whether to
2397delete the merge buffer. 2469delete the merge buffer.
2398If `ediff-autostore-merges' is neither nil nor t, the merge buffer is saved 2470If `ediff-autostore-merges' is neither nil nor t, the merge buffer is saved
2399only if this merge job is part of a group, i.e., was invoked from within 2471only if this merge job is part of a group, i.e., was invoked from within
2400`ediff-merge-directories', `ediff-merge-directory-revisions', and such." 2472`ediff-merge-directories', `ediff-merge-directory-revisions', and such."
2401 (let ((merge-store-file ediff-merge-store-file)) 2473 (let ((merge-store-file ediff-merge-store-file)
2474 (ediff-autostore-merges ; fake ediff-autostore-merges, if necessary
2475 (if save-and-continue t ediff-autostore-merges)))
2402 (if ediff-autostore-merges 2476 (if ediff-autostore-merges
2403 (cond ((stringp ediff-merge-store-file) 2477 (cond ((stringp ediff-merge-store-file)
2404 ;; store, ask to delete 2478 ;; store, ask to delete
2405 (ediff-write-merge-buffer-then-kill 2479 (ediff-write-merge-buffer-and-maybe-kill
2406 ediff-buffer-C merge-store-file 'show-file)) 2480 ediff-buffer-C merge-store-file 'show-file save-and-continue))
2407 ((eq ediff-autostore-merges t) 2481 ((eq ediff-autostore-merges t)
2408 ;; ask for file name 2482 ;; ask for file name
2409 (setq merge-store-file 2483 (setq merge-store-file
2410 (read-file-name "Save the result of the merge in: ")) 2484 (read-file-name "Save the merge buffer in file: "))
2411 (ediff-write-merge-buffer-then-kill 2485 (ediff-write-merge-buffer-and-maybe-kill
2412 ediff-buffer-C merge-store-file)) 2486 ediff-buffer-C merge-store-file nil save-and-continue))
2413 ((and (ediff-buffer-live-p ediff-meta-buffer) 2487 ((and (ediff-buffer-live-p ediff-meta-buffer)
2414 (ediff-eval-in-buffer ediff-meta-buffer 2488 (ediff-eval-in-buffer ediff-meta-buffer
2415 (ediff-merge-metajob))) 2489 (ediff-merge-metajob)))
@@ -2418,12 +2492,16 @@ only if this merge job is part of a group, i.e., was invoked from within
2418 ;; of the merge. 2492 ;; of the merge.
2419 ;; Ask where to save anyway--will decide what to do here later. 2493 ;; Ask where to save anyway--will decide what to do here later.
2420 (setq merge-store-file 2494 (setq merge-store-file
2421 (read-file-name "The result of the merge goes into: ")) 2495 (read-file-name "Save the merge buffer in file: "))
2422 (ediff-write-merge-buffer-then-kill 2496 (ediff-write-merge-buffer-and-maybe-kill
2423 ediff-buffer-C merge-store-file)))) 2497 ediff-buffer-C merge-store-file nil save-and-continue))))
2424 )) 2498 ))
2425 2499
2426(defun ediff-write-merge-buffer-then-kill (buf file &optional show-file) 2500;; write merge buffer. If the optional argument save-and-continue is non-nil,
2501;; then don't kill the merge buffer
2502(defun ediff-write-merge-buffer-and-maybe-kill (buf file
2503 &optional
2504 show-file save-and-continue)
2427 (ediff-eval-in-buffer buf 2505 (ediff-eval-in-buffer buf
2428 (if (or (not (file-exists-p file)) 2506 (if (or (not (file-exists-p file))
2429 (y-or-n-p (format "File %s exists, overwrite? " file))) 2507 (y-or-n-p (format "File %s exists, overwrite? " file)))
@@ -2433,7 +2511,9 @@ only if this merge job is part of a group, i.e., was invoked from within
2433 (progn 2511 (progn
2434 (message "Merge buffer saved in: %s" file) 2512 (message "Merge buffer saved in: %s" file)
2435 (sit-for 2))) 2513 (sit-for 2)))
2436 (if (y-or-n-p "Merge buffer saved in file. Now kill the buffer? ") 2514 (if (and
2515 (not save-and-continue)
2516 (y-or-n-p "Merge buffer saved in file. Now kill the buffer? "))
2437 (ediff-kill-buffer-carefully buf)))))) 2517 (ediff-kill-buffer-carefully buf))))))
2438 2518
2439;; The default way of suspending Ediff. 2519;; The default way of suspending Ediff.
@@ -2445,8 +2525,9 @@ only if this merge job is part of a group, i.e., was invoked from within
2445 (buf-A-wind (ediff-get-visible-buffer-window buf-A)) 2525 (buf-A-wind (ediff-get-visible-buffer-window buf-A))
2446 (buf-B-wind (ediff-get-visible-buffer-window buf-B)) 2526 (buf-B-wind (ediff-get-visible-buffer-window buf-B))
2447 (buf-C-wind (ediff-get-visible-buffer-window buf-C)) 2527 (buf-C-wind (ediff-get-visible-buffer-window buf-C))
2448 (buf-patch ediff-patchbufer) 2528 (buf-patch (if (boundp 'ediff-patchbufer) ediff-patchbufer nil))
2449 (buf-patch-diag ediff-patch-diagnostics) 2529 (buf-patch-diag (if (boundp 'ediff-patch-diagnostics)
2530 ediff-patch-diagnostics nil))
2450 (buf-err ediff-error-buffer) 2531 (buf-err ediff-error-buffer)
2451 (buf-diff ediff-diff-buffer) 2532 (buf-diff ediff-diff-buffer)
2452 (buf-custom-diff ediff-custom-diff-buffer) 2533 (buf-custom-diff ediff-custom-diff-buffer)
@@ -2467,20 +2548,28 @@ only if this merge job is part of a group, i.e., was invoked from within
2467 (select-window buf-A-wind) 2548 (select-window buf-A-wind)
2468 (delete-other-windows) 2549 (delete-other-windows)
2469 (bury-buffer)) 2550 (bury-buffer))
2470 (if (ediff-buffer-live-p buf-A) (bury-buffer buf-A))) 2551 (if (ediff-buffer-live-p buf-A)
2552 (progn
2553 (set-buffer buf-A)
2554 (bury-buffer))))
2471 (if (window-live-p buf-B-wind) 2555 (if (window-live-p buf-B-wind)
2472 (progn 2556 (progn
2473 (select-window buf-B-wind) 2557 (select-window buf-B-wind)
2474 (delete-other-windows) 2558 (delete-other-windows)
2475 (bury-buffer)) 2559 (bury-buffer))
2476 (if (ediff-buffer-live-p buf-B) (bury-buffer buf-B))) 2560 (if (ediff-buffer-live-p buf-B)
2561 (progn
2562 (set-buffer buf-B)
2563 (bury-buffer))))
2477 (if (window-live-p buf-C-wind) 2564 (if (window-live-p buf-C-wind)
2478 (progn 2565 (progn
2479 (select-window buf-C-wind) 2566 (select-window buf-C-wind)
2480 (delete-other-windows) 2567 (delete-other-windows)
2481 (bury-buffer)) 2568 (bury-buffer))
2482 (if (ediff-buffer-live-p buf-C) (bury-buffer buf-C))) 2569 (if (ediff-buffer-live-p buf-C)
2483 2570 (progn
2571 (set-buffer buf-C)
2572 (bury-buffer))))
2484 )) 2573 ))
2485 2574
2486 2575
@@ -2530,12 +2619,12 @@ Hit \\[ediff-recenter] to reset the windows afterward."
2530 (if (ediff-buffer-live-p ediff-custom-diff-buffer) 2619 (if (ediff-buffer-live-p ediff-custom-diff-buffer)
2531 (concat "\tin buffer " 2620 (concat "\tin buffer "
2532 (buffer-name ediff-custom-diff-buffer)) 2621 (buffer-name ediff-custom-diff-buffer))
2533 "is not available"))) 2622 " is not available")))
2534 (princ (format "Plain diff output %s\n" 2623 (princ (format "Plain diff output %s\n"
2535 (if (ediff-buffer-live-p ediff-diff-buffer) 2624 (if (ediff-buffer-live-p ediff-diff-buffer)
2536 (concat "\tin buffer " 2625 (concat "\tin buffer "
2537 (buffer-name ediff-diff-buffer)) 2626 (buffer-name ediff-diff-buffer))
2538 "is not available"))) 2627 " is not available")))
2539 2628
2540 (let* ((A-line (ediff-eval-in-buffer ediff-buffer-A 2629 (let* ((A-line (ediff-eval-in-buffer ediff-buffer-A
2541 (1+ (count-lines (point-min) (point))))) 2630 (1+ (count-lines (point-min) (point)))))
@@ -2557,9 +2646,9 @@ Hit \\[ediff-recenter] to reset the windows afterward."
2557 (t (1+ ediff-current-difference))))) 2646 (t (1+ ediff-current-difference)))))
2558 2647
2559 (princ 2648 (princ
2560 (format "\n%s regions that differ only in white space & line breaks" 2649 (format "\n%s regions that differ in white space & line breaks only"
2561 (if ediff-ignore-similar-regions 2650 (if ediff-ignore-similar-regions
2562 "Skipping" "Not skipping"))) 2651 "Ignoring" "Showing")))
2563 (if (and ediff-merge-job ediff-show-clashes-only) 2652 (if (and ediff-merge-job ediff-show-clashes-only)
2564 (princ 2653 (princ
2565 "\nFocusing on regions where both buffers differ from the ancestor")) 2654 "\nFocusing on regions where both buffers differ from the ancestor"))
@@ -2906,16 +2995,19 @@ Ediff Control Panel to restore highlighting."
2906 (let ((answer "") 2995 (let ((answer "")
2907 (possibilities (list ?A ?B ?C)) 2996 (possibilities (list ?A ?B ?C))
2908 (zmacs-regions t) 2997 (zmacs-regions t)
2998 (ctl-buf (current-buffer))
2909 quit-now 2999 quit-now
2910 begA begB endA endB bufA bufB) 3000 begA begB endA endB bufA bufB)
2911 3001
2912 (cond ((ediff-merge-job) 3002 (cond ((ediff-merge-job)
2913 (setq bufB ediff-buffer-C) 3003 (setq bufB ediff-buffer-C)
2914 (while (cond ((memq answer '(?A ?a)) 3004 (while (cond ((eq answer ?A)
2915 (setq bufA ediff-buffer-A) 3005 (setq bufA ediff-buffer-A
3006 possibilities '(?B))
2916 nil) 3007 nil)
2917 ((memq answer '(?B ?b)) 3008 ((eq answer ?B)
2918 (setq bufA ediff-buffer-B) 3009 (setq bufA ediff-buffer-B
3010 possibilities '(?A))
2919 nil) 3011 nil)
2920 ((equal answer "")) 3012 ((equal answer ""))
2921 (t (beep 1) 3013 (t (beep 1)
@@ -2924,7 +3016,7 @@ Ediff Control Panel to restore highlighting."
2924 t)) 3016 t))
2925 (let ((cursor-in-echo-area t)) 3017 (let ((cursor-in-echo-area t))
2926 (message "Which buffer to compare to the merge buffer (A/B)? ") 3018 (message "Which buffer to compare to the merge buffer (A/B)? ")
2927 (setq answer (read-char-exclusive))))) 3019 (setq answer (capitalize (read-char-exclusive))))))
2928 3020
2929 ((ediff-3way-comparison-job) 3021 ((ediff-3way-comparison-job)
2930 (while (cond ((memq answer possibilities) 3022 (while (cond ((memq answer possibilities)
@@ -2964,7 +3056,8 @@ Ediff Control Panel to restore highlighting."
2964 (setq answer (capitalize (read-char-exclusive)))))) 3056 (setq answer (capitalize (read-char-exclusive))))))
2965 (t ; 2way comparison 3057 (t ; 2way comparison
2966 (setq bufA ediff-buffer-A 3058 (setq bufA ediff-buffer-A
2967 bufB ediff-buffer-B))) 3059 bufB ediff-buffer-B
3060 possibilities nil)))
2968 3061
2969 (ediff-eval-in-buffer bufA 3062 (ediff-eval-in-buffer bufA
2970 (or (mark t) 3063 (or (mark t)
@@ -3010,8 +3103,21 @@ Ediff Control Panel to restore highlighting."
3010 ) 3103 )
3011 ;; (sit-for 0) 3104 ;; (sit-for 0)
3012 3105
3106 ;; At this point, possibilities contains either the window char A/B/C
3107 ;; that was not selected, or it is nil. We delete the window that is not
3108 ;; selected.
3109 (if possibilities
3110 (ediff-eval-in-buffer ctl-buf
3111 (let* ((wind-to-delete (eval
3112 (intern
3113 (format
3114 "ediff-window-%c" (car possibilities)))))
3115 (frame (window-frame wind-to-delete)))
3116 (delete-window wind-to-delete)
3117 (select-frame frame)
3118 (balance-windows))))
3013 (or (y-or-n-p 3119 (or (y-or-n-p
3014 "Please check the selected regions. Continue? ") 3120 "Please check regions selected for comparison. Continue? ")
3015 (setq quit-now t)) 3121 (setq quit-now t))
3016 3122
3017 (ediff-eval-in-buffer bufA 3123 (ediff-eval-in-buffer bufA
@@ -3019,13 +3125,18 @@ Ediff Control Panel to restore highlighting."
3019 (ediff-eval-in-buffer bufB 3125 (ediff-eval-in-buffer bufB
3020 (widen)) 3126 (widen))
3021 (if quit-now 3127 (if quit-now
3022 (error "Thank you. Come back another day...")) 3128 (ediff-eval-in-buffer ctl-buf
3129 (ediff-recenter)
3130 (sit-for 0)
3131 (error "All right. Make up your mind and come back...")))
3023 3132
3024 (ediff-regions-internal 3133 (ediff-regions-internal
3025 bufA begA endA bufB begB endB 3134 bufA begA endA bufB begB endB
3026 nil ; startup hook 3135 nil ; setup-hook
3027 'ediff-regions-linewise ; job name 3136 'ediff-regions-linewise ; job name
3028 nil) ; no word mode 3137 nil ; no word mode
3138 ;; setup param to pass to ediff-setup
3139 (list (cons 'ediff-split-window-function ediff-split-window-function)))
3029 )) 3140 ))
3030 3141
3031 3142
@@ -3184,18 +3295,6 @@ Ediff Control Panel to restore highlighting."
3184 (ediff-overlay-put overl 'ediff-diff-num 0) 3295 (ediff-overlay-put overl 'ediff-diff-num 0)
3185 overl)))) 3296 overl))))
3186 3297
3187(defsubst ediff-overlay-start (overl)
3188 (if (ediff-overlayp overl)
3189 (if ediff-emacs-p
3190 (overlay-start overl)
3191 (extent-start-position overl))))
3192
3193(defsubst ediff-overlay-end (overl)
3194 (if (ediff-overlayp overl)
3195 (if ediff-emacs-p
3196 (overlay-end overl)
3197 (extent-end-position overl))))
3198
3199 3298
3200;; Like other-buffer, but prefers visible buffers and ignores temporary or 3299;; Like other-buffer, but prefers visible buffers and ignores temporary or
3201;; other insignificant buffers (those beginning with "^[ *]"). 3300;; other insignificant buffers (those beginning with "^[ *]").
@@ -3594,6 +3693,4 @@ Mail anyway? (y or n) ")
3594;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 3693;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
3595;;; End: 3694;;; End:
3596 3695
3597(provide 'ediff-util)
3598
3599;;; ediff-util.el ends here 3696;;; ediff-util.el ends here
diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el
index cec2d6f2ccf..75cfb789d0e 100644
--- a/lisp/ediff-vers.el
+++ b/lisp/ediff-vers.el
@@ -1,6 +1,6 @@
1;;; ediff-vers.el --- version control interface to Ediff 1;;; ediff-vers.el --- version control interface to Ediff
2 2
3;;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. 3;;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -30,6 +30,7 @@
30(defvar cvs-shell) 30(defvar cvs-shell)
31(defvar cvs-program) 31(defvar cvs-program)
32(defvar cvs-cookie-handle) 32(defvar cvs-cookie-handle)
33(defvar ediff-temp-file-prefix)
33 34
34(and noninteractive 35(and noninteractive
35 (eval-when-compile 36 (eval-when-compile
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el
index 8edde2995df..6aff0d81278 100644
--- a/lisp/ediff-wind.el
+++ b/lisp/ediff-wind.el
@@ -1,6 +1,6 @@
1;;; ediff-wind.el --- window manipulation utilities 1;;; ediff-wind.el --- window manipulation utilities
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -22,11 +22,8 @@
22;; Boston, MA 02111-1307, USA. 22;; Boston, MA 02111-1307, USA.
23 23
24;;; Code: 24;;; Code:
25 25
26(require 'ediff-init) 26(provide 'ediff-wind)
27(if ediff-xemacs-p
28 (require 'ediff-tbar)
29 (defun ediff-compute-toolbar-width () 0))
30 27
31;; Compiler pacifier 28;; Compiler pacifier
32(defvar icon-title-format) 29(defvar icon-title-format)
@@ -38,10 +35,39 @@
38(defvar right-toolbar-width) 35(defvar right-toolbar-width)
39(defvar default-menubar) 36(defvar default-menubar)
40(defvar frame-icon-title-format) 37(defvar frame-icon-title-format)
38(defvar ediff-diff-status)
39
40(eval-when-compile
41 (let ((load-path (cons (expand-file-name ".") load-path)))
42 (or (featurep 'ediff-init)
43 (load "ediff-init.el" nil nil 'nosuffix))
44 (or (featurep 'ediff-util)
45 (load "ediff-util.el" nil nil 'nosuffix))
46 (or (featurep 'ediff-help)
47 (load "ediff-help.el" nil nil 'nosuffix))
48 (or (featurep 'ediff-tbar)
49 (load "ediff-tbar.el" 'noerror nil 'nosuffix))
50 ))
41;; end pacifier 51;; end pacifier
42 52
53(require 'ediff-init)
54
55;; be careful with ediff-tbar
56(if ediff-xemacs-p
57 (condition-case nil
58 (require 'ediff-tbar)
59 (error
60 (defun ediff-compute-toolbar-width () 0)))
61 (defun ediff-compute-toolbar-width () 0))
62
63(defgroup ediff-window nil
64 "Ediff window manipulation"
65 :prefix "ediff-"
66 :group 'ediff
67 :group 'frames)
68
43 69
44(defvar ediff-window-setup-function (if (ediff-window-display-p) 70(defcustom ediff-window-setup-function (if (ediff-window-display-p)
45 'ediff-setup-windows-multiframe 71 'ediff-setup-windows-multiframe
46 'ediff-setup-windows-plain) 72 'ediff-setup-windows-plain)
47 "*Function called to set up windows. 73 "*Function called to set up windows.
@@ -62,7 +88,9 @@ The basic guidelines:
62 buffer-A, buffer-B, buffer-C, control-buffer 88 buffer-A, buffer-B, buffer-C, control-buffer
63 Buffer C may not be used in jobs that compare only two buffers. 89 Buffer C may not be used in jobs that compare only two buffers.
64If you plan to do something fancy, take a close look at how the two 90If you plan to do something fancy, take a close look at how the two
65provided functions are written.") 91provided functions are written."
92 :type 'function
93 :group 'ediff-window)
66 94
67;; indicates if we are in a multiframe setup 95;; indicates if we are in a multiframe setup
68(ediff-defvar-local ediff-multiframe nil "") 96(ediff-defvar-local ediff-multiframe nil "")
@@ -83,21 +111,25 @@ provided functions are written.")
83(ediff-defvar-local ediff-window-config-saved "" "") 111(ediff-defvar-local ediff-window-config-saved "" "")
84 112
85 113
86(defvar ediff-split-window-function 'split-window-vertically 114(defcustom ediff-split-window-function 'split-window-vertically
87 "*The function used to split the main window between buffer-A and buffer-B. 115 "*The function used to split the main window between buffer-A and buffer-B.
88You can set it to a horizontal split instead of the default vertical split 116You can set it to a horizontal split instead of the default vertical split
89by setting this variable to `split-window-horizontally'. 117by setting this variable to `split-window-horizontally'.
90You can also have your own function to do fancy splits. 118You can also have your own function to do fancy splits.
91This variable has no effect when buffer-A/B are shown in different frames. 119This variable has no effect when buffer-A/B are shown in different frames.
92In this case, Ediff will use those frames to display these buffers.") 120In this case, Ediff will use those frames to display these buffers."
121 :type 'function
122 :group 'ediff-window)
93 123
94(defvar ediff-merge-split-window-function 'split-window-horizontally 124(defcustom ediff-merge-split-window-function 'split-window-horizontally
95 "*The function used to split the main window between buffer-A and buffer-B. 125 "*The function used to split the main window between buffer-A and buffer-B.
96You can set it to a vertical split instead of the default horizontal split 126You can set it to a vertical split instead of the default horizontal split
97by setting this variable to `split-window-vertically'. 127by setting this variable to `split-window-vertically'.
98You can also have your own function to do fancy splits. 128You can also have your own function to do fancy splits.
99This variable has no effect when buffer-A/B/C are shown in different frames. 129This variable has no effect when buffer-A/B/C are shown in different frames.
100In this case, Ediff will use those frames to display these buffers.") 130In this case, Ediff will use those frames to display these buffers."
131 :type 'function
132 :group 'ediff-window)
101 133
102(defconst ediff-control-frame-parameters 134(defconst ediff-control-frame-parameters
103 (list 135 (list
@@ -132,40 +164,50 @@ Do not specify width and height here. These are computed automatically.")
132(defvar ediff-mouse-pixel-threshold 30 164(defvar ediff-mouse-pixel-threshold 30
133 "If the user moves mouse more than this many pixels, Ediff won't warp mouse into control window.") 165 "If the user moves mouse more than this many pixels, Ediff won't warp mouse into control window.")
134 166
135(defvar ediff-grab-mouse t 167(defcustom ediff-grab-mouse t
136 "*If t, Ediff will always grab the mouse and put it in the control frame. 168 "*If t, Ediff will always grab the mouse and put it in the control frame.
137If 'maybe, Ediff will do it sometimes, but not after operations that require 169If 'maybe, Ediff will do it sometimes, but not after operations that require
138relatively long time. If nil, the mouse will be entirely user's 170relatively long time. If nil, the mouse will be entirely user's
139responsibility.") 171responsibility."
172 :type 'boolean
173 :group 'ediff-window)
140 174
141(defvar ediff-control-frame-position-function 'ediff-make-frame-position 175(defcustom ediff-control-frame-position-function 'ediff-make-frame-position
142 "Function to call to determine the desired location for the control panel. 176 "Function to call to determine the desired location for the control panel.
143Expects three parameters: the control buffer, the desired width and height 177Expects three parameters: the control buffer, the desired width and height
144of the control frame. It returns an association list 178of the control frame. It returns an association list
145of the form \(\(top . <position>\) \(left . <position>\)\)") 179of the form \(\(top . <position>\) \(left . <position>\)\)"
180 :type 'boolean
181 :group 'ediff-window)
146 182
147(defvar ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14) 183(defcustom ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14)
148 "*The upward shift of control frame from the top of buffer A's frame. 184 "*The upward shift of control frame from the top of buffer A's frame.
149Measured in pixels. 185Measured in pixels.
150This is used by the default control frame positioning function, 186This is used by the default control frame positioning function,
151`ediff-make-frame-position'. This variable is provided for easy 187`ediff-make-frame-position'. This variable is provided for easy
152customization of the default.") 188customization of the default."
189 :type 'integer
190 :group 'ediff-window)
153 191
154(defvar ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3) 192(defcustom ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3)
155 "*The leftward shift of control frame from the right edge of buf A's frame. 193 "*The leftward shift of control frame from the right edge of buf A's frame.
156Measured in characters. 194Measured in characters.
157This is used by the default control frame positioning function, 195This is used by the default control frame positioning function,
158`ediff-make-frame-position' to adjust the position of the control frame 196`ediff-make-frame-position' to adjust the position of the control frame
159when it shows the short menu. This variable is provided for easy 197when it shows the short menu. This variable is provided for easy
160customization of the default.") 198customization of the default."
199 :type 'integer
200 :group 'ediff-window)
161 201
162(defvar ediff-wide-control-frame-rightward-shift 7 202(defcustom ediff-wide-control-frame-rightward-shift 7
163 "*The rightward shift of control frame from the left edge of buf A's frame. 203 "*The rightward shift of control frame from the left edge of buf A's frame.
164Measured in characters. 204Measured in characters.
165This is used by the default control frame positioning function, 205This is used by the default control frame positioning function,
166`ediff-make-frame-position' to adjust the position of the control frame 206`ediff-make-frame-position' to adjust the position of the control frame
167when it shows the full menu. This variable is provided for easy 207when it shows the full menu. This variable is provided for easy
168customization of the default.") 208customization of the default."
209 :type 'integer
210 :group 'ediff-window)
169 211
170 212
171;; Wide frame display 213;; Wide frame display
@@ -189,7 +231,7 @@ the frame used for the wide display.")
189;; Frame used for the control panel in a windowing system. 231;; Frame used for the control panel in a windowing system.
190(ediff-defvar-local ediff-control-frame nil "") 232(ediff-defvar-local ediff-control-frame nil "")
191 233
192(defvar ediff-prefer-iconified-control-frame nil 234(defcustom ediff-prefer-iconified-control-frame nil
193 "*If t, keep control panel iconified when help message is off. 235 "*If t, keep control panel iconified when help message is off.
194This has effect only on a windowing system. 236This has effect only on a windowing system.
195If t, hitting `?' to toggle control panel off iconifies it. 237If t, hitting `?' to toggle control panel off iconifies it.
@@ -197,7 +239,9 @@ If t, hitting `?' to toggle control panel off iconifies it.
197This is only useful in Emacs and only for certain kinds of window managers, 239This is only useful in Emacs and only for certain kinds of window managers,
198such as TWM and its derivatives, since the window manager must permit 240such as TWM and its derivatives, since the window manager must permit
199keyboard input to go into icons. XEmacs completely ignores keyboard input 241keyboard input to go into icons. XEmacs completely ignores keyboard input
200into icons, regardless of the window manager.") 242into icons, regardless of the window manager."
243 :type 'boolean
244 :group 'ediff-window)
201 245
202;;; Functions 246;;; Functions
203 247
@@ -515,8 +559,12 @@ into icons, regardless of the window manager.")
515 559
516 (if use-same-frame 560 (if use-same-frame
517 (let ((window-min-height 1)) 561 (let ((window-min-height 1))
518 ;; avoid dedicated and non-splittable windows 562 (if (and (eq frame-A frame-B)
519 (ediff-skip-unsuitable-frames) 563 (eq frame-B frame-C)
564 (frame-live-p frame-A))
565 (select-frame frame-A)
566 ;; avoid dedicated and non-splittable windows
567 (ediff-skip-unsuitable-frames))
520 (delete-other-windows) 568 (delete-other-windows)
521 (setq merge-window-lines 569 (setq merge-window-lines
522 (max 2 (round (* (window-height) merge-window-share)))) 570 (max 2 (round (* (window-height) merge-window-share))))
@@ -678,8 +726,10 @@ into icons, regardless of the window manager.")
678 726
679 (if use-same-frame 727 (if use-same-frame
680 (let (wind-width-or-height) ; this affects 3way setups only 728 (let (wind-width-or-height) ; this affects 3way setups only
681 ;; avoid dedicated and non-splittable windows 729 (if (and (eq frame-A frame-B) (frame-live-p frame-A))
682 (ediff-skip-unsuitable-frames) 730 (select-frame frame-A)
731 ;; avoid dedicated and non-splittable windows
732 (ediff-skip-unsuitable-frames))
683 (delete-other-windows) 733 (delete-other-windows)
684 (switch-to-buffer buf-A) 734 (switch-to-buffer buf-A)
685 (setq wind-A (selected-window)) 735 (setq wind-A (selected-window))
@@ -858,16 +908,15 @@ into icons, regardless of the window manager.")
858 fheight lines 908 fheight lines
859 fwidth (max (+ (ediff-help-message-line-length) 2) 909 fwidth (max (+ (ediff-help-message-line-length) 2)
860 (ediff-compute-toolbar-width)) 910 (ediff-compute-toolbar-width))
861 adjusted-parameters (append (list 911 adjusted-parameters
862 ;; possibly change surrogate minibuffer 912 (list
863 (cons 'minibuffer 913 ;; possibly change surrogate minibuffer
864 (minibuffer-window 914 (cons 'minibuffer
865 designated-minibuffer-frame)) 915 (minibuffer-window
866 (cons 'width fwidth) 916 designated-minibuffer-frame))
867 (cons 'height fheight)) 917 (cons 'width fwidth)
868 (funcall 918 (cons 'height fheight))
869 ediff-control-frame-position-function 919 )
870 ctl-buffer fwidth fheight)))
871 (if ediff-use-long-help-message 920 (if ediff-use-long-help-message
872 (setq adjusted-parameters 921 (setq adjusted-parameters
873 (cons '(auto-raise . nil) adjusted-parameters))) 922 (cons '(auto-raise . nil) adjusted-parameters)))
@@ -876,8 +925,10 @@ into icons, regardless of the window manager.")
876 ;; are changed. 925 ;; are changed.
877 (if ediff-xemacs-p 926 (if ediff-xemacs-p
878 (progn 927 (progn
928 (set-specifier top-toolbar-height (list ctl-frame 2))
929 (sit-for 0)
879 (set-specifier top-toolbar-height (list ctl-frame 0)) 930 (set-specifier top-toolbar-height (list ctl-frame 0))
880 (set-specifier bottom-toolbar-height (list ctl-frame 0)) 931 ;;(set-specifier bottom-toolbar-height (list ctl-frame 0))
881 (set-specifier left-toolbar-width (list ctl-frame 0)) 932 (set-specifier left-toolbar-width (list ctl-frame 0))
882 (set-specifier right-toolbar-width (list ctl-frame 0)) 933 (set-specifier right-toolbar-width (list ctl-frame 0))
883 )) 934 ))
@@ -890,11 +941,13 @@ into icons, regardless of the window manager.")
890 (if (memq system-type '(emx windows-nt windows-95)) 941 (if (memq system-type '(emx windows-nt windows-95))
891 (modify-frame-parameters ctl-frame adjusted-parameters)) 942 (modify-frame-parameters ctl-frame adjusted-parameters))
892 943
893 (goto-char (point-min)) 944 ;; make or zap toolbar (if not requested)
945 (ediff-make-bottom-toolbar ctl-frame)
894 946
947 (goto-char (point-min))
948
895 (modify-frame-parameters ctl-frame adjusted-parameters) 949 (modify-frame-parameters ctl-frame adjusted-parameters)
896 (make-frame-visible ctl-frame) 950 (make-frame-visible ctl-frame)
897 (ediff-make-bottom-toolbar) ; no effect if the toolbar is not requested
898 951
899 ;; This works around a bug in 19.25 and earlier. There, if frame gets 952 ;; This works around a bug in 19.25 and earlier. There, if frame gets
900 ;; iconified, the current buffer changes to that of the frame that 953 ;; iconified, the current buffer changes to that of the frame that
@@ -910,6 +963,12 @@ into icons, regardless of the window manager.")
910 (raise-frame ctl-frame))) 963 (raise-frame ctl-frame)))
911 964
912 (set-window-dedicated-p (selected-window) t) 965 (set-window-dedicated-p (selected-window) t)
966
967 ;; Now move the frame. We must do it separately due to an obscure bug in
968 ;; XEmacs
969 (modify-frame-parameters
970 ctl-frame
971 (funcall ediff-control-frame-position-function ctl-buffer fwidth fheight))
913 972
914 ;; synchronize so the cursor will move to control frame 973 ;; synchronize so the cursor will move to control frame
915 ;; per RMS suggestion 974 ;; per RMS suggestion
@@ -935,6 +994,7 @@ into icons, regardless of the window manager.")
935 (ediff-eval-in-buffer ctl-buffer 994 (ediff-eval-in-buffer ctl-buffer
936 (run-hooks 'ediff-after-setup-control-frame-hook)) 995 (run-hooks 'ediff-after-setup-control-frame-hook))
937 )) 996 ))
997
938 998
939(defun ediff-destroy-control-frame (ctl-buffer) 999(defun ediff-destroy-control-frame (ctl-buffer)
940 (ediff-eval-in-buffer ctl-buffer 1000 (ediff-eval-in-buffer ctl-buffer
@@ -1061,9 +1121,9 @@ It assumes that it is called from within the control buffer."
1061 1121
1062 ;; control buffer format 1122 ;; control buffer format
1063 (setq mode-line-format 1123 (setq mode-line-format
1064 (list (if (ediff-narrow-control-frame-p) " " "-- ") 1124 (if (ediff-narrow-control-frame-p)
1065 mode-line-buffer-identification 1125 (list " " mode-line-buffer-identification)
1066 " Quick Help")) 1126 (list "-- " mode-line-buffer-identification " Quick Help")))
1067 ;; control buffer id 1127 ;; control buffer id
1068 (setq mode-line-buffer-identification 1128 (setq mode-line-buffer-identification
1069 (if (ediff-narrow-control-frame-p) 1129 (if (ediff-narrow-control-frame-p)
@@ -1204,7 +1264,4 @@ It assumes that it is called from within the control buffer."
1204;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 1264;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
1205;;; End: 1265;;; End:
1206 1266
1207(provide 'ediff-wind)
1208
1209
1210;;; ediff-wind.el ends here 1267;;; ediff-wind.el ends here
diff --git a/lisp/ediff.el b/lisp/ediff.el
index 9c4c8cec3e5..61b51da5702 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -1,13 +1,13 @@
1;;; ediff.el --- a comprehensive visual interface to diff & patch 1;;; ediff.el --- a comprehensive visual interface to diff & patch
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6;; Created: February 2, 1994 6;; Created: February 2, 1994
7;; Keywords: comparing, merging, patching, version control. 7;; Keywords: comparing, merging, patching, version control.
8 8
9(defconst ediff-version "2.63" "The current version of Ediff") 9(defconst ediff-version "2.65" "The current version of Ediff")
10(defconst ediff-date "September 12, 1996" "Date of last update") 10(defconst ediff-date "May 1, 1997" "Date of last update")
11 11
12 12
13;; This file is part of GNU Emacs. 13;; This file is part of GNU Emacs.
@@ -106,21 +106,40 @@
106 106
107;;; Code: 107;;; Code:
108 108
109(require 'ediff-init) 109(provide 'ediff)
110;; ediff-mult is always required, because of the registry stuff
111(require 'ediff-mult)
112 110
111;; Compiler pacifier
113(and noninteractive 112(and noninteractive
114 (eval-when-compile 113 (eval-when-compile
115 (let ((load-path (cons (expand-file-name ".") load-path)))
116 (load-library "dired") 114 (load-library "dired")
117 (load-file "ediff-ptch.el") 115 (load-library "info")
118 (load-file "ediff-vers.el") 116 (load "pcl-cvs" 'noerror)))
119 (load "pcl-cvs" 'noerror)))) 117(eval-when-compile
118 (let ((load-path (cons (expand-file-name ".") load-path)))
119 (or (featurep 'ediff-init)
120 (load "ediff-init.el" nil nil 'nosuffix))
121 (or (featurep 'ediff-mult)
122 (load "ediff-mult.el" nil nil 'nosuffix))
123 (or (featurep 'ediff-ptch)
124 (load "ediff-ptch.el" nil nil 'nosuffix))
125 (or (featurep 'ediff-vers)
126 (load "ediff-vers.el" nil nil 'nosuffix))
127 ))
128;; end pacifier
129
130(require 'ediff-init)
131(require 'ediff-mult) ; required because of the registry stuff
132
133(defgroup ediff nil
134 "A comprehensive visual interface to diff & patch"
135 :group 'tools)
136
137
138(defcustom ediff-use-last-dir nil
139 "*If t, Ediff uses previous directory as default when reading file name."
140 :type 'boolean
141 :group 'ediff)
120 142
121(defvar ediff-use-last-dir nil
122 "*If t, Ediff uses previous directory as default when reading file name.")
123
124(defvar ediff-last-dir-A nil 143(defvar ediff-last-dir-A nil
125 "Last directory used by an Ediff command for file-A.") 144 "Last directory used by an Ediff command for file-A.")
126(defvar ediff-last-dir-B nil 145(defvar ediff-last-dir-B nil
@@ -276,8 +295,8 @@
276 295
277 (ediff-eval-in-buffer (symbol-value buffer-name) 296 (ediff-eval-in-buffer (symbol-value buffer-name)
278 (widen) ; Make sure the entire file is seen 297 (widen) ; Make sure the entire file is seen
279 (cond (file-magic ;; file has handler, such as jka-compr-handler or 298 (cond (file-magic ; file has a handler, such as jka-compr-handler or
280 ;; ange-ftp-hook-function--arrange for temp file 299 ;;; ange-ftp-hook-function--arrange for temp file
281 (ediff-verify-file-buffer 'magic) 300 (ediff-verify-file-buffer 'magic)
282 (setq file 301 (setq file
283 (ediff-make-temp-file 302 (ediff-make-temp-file
@@ -767,7 +786,7 @@ If WIND-B is nil, use window next to WIND-A."
767 end-B (window-end)))) 786 end-B (window-end))))
768 (ediff-regions-internal 787 (ediff-regions-internal
769 buffer-A beg-A end-A buffer-B beg-B end-B 788 buffer-A beg-A end-A buffer-B beg-B end-B
770 startup-hooks job-name word-mode))) 789 startup-hooks job-name word-mode nil)))
771 790
772;;;###autoload 791;;;###autoload
773(defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks) 792(defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks)
@@ -804,7 +823,7 @@ lines. For large regions, use `ediff-regions-linewise'."
804 (ediff-regions-internal 823 (ediff-regions-internal
805 (get-buffer buffer-A) reg-A-beg reg-A-end 824 (get-buffer buffer-A) reg-A-beg reg-A-end
806 (get-buffer buffer-B) reg-B-beg reg-B-end 825 (get-buffer buffer-B) reg-B-beg reg-B-end
807 startup-hooks 'ediff-regions-wordwise 'word-mode))) 826 startup-hooks 'ediff-regions-wordwise 'word-mode nil)))
808 827
809;;;###autoload 828;;;###autoload
810(defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks) 829(defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks)
@@ -864,7 +883,8 @@ lines. For small regions, use `ediff-regions-wordwise'."
864;; compare region beg-A to end-A of buffer-A 883;; compare region beg-A to end-A of buffer-A
865;; to regions beg-B -- end-B in buffer-B. 884;; to regions beg-B -- end-B in buffer-B.
866(defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B 885(defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B
867 startup-hooks job-name word-mode) 886 startup-hooks job-name word-mode
887 setup-parameters)
868 (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer)) 888 (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer))
869 overl-A overl-B 889 overl-A overl-B
870 file-A file-B) 890 file-A file-B)
@@ -915,9 +935,11 @@ Continue anyway? (y/n) "))
915 (delete-file (, file-A)) 935 (delete-file (, file-A))
916 (delete-file (, file-B)))) 936 (delete-file (, file-B))))
917 startup-hooks) 937 startup-hooks)
918 (list (cons 'ediff-word-mode word-mode) 938 (append
919 (cons 'ediff-narrow-bounds (list overl-A overl-B)) 939 (list (cons 'ediff-word-mode word-mode)
920 (cons 'ediff-job-name job-name)) 940 (cons 'ediff-narrow-bounds (list overl-A overl-B))
941 (cons 'ediff-job-name job-name))
942 setup-parameters)
921 ) 943 )
922 )) 944 ))
923 945
@@ -1132,7 +1154,7 @@ buffer."
1132;;;###autoload 1154;;;###autoload
1133(defun run-ediff-from-cvs-buffer (pos) 1155(defun run-ediff-from-cvs-buffer (pos)
1134 "Run Ediff-merge on appropriate revisions of the selected file. 1156 "Run Ediff-merge on appropriate revisions of the selected file.
1135First run after `M-x cvs-update'. Then place the cursor on a lide describing a 1157First run after `M-x cvs-update'. Then place the cursor on a line describing a
1136file and then run `run-ediff-from-cvs-buffer'." 1158file and then run `run-ediff-from-cvs-buffer'."
1137 (interactive "d") 1159 (interactive "d")
1138 (ediff-load-version-control) 1160 (ediff-load-version-control)
@@ -1273,7 +1295,6 @@ With optional NODE, goes to that node."
1273;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 1295;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
1274;;; End: 1296;;; End:
1275 1297
1276(provide 'ediff)
1277(require 'ediff-util) 1298(require 'ediff-util)
1278 1299
1279;;; ediff.el ends here 1300;;; ediff.el ends here