1 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4 ;; 2004, 2005, 2006 Free Software Foundation, Inc.
6 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
29 ;;; These must be placed in menu-bar.el in Emacs
31 ;; (define-key menu-bar-tools-menu [ediff-misc]
32 ;; '("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
33 ;; (define-key menu-bar-tools-menu [epatch]
34 ;; '("Apply Patch" . menu-bar-epatch-menu))
35 ;; (define-key menu-bar-tools-menu [ediff-merge]
36 ;; '("Merge" . menu-bar-ediff-merge-menu))
37 ;; (define-key menu-bar-tools-menu [ediff]
38 ;; '("Compare" . menu-bar-ediff-menu))
42 (defvar ediff-merge-menu
)
44 (defvar ediff-misc-menu
)
47 ;; allow menus to be set up without ediff-wind.el being loaded
49 (defvar ediff-window-setup-function
)
51 ;; This macro is used to avoid compilation warnings.
52 ;; The macro will expand into the form that is appropriate to the
53 ;; compiler at hand (emacs or xemacs).
54 ;; The autoload, below, is useless in Emacs because ediff-hook.el
55 ;; is dumped with emacs, but it is needed in XEmacs
56 ;;;###autoload (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) (if (string-match "XEmacs" emacs-version) xemacs-form emacs-form))
58 (defmacro ediff-cond-compile-for-xemacs-or-emacs
(xemacs-form emacs-form
)
59 (if (string-match "XEmacs" emacs-version
)
60 xemacs-form emacs-form
))
62 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
63 ;; emacs, but it is needed in XEmacs
65 (ediff-cond-compile-for-xemacs-or-emacs
67 (defun ediff-xemacs-init-menus ()
68 (if (featurep 'menubar
)
71 '("Tools") ediff-menu
"OO-Browser...")
73 '("Tools") ediff-merge-menu
"OO-Browser...")
75 '("Tools") epatch-menu
"OO-Browser...")
77 '("Tools") ediff-misc-menu
"OO-Browser...")
79 '("Tools") "-------" "OO-Browser...")
85 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
86 ;; emacs, but it is needed in XEmacs
88 (ediff-cond-compile-for-xemacs-or-emacs
92 ["Two Files..." ediff-files t
]
93 ["Two Buffers..." ediff-buffers t
]
94 ["Three Files..." ediff-files3 t
]
95 ["Three Buffers..." ediff-buffers3 t
]
97 ["Two Directories..." ediff-directories t
]
98 ["Three Directories..." ediff-directories3 t
]
100 ["File with Revision..." ediff-revision t
]
101 ["Directory Revisions..." ediff-directory-revisions t
]
103 ["Windows Word-by-word..." ediff-windows-wordwise t
]
104 ["Windows Line-by-line..." ediff-windows-linewise t
]
106 ["Regions Word-by-word..." ediff-regions-wordwise t
]
107 ["Regions Line-by-line..." ediff-regions-linewise t
]
109 (defvar ediff-merge-menu
111 ["Files..." ediff-merge-files t
]
112 ["Files with Ancestor..." ediff-merge-files-with-ancestor t
]
113 ["Buffers..." ediff-merge-buffers t
]
114 ["Buffers with Ancestor..."
115 ediff-merge-buffers-with-ancestor t
]
117 ["Directories..." ediff-merge-directories t
]
118 ["Directories with Ancestor..."
119 ediff-merge-directories-with-ancestor t
]
121 ["Revisions..." ediff-merge-revisions t
]
122 ["Revisions with Ancestor..."
123 ediff-merge-revisions-with-ancestor t
]
124 ["Directory Revisions..." ediff-merge-directory-revisions t
]
125 ["Directory Revisions with Ancestor..."
126 ediff-merge-directory-revisions-with-ancestor t
]
130 ["To a file..." ediff-patch-file t
]
131 ["To a buffer..." ediff-patch-buffer t
]
133 (defvar ediff-misc-menu
134 '("Ediff Miscellanea"
135 ["Ediff Manual" ediff-documentation t
]
136 ["Customize Ediff" ediff-customize t
]
137 ["List Ediff Sessions" ediff-show-registry t
]
138 ["Use separate frame for Ediff control buffer"
139 ediff-toggle-multiframe
141 :selected
(if (and (featurep 'ediff-util
)
142 (boundp 'ediff-window-setup-function
))
143 (eq ediff-window-setup-function
144 'ediff-setup-windows-multiframe
))]
145 ["Use a toolbar with Ediff control buffer"
146 ediff-toggle-use-toolbar
148 :selected
(if (featurep 'ediff-tbar
)
149 (ediff-use-toolbar-p))]
152 ;; put these menus before Object-Oriented-Browser in Tools menu
153 (if (and (featurep 'menubar
) (not (featurep 'infodock
))
154 (not (featurep 'ediff-hook
)))
155 (ediff-xemacs-init-menus)))
157 ;; Emacs--only if menu-bar is loaded
158 (if (featurep 'menu-bar
)
160 ;; initialize menu bar keymaps
161 (defvar menu-bar-ediff-misc-menu
162 (make-sparse-keymap "Ediff Miscellanea"))
163 (fset 'menu-bar-ediff-misc-menu
164 (symbol-value 'menu-bar-ediff-misc-menu
))
165 (defvar menu-bar-epatch-menu
(make-sparse-keymap "Apply Patch"))
166 (fset 'menu-bar-epatch-menu
(symbol-value 'menu-bar-epatch-menu
))
167 (defvar menu-bar-ediff-merge-menu
(make-sparse-keymap "Merge"))
168 (fset 'menu-bar-ediff-merge-menu
169 (symbol-value 'menu-bar-ediff-merge-menu
))
170 (defvar menu-bar-ediff-menu
(make-sparse-keymap "Compare"))
171 (fset 'menu-bar-ediff-menu
(symbol-value 'menu-bar-ediff-menu
))
174 (define-key menu-bar-ediff-menu
[window]
175 '("This Window and Next Window" . compare-windows))
176 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
177 '("Windows Line-by-line..." . ediff-windows-linewise))
178 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
179 '("Windows Word-by-word..." . ediff-windows-wordwise))
180 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
181 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
182 '("Regions Line-by-line..." . ediff-regions-linewise))
183 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
184 '("Regions Word-by-word..." . ediff-regions-wordwise))
185 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
186 (define-key menu-bar-ediff-menu [ediff-dir-revision]
187 '("Directory Revisions..." . ediff-directory-revisions))
188 (define-key menu-bar-ediff-menu [ediff-revision]
189 '("File with Revision..." . ediff-revision))
190 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
191 (define-key menu-bar-ediff-menu [ediff-directories3]
192 '("Three Directories..." . ediff-directories3))
193 (define-key menu-bar-ediff-menu [ediff-directories]
194 '("Two Directories..." . ediff-directories))
195 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
196 (define-key menu-bar-ediff-menu [ediff-buffers3]
197 '("Three Buffers..." . ediff-buffers3))
198 (define-key menu-bar-ediff-menu [ediff-files3]
199 '("Three Files..." . ediff-files3))
200 (define-key menu-bar-ediff-menu [ediff-buffers]
201 '("Two Buffers..." . ediff-buffers))
202 (define-key menu-bar-ediff-menu [ediff-files]
203 '("Two Files..." . ediff-files))
207 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
208 '("Directory Revisions with Ancestor..."
209 . ediff-merge-directory-revisions-with-ancestor))
211 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
212 '("Directory Revisions..." . ediff-merge-directory-revisions))
214 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
215 '("Revisions with Ancestor..."
216 . ediff-merge-revisions-with-ancestor))
217 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
218 '("Revisions..." . ediff-merge-revisions))
219 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
221 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
222 '("Directories with Ancestor..."
223 . ediff-merge-directories-with-ancestor))
224 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
225 '("Directories..." . ediff-merge-directories))
227 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
229 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
230 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
231 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
232 '("Buffers..." . ediff-merge-buffers))
233 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
234 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
235 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
236 '("Files..." . ediff-merge-files))
238 ;; define epatch menu
239 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
240 '("To a Buffer..." . ediff-patch-buffer))
241 (define-key menu-bar-epatch-menu [ediff-patch-file]
242 '("To a File..." . ediff-patch-file))
244 ;; define ediff miscellanea
245 (define-key menu-bar-ediff-misc-menu [emultiframe]
246 '("Toggle use of separate control buffer frame"
247 . ediff-toggle-multiframe))
248 (define-key menu-bar-ediff-misc-menu [eregistry]
249 '("List Ediff Sessions" . ediff-show-registry))
250 (define-key menu-bar-ediff-misc-menu [ediff-cust]
251 '("Customize Ediff" . ediff-customize))
252 (define-key menu-bar-ediff-misc-menu [ediff-doc]
253 '("Ediff Manual" . ediff-documentation))
257 ) ; ediff-cond-compile-for-xemacs-or-emacs
259 ;; arrange for autoloads
261 () ; if dumping, autoloads are set up in loaddefs.el
262 ;; if the user decides to load this file, set up autoloads
263 ;; compare files and buffers
264 (autoload 'ediff "ediff" "Compare two files" t)
265 (autoload 'ediff-files "ediff" "Compare two files" t)
266 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
267 (autoload 'ebuffers "ediff" "Compare two bufers" t)
268 (autoload 'ediff3 "ediff" "Compare three files" t)
269 (autoload 'ediff-files3 "ediff" "Compare three files" t)
270 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
271 (autoload 'ebuffers3 "ediff" "Compare three bufers" t)
273 (autoload 'erevision "ediff" "Compare versions of a file" t)
274 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
276 ;; compare regions and windows
277 (autoload 'ediff-windows-wordwise
278 "ediff" "Compare two windows word-by-word." t)
279 (autoload 'ediff-regions-wordwise
280 "ediff" "Compare two regions word-by-word." t)
281 (autoload 'ediff-windows-linewise
282 "ediff" "Compare two windows line-by-line." t)
283 (autoload 'ediff-regions-linewise
284 "ediff" "Compare two regions line-by-line." t)
287 (autoload 'ediff-patch-file "ediff" "Patch a file." t)
288 (autoload 'epatch "ediff" "Patch a file." t)
289 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
290 (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
293 (autoload 'ediff-merge "ediff" "Merge two files." t)
294 (autoload 'ediff-merge-files "ediff" "Merge two files." t)
295 (autoload 'ediff-merge-files-with-ancestor
296 "ediff" "Merge two files using a third file as an ancestor." t)
297 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
298 (autoload 'ediff-merge-buffers-with-ancestor
299 "ediff" "Merge two buffers using a third buffer as an ancestor." t)
301 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
302 (autoload 'ediff-merge-revisions-with-ancestor
303 "ediff" "Merge two versions of a file." t)
305 ;; compare directories
306 (autoload 'edirs "ediff" "Compare files in two directories." t)
307 (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
308 (autoload 'edirs3 "ediff" "Compare files in three directories." t)
310 'ediff-directories3 "ediff" "Compare files in three directories." t)
312 (autoload 'edir-revisions
313 "ediff" "Compare two versions of a file." t)
314 (autoload 'ediff-directory-revisions
315 "ediff" "Compare two versions of a file." t)
318 (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
319 (autoload 'ediff-merge-directories
320 "ediff" "Merge files in two directories." t)
321 (autoload 'edirs-merge-with-ancestor
323 "Merge files in two directories using files in a third dir as ancestors."
325 (autoload 'ediff-merge-directories-with-ancestor
327 "Merge files in two directories using files in a third dir as ancestors."
330 (autoload 'edir-merge-revisions
331 "ediff" "Merge versions of files in a directory." t)
332 (autoload 'ediff-merge-directory-revisions
333 "ediff" "Merge versions of files in a directory." t)
334 (autoload 'ediff-merge-directory-revisions-with-ancestor
336 "Merge versions of files in a directory using other versions as ancestors."
338 (autoload 'edir-merge-revisions-with-ancestor
340 "Merge versions of files in a directory using other versions as ancestors."
344 (autoload 'ediff-show-registry
346 "Display the registry of active Ediff sessions."
350 "Display the registry of active Ediff sessions."
352 (autoload 'ediff-documentation
354 "Display Ediff's manual."
356 (autoload 'ediff-version
358 "Show Ediff's version and last modification date."
360 (autoload 'ediff-toggle-multiframe
362 "Toggle the use of separate frame for Ediff control buffer."
364 (autoload 'ediff-toggle-use-toolbar
366 "Toggle the use of Ediff toolbar."
372 (provide 'ediff-hook)
374 ;;; arch-tag: 512f8656-8a4b-4789-af5d-5c6144498df3
375 ;;; ediff-hook.el ends here