(makefile-warn-suspicious-lines): clean
[emacs.git] / lisp / ediff-hook.el
blobe315930ad37c28ba01dd3f06d88139e89c7fad31
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")
66 ["-------" nil nil] "OO-Browser...")
67 ))))
70 ;; explicit string-match is needed: ediff-xemacs-p is not defined at build time
71 ;;;###autoload
72 (cond ((string-match "XEmacs" emacs-version)
73 (defvar ediff-menu
74 '("Compare"
75 ["Two Files..." ediff-files t]
76 ["Two Buffers..." ediff-buffers t]
77 ["Three Files..." ediff-files3 t]
78 ["Three Buffers..." ediff-buffers3 t]
79 "---"
80 ["Two Directories..." ediff-directories t]
81 ["Three Directories..." ediff-directories3 t]
82 "---"
83 ["File with Revision..." ediff-revision t]
84 ["Directory Revisions..." ediff-directory-revisions t]
85 "---"
86 ["Windows Word-by-word..." ediff-windows-wordwise t]
87 ["Windows Line-by-line..." ediff-windows-linewise t]
88 "---"
89 ["Regions Word-by-word..." ediff-regions-wordwise t]
90 ["Regions Line-by-line..." ediff-regions-linewise t]
92 (defvar ediff-merge-menu
93 '("Merge"
94 ["Files..." ediff-merge-files t]
95 ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
96 ["Buffers..." ediff-merge-buffers t]
97 ["Buffers with Ancestor..."
98 ediff-merge-buffers-with-ancestor t]
99 "---"
100 ["Directories..." ediff-merge-directories t]
101 ["Directories with Ancestor..."
102 ediff-merge-directories-with-ancestor t]
103 "---"
104 ["Revisions..." ediff-merge-revisions t]
105 ["Revisions with Ancestor..."
106 ediff-merge-revisions-with-ancestor t]
107 ["Directory Revisions..." ediff-merge-directory-revisions t]
108 ["Directory Revisions with Ancestor..."
109 ediff-merge-directory-revisions-with-ancestor t]
111 (defvar epatch-menu
112 '("Apply Patch"
113 ["To a file..." ediff-patch-file t]
114 ["To a buffer..." ediff-patch-buffer t]
116 (defvar ediff-misc-menu
117 '("Ediff Miscellanea"
118 ["Ediff Manual..." ediff-documentation t]
119 ["Customize Ediff..." ediff-customize t]
120 ["List Ediff Sessions..." ediff-show-registry t]
121 ["Use separate frame for Ediff control buffer..."
122 ediff-toggle-multiframe
123 :style toggle
124 :selected (if (and (featurep 'ediff-util)
125 (boundp 'ediff-window-setup-function))
126 (eq ediff-window-setup-function
127 'ediff-setup-windows-multiframe))]
128 ["Use a toolbar with Ediff control buffer"
129 ediff-toggle-use-toolbar
130 :style toggle
131 :selected (if (featurep 'ediff-tbar)
132 (ediff-use-toolbar-p))]
135 ;; put these menus before Object-Oriented-Browser in Tools menu
136 ;;; (add-hook 'before-init-hook 'ediff-xemacs-init-menus)
137 ;;; (if (not purify-flag)
138 ;;; (ediff-xemacs-init-menus))
139 ;;; )
140 (if (and (featurep 'menubar) (not (featurep 'infodock))
141 (not (featurep 'ediff-hook)))
142 (ediff-xemacs-init-menus)))
144 ;; Emacs--only if menu-bar is loaded
145 ((featurep 'menu-bar)
146 ;; initialize menu bar keymaps
147 (defvar menu-bar-ediff-misc-menu
148 (make-sparse-keymap "Ediff Miscellanea"))
149 (fset 'menu-bar-ediff-misc-menu
150 (symbol-value 'menu-bar-ediff-misc-menu))
151 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
152 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
153 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
154 (fset 'menu-bar-ediff-merge-menu
155 (symbol-value 'menu-bar-ediff-merge-menu))
156 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
157 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
159 ;; define ediff-menu
160 (define-key menu-bar-ediff-menu [window]
161 '("This Window and Next Window" . compare-windows))
162 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
163 '("Windows Line-by-line..." . ediff-windows-linewise))
164 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
165 '("Windows Word-by-word..." . ediff-windows-wordwise))
166 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
167 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
168 '("Regions Line-by-line..." . ediff-regions-linewise))
169 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
170 '("Regions Word-by-word..." . ediff-regions-wordwise))
171 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
172 (define-key menu-bar-ediff-menu [ediff-dir-revision]
173 '("Directory Revisions..." . ediff-directory-revisions))
174 (define-key menu-bar-ediff-menu [ediff-revision]
175 '("File with Revision..." . ediff-revision))
176 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
177 (define-key menu-bar-ediff-menu [ediff-directories3]
178 '("Three Directories..." . ediff-directories3))
179 (define-key menu-bar-ediff-menu [ediff-directories]
180 '("Two Directories..." . ediff-directories))
181 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
182 (define-key menu-bar-ediff-menu [ediff-buffers3]
183 '("Three Buffers..." . ediff-buffers3))
184 (define-key menu-bar-ediff-menu [ediff-files3]
185 '("Three Files..." . ediff-files3))
186 (define-key menu-bar-ediff-menu [ediff-buffers]
187 '("Two Buffers..." . ediff-buffers))
188 (define-key menu-bar-ediff-menu [ediff-files]
189 '("Two Files..." . ediff-files))
191 ;; define merge menu
192 (define-key
193 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
194 '("Directory Revisions with Ancestor..."
195 . ediff-merge-directory-revisions-with-ancestor))
196 (define-key
197 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
198 '("Directory Revisions..." . ediff-merge-directory-revisions))
199 (define-key
200 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
201 '("Revisions with Ancestor..."
202 . ediff-merge-revisions-with-ancestor))
203 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
204 '("Revisions..." . ediff-merge-revisions))
205 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
206 (define-key
207 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
208 '("Directories with Ancestor..."
209 . ediff-merge-directories-with-ancestor))
210 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
211 '("Directories..." . ediff-merge-directories))
212 (define-key
213 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
214 (define-key
215 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
216 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
217 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
218 '("Buffers..." . ediff-merge-buffers))
219 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
220 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
221 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
222 '("Files..." . ediff-merge-files))
224 ;; define epatch menu
225 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
226 '("To a Buffer..." . ediff-patch-buffer))
227 (define-key menu-bar-epatch-menu [ediff-patch-file]
228 '("To a File..." . ediff-patch-file))
230 ;; define ediff miscellanea
231 (define-key menu-bar-ediff-misc-menu [emultiframe]
232 '("Toggle use of separate control buffer frame..."
233 . ediff-toggle-multiframe))
234 (define-key menu-bar-ediff-misc-menu [eregistry]
235 '("List Ediff Sessions..." . ediff-show-registry))
236 (define-key menu-bar-ediff-misc-menu [ediff-cust]
237 '("Customize Ediff..." . ediff-customize))
238 (define-key menu-bar-ediff-misc-menu [ediff-doc]
239 '("Ediff Manual..." . ediff-documentation))
242 ) ; cond
244 ;; arrange for autoloads
245 (if purify-flag
246 () ; if dumping, autoloads are set up in loaddefs.el
247 ;; if the user decides to load this file, set up autoloads
248 ;; compare files and buffers
249 (autoload 'ediff "ediff" "Compare two files" t)
250 (autoload 'ediff-files "ediff" "Compare two files" t)
251 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
252 (autoload 'ebuffers "ediff" "Compare two bufers" t)
253 (autoload 'ediff3 "ediff" "Compare three files" t)
254 (autoload 'ediff-files3 "ediff" "Compare three files" t)
255 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
256 (autoload 'ebuffers3 "ediff" "Compare three bufers" t)
258 (autoload 'erevision "ediff" "Compare versions of a file" t)
259 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
261 ;; compare regions and windows
262 (autoload 'ediff-windows-wordwise
263 "ediff" "Compare two windows word-by-word." t)
264 (autoload 'ediff-regions-wordwise
265 "ediff" "Compare two regions word-by-word." t)
266 (autoload 'ediff-windows-linewise
267 "ediff" "Compare two windows line-by-line." t)
268 (autoload 'ediff-regions-linewise
269 "ediff" "Compare two regions line-by-line." t)
271 ;; patch
272 (autoload 'ediff-patch-file "ediff" "Patch a file." t)
273 (autoload 'epatch "ediff" "Patch a file." t)
274 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
275 (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
277 ;; merge
278 (autoload 'ediff-merge "ediff" "Merge two files." t)
279 (autoload 'ediff-merge-files "ediff" "Merge two files." t)
280 (autoload 'ediff-merge-files-with-ancestor
281 "ediff" "Merge two files using a third file as an ancestor." t)
282 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
283 (autoload 'ediff-merge-buffers-with-ancestor
284 "ediff" "Merge two buffers using a third buffer as an ancestor." t)
286 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
287 (autoload 'ediff-merge-revisions-with-ancestor
288 "ediff" "Merge two versions of a file." t)
290 ;; compare directories
291 (autoload 'edirs "ediff" "Compare files in two directories." t)
292 (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
293 (autoload 'edirs3 "ediff" "Compare files in three directories." t)
294 (autoload
295 'ediff-directories3 "ediff" "Compare files in three directories." t)
297 (autoload 'edir-revisions
298 "ediff" "Compare two versions of a file." t)
299 (autoload 'ediff-directory-revisions
300 "ediff" "Compare two versions of a file." t)
302 ;; merge directories
303 (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
304 (autoload 'ediff-merge-directories
305 "ediff" "Merge files in two directories." t)
306 (autoload 'edirs-merge-with-ancestor
307 "ediff"
308 "Merge files in two directories using files in a third dir as ancestors."
310 (autoload 'ediff-merge-directories-with-ancestor
311 "ediff"
312 "Merge files in two directories using files in a third dir as ancestors."
315 (autoload 'edir-merge-revisions
316 "ediff" "Merge versions of files in a directory." t)
317 (autoload 'ediff-merge-directory-revisions
318 "ediff" "Merge versions of files in a directory." t)
319 (autoload 'ediff-merge-directory-revisions-with-ancestor
320 "ediff"
321 "Merge versions of files in a directory using other versions as ancestors."
323 (autoload 'edir-merge-revisions-with-ancestor
324 "ediff"
325 "Merge versions of files in a directory using other versions as ancestors."
328 ;; misc
329 (autoload 'ediff-show-registry
330 "ediff-mult"
331 "Display the registry of active Ediff sessions."
333 (autoload 'eregistry
334 "ediff-mult"
335 "Display the registry of active Ediff sessions."
337 (autoload 'ediff-documentation
338 "ediff"
339 "Display Ediff's manual."
341 (autoload 'ediff-version
342 "ediff"
343 "Show Ediff's version and last modification date."
345 (autoload 'ediff-toggle-multiframe
346 "ediff-util"
347 "Toggle the use of separate frame for Ediff control buffer."
349 (autoload 'ediff-toggle-use-toolbar
350 "ediff-util"
351 "Toggle the use of Ediff toolbar."
354 ) ; if purify-flag
357 (provide 'ediff-hook)
360 ;;; ediff-hook.el ends here