Comment (python-mode is now separate from Python).
[emacs.git] / lisp / ediff-hook.el
blob00525b6fe440b25cac97069f0091293b3eed6f65
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, 2009 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 of the License, or
13 ;; (at your option) 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. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Commentary:
25 ;;; Code:
27 ;;; These must be placed in menu-bar.el in Emacs
29 ;; (define-key menu-bar-tools-menu [ediff-misc]
30 ;; '("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
31 ;; (define-key menu-bar-tools-menu [epatch]
32 ;; '("Apply Patch" . menu-bar-epatch-menu))
33 ;; (define-key menu-bar-tools-menu [ediff-merge]
34 ;; '("Merge" . menu-bar-ediff-merge-menu))
35 ;; (define-key menu-bar-tools-menu [ediff]
36 ;; '("Compare" . menu-bar-ediff-menu))
38 ;; Compiler pacifier
39 (defvar ediff-menu)
40 (defvar ediff-merge-menu)
41 (defvar epatch-menu)
42 (defvar ediff-misc-menu)
43 ;; end pacifier
45 ;; allow menus to be set up without ediff-wind.el being loaded
46 (defvar ediff-window-setup-function)
48 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
49 ;; emacs, but it is needed in XEmacs
50 ;;;###autoload
51 (if (featurep 'xemacs)
52 (progn
53 (defun ediff-xemacs-init-menus ()
54 (when (featurep 'menubar)
55 (add-submenu
56 '("Tools") ediff-menu "OO-Browser...")
57 (add-submenu
58 '("Tools") ediff-merge-menu "OO-Browser...")
59 (add-submenu
60 '("Tools") epatch-menu "OO-Browser...")
61 (add-submenu
62 '("Tools") ediff-misc-menu "OO-Browser...")
63 (add-menu-button
64 '("Tools") "-------" "OO-Browser...")
66 (defvar ediff-menu
67 '("Compare"
68 ["Two Files..." ediff-files t]
69 ["Two Buffers..." ediff-buffers t]
70 ["Three Files..." ediff-files3 t]
71 ["Three Buffers..." ediff-buffers3 t]
72 "---"
73 ["Two Directories..." ediff-directories t]
74 ["Three Directories..." ediff-directories3 t]
75 "---"
76 ["File with Revision..." ediff-revision t]
77 ["Directory Revisions..." ediff-directory-revisions t]
78 "---"
79 ["Windows Word-by-word..." ediff-windows-wordwise t]
80 ["Windows Line-by-line..." ediff-windows-linewise t]
81 "---"
82 ["Regions Word-by-word..." ediff-regions-wordwise t]
83 ["Regions Line-by-line..." ediff-regions-linewise t]
85 (defvar ediff-merge-menu
86 '("Merge"
87 ["Files..." ediff-merge-files t]
88 ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
89 ["Buffers..." ediff-merge-buffers t]
90 ["Buffers with Ancestor..."
91 ediff-merge-buffers-with-ancestor t]
92 "---"
93 ["Directories..." ediff-merge-directories t]
94 ["Directories with Ancestor..."
95 ediff-merge-directories-with-ancestor t]
96 "---"
97 ["Revisions..." ediff-merge-revisions t]
98 ["Revisions with Ancestor..."
99 ediff-merge-revisions-with-ancestor t]
100 ["Directory Revisions..." ediff-merge-directory-revisions t]
101 ["Directory Revisions with Ancestor..."
102 ediff-merge-directory-revisions-with-ancestor t]
104 (defvar epatch-menu
105 '("Apply Patch"
106 ["To a file..." ediff-patch-file t]
107 ["To a buffer..." ediff-patch-buffer t]
109 (defvar ediff-misc-menu
110 '("Ediff Miscellanea"
111 ["Ediff Manual" ediff-documentation t]
112 ["Customize Ediff" ediff-customize t]
113 ["List Ediff Sessions" ediff-show-registry t]
114 ["Use separate frame for Ediff control buffer"
115 ediff-toggle-multiframe
116 :style toggle
117 :selected (if (and (featurep 'ediff-util)
118 (boundp 'ediff-window-setup-function))
119 (eq ediff-window-setup-function
120 'ediff-setup-windows-multiframe))]
121 ["Use a toolbar with Ediff control buffer"
122 ediff-toggle-use-toolbar
123 :style toggle
124 :selected (if (featurep 'ediff-tbar)
125 (ediff-use-toolbar-p))]))
127 ;; put these menus before Object-Oriented-Browser in Tools menu
128 (if (and (featurep 'menubar) (not (featurep 'infodock))
129 (not (featurep 'ediff-hook)))
130 (ediff-xemacs-init-menus)))
131 ;; Emacs
132 ;; initialize menu bar keymaps
133 (defvar menu-bar-ediff-misc-menu
134 (make-sparse-keymap "Ediff Miscellanea"))
135 (fset 'menu-bar-ediff-misc-menu
136 (symbol-value 'menu-bar-ediff-misc-menu))
137 (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
138 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
139 (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
140 (fset 'menu-bar-ediff-merge-menu
141 (symbol-value 'menu-bar-ediff-merge-menu))
142 (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
143 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
145 ;; define ediff compare menu
146 (define-key menu-bar-ediff-menu [window]
147 '(menu-item "This Window and Next Window" compare-windows
148 :help "Compare the current window and the next window"))
149 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
150 '(menu-item "Windows Line-by-line..." ediff-windows-linewise
151 :help "Compare windows line-wise"))
152 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
153 '(menu-item "Windows Word-by-word..." ediff-windows-wordwise
154 :help "Compare windows word-wise"))
155 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
156 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
157 '(menu-item "Regions Line-by-line..." ediff-regions-linewise
158 :help "Compare regions line-wise"))
159 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
160 '(menu-item "Regions Word-by-word..." ediff-regions-wordwise
161 :help "Compare regions word-wise"))
162 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
163 (define-key menu-bar-ediff-menu [ediff-dir-revision]
164 '(menu-item "Directory Revisions..." ediff-directory-revisions
165 :help "Compare directory files with their older versions"))
166 (define-key menu-bar-ediff-menu [ediff-revision]
167 '(menu-item "File with Revision..." ediff-revision
168 :help "Compare file with its older versions"))
169 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
170 (define-key menu-bar-ediff-menu [ediff-directories3]
171 '(menu-item "Three Directories..." ediff-directories3
172 :help "Compare files common to three directories simultaneously"))
173 (define-key menu-bar-ediff-menu [ediff-directories]
174 '(menu-item "Two Directories..." ediff-directories
175 :help "Compare files common to two directories simultaneously"))
176 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
177 (define-key menu-bar-ediff-menu [ediff-buffers3]
178 '(menu-item "Three Buffers..." ediff-buffers3
179 :help "Compare three buffers simultaneously"))
180 (define-key menu-bar-ediff-menu [ediff-files3]
181 '(menu-item "Three Files..." ediff-files3
182 :help "Compare three files simultaneously"))
183 (define-key menu-bar-ediff-menu [ediff-buffers]
184 '(menu-item "Two Buffers..." ediff-buffers
185 :help "Compare two buffers simultaneously"))
186 (define-key menu-bar-ediff-menu [ediff-files]
187 '(menu-item "Two Files..." ediff-files
188 :help "Compare two files simultaneously"))
190 ;; define ediff merge menu
191 (define-key
192 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
193 '(menu-item "Directory Revisions with Ancestor..."
194 ediff-merge-directory-revisions-with-ancestor
195 :help "Merge versions of the files in the same directory by comparing the files with common ancestors"))
196 (define-key
197 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
198 '(menu-item "Directory Revisions..." ediff-merge-directory-revisions
199 :help "Merge versions of the files in the same directory (without using ancestor information)"))
200 (define-key
201 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
202 '(menu-item "Revisions with Ancestor..."
203 ediff-merge-revisions-with-ancestor
204 :help "Merge versions of the same file by comparing them with a common ancestor"))
205 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
206 '(menu-item "Revisions..." ediff-merge-revisions
207 :help "Merge versions of the same file (without using ancestor information)"))
208 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
209 (define-key
210 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
211 '(menu-item "Directories with Ancestor..."
212 ediff-merge-directories-with-ancestor
213 :help "Merge files common to a pair of directories by comparing the files with common ancestors"))
214 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
215 '(menu-item "Directories..." ediff-merge-directories
216 :help "Merge files common to a pair of directories"))
217 (define-key
218 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
219 (define-key
220 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
221 '(menu-item "Buffers with Ancestor..." ediff-merge-buffers-with-ancestor
222 :help "Merge buffers by comparing their contents with a common ancestor"))
223 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
224 '(menu-item "Buffers..." ediff-merge-buffers
225 :help "Merge buffers (without using ancestor information)"))
226 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
227 '(menu-item "Files with Ancestor..." ediff-merge-files-with-ancestor
228 :help "Merge files by comparing them with a common ancestor"))
229 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
230 '(menu-item "Files..." ediff-merge-files
231 :help "Merge files (without using ancestor information)"))
233 ;; define epatch menu
234 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
235 '(menu-item "To a Buffer..." ediff-patch-buffer
236 :help "Apply a patch to the contents of a buffer"))
237 (define-key menu-bar-epatch-menu [ediff-patch-file]
238 '(menu-item "To a File..." ediff-patch-file
239 :help "Apply a patch to a file"))
241 ;; define ediff miscellanea
242 (define-key menu-bar-ediff-misc-menu [emultiframe]
243 '(menu-item "Toggle use of separate control buffer frame"
244 ediff-toggle-multiframe
245 :help "Switch between the single-frame presentation mode and the multi-frame mode"))
246 (define-key menu-bar-ediff-misc-menu [eregistry]
247 '(menu-item "List Ediff Sessions" ediff-show-registry
248 :help "List all active Ediff sessions; it is a convenient way to find and resume such a session"))
249 (define-key menu-bar-ediff-misc-menu [ediff-cust]
250 '(menu-item "Customize Ediff" ediff-customize
251 :help "Change some of the parameters that govern the behavior of Ediff"))
252 (define-key menu-bar-ediff-misc-menu [ediff-doc]
253 '(menu-item "Ediff Manual" ediff-documentation
254 :help "Bring up the Ediff manual")))
256 (provide 'ediff-hook)
259 ;; arch-tag: 512f8656-8a4b-4789-af5d-5c6144498df3
260 ;;; ediff-hook.el ends here