0
|
1 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
|
|
2
|
|
3 ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
|
4
|
|
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
|
|
6
|
|
7 ;; This file is part of GNU Emacs.
|
|
8
|
|
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
10 ;; it under the terms of the GNU General Public License as published by
|
|
11 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
12 ;; any later version.
|
|
13
|
|
14 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 ;; GNU General Public License for more details.
|
|
18
|
|
19 ;; You should have received a copy of the GNU General Public License
|
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 ;; Boston, MA 02111-1307, USA.
|
|
23
|
|
24 ;;; Code:
|
|
25
|
|
26 ;;; These must be placed in menu-bar.el in Emacs
|
|
27 ;;
|
|
28 ;; (define-key menu-bar-tools-menu [epatch]
|
|
29 ;; '("Apply Patch" . menu-bar-epatch-menu))
|
|
30 ;; (define-key menu-bar-tools-menu [ediff-merge]
|
|
31 ;; '("Merge" . menu-bar-ediff-merge-menu))
|
|
32 ;; (define-key menu-bar-tools-menu [ediff]
|
|
33 ;; '("Compare" . menu-bar-ediff-menu))
|
|
34
|
|
35 ;; Compiler pacifier
|
|
36 (defvar ediff-menu)
|
|
37 (defvar ediff-merge-menu)
|
|
38 (defvar epatch-menu)
|
|
39 ;; end pacifier
|
|
40
|
14
|
41 ;; allow menus to be set up without ediff-wind.el being loaded
|
|
42 (defvar ediff-window-setup-function)
|
|
43
|
12
|
44
|
0
|
45 (defun ediff-xemacs-init-menus ()
|
14
|
46 (setq ediff-window-setup-function
|
|
47 (if (console-on-window-system-p)
|
|
48 'ediff-setup-windows-multiframe
|
|
49 'ediff-setup-windows-plain))
|
0
|
50 (if (featurep 'menubar)
|
|
51 (progn
|
14
|
52 (add-menu-button
|
|
53 '("Tools")
|
|
54 ["Use separate frame for Ediff control buffer"
|
|
55 ediff-toggle-multiframe
|
|
56 :style toggle
|
|
57 :selected (eq ediff-window-setup-function 'ediff-setup-windows-multiframe)]
|
|
58 "00-Browser...")
|
|
59 ;;(add-menu-button
|
|
60 ;; '("Tools")
|
|
61 ;; ["Use a toolbar with Ediff control buffer"
|
|
62 ;; ediff-toggle-use-toolbar
|
|
63 ;; :style toggle
|
|
64 ;; :selected (ediff-use-toolbar-p)]
|
|
65 ;; "00-Browser...")
|
0
|
66 (add-submenu
|
|
67 '("Tools") ediff-menu "OO-Browser...")
|
|
68 (add-submenu
|
|
69 '("Tools") ediff-merge-menu "OO-Browser...")
|
|
70 (add-submenu
|
|
71 '("Tools") epatch-menu "OO-Browser...")
|
|
72 (add-menu-button
|
|
73 '("Tools")
|
|
74 ["-------" nil nil] "OO-Browser...")
|
|
75 )))
|
|
76
|
|
77
|
|
78 ;; explicit string-match is needed: ediff-xemacs-p is not defined at build time
|
|
79 (cond ((string-match "XEmacs" emacs-version)
|
|
80 (defvar ediff-menu
|
|
81 '("Compare"
|
|
82 ["Two Files..." ediff-files t]
|
|
83 ["Two Buffers..." ediff-buffers t]
|
|
84 ["Three Files..." ediff-files3 t]
|
|
85 ["Three Buffers..." ediff-buffers3 t]
|
|
86 "---"
|
|
87 ["Two Directories..." ediff-directories t]
|
|
88 ["Three Directories..." ediff-directories3 t]
|
|
89 "---"
|
|
90 ["File with Revision..." ediff-revision t]
|
|
91 ["Directory Revisions..." ediff-directory-revisions t]
|
|
92 "---"
|
|
93 ["Windows Word-by-word..." ediff-windows-wordwise t]
|
|
94 ["Windows Line-by-line..." ediff-windows-linewise t]
|
|
95 "---"
|
|
96 ["Regions Word-by-word..." ediff-regions-wordwise t]
|
|
97 ["Regions Line-by-line..." ediff-regions-linewise t]
|
|
98 "---"
|
|
99 ["List Ediff Sessions..." ediff-show-registry t]
|
|
100 ["Ediff Manual..." ediff-documentation t]
|
|
101 ))
|
|
102 (defvar ediff-merge-menu
|
|
103 '("Merge"
|
|
104 ["Files..." ediff-merge-files t]
|
|
105 ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
|
|
106 ["Buffers..." ediff-merge-buffers t]
|
|
107 ["Buffers with Ancestor..."
|
|
108 ediff-merge-buffers-with-ancestor t]
|
|
109 "---"
|
|
110 ["Directories..." ediff-merge-directories t]
|
|
111 ["Directories with Ancestor..."
|
|
112 ediff-merge-directories-with-ancestor t]
|
|
113 "---"
|
|
114 ["Revisions..." ediff-merge-revisions t]
|
|
115 ["Revisions with Ancestor..."
|
|
116 ediff-merge-revisions-with-ancestor t]
|
|
117 ["Directory Revisions..." ediff-merge-directory-revisions t]
|
|
118 ["Directory Revisions with Ancestor..."
|
|
119 ediff-merge-directory-revisions-with-ancestor t]
|
|
120 "---"
|
|
121 ["List Ediff Sessions..." ediff-show-registry t]
|
|
122 ["Ediff Manual..." ediff-documentation t]
|
|
123 ))
|
|
124 (defvar epatch-menu
|
|
125 '("Apply Patch"
|
|
126 ["To a file..." ediff-patch-file t]
|
|
127 ["To a buffer..." ediff-patch-buffer t]
|
|
128 "---"
|
|
129 ["List Ediff Sessions..." ediff-show-registry t]
|
|
130 ["Ediff Manual..." ediff-documentation t]
|
|
131 ))
|
|
132
|
|
133 ;; put these menus before Object-Oriented-Browser in Tools menu
|
|
134 (add-hook 'before-init-hook 'ediff-xemacs-init-menus)
|
|
135 (if (not purify-flag)
|
|
136 (ediff-xemacs-init-menus))
|
|
137 )
|
|
138
|
|
139 ;; Emacs--only if menu-bar is loaded
|
|
140 ((featurep 'menu-bar)
|
|
141 ;; initialize menu bar keymaps
|
|
142 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
|
|
143 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
|
|
144 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
|
|
145 (fset 'menu-bar-ediff-merge-menu
|
|
146 (symbol-value 'menu-bar-ediff-merge-menu))
|
|
147 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
|
|
148 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
|
|
149
|
|
150 ;; define ediff-menu
|
|
151 (define-key menu-bar-ediff-menu [ediff-doc]
|
|
152 '("Ediff Manual..." . ediff-documentation))
|
12
|
153 (define-key menu-bar-ediff-menu [emultiframe]
|
14
|
154 '("Toggle separate control buffer frame..."
|
|
155 . ediff-toggle-multiframe))
|
0
|
156 (define-key menu-bar-ediff-menu [eregistry]
|
|
157 '("List Ediff Sessions..." . ediff-show-registry))
|
|
158 (define-key menu-bar-ediff-menu [separator-ediff-manual] '("--"))
|
|
159 (define-key menu-bar-ediff-menu [window]
|
|
160 '("This Window and Next Window" . compare-windows))
|
|
161 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
|
|
162 '("Windows Line-by-line..." . ediff-windows-linewise))
|
|
163 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
|
|
164 '("Windows Word-by-word..." . ediff-windows-wordwise))
|
|
165 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
|
|
166 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
|
|
167 '("Regions Line-by-line..." . ediff-regions-linewise))
|
|
168 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
|
|
169 '("Regions Word-by-word..." . ediff-regions-wordwise))
|
|
170 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
|
|
171 (define-key menu-bar-ediff-menu [ediff-dir-revision]
|
|
172 '("Directory Revisions..." . ediff-directory-revisions))
|
|
173 (define-key menu-bar-ediff-menu [ediff-revision]
|
|
174 '("File with Revision..." . ediff-revision))
|
|
175 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
|
|
176 (define-key menu-bar-ediff-menu [ediff-directories3]
|
|
177 '("Three Directories..." . ediff-directories3))
|
|
178 (define-key menu-bar-ediff-menu [ediff-directories]
|
|
179 '("Two Directories..." . ediff-directories))
|
|
180 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
|
|
181 (define-key menu-bar-ediff-menu [ediff-buffers3]
|
|
182 '("Three Buffers..." . ediff-buffers3))
|
|
183 (define-key menu-bar-ediff-menu [ediff-files3]
|
|
184 '("Three Files..." . ediff-files3))
|
|
185 (define-key menu-bar-ediff-menu [ediff-buffers]
|
|
186 '("Two Buffers..." . ediff-buffers))
|
|
187 (define-key menu-bar-ediff-menu [ediff-files]
|
|
188 '("Two Files..." . ediff-files))
|
|
189
|
|
190 ;; define merge menu
|
|
191 (define-key menu-bar-ediff-merge-menu [ediff-doc2]
|
|
192 '("Ediff Manual..." . ediff-documentation))
|
12
|
193 (define-key menu-bar-ediff-merge-menu [emultiframe2]
|
14
|
194 '("Toggle separate control buffer frame..."
|
|
195 . ediff-toggle-multiframe))
|
0
|
196 (define-key menu-bar-ediff-merge-menu [eregistry2]
|
|
197 '("List Ediff Sessions..." . ediff-show-registry))
|
|
198 (define-key
|
|
199 menu-bar-ediff-merge-menu [separator-ediff-merge-manual] '("--"))
|
|
200 (define-key
|
|
201 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
|
|
202 '("Directory Revisions with Ancestor..."
|
|
203 . ediff-merge-directory-revisions-with-ancestor))
|
|
204 (define-key
|
|
205 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
|
|
206 '("Directory Revisions..." . ediff-merge-directory-revisions))
|
|
207 (define-key
|
|
208 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
|
|
209 '("Revisions with Ancestor..."
|
|
210 . ediff-merge-revisions-with-ancestor))
|
|
211 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
|
|
212 '("Revisions..." . ediff-merge-revisions))
|
|
213 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
|
|
214 (define-key
|
|
215 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
|
|
216 '("Directories with Ancestor..."
|
|
217 . ediff-merge-directories-with-ancestor))
|
|
218 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
|
|
219 '("Directories..." . ediff-merge-directories))
|
|
220 (define-key
|
|
221 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
|
|
222 (define-key
|
|
223 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
|
|
224 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
|
|
225 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
|
|
226 '("Buffers..." . ediff-merge-buffers))
|
|
227 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
|
|
228 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
|
|
229 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
|
|
230 '("Files..." . ediff-merge-files))
|
|
231
|
|
232 ;; define epatch menu
|
|
233 (define-key menu-bar-epatch-menu [ediff-doc3]
|
|
234 '("Ediff Manual..." . ediff-documentation))
|
12
|
235 (define-key menu-bar-epatch-menu [emultiframe3]
|
14
|
236 '("Toggle separate control buffer frame..."
|
|
237 . ediff-toggle-multiframe))
|
0
|
238 (define-key menu-bar-epatch-menu [eregistry3]
|
14
|
239 '("List Ediff Sessions..." . ediff-show-registry))
|
0
|
240 (define-key menu-bar-epatch-menu [separator-epatch] '("--"))
|
|
241 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
|
|
242 '("To a Buffer..." . ediff-patch-buffer))
|
|
243 (define-key menu-bar-epatch-menu [ediff-patch-file]
|
|
244 '("To a File..." . ediff-patch-file)))
|
|
245
|
|
246 ) ; cond
|
|
247
|
|
248 ;; arrange for autoloads
|
|
249 (if purify-flag
|
|
250 () ; if dumping, autoloads are set up in loaddefs.el
|
|
251 ;; if the user decides to load this file, set up autoloads
|
|
252 ;; compare files and buffers
|
|
253 (autoload 'ediff "ediff" "Compare two files" t)
|
|
254 (autoload 'ediff-files "ediff" "Compare two files" t)
|
|
255 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
|
|
256 (autoload 'ebuffers "ediff" "Compare two bufers" t)
|
|
257 (autoload 'ediff3 "ediff" "Compare three files" t)
|
|
258 (autoload 'ediff-files3 "ediff" "Compare three files" t)
|
|
259 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
|
|
260 (autoload 'ebuffers3 "ediff" "Compare three bufers" t)
|
|
261
|
|
262 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
|
|
263
|
|
264 ;; compare regions and windows
|
|
265 (autoload 'ediff-windows-wordwise
|
|
266 "ediff" "Compare two windows word-by-word." t)
|
|
267 (autoload 'ediff-regions-wordwise
|
|
268 "ediff" "Compare two regions word-by-word." t)
|
|
269 (autoload 'ediff-windows-linewise
|
|
270 "ediff" "Compare two windows line-by-line." t)
|
|
271 (autoload 'ediff-regions-linewise
|
|
272 "ediff" "Compare two regions line-by-line." t)
|
|
273
|
|
274 ;; patch
|
|
275 (autoload 'ediff-patch-file "ediff" "Patch a file." t)
|
|
276 (autoload 'epatch "ediff" "Patch a file." t)
|
|
277 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
|
|
278 (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
|
|
279
|
|
280 ;; merge
|
|
281 (autoload 'ediff-merge "ediff" "Merge two files." t)
|
|
282 (autoload 'ediff-merge-files "ediff" "Merge two files." t)
|
|
283 (autoload 'ediff-merge-files-with-ancestor
|
|
284 "ediff" "Merge two files using a third file as an ancestor." t)
|
|
285 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
|
|
286 (autoload 'ediff-merge-buffers-with-ancestor
|
|
287 "ediff" "Merge two buffers using a third buffer as an ancestor." t)
|
|
288
|
|
289 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
|
|
290 (autoload 'ediff-merge-revisions-with-ancestor
|
|
291 "ediff" "Merge two versions of a file." t)
|
|
292
|
|
293 ;; compare directories
|
|
294 (autoload 'edirs "ediff" "Compare files in two directories." t)
|
|
295 (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
|
|
296 (autoload 'edirs3 "ediff" "Compare files in three directories." t)
|
|
297 (autoload
|
|
298 'ediff-directories3 "ediff" "Compare files in three directories." t)
|
|
299
|
|
300 (autoload 'edir-revisions
|
|
301 "ediff" "Compare two versions of a file." t)
|
|
302 (autoload 'ediff-directory-revisions
|
|
303 "ediff" "Compare two versions of a file." t)
|
|
304
|
|
305 ;; merge directories
|
|
306 (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
|
|
307 (autoload 'ediff-merge-directories
|
|
308 "ediff" "Merge files in two directories." t)
|
|
309 (autoload 'edirs-merge-with-ancestor
|
|
310 "ediff"
|
|
311 "Merge files in two directories using files in a third dir as ancestors."
|
|
312 t)
|
|
313 (autoload 'ediff-merge-directories-with-ancestor
|
|
314 "ediff"
|
|
315 "Merge files in two directories using files in a third dir as ancestors."
|
|
316 t)
|
|
317
|
|
318 (autoload 'edir-merge-revisions
|
|
319 "ediff" "Merge versions of files in a directory." t)
|
|
320 (autoload 'ediff-merge-directory-revisions
|
|
321 "ediff" "Merge versions of files in a directory." t)
|
|
322 (autoload 'ediff-merge-directory-revisions-with-ancestor
|
|
323 "ediff"
|
|
324 "Merge versions of files in a directory using other versions as ancestors."
|
|
325 t)
|
|
326 (autoload 'edir-merge-revisions-with-ancestor
|
|
327 "ediff"
|
|
328 "Merge versions of files in a directory using other versions as ancestors."
|
|
329 t)
|
|
330
|
|
331 ;; misc
|
|
332 (autoload 'ediff-show-registry
|
12
|
333 "ediff-mult"
|
0
|
334 "Display the registry of active Ediff sessions."
|
|
335 t)
|
|
336 (autoload 'ediff-documentation
|
|
337 "ediff"
|
|
338 "Display Ediff's manual."
|
|
339 t)
|
|
340 (autoload 'ediff-version
|
|
341 "ediff"
|
|
342 "Show Ediff's version and last modification date."
|
|
343 t)
|
12
|
344 (autoload 'ediff-toggle-multiframe
|
|
345 "ediff-util"
|
|
346 "Toggle the use of separate frame for Ediff control buffer."
|
|
347 t)
|
14
|
348 (condition-case nil
|
|
349 (if (string-match "XEmacs" emacs-version)
|
|
350 (autoload 'ediff-toggle-use-toolbar
|
|
351 "ediff-tbar"
|
|
352 "Toggle the use of Ediff toolbar."
|
|
353 t))
|
|
354 (error))
|
0
|
355 ) ; if purify-flag
|
|
356
|
|
357
|
|
358 (provide 'ediff-hook)
|
|
359
|
|
360
|
|
361 ;;; ediff-hook.el ends here
|