*** empty log message ***
[emacs.git] / lisp / ediff-hook.el
blob7bdb8567b275a66ccdcee1af29e9b7da0ceeacda
1 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
3 ;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
7 ;; This file is part of GNU Emacs.
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.
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.
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.
24 ;;; Code:
26 ;;; These must be placed in menu-bar.el in Emacs
28 ;; (define-key menu-bar-tools-menu [ediff-misc]
29 ;; '("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
30 ;; (define-key menu-bar-tools-menu [epatch]
31 ;; '("Apply Patch" . menu-bar-epatch-menu))
32 ;; (define-key menu-bar-tools-menu [ediff-merge]
33 ;; '("Merge" . menu-bar-ediff-merge-menu))
34 ;; (define-key menu-bar-tools-menu [ediff]
35 ;; '("Compare" . menu-bar-ediff-menu))
37 ;; Compiler pacifier
38 (defvar ediff-menu)
39 (defvar ediff-merge-menu)
40 (defvar epatch-menu)
41 (defvar ediff-misc-menu)
42 ;; end pacifier
44 ;; allow menus to be set up without ediff-wind.el being loaded
45 ;;;###autoload
46 (defvar ediff-window-setup-function)
48 ;; Note we wrap this in a progn so that we pick up the whole def
49 ;; for auto-autoload. That way we do not load ediff-hook.el when defining
50 ;; the menus.
51 ;;;###autoload
52 (progn
53 (defun ediff-xemacs-init-menus ()
54 (if (featurep 'menubar)
55 (progn
56 (add-submenu
57 '("Tools") ediff-menu "OO-Browser...")
58 (add-submenu
59 '("Tools") ediff-merge-menu "OO-Browser...")
60 (add-submenu
61 '("Tools") epatch-menu "OO-Browser...")
62 (add-submenu
63 '("Tools") ediff-misc-menu "OO-Browser...")
64 (add-menu-button
65 '("Tools") "-------" "OO-Browser...")
66 ))))
69 ;; explicit string-match is needed: ediff-xemacs-p is not defined at build time
70 ;;;###autoload
71 (cond ((string-match "XEmacs" emacs-version)
72 (defvar ediff-menu
73 '("Compare"
74 ["Two Files..." ediff-files t]
75 ["Two Buffers..." ediff-buffers t]
76 ["Three Files..." ediff-files3 t]
77 ["Three Buffers..." ediff-buffers3 t]
78 "---"
79 ["Two Directories..." ediff-directories t]
80 ["Three Directories..." ediff-directories3 t]
81 "---"
82 ["File with Revision..." ediff-revision t]
83 ["Directory Revisions..." ediff-directory-revisions t]
84 "---"
85 ["Windows Word-by-word..." ediff-windows-wordwise t]
86 ["Windows Line-by-line..." ediff-windows-linewise t]
87 "---"
88 ["Regions Word-by-word..." ediff-regions-wordwise t]
89 ["Regions Line-by-line..." ediff-regions-linewise t]
91 (defvar ediff-merge-menu
92 '("Merge"
93 ["Files..." ediff-merge-files t]
94 ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
95 ["Buffers..." ediff-merge-buffers t]
96 ["Buffers with Ancestor..."
97 ediff-merge-buffers-with-ancestor t]
98 "---"
99 ["Directories..." ediff-merge-directories t]
100 ["Directories with Ancestor..."
101 ediff-merge-directories-with-ancestor t]
102 "---"
103 ["Revisions..." ediff-merge-revisions t]
104 ["Revisions with Ancestor..."
105 ediff-merge-revisions-with-ancestor t]
106 ["Directory Revisions..." ediff-merge-directory-revisions t]
107 ["Directory Revisions with Ancestor..."
108 ediff-merge-directory-revisions-with-ancestor t]
110 (defvar epatch-menu
111 '("Apply Patch"
112 ["To a file..." ediff-patch-file t]
113 ["To a buffer..." ediff-patch-buffer t]
115 (defvar ediff-misc-menu
116 '("Ediff Miscellanea"
117 ["Ediff Manual..." ediff-documentation t]
118 ["Customize Ediff..." ediff-customize t]
119 ["List Ediff Sessions..." ediff-show-registry t]
120 ["Use separate frame for Ediff control buffer..."
121 ediff-toggle-multiframe
122 :style toggle
123 :selected (if (and (featurep 'ediff-util)
124 (boundp 'ediff-window-setup-function))
125 (eq ediff-window-setup-function
126 'ediff-setup-windows-multiframe))]
127 ["Use a toolbar with Ediff control buffer"
128 ediff-toggle-use-toolbar
129 :style toggle
130 :selected (if (featurep 'ediff-tbar)
131 (ediff-use-toolbar-p))]
134 ;; put these menus before Object-Oriented-Browser in Tools menu
135 ;;; (add-hook 'before-init-hook 'ediff-xemacs-init-menus)
136 ;;; (if (not purify-flag)
137 ;;; (ediff-xemacs-init-menus))
138 ;;; )
139 (if (and (featurep 'menubar) (not (featurep 'infodock))
140 (not (featurep 'ediff-hook)))
141 (ediff-xemacs-init-menus)))
143 ;; Emacs--only if menu-bar is loaded
144 ((featurep 'menu-bar)
145 ;; initialize menu bar keymaps
146 (defvar menu-bar-ediff-misc-menu
147 (make-sparse-keymap "Ediff Miscellanea"))
148 (fset 'menu-bar-ediff-misc-menu
149 (symbol-value 'menu-bar-ediff-misc-menu))
150 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
151 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
152 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
153 (fset 'menu-bar-ediff-merge-menu
154 (symbol-value 'menu-bar-ediff-merge-menu))
155 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
156 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
158 ;; define ediff-menu
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))
190 ;; define merge menu
191 (define-key
192 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
193 '("Directory Revisions with Ancestor..."
194 . ediff-merge-directory-revisions-with-ancestor))
195 (define-key
196 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
197 '("Directory Revisions..." . ediff-merge-directory-revisions))
198 (define-key
199 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
200 '("Revisions with Ancestor..."
201 . ediff-merge-revisions-with-ancestor))
202 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
203 '("Revisions..." . ediff-merge-revisions))
204 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
205 (define-key
206 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
207 '("Directories with Ancestor..."
208 . ediff-merge-directories-with-ancestor))
209 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
210 '("Directories..." . ediff-merge-directories))
211 (define-key
212 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
213 (define-key
214 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
215 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
216 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
217 '("Buffers..." . ediff-merge-buffers))
218 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
219 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
220 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
221 '("Files..." . ediff-merge-files))
223 ;; define epatch menu
224 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
225 '("To a Buffer..." . ediff-patch-buffer))
226 (define-key menu-bar-epatch-menu [ediff-patch-file]
227 '("To a File..." . ediff-patch-file))
229 ;; define ediff miscellanea
230 (define-key menu-bar-ediff-misc-menu [emultiframe]
231 '("Toggle use of separate control buffer frame..."
232 . ediff-toggle-multiframe))
233 (define-key menu-bar-ediff-misc-menu [eregistry]
234 '("List Ediff Sessions..." . ediff-show-registry))
235 (define-key menu-bar-ediff-misc-menu [ediff-cust]
236 '("Customize Ediff..." . ediff-customize))
237 (define-key menu-bar-ediff-misc-menu [ediff-doc]
238 '("Ediff Manual..." . ediff-documentation))
241 ) ; cond
243 ;; arrange for autoloads
244 (if purify-flag
245 () ; if dumping, autoloads are set up in loaddefs.el
246 ;; if the user decides to load this file, set up autoloads
247 ;; compare files and buffers
248 (autoload 'ediff "ediff" "Compare two files" t)
249 (autoload 'ediff-files "ediff" "Compare two files" t)
250 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
251 (autoload 'ebuffers "ediff" "Compare two bufers" t)
252 (autoload 'ediff3 "ediff" "Compare three files" t)
253 (autoload 'ediff-files3 "ediff" "Compare three files" t)
254 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
255 (autoload 'ebuffers3 "ediff" "Compare three bufers" t)
257 (autoload 'erevision "ediff" "Compare versions of a file" t)
258 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
260 ;; compare regions and windows
261 (autoload 'ediff-windows-wordwise
262 "ediff" "Compare two windows word-by-word." t)
263 (autoload 'ediff-regions-wordwise
264 "ediff" "Compare two regions word-by-word." t)
265 (autoload 'ediff-windows-linewise
266 "ediff" "Compare two windows line-by-line." t)
267 (autoload 'ediff-regions-linewise
268 "ediff" "Compare two regions line-by-line." t)
270 ;; patch
271 (autoload 'ediff-patch-file "ediff" "Patch a file." t)
272 (autoload 'epatch "ediff" "Patch a file." t)
273 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
274 (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
276 ;; merge
277 (autoload 'ediff-merge "ediff" "Merge two files." t)
278 (autoload 'ediff-merge-files "ediff" "Merge two files." t)
279 (autoload 'ediff-merge-files-with-ancestor
280 "ediff" "Merge two files using a third file as an ancestor." t)
281 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
282 (autoload 'ediff-merge-buffers-with-ancestor
283 "ediff" "Merge two buffers using a third buffer as an ancestor." t)
285 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
286 (autoload 'ediff-merge-revisions-with-ancestor
287 "ediff" "Merge two versions of a file." t)
289 ;; compare directories
290 (autoload 'edirs "ediff" "Compare files in two directories." t)
291 (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
292 (autoload 'edirs3 "ediff" "Compare files in three directories." t)
293 (autoload
294 'ediff-directories3 "ediff" "Compare files in three directories." t)
296 (autoload 'edir-revisions
297 "ediff" "Compare two versions of a file." t)
298 (autoload 'ediff-directory-revisions
299 "ediff" "Compare two versions of a file." t)
301 ;; merge directories
302 (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
303 (autoload 'ediff-merge-directories
304 "ediff" "Merge files in two directories." t)
305 (autoload 'edirs-merge-with-ancestor
306 "ediff"
307 "Merge files in two directories using files in a third dir as ancestors."
309 (autoload 'ediff-merge-directories-with-ancestor
310 "ediff"
311 "Merge files in two directories using files in a third dir as ancestors."
314 (autoload 'edir-merge-revisions
315 "ediff" "Merge versions of files in a directory." t)
316 (autoload 'ediff-merge-directory-revisions
317 "ediff" "Merge versions of files in a directory." t)
318 (autoload 'ediff-merge-directory-revisions-with-ancestor
319 "ediff"
320 "Merge versions of files in a directory using other versions as ancestors."
322 (autoload 'edir-merge-revisions-with-ancestor
323 "ediff"
324 "Merge versions of files in a directory using other versions as ancestors."
327 ;; misc
328 (autoload 'ediff-show-registry
329 "ediff-mult"
330 "Display the registry of active Ediff sessions."
332 (autoload 'eregistry
333 "ediff-mult"
334 "Display the registry of active Ediff sessions."
336 (autoload 'ediff-documentation
337 "ediff"
338 "Display Ediff's manual."
340 (autoload 'ediff-version
341 "ediff"
342 "Show Ediff's version and last modification date."
344 (autoload 'ediff-toggle-multiframe
345 "ediff-util"
346 "Toggle the use of separate frame for Ediff control buffer."
348 (autoload 'ediff-toggle-use-toolbar
349 "ediff-util"
350 "Toggle the use of Ediff toolbar."
353 ) ; if purify-flag
356 (provide 'ediff-hook)
359 ;;; ediff-hook.el ends here