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)
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.
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))
41 (defvar ediff-merge-menu
)
43 (defvar ediff-misc-menu
)
46 ;; allow menus to be set up without ediff-wind.el being loaded
48 (defvar ediff-window-setup-function
)
50 ;; This macro is used to avoid compilation warnings.
51 ;; The macro will expand into the form that is appropriate to the
52 ;; compiler at hand (emacs or xemacs).
53 ;; The autoload, below, is useless in Emacs because ediff-hook.el
54 ;; is dumped with emacs, but it is needed in XEmacs
55 ;;;###autoload (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) (if (string-match "XEmacs" emacs-version) xemacs-form emacs-form))
57 (defmacro ediff-cond-compile-for-xemacs-or-emacs
(xemacs-form emacs-form
)
58 (if (string-match "XEmacs" emacs-version
)
59 xemacs-form emacs-form
))
61 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
62 ;; emacs, but it is needed in XEmacs
64 (ediff-cond-compile-for-xemacs-or-emacs
66 (defun ediff-xemacs-init-menus ()
67 (if (featurep 'menubar
)
70 '("Tools") ediff-menu
"OO-Browser...")
72 '("Tools") ediff-merge-menu
"OO-Browser...")
74 '("Tools") epatch-menu
"OO-Browser...")
76 '("Tools") ediff-misc-menu
"OO-Browser...")
78 '("Tools") "-------" "OO-Browser...")
84 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
85 ;; emacs, but it is needed in XEmacs
87 (ediff-cond-compile-for-xemacs-or-emacs
91 ["Two Files..." ediff-files t
]
92 ["Two Buffers..." ediff-buffers t
]
93 ["Three Files..." ediff-files3 t
]
94 ["Three Buffers..." ediff-buffers3 t
]
96 ["Two Directories..." ediff-directories t
]
97 ["Three Directories..." ediff-directories3 t
]
99 ["File with Revision..." ediff-revision t
]
100 ["Directory Revisions..." ediff-directory-revisions t
]
102 ["Windows Word-by-word..." ediff-windows-wordwise t
]
103 ["Windows Line-by-line..." ediff-windows-linewise t
]
105 ["Regions Word-by-word..." ediff-regions-wordwise t
]
106 ["Regions Line-by-line..." ediff-regions-linewise t
]
108 (defvar ediff-merge-menu
110 ["Files..." ediff-merge-files t
]
111 ["Files with Ancestor..." ediff-merge-files-with-ancestor t
]
112 ["Buffers..." ediff-merge-buffers t
]
113 ["Buffers with Ancestor..."
114 ediff-merge-buffers-with-ancestor t
]
116 ["Directories..." ediff-merge-directories t
]
117 ["Directories with Ancestor..."
118 ediff-merge-directories-with-ancestor t
]
120 ["Revisions..." ediff-merge-revisions t
]
121 ["Revisions with Ancestor..."
122 ediff-merge-revisions-with-ancestor t
]
123 ["Directory Revisions..." ediff-merge-directory-revisions t
]
124 ["Directory Revisions with Ancestor..."
125 ediff-merge-directory-revisions-with-ancestor t
]
129 ["To a file..." ediff-patch-file t
]
130 ["To a buffer..." ediff-patch-buffer t
]
132 (defvar ediff-misc-menu
133 '("Ediff Miscellanea"
134 ["Ediff Manual..." ediff-documentation t
]
135 ["Customize Ediff..." ediff-customize t
]
136 ["List Ediff Sessions..." ediff-show-registry t
]
137 ["Use separate frame for Ediff control buffer..."
138 ediff-toggle-multiframe
140 :selected
(if (and (featurep 'ediff-util
)
141 (boundp 'ediff-window-setup-function
))
142 (eq ediff-window-setup-function
143 'ediff-setup-windows-multiframe
))]
144 ["Use a toolbar with Ediff control buffer"
145 ediff-toggle-use-toolbar
147 :selected
(if (featurep 'ediff-tbar
)
148 (ediff-use-toolbar-p))]
151 ;; put these menus before Object-Oriented-Browser in Tools menu
152 (if (and (featurep 'menubar
) (not (featurep 'infodock
))
153 (not (featurep 'ediff-hook
)))
154 (ediff-xemacs-init-menus)))
156 ;; Emacs--only if menu-bar is loaded
157 (if (featurep 'menu-bar
)
159 ;; initialize menu bar keymaps
160 (defvar menu-bar-ediff-misc-menu
161 (make-sparse-keymap "Ediff Miscellanea"))
162 (fset 'menu-bar-ediff-misc-menu
163 (symbol-value 'menu-bar-ediff-misc-menu
))
164 (defvar menu-bar-epatch-menu
(make-sparse-keymap "Apply Patch"))
165 (fset 'menu-bar-epatch-menu
(symbol-value 'menu-bar-epatch-menu
))
166 (defvar menu-bar-ediff-merge-menu
(make-sparse-keymap "Merge"))
167 (fset 'menu-bar-ediff-merge-menu
168 (symbol-value 'menu-bar-ediff-merge-menu
))
169 (defvar menu-bar-ediff-menu
(make-sparse-keymap "Compare"))
170 (fset 'menu-bar-ediff-menu
(symbol-value 'menu-bar-ediff-menu
))
173 (define-key menu-bar-ediff-menu
[window]
174 '("This Window and Next Window" . compare-windows))
175 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
176 '("Windows Line-by-line..." . ediff-windows-linewise))
177 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
178 '("Windows Word-by-word..." . ediff-windows-wordwise))
179 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
180 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
181 '("Regions Line-by-line..." . ediff-regions-linewise))
182 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
183 '("Regions Word-by-word..." . ediff-regions-wordwise))
184 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
185 (define-key menu-bar-ediff-menu [ediff-dir-revision]
186 '("Directory Revisions..." . ediff-directory-revisions))
187 (define-key menu-bar-ediff-menu [ediff-revision]
188 '("File with Revision..." . ediff-revision))
189 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
190 (define-key menu-bar-ediff-menu [ediff-directories3]
191 '("Three Directories..." . ediff-directories3))
192 (define-key menu-bar-ediff-menu [ediff-directories]
193 '("Two Directories..." . ediff-directories))
194 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
195 (define-key menu-bar-ediff-menu [ediff-buffers3]
196 '("Three Buffers..." . ediff-buffers3))
197 (define-key menu-bar-ediff-menu [ediff-files3]
198 '("Three Files..." . ediff-files3))
199 (define-key menu-bar-ediff-menu [ediff-buffers]
200 '("Two Buffers..." . ediff-buffers))
201 (define-key menu-bar-ediff-menu [ediff-files]
202 '("Two Files..." . ediff-files))
206 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
207 '("Directory Revisions with Ancestor..."
208 . ediff-merge-directory-revisions-with-ancestor))
210 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
211 '("Directory Revisions..." . ediff-merge-directory-revisions))
213 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
214 '("Revisions with Ancestor..."
215 . ediff-merge-revisions-with-ancestor))
216 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
217 '("Revisions..." . ediff-merge-revisions))
218 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
220 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
221 '("Directories with Ancestor..."
222 . ediff-merge-directories-with-ancestor))
223 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
224 '("Directories..." . ediff-merge-directories))
226 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
228 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
229 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
230 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
231 '("Buffers..." . ediff-merge-buffers))
232 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
233 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
234 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
235 '("Files..." . ediff-merge-files))
237 ;; define epatch menu
238 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
239 '("To a Buffer..." . ediff-patch-buffer))
240 (define-key menu-bar-epatch-menu [ediff-patch-file]
241 '("To a File..." . ediff-patch-file))
243 ;; define ediff miscellanea
244 (define-key menu-bar-ediff-misc-menu [emultiframe]
245 '("Toggle use of separate control buffer frame..."
246 . ediff-toggle-multiframe))
247 (define-key menu-bar-ediff-misc-menu [eregistry]
248 '("List Ediff Sessions..." . ediff-show-registry))
249 (define-key menu-bar-ediff-misc-menu [ediff-cust]
250 '("Customize Ediff..." . ediff-customize))
251 (define-key menu-bar-ediff-misc-menu [ediff-doc]
252 '("Ediff Manual..." . ediff-documentation))
256 ) ; ediff-cond-compile-for-xemacs-or-emacs
258 ;; arrange for autoloads
260 () ; if dumping, autoloads are set up in loaddefs.el
261 ;; if the user decides to load this file, set up autoloads
262 ;; compare files and buffers
263 (autoload 'ediff "ediff" "Compare two files" t)
264 (autoload 'ediff-files "ediff" "Compare two files" t)
265 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
266 (autoload 'ebuffers "ediff" "Compare two bufers" t)
267 (autoload 'ediff3 "ediff" "Compare three files" t)
268 (autoload 'ediff-files3 "ediff" "Compare three files" t)
269 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
270 (autoload 'ebuffers3 "ediff" "Compare three bufers" t)
272 (autoload 'erevision "ediff" "Compare versions of a file" t)
273 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
275 ;; compare regions and windows
276 (autoload 'ediff-windows-wordwise
277 "ediff" "Compare two windows word-by-word." t)
278 (autoload 'ediff-regions-wordwise
279 "ediff" "Compare two regions word-by-word." t)
280 (autoload 'ediff-windows-linewise
281 "ediff" "Compare two windows line-by-line." t)
282 (autoload 'ediff-regions-linewise
283 "ediff" "Compare two regions line-by-line." t)
286 (autoload 'ediff-patch-file "ediff" "Patch a file." t)
287 (autoload 'epatch "ediff" "Patch a file." t)
288 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
289 (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
292 (autoload 'ediff-merge "ediff" "Merge two files." t)
293 (autoload 'ediff-merge-files "ediff" "Merge two files." t)
294 (autoload 'ediff-merge-files-with-ancestor
295 "ediff" "Merge two files using a third file as an ancestor." t)
296 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
297 (autoload 'ediff-merge-buffers-with-ancestor
298 "ediff" "Merge two buffers using a third buffer as an ancestor." t)
300 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
301 (autoload 'ediff-merge-revisions-with-ancestor
302 "ediff" "Merge two versions of a file." t)
304 ;; compare directories
305 (autoload 'edirs "ediff" "Compare files in two directories." t)
306 (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
307 (autoload 'edirs3 "ediff" "Compare files in three directories." t)
309 'ediff-directories3 "ediff" "Compare files in three directories." t)
311 (autoload 'edir-revisions
312 "ediff" "Compare two versions of a file." t)
313 (autoload 'ediff-directory-revisions
314 "ediff" "Compare two versions of a file." t)
317 (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
318 (autoload 'ediff-merge-directories
319 "ediff" "Merge files in two directories." t)
320 (autoload 'edirs-merge-with-ancestor
322 "Merge files in two directories using files in a third dir as ancestors."
324 (autoload 'ediff-merge-directories-with-ancestor
326 "Merge files in two directories using files in a third dir as ancestors."
329 (autoload 'edir-merge-revisions
330 "ediff" "Merge versions of files in a directory." t)
331 (autoload 'ediff-merge-directory-revisions
332 "ediff" "Merge versions of files in a directory." t)
333 (autoload 'ediff-merge-directory-revisions-with-ancestor
335 "Merge versions of files in a directory using other versions as ancestors."
337 (autoload 'edir-merge-revisions-with-ancestor
339 "Merge versions of files in a directory using other versions as ancestors."
343 (autoload 'ediff-show-registry
345 "Display the registry of active Ediff sessions."
349 "Display the registry of active Ediff sessions."
351 (autoload 'ediff-documentation
353 "Display Ediff's manual."
355 (autoload 'ediff-version
357 "Show Ediff's version and last modification date."
359 (autoload 'ediff-toggle-multiframe
361 "Toggle the use of separate frame for Ediff control buffer."
363 (autoload 'ediff-toggle-use-toolbar
365 "Toggle the use of Ediff toolbar."
371 (provide 'ediff-hook)
373 ;;; ediff-hook.el ends here