Typo fix.
[emacs.git] / lisp / ediff-hook.el
blobc32f0dd148587c85015c21258d1fd66d61611bd4
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, 2007, 2008 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 3, or (at your option)
13 ;; any later version.
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.
25 ;;; Commentary:
27 ;;; Code:
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))
40 ;; Compiler pacifier
41 (defvar ediff-menu)
42 (defvar ediff-merge-menu)
43 (defvar epatch-menu)
44 (defvar ediff-misc-menu)
45 ;; end pacifier
47 ;; allow menus to be set up without ediff-wind.el being loaded
48 (defvar ediff-window-setup-function)
50 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
51 ;; emacs, but it is needed in XEmacs
52 ;;;###autoload
53 (if (featurep 'xemacs)
54 (progn
55 (defun ediff-xemacs-init-menus ()
56 (when (featurep 'menubar)
57 (add-submenu
58 '("Tools") ediff-menu "OO-Browser...")
59 (add-submenu
60 '("Tools") ediff-merge-menu "OO-Browser...")
61 (add-submenu
62 '("Tools") epatch-menu "OO-Browser...")
63 (add-submenu
64 '("Tools") ediff-misc-menu "OO-Browser...")
65 (add-menu-button
66 '("Tools") "-------" "OO-Browser...")
68 (defvar ediff-menu
69 '("Compare"
70 ["Two Files..." ediff-files t]
71 ["Two Buffers..." ediff-buffers t]
72 ["Three Files..." ediff-files3 t]
73 ["Three Buffers..." ediff-buffers3 t]
74 "---"
75 ["Two Directories..." ediff-directories t]
76 ["Three Directories..." ediff-directories3 t]
77 "---"
78 ["File with Revision..." ediff-revision t]
79 ["Directory Revisions..." ediff-directory-revisions t]
80 "---"
81 ["Windows Word-by-word..." ediff-windows-wordwise t]
82 ["Windows Line-by-line..." ediff-windows-linewise t]
83 "---"
84 ["Regions Word-by-word..." ediff-regions-wordwise t]
85 ["Regions Line-by-line..." ediff-regions-linewise t]
87 (defvar ediff-merge-menu
88 '("Merge"
89 ["Files..." ediff-merge-files t]
90 ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
91 ["Buffers..." ediff-merge-buffers t]
92 ["Buffers with Ancestor..."
93 ediff-merge-buffers-with-ancestor t]
94 "---"
95 ["Directories..." ediff-merge-directories t]
96 ["Directories with Ancestor..."
97 ediff-merge-directories-with-ancestor t]
98 "---"
99 ["Revisions..." ediff-merge-revisions t]
100 ["Revisions with Ancestor..."
101 ediff-merge-revisions-with-ancestor t]
102 ["Directory Revisions..." ediff-merge-directory-revisions t]
103 ["Directory Revisions with Ancestor..."
104 ediff-merge-directory-revisions-with-ancestor t]
106 (defvar epatch-menu
107 '("Apply Patch"
108 ["To a file..." ediff-patch-file t]
109 ["To a buffer..." ediff-patch-buffer t]
111 (defvar ediff-misc-menu
112 '("Ediff Miscellanea"
113 ["Ediff Manual" ediff-documentation t]
114 ["Customize Ediff" ediff-customize t]
115 ["List Ediff Sessions" ediff-show-registry t]
116 ["Use separate frame for Ediff control buffer"
117 ediff-toggle-multiframe
118 :style toggle
119 :selected (if (and (featurep 'ediff-util)
120 (boundp 'ediff-window-setup-function))
121 (eq ediff-window-setup-function
122 'ediff-setup-windows-multiframe))]
123 ["Use a toolbar with Ediff control buffer"
124 ediff-toggle-use-toolbar
125 :style toggle
126 :selected (if (featurep 'ediff-tbar)
127 (ediff-use-toolbar-p))]))
129 ;; put these menus before Object-Oriented-Browser in Tools menu
130 (if (and (featurep 'menubar) (not (featurep 'infodock))
131 (not (featurep 'ediff-hook)))
132 (ediff-xemacs-init-menus)))
133 ;; Emacs
134 ;; initialize menu bar keymaps
135 (defvar menu-bar-ediff-misc-menu
136 (make-sparse-keymap "Ediff Miscellanea"))
137 (fset 'menu-bar-ediff-misc-menu
138 (symbol-value 'menu-bar-ediff-misc-menu))
139 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
140 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
141 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
142 (fset 'menu-bar-ediff-merge-menu
143 (symbol-value 'menu-bar-ediff-merge-menu))
144 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
145 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
147 ;; define ediff-menu
148 (define-key menu-bar-ediff-menu [window]
149 '("This Window and Next Window" . compare-windows))
150 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
151 '("Windows Line-by-line..." . ediff-windows-linewise))
152 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
153 '("Windows Word-by-word..." . ediff-windows-wordwise))
154 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
155 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
156 '("Regions Line-by-line..." . ediff-regions-linewise))
157 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
158 '("Regions Word-by-word..." . ediff-regions-wordwise))
159 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
160 (define-key menu-bar-ediff-menu [ediff-dir-revision]
161 '("Directory Revisions..." . ediff-directory-revisions))
162 (define-key menu-bar-ediff-menu [ediff-revision]
163 '("File with Revision..." . ediff-revision))
164 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
165 (define-key menu-bar-ediff-menu [ediff-directories3]
166 '("Three Directories..." . ediff-directories3))
167 (define-key menu-bar-ediff-menu [ediff-directories]
168 '("Two Directories..." . ediff-directories))
169 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
170 (define-key menu-bar-ediff-menu [ediff-buffers3]
171 '("Three Buffers..." . ediff-buffers3))
172 (define-key menu-bar-ediff-menu [ediff-files3]
173 '("Three Files..." . ediff-files3))
174 (define-key menu-bar-ediff-menu [ediff-buffers]
175 '("Two Buffers..." . ediff-buffers))
176 (define-key menu-bar-ediff-menu [ediff-files]
177 '("Two Files..." . ediff-files))
179 ;; define merge menu
180 (define-key
181 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
182 '("Directory Revisions with Ancestor..."
183 . ediff-merge-directory-revisions-with-ancestor))
184 (define-key
185 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
186 '("Directory Revisions..." . ediff-merge-directory-revisions))
187 (define-key
188 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
189 '("Revisions with Ancestor..."
190 . ediff-merge-revisions-with-ancestor))
191 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
192 '("Revisions..." . ediff-merge-revisions))
193 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
194 (define-key
195 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
196 '("Directories with Ancestor..."
197 . ediff-merge-directories-with-ancestor))
198 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
199 '("Directories..." . ediff-merge-directories))
200 (define-key
201 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
202 (define-key
203 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
204 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
205 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
206 '("Buffers..." . ediff-merge-buffers))
207 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
208 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
209 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
210 '("Files..." . ediff-merge-files))
212 ;; define epatch menu
213 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
214 '("To a Buffer..." . ediff-patch-buffer))
215 (define-key menu-bar-epatch-menu [ediff-patch-file]
216 '("To a File..." . ediff-patch-file))
218 ;; define ediff miscellanea
219 (define-key menu-bar-ediff-misc-menu [emultiframe]
220 '("Toggle use of separate control buffer frame"
221 . ediff-toggle-multiframe))
222 (define-key menu-bar-ediff-misc-menu [eregistry]
223 '("List Ediff Sessions" . ediff-show-registry))
224 (define-key menu-bar-ediff-misc-menu [ediff-cust]
225 '("Customize Ediff" . ediff-customize))
226 (define-key menu-bar-ediff-misc-menu [ediff-doc]
227 '("Ediff Manual" . ediff-documentation)))
229 (provide 'ediff-hook)
232 ;; arch-tag: 512f8656-8a4b-4789-af5d-5c6144498df3
233 ;;; ediff-hook.el ends here