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
47 (defvar ediff-window-setup-function
)
49 ;; This is used to avoid compilation warnings. When emacs/xemacs forms can
50 ;; generate compile time warnings, we use this macro.
51 ;; In this case, the macro will expand into the form that is appropriate to the
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 ;; Note we wrap this in a progn so that we pick up the whole def
59 ;; for auto-autoload. That way we do not load ediff-hook.el when defining
62 (ediff-cond-compile-for-xemacs-or-emacs
64 (defun ediff-xemacs-init-menus ()
65 (if (featurep 'menubar
)
68 '("Tools") ediff-menu
"OO-Browser...")
70 '("Tools") ediff-merge-menu
"OO-Browser...")
72 '("Tools") epatch-menu
"OO-Browser...")
74 '("Tools") ediff-misc-menu
"OO-Browser...")
76 '("Tools") "-------" "OO-Browser...")
82 (ediff-cond-compile-for-xemacs-or-emacs
86 ["Two Files..." ediff-files t
]
87 ["Two Buffers..." ediff-buffers t
]
88 ["Three Files..." ediff-files3 t
]
89 ["Three Buffers..." ediff-buffers3 t
]
91 ["Two Directories..." ediff-directories t
]
92 ["Three Directories..." ediff-directories3 t
]
94 ["File with Revision..." ediff-revision t
]
95 ["Directory Revisions..." ediff-directory-revisions t
]
97 ["Windows Word-by-word..." ediff-windows-wordwise t
]
98 ["Windows Line-by-line..." ediff-windows-linewise t
]
100 ["Regions Word-by-word..." ediff-regions-wordwise t
]
101 ["Regions Line-by-line..." ediff-regions-linewise t
]
103 (defvar ediff-merge-menu
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
]
111 ["Directories..." ediff-merge-directories t
]
112 ["Directories with Ancestor..."
113 ediff-merge-directories-with-ancestor t
]
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
]
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
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
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
)
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
))
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))
201 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
202 '("Directory Revisions with Ancestor..."
203 . ediff-merge-directory-revisions-with-ancestor))
205 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
206 '("Directory Revisions..." . ediff-merge-directory-revisions))
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] '("--"))
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))
221 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
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))
251 ) ; ediff-cond-compile-for-xemacs-or-emacs
253 ;; arrange for autoloads
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)
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)
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)
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)
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
317 "Merge files in two directories using files in a third dir as ancestors."
319 (autoload 'ediff-merge-directories-with-ancestor
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
330 "Merge versions of files in a directory using other versions as ancestors."
332 (autoload 'edir-merge-revisions-with-ancestor
334 "Merge versions of files in a directory using other versions as ancestors."
338 (autoload 'ediff-show-registry
340 "Display the registry of active Ediff sessions."
344 "Display the registry of active Ediff sessions."
346 (autoload 'ediff-documentation
348 "Display Ediff's manual."
350 (autoload 'ediff-version
352 "Show Ediff's version and last modification date."
354 (autoload 'ediff-toggle-multiframe
356 "Toggle the use of separate frame for Ediff control buffer."
358 (autoload 'ediff-toggle-use-toolbar
360 "Toggle the use of Ediff toolbar."
366 (provide 'ediff-hook)
368 ;;; ediff-hook.el ends here