(cvs-cmd-do): Accept non-CVS dirs with CVS-ctrl'd subdirs.
[emacs.git] / lisp / ediff-hook.el
blobdaae55827a93f4d59cf921d0db28091fc5985d7f
1 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
3 ;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
5 ;; Author: Michael Kifer <kifer@cs.stonybrook.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 ;;; Commentary:
26 ;;; Code:
28 ;;; These must be placed in menu-bar.el in Emacs
30 ;; (define-key menu-bar-tools-menu [ediff-misc]
31 ;; '("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
32 ;; (define-key menu-bar-tools-menu [epatch]
33 ;; '("Apply Patch" . menu-bar-epatch-menu))
34 ;; (define-key menu-bar-tools-menu [ediff-merge]
35 ;; '("Merge" . menu-bar-ediff-merge-menu))
36 ;; (define-key menu-bar-tools-menu [ediff]
37 ;; '("Compare" . menu-bar-ediff-menu))
39 ;; Compiler pacifier
40 (defvar ediff-menu)
41 (defvar ediff-merge-menu)
42 (defvar epatch-menu)
43 (defvar ediff-misc-menu)
44 ;; end pacifier
46 ;; allow menus to be set up without ediff-wind.el being loaded
47 (defvar ediff-window-setup-function)
49 ;; This macro is used to avoid compilation warnings.
50 ;; The macro will expand into the form that is appropriate to the
51 ;; compiler at hand (emacs or xemacs).
52 ;; The autoload, below, is useless in Emacs because ediff-hook.el
53 ;; is dumped with emacs, but it is needed in XEmacs
54 (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
55 (if (string-match "XEmacs" emacs-version)
56 xemacs-form emacs-form))
58 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
59 ;; emacs, but it is needed in XEmacs
60 (ediff-cond-compile-for-xemacs-or-emacs
61 ;; xemacs form
62 (defun ediff-xemacs-init-menus ()
63 (if (featurep 'menubar)
64 (progn
65 (add-submenu
66 '("Tools") ediff-menu "OO-Browser...")
67 (add-submenu
68 '("Tools") ediff-merge-menu "OO-Browser...")
69 (add-submenu
70 '("Tools") epatch-menu "OO-Browser...")
71 (add-submenu
72 '("Tools") ediff-misc-menu "OO-Browser...")
73 (add-menu-button
74 '("Tools") "-------" "OO-Browser...")
75 )))
76 nil ; emacs form
80 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
81 ;; emacs, but it is needed in XEmacs
82 (ediff-cond-compile-for-xemacs-or-emacs
83 (progn
84 (defvar ediff-menu
85 '("Compare"
86 ["Two Files..." ediff-files t]
87 ["Two Buffers..." ediff-buffers t]
88 ["Three Files..." ediff-files3 t]
89 ["Three Buffers..." ediff-buffers3 t]
90 "---"
91 ["Two Directories..." ediff-directories t]
92 ["Three Directories..." ediff-directories3 t]
93 "---"
94 ["File with Revision..." ediff-revision t]
95 ["Directory Revisions..." ediff-directory-revisions t]
96 "---"
97 ["Windows Word-by-word..." ediff-windows-wordwise t]
98 ["Windows Line-by-line..." ediff-windows-linewise t]
99 "---"
100 ["Regions Word-by-word..." ediff-regions-wordwise t]
101 ["Regions Line-by-line..." ediff-regions-linewise t]
103 (defvar ediff-merge-menu
104 '("Merge"
105 ["Files..." ediff-merge-files t]
106 ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
107 ["Buffers..." ediff-merge-buffers t]
108 ["Buffers with Ancestor..."
109 ediff-merge-buffers-with-ancestor t]
110 "---"
111 ["Directories..." ediff-merge-directories t]
112 ["Directories with Ancestor..."
113 ediff-merge-directories-with-ancestor t]
114 "---"
115 ["Revisions..." ediff-merge-revisions t]
116 ["Revisions with Ancestor..."
117 ediff-merge-revisions-with-ancestor t]
118 ["Directory Revisions..." ediff-merge-directory-revisions t]
119 ["Directory Revisions with Ancestor..."
120 ediff-merge-directory-revisions-with-ancestor t]
122 (defvar epatch-menu
123 '("Apply Patch"
124 ["To a file..." ediff-patch-file t]
125 ["To a buffer..." ediff-patch-buffer t]
127 (defvar ediff-misc-menu
128 '("Ediff Miscellanea"
129 ["Ediff Manual..." ediff-documentation t]
130 ["Customize Ediff..." ediff-customize t]
131 ["List Ediff Sessions..." ediff-show-registry t]
132 ["Use separate frame for Ediff control buffer..."
133 ediff-toggle-multiframe
134 :style toggle
135 :selected (if (and (featurep 'ediff-util)
136 (boundp 'ediff-window-setup-function))
137 (eq ediff-window-setup-function
138 'ediff-setup-windows-multiframe))]
139 ["Use a toolbar with Ediff control buffer"
140 ediff-toggle-use-toolbar
141 :style toggle
142 :selected (if (featurep 'ediff-tbar)
143 (ediff-use-toolbar-p))]
146 ;; put these menus before Object-Oriented-Browser in Tools menu
147 (if (and (featurep 'menubar) (not (featurep 'infodock))
148 (not (featurep 'ediff-hook)))
149 (ediff-xemacs-init-menus)))
151 ;; Emacs--only if menu-bar is loaded
152 (if (featurep 'menu-bar)
153 (progn
154 ;; initialize menu bar keymaps
155 (defvar menu-bar-ediff-misc-menu
156 (make-sparse-keymap "Ediff Miscellanea"))
157 (fset 'menu-bar-ediff-misc-menu
158 (symbol-value 'menu-bar-ediff-misc-menu))
159 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
160 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
161 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
162 (fset 'menu-bar-ediff-merge-menu
163 (symbol-value 'menu-bar-ediff-merge-menu))
164 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
165 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
167 ;; define ediff-menu
168 (define-key menu-bar-ediff-menu [window]
169 '("This Window and Next Window" . compare-windows))
170 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
171 '("Windows Line-by-line..." . ediff-windows-linewise))
172 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
173 '("Windows Word-by-word..." . ediff-windows-wordwise))
174 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
175 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
176 '("Regions Line-by-line..." . ediff-regions-linewise))
177 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
178 '("Regions Word-by-word..." . ediff-regions-wordwise))
179 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
180 (define-key menu-bar-ediff-menu [ediff-dir-revision]
181 '("Directory Revisions..." . ediff-directory-revisions))
182 (define-key menu-bar-ediff-menu [ediff-revision]
183 '("File with Revision..." . ediff-revision))
184 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
185 (define-key menu-bar-ediff-menu [ediff-directories3]
186 '("Three Directories..." . ediff-directories3))
187 (define-key menu-bar-ediff-menu [ediff-directories]
188 '("Two Directories..." . ediff-directories))
189 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
190 (define-key menu-bar-ediff-menu [ediff-buffers3]
191 '("Three Buffers..." . ediff-buffers3))
192 (define-key menu-bar-ediff-menu [ediff-files3]
193 '("Three Files..." . ediff-files3))
194 (define-key menu-bar-ediff-menu [ediff-buffers]
195 '("Two Buffers..." . ediff-buffers))
196 (define-key menu-bar-ediff-menu [ediff-files]
197 '("Two Files..." . ediff-files))
199 ;; define merge menu
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))
232 ;; define epatch menu
233 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
234 '("To a Buffer..." . ediff-patch-buffer))
235 (define-key menu-bar-epatch-menu [ediff-patch-file]
236 '("To a File..." . ediff-patch-file))
238 ;; define ediff miscellanea
239 (define-key menu-bar-ediff-misc-menu [emultiframe]
240 '("Toggle use of separate control buffer frame..."
241 . ediff-toggle-multiframe))
242 (define-key menu-bar-ediff-misc-menu [eregistry]
243 '("List Ediff Sessions..." . ediff-show-registry))
244 (define-key menu-bar-ediff-misc-menu [ediff-cust]
245 '("Customize Ediff..." . ediff-customize))
246 (define-key menu-bar-ediff-misc-menu [ediff-doc]
247 '("Ediff Manual..." . ediff-documentation))
250 ) ; emacs case
251 ) ; ediff-cond-compile-for-xemacs-or-emacs
253 ;; arrange for autoloads
254 (if purify-flag
255 () ; if dumping, autoloads are set up in loaddefs.el
256 ;; if the user decides to load this file, set up autoloads
257 ;; compare files and buffers
258 (autoload 'ediff "ediff" "Compare two files" t)
259 (autoload 'ediff-files "ediff" "Compare two files" t)
260 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
261 (autoload 'ebuffers "ediff" "Compare two bufers" t)
262 (autoload 'ediff3 "ediff" "Compare three files" t)
263 (autoload 'ediff-files3 "ediff" "Compare three files" t)
264 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
265 (autoload 'ebuffers3 "ediff" "Compare three bufers" t)
267 (autoload 'erevision "ediff" "Compare versions of a file" t)
268 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
270 ;; compare regions and windows
271 (autoload 'ediff-windows-wordwise
272 "ediff" "Compare two windows word-by-word." t)
273 (autoload 'ediff-regions-wordwise
274 "ediff" "Compare two regions word-by-word." t)
275 (autoload 'ediff-windows-linewise
276 "ediff" "Compare two windows line-by-line." t)
277 (autoload 'ediff-regions-linewise
278 "ediff" "Compare two regions line-by-line." t)
280 ;; patch
281 (autoload 'ediff-patch-file "ediff" "Patch a file." t)
282 (autoload 'epatch "ediff" "Patch a file." t)
283 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
284 (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
286 ;; merge
287 (autoload 'ediff-merge "ediff" "Merge two files." t)
288 (autoload 'ediff-merge-files "ediff" "Merge two files." t)
289 (autoload 'ediff-merge-files-with-ancestor
290 "ediff" "Merge two files using a third file as an ancestor." t)
291 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
292 (autoload 'ediff-merge-buffers-with-ancestor
293 "ediff" "Merge two buffers using a third buffer as an ancestor." t)
295 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
296 (autoload 'ediff-merge-revisions-with-ancestor
297 "ediff" "Merge two versions of a file." t)
299 ;; compare directories
300 (autoload 'edirs "ediff" "Compare files in two directories." t)
301 (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
302 (autoload 'edirs3 "ediff" "Compare files in three directories." t)
303 (autoload
304 'ediff-directories3 "ediff" "Compare files in three directories." t)
306 (autoload 'edir-revisions
307 "ediff" "Compare two versions of a file." t)
308 (autoload 'ediff-directory-revisions
309 "ediff" "Compare two versions of a file." t)
311 ;; merge directories
312 (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
313 (autoload 'ediff-merge-directories
314 "ediff" "Merge files in two directories." t)
315 (autoload 'edirs-merge-with-ancestor
316 "ediff"
317 "Merge files in two directories using files in a third dir as ancestors."
319 (autoload 'ediff-merge-directories-with-ancestor
320 "ediff"
321 "Merge files in two directories using files in a third dir as ancestors."
324 (autoload 'edir-merge-revisions
325 "ediff" "Merge versions of files in a directory." t)
326 (autoload 'ediff-merge-directory-revisions
327 "ediff" "Merge versions of files in a directory." t)
328 (autoload 'ediff-merge-directory-revisions-with-ancestor
329 "ediff"
330 "Merge versions of files in a directory using other versions as ancestors."
332 (autoload 'edir-merge-revisions-with-ancestor
333 "ediff"
334 "Merge versions of files in a directory using other versions as ancestors."
337 ;; misc
338 (autoload 'ediff-show-registry
339 "ediff-mult"
340 "Display the registry of active Ediff sessions."
342 (autoload 'eregistry
343 "ediff-mult"
344 "Display the registry of active Ediff sessions."
346 (autoload 'ediff-documentation
347 "ediff"
348 "Display Ediff's manual."
350 (autoload 'ediff-version
351 "ediff"
352 "Show Ediff's version and last modification date."
354 (autoload 'ediff-toggle-multiframe
355 "ediff-util"
356 "Toggle the use of separate frame for Ediff control buffer."
358 (autoload 'ediff-toggle-use-toolbar
359 "ediff-util"
360 "Toggle the use of Ediff toolbar."
363 ) ; if purify-flag
366 (provide 'ediff-hook)
368 ;;; ediff-hook.el ends here