(menu-bar-epatch-menu, menu-bar-ediff-merge-menu)
[emacs.git] / lisp / ediff-hook.el
blob6273fcd3fcdf02b35afac75ce446cf3a9c59853c
1 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
2 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 ;; This file is part of GNU Emacs.
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; any later version.
13 ;; GNU Emacs is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 ;;; These must be placed in menu-bar.el in Emacs
25 ;; (define-key menu-bar-tools-menu [eregistry]
26 ;; '("List Ediff Sessions" . ediff-show-registry))
27 ;; (define-key menu-bar-tools-menu [epatch]
28 ;; '("Apply Patch" . menu-bar-epatch-menu))
29 ;; (define-key menu-bar-tools-menu [ediff-merge]
30 ;; '("Merge" . menu-bar-ediff-merge-menu))
31 ;; (define-key menu-bar-tools-menu [ediff]
32 ;; '("Compare" . menu-bar-ediff-menu))
35 (defun ediff-xemacs-init-menus ()
36 (if (featurep 'menubar)
37 (progn
38 (add-submenu
39 '("Tools") ediff-menu "OO-Browser...")
40 (add-submenu
41 '("Tools") ediff-merge-menu "OO-Browser...")
42 (add-submenu
43 '("Tools") epatch-menu "OO-Browser...")
44 (add-menu-button
45 '("Tools")
46 ["List Ediff Sessions" ediff-show-registry t] "OO-Browser...")
47 (add-menu-button
48 '("Tools")
49 ["---" nil nil] "OO-Browser...")
50 )))
54 ;; explicit string-match is needed: ediff-xemacs-p is not defined at build time
55 (cond ((string-match "XEmacs" emacs-version)
56 (defvar ediff-menu
57 '("Compare"
58 ["Two Files ..." ediff-files t]
59 ["Two Buffers ..." ediff-buffers t]
60 ["Three Files ..." ediff-files3 t]
61 ["Three Buffers ..." ediff-buffers3 t]
62 "---"
63 ["Two Directories ..." ediff-directories t]
64 ["Three Directories ..." ediff-directories3 t]
65 "---"
66 ["File with Revision ..." ediff-revision t]
67 ["Directory Revisions ..." ediff-directory-revisions t]
68 "---"
69 ["Windows Word-by-word ..." ediff-windows-wordwise t]
70 ["Windows Line-by-line ..." ediff-windows-linewise t]
71 "---"
72 ["Regions Word-by-word ..." ediff-regions-wordwise t]
73 ["Regions Line-by-line ..." ediff-regions-linewise t]))
74 (defvar ediff-merge-menu
75 '("Merge"
76 ["Files ..." ediff-merge-files t]
77 ["Files with Ancestor ..." ediff-merge-files-with-ancestor t]
78 ["Buffers ..." ediff-merge-buffers t]
79 ["Buffers with Ancestor ..."
80 ediff-merge-buffers-with-ancestor t]
81 "---"
82 ["Directories ..." ediff-merge-directories t]
83 ["Directories with Ancestor ..."
84 ediff-merge-directories-with-ancestor t]
85 "---"
86 ["Revisions ..." ediff-merge-revisions t]
87 ["Revisions with Ancestor ..."
88 ediff-merge-revisions-with-ancestor t]
89 ["Directory Revisions ..." ediff-merge-directory-revisions t]
90 ["Directory Revisions with Ancestor ..."
91 ediff-merge-directory-revisions-with-ancestor t]))
92 (defvar epatch-menu
93 '("Apply Patch"
94 ["To a file ..." ediff-patch-file t]
95 ["To a buffer ..." ediff-patch-buffer t]))
97 ;; put these menus before Object-Oriented-Browser in Tools menu
98 (add-hook 'before-init-hook 'ediff-xemacs-init-menus)
99 ;; this `if' is to be deleted before going into distribution
100 (if (not purify-flag)
101 (ediff-xemacs-init-menus))
104 ;; Emacs--only if menu-bar is loaded
105 ((featurep 'menu-bar)
106 ;; initialize menu bar keymaps
107 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
108 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
109 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
110 (fset 'menu-bar-ediff-merge-menu
111 (symbol-value 'menu-bar-ediff-merge-menu))
112 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
113 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
115 ;; define ediff-menu
116 (define-key menu-bar-ediff-menu [window]
117 '("This Window And Next Window" . compare-windows))
118 (define-key menu-bar-ediff-menu [ediff-dir-revision]
119 '("Directory Revisions ..." . ediff-directory-revisions))
120 (define-key menu-bar-ediff-menu [ediff-revision]
121 '("File with Revision ..." . ediff-revision))
122 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
123 (define-key menu-bar-ediff-menu [ediff-directories3]
124 '("Three Directories ..." . ediff-directories3))
125 (define-key menu-bar-ediff-menu [ediff-directories]
126 '("Two Directories ..." . ediff-directories))
127 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
128 (define-key menu-bar-ediff-menu [ediff-buffers3]
129 '("Three Buffers ..." . ediff-buffers3))
130 (define-key menu-bar-ediff-menu [ediff-files3]
131 '("Three Files ..." . ediff-files3))
132 (define-key menu-bar-ediff-menu [ediff-buffers]
133 '("Two Buffers ..." . ediff-buffers))
134 (define-key menu-bar-ediff-menu [ediff-files]
135 '("Two Files ..." . ediff-files))
136 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
137 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
138 '("Regions Line-by-line ..." . ediff-regions-linewise))
139 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
140 '("Regions Word-by-word ..." . ediff-regions-wordwise))
141 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
142 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
143 '("Windows Line-by-line ..." . ediff-windows-linewise))
144 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
145 '("Windows Word-by-word ..." . ediff-windows-wordwise))
147 ;; define merge menu
148 (define-key
149 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
150 '("Directory Revisions with Ancestor ..."
151 . ediff-merge-directory-revisions-with-ancestor))
152 (define-key
153 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
154 '("Directory Revisions ..." . ediff-merge-directory-revisions))
155 (define-key
156 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
157 '("Revisions with Ancestor ..."
158 . ediff-merge-revisions-with-ancestor))
159 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
160 '("Revisions ..." . ediff-merge-revisions))
161 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
162 (define-key
163 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
164 '("Directories with Ancestor ..."
165 . ediff-merge-directories-with-ancestor))
166 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
167 '("Directories ..." . ediff-merge-directories))
168 (define-key
169 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
170 (define-key
171 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
172 '("Buffers with Ancestor ..." . ediff-merge-buffers-with-ancestor))
173 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
174 '("Buffers ..." . ediff-merge-buffers))
175 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
176 '("Files with Ancestor ..." . ediff-merge-files-with-ancestor))
177 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
178 '("Files ..." . ediff-merge-files))
180 ;; define epatch menu
181 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
182 '("To a Buffer ..." . ediff-patch-buffer))
183 (define-key menu-bar-epatch-menu [ediff-patch-file]
184 '("To a File ..." . ediff-patch-file)))
186 ) ; cond
188 ;; arrange for autoloads
189 (if purify-flag
190 () ; if dumping, autoloads are set up in loaddefs.el
191 ;; if the user decides to load this file, set up autoloads
192 ;; compare files and buffers
193 (autoload 'ediff "ediff" "Compare two files" t)
194 (autoload 'ediff-files "ediff" "Compare two files" t)
195 (autoload 'ediff-buffers "ediff" "Compare two bufers" t)
196 (autoload 'ediff3 "ediff" "Compare three files" t)
197 (autoload 'ediff-files3 "ediff" "Compare three files" t)
198 (autoload 'ediff-buffers3 "ediff" "Compare three bufers" t)
200 (autoload 'ediff-revision "ediff" "Compare versions of a file" t)
202 ;; compare regions and windows
203 (autoload 'ediff-windows-wordwise
204 "ediff" "Compare two windows word-by-word" t)
205 (autoload 'ediff-regions-wordwise
206 "ediff" "Compare two regions word-by-word" t)
207 (autoload 'ediff-windows-linewise
208 "ediff" "Compare two windows line-by-line" t)
209 (autoload 'ediff-regions-linewise
210 "ediff" "Compare two regions line-by-line" t)
212 ;; patch
213 (autoload 'ediff-patch-file "ediff" "Patch a file" t)
214 (autoload 'epatch "ediff" "Patch a file" t)
215 (autoload 'ediff-patch-buffer "ediff" "Patch a buffer")
216 (autoload 'epatch-buffer "ediff" "Patch a buffer" t)
218 ;; merge
219 (autoload 'ediff-merge "ediff" "Merge two files" t)
220 (autoload 'ediff-merge-files "ediff" "Merge two files" t)
221 (autoload 'ediff-merge-files-with-ancestor
222 "ediff" "Merge two files using a third file as an ancestor" t)
223 (autoload 'ediff-merge-buffers "ediff" "Merge two buffers" t)
224 (autoload 'ediff-merge-buffers-with-ancestor
225 "ediff" "Merge two buffers using a third buffer as an ancestor" t)
227 (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file" t)
228 (autoload 'ediff-merge-revisions-with-ancestor
229 "ediff" "Merge two versions of a file" t)
231 ;; compare directories
232 (autoload 'edirs "ediff" "Compare files in two directories" t)
233 (autoload 'ediff-directories "ediff" "Compare files in two directories" t)
234 (autoload 'edirs3 "ediff" "Compare files in three directories" t)
235 (autoload 'ediff-directories3 "ediff" "Compare files in three directories" t)
237 (autoload 'edir-revisions
238 "ediff" "Compare two versions of a file" t)
239 (autoload 'ediff-directory-revisions
240 "ediff" "Compare two versions of a file" t)
242 ;; merge directories
243 (autoload 'edirs-merge "ediff" "Merge files in two directories" t)
244 (autoload 'ediff-merge-directories
245 "ediff" "Merge files in two directories" t)
246 (autoload 'edirs-merge-with-ancestor
247 "ediff"
248 "Merge files in two directories using files in a third dir as ancestors" t)
249 (autoload 'ediff-merge-directories-with-ancestor
250 "ediff"
251 "Merge files in two directories using files in a third dir as ancestors" t)
253 (autoload 'edir-merge-revisions
254 "ediff" "Merge versions of files in a directory" t)
255 (autoload 'ediff-merge-directory-revisions
256 "ediff" "Merge versions of files in a directory" t)
257 (autoload 'ediff-merge-directory-revisions-with-ancestor
258 "ediff"
259 "Merge versions of files in a directory using other versions as ancestors"
261 (autoload 'edir-merge-revisions-with-ancestor
262 "ediff"
263 "Merge versions of files in a directory using other versions as ancestors"
266 ;; misc
267 (autoload 'ediff-show-registry
268 "ediff-mult"
269 "Display the registry of active Ediff sessions"
271 (autoload 'ediff-version
272 "ediff"
273 "Show Ediff's version and last modification date"
275 ) ; if purify-flag
278 (provide 'ediff-hook)
281 ;;; ediff-hook.el ends here