*** empty log message ***
[emacs.git] / lisp / ediff-hook.el
blobbab839595237d7fd6fed950a1d98e438ee0a5302
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 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-menu
146 (define-key menu-bar-ediff-menu [window]
147 '("This Window and Next Window" . compare-windows))
148 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
149 '("Windows Line-by-line..." . ediff-windows-linewise))
150 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
151 '("Windows Word-by-word..." . ediff-windows-wordwise))
152 (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
153 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
154 '("Regions Line-by-line..." . ediff-regions-linewise))
155 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
156 '("Regions Word-by-word..." . ediff-regions-wordwise))
157 (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
158 (define-key menu-bar-ediff-menu [ediff-dir-revision]
159 '("Directory Revisions..." . ediff-directory-revisions))
160 (define-key menu-bar-ediff-menu [ediff-revision]
161 '("File with Revision..." . ediff-revision))
162 (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
163 (define-key menu-bar-ediff-menu [ediff-directories3]
164 '("Three Directories..." . ediff-directories3))
165 (define-key menu-bar-ediff-menu [ediff-directories]
166 '("Two Directories..." . ediff-directories))
167 (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
168 (define-key menu-bar-ediff-menu [ediff-buffers3]
169 '("Three Buffers..." . ediff-buffers3))
170 (define-key menu-bar-ediff-menu [ediff-files3]
171 '("Three Files..." . ediff-files3))
172 (define-key menu-bar-ediff-menu [ediff-buffers]
173 '("Two Buffers..." . ediff-buffers))
174 (define-key menu-bar-ediff-menu [ediff-files]
175 '("Two Files..." . ediff-files))
177 ;; define merge menu
178 (define-key
179 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
180 '("Directory Revisions with Ancestor..."
181 . ediff-merge-directory-revisions-with-ancestor))
182 (define-key
183 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
184 '("Directory Revisions..." . ediff-merge-directory-revisions))
185 (define-key
186 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
187 '("Revisions with Ancestor..."
188 . ediff-merge-revisions-with-ancestor))
189 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
190 '("Revisions..." . ediff-merge-revisions))
191 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
192 (define-key
193 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
194 '("Directories with Ancestor..."
195 . ediff-merge-directories-with-ancestor))
196 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
197 '("Directories..." . ediff-merge-directories))
198 (define-key
199 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
200 (define-key
201 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
202 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
203 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
204 '("Buffers..." . ediff-merge-buffers))
205 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
206 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
207 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
208 '("Files..." . ediff-merge-files))
210 ;; define epatch menu
211 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
212 '("To a Buffer..." . ediff-patch-buffer))
213 (define-key menu-bar-epatch-menu [ediff-patch-file]
214 '("To a File..." . ediff-patch-file))
216 ;; define ediff miscellanea
217 (define-key menu-bar-ediff-misc-menu [emultiframe]
218 '("Toggle use of separate control buffer frame"
219 . ediff-toggle-multiframe))
220 (define-key menu-bar-ediff-misc-menu [eregistry]
221 '("List Ediff Sessions" . ediff-show-registry))
222 (define-key menu-bar-ediff-misc-menu [ediff-cust]
223 '("Customize Ediff" . ediff-customize))
224 (define-key menu-bar-ediff-misc-menu [ediff-doc]
225 '("Ediff Manual" . ediff-documentation)))
227 (provide 'ediff-hook)
230 ;; arch-tag: 512f8656-8a4b-4789-af5d-5c6144498df3
231 ;;; ediff-hook.el ends here