1 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
3 ;; Copyright (C) 1995-2014 Free Software Foundation, Inc.
5 ;; 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/>.
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))
40 (defvar ediff-merge-menu
)
42 (defvar ediff-misc-menu
)
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
51 (if (featurep 'xemacs
)
53 (defun ediff-xemacs-init-menus ()
54 (when (featurep 'menubar
)
56 '("Tools") ediff-menu
"OO-Browser...")
58 '("Tools") ediff-merge-menu
"OO-Browser...")
60 '("Tools") epatch-menu
"OO-Browser...")
62 '("Tools") ediff-misc-menu
"OO-Browser...")
64 '("Tools") "-------" "OO-Browser...")
68 ["Two Files..." ediff-files t
]
69 ["Two Buffers..." ediff-buffers t
]
70 ["Three Files..." ediff-files3 t
]
71 ["Three Buffers..." ediff-buffers3 t
]
73 ["Two Directories..." ediff-directories t
]
74 ["Three Directories..." ediff-directories3 t
]
76 ["File with Revision..." ediff-revision t
]
77 ["Directory Revisions..." ediff-directory-revisions t
]
79 ["Windows Word-by-word..." ediff-windows-wordwise t
]
80 ["Windows Line-by-line..." ediff-windows-linewise t
]
82 ["Regions Word-by-word..." ediff-regions-wordwise t
]
83 ["Regions Line-by-line..." ediff-regions-linewise t
]
85 (defvar ediff-merge-menu
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
]
93 ["Directories..." ediff-merge-directories t
]
94 ["Directories with Ancestor..."
95 ediff-merge-directories-with-ancestor t
]
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
]
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
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
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)))
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
[ediff-misc
]
147 `(menu-item ,(purecopy "Ediff Miscellanea") menu-bar-ediff-misc-menu
))
148 (define-key menu-bar-ediff-menu
[separator-ediff-misc
] menu-bar-separator
)
149 (define-key menu-bar-ediff-menu
[window]
150 `(menu-item ,(purecopy "This Window and Next Window") compare-windows
151 :help ,(purecopy "Compare the current window and the next window")))
152 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
153 `(menu-item ,(purecopy "Windows Line-by-line...") ediff-windows-linewise
154 :help ,(purecopy "Compare windows line-wise")))
155 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
156 `(menu-item ,(purecopy "Windows Word-by-word...") ediff-windows-wordwise
157 :help ,(purecopy "Compare windows word-wise")))
158 (define-key menu-bar-ediff-menu [separator-ediff-windows] menu-bar-separator)
159 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
160 `(menu-item ,(purecopy "Regions Line-by-line...") ediff-regions-linewise
161 :help ,(purecopy "Compare regions line-wise")))
162 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
163 `(menu-item ,(purecopy "Regions Word-by-word...") ediff-regions-wordwise
164 :help ,(purecopy "Compare regions word-wise")))
165 (define-key menu-bar-ediff-menu [separator-ediff-regions] menu-bar-separator)
166 (define-key menu-bar-ediff-menu [ediff-dir-revision]
167 `(menu-item ,(purecopy "Directory Revisions...") ediff-directory-revisions
168 :help ,(purecopy "Compare directory files with their older versions")))
169 (define-key menu-bar-ediff-menu [ediff-revision]
170 `(menu-item ,(purecopy "File with Revision...") ediff-revision
171 :help ,(purecopy "Compare file with its older versions")))
172 (define-key menu-bar-ediff-menu [separator-ediff-directories] menu-bar-separator)
173 (define-key menu-bar-ediff-menu [ediff-directories3]
174 `(menu-item ,(purecopy "Three Directories...") ediff-directories3
175 :help ,(purecopy "Compare files common to three directories simultaneously")))
176 (define-key menu-bar-ediff-menu [ediff-directories]
177 `(menu-item ,(purecopy "Two Directories...") ediff-directories
178 :help ,(purecopy "Compare files common to two directories simultaneously")))
179 (define-key menu-bar-ediff-menu [separator-ediff-files] menu-bar-separator)
180 (define-key menu-bar-ediff-menu [ediff-buffers3]
181 `(menu-item ,(purecopy "Three Buffers...") ediff-buffers3
182 :help ,(purecopy "Compare three buffers simultaneously")))
183 (define-key menu-bar-ediff-menu [ediff-files3]
184 `(menu-item ,(purecopy "Three Files...") ediff-files3
185 :help ,(purecopy "Compare three files simultaneously")))
186 (define-key menu-bar-ediff-menu [ediff-buffers]
187 `(menu-item ,(purecopy "Two Buffers...") ediff-buffers
188 :help ,(purecopy "Compare two buffers simultaneously")))
189 (define-key menu-bar-ediff-menu [ediff-files]
190 `(menu-item ,(purecopy "Two Files...") ediff-files
191 :help ,(purecopy "Compare two files simultaneously")))
193 ;; define ediff merge menu
195 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
196 `(menu-item ,(purecopy "Directory Revisions with Ancestor...")
197 ediff-merge-directory-revisions-with-ancestor
198 :help ,(purecopy "Merge versions of the files in the same directory by comparing the files with common ancestors")))
200 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
201 `(menu-item ,(purecopy "Directory Revisions...") ediff-merge-directory-revisions
202 :help ,(purecopy "Merge versions of the files in the same directory (without using ancestor information)")))
204 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
205 `(menu-item ,(purecopy "Revisions with Ancestor...")
206 ediff-merge-revisions-with-ancestor
207 :help ,(purecopy "Merge versions of the same file by comparing them with a common ancestor")))
208 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
209 `(menu-item ,(purecopy "Revisions...") ediff-merge-revisions
210 :help ,(purecopy "Merge versions of the same file (without using ancestor information)")))
211 (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] menu-bar-separator)
213 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
214 `(menu-item ,(purecopy "Directories with Ancestor...")
215 ediff-merge-directories-with-ancestor
216 :help ,(purecopy "Merge files common to a pair of directories by comparing the files with common ancestors")))
217 (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
218 `(menu-item ,(purecopy "Directories...") ediff-merge-directories
219 :help ,(purecopy "Merge files common to a pair of directories")))
221 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] menu-bar-separator)
223 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
224 `(menu-item ,(purecopy "Buffers with Ancestor...") ediff-merge-buffers-with-ancestor
225 :help ,(purecopy "Merge buffers by comparing their contents with a common ancestor")))
226 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
227 `(menu-item ,(purecopy "Buffers...") ediff-merge-buffers
228 :help ,(purecopy "Merge buffers (without using ancestor information)")))
229 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
230 `(menu-item ,(purecopy "Files with Ancestor...") ediff-merge-files-with-ancestor
231 :help ,(purecopy "Merge files by comparing them with a common ancestor")))
232 (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
233 `(menu-item ,(purecopy "Files...") ediff-merge-files
234 :help ,(purecopy "Merge files (without using ancestor information)")))
236 ;; define epatch menu
237 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
238 `(menu-item ,(purecopy "To a Buffer...") ediff-patch-buffer
239 :help ,(purecopy "Apply a patch to the contents of a buffer")))
240 (define-key menu-bar-epatch-menu [ediff-patch-file]
241 `(menu-item ,(purecopy "To a File...") ediff-patch-file
242 :help ,(purecopy "Apply a patch to a file")))
244 ;; define ediff miscellanea
245 (define-key menu-bar-ediff-misc-menu [emultiframe]
246 `(menu-item ,(purecopy "Use separate control buffer frame")
247 ediff-toggle-multiframe
248 :help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode")))
249 (define-key menu-bar-ediff-misc-menu [eregistry]
250 `(menu-item ,(purecopy "List Ediff Sessions") ediff-show-registry
251 :help ,(purecopy "List all active Ediff sessions; it is a convenient way to find and resume such a session")))
252 (define-key menu-bar-ediff-misc-menu [ediff-cust]
253 `(menu-item ,(purecopy "Customize Ediff") ediff-customize
254 :help ,(purecopy "Change some of the parameters that govern the behavior of Ediff")))
255 (define-key menu-bar-ediff-misc-menu [ediff-doc]
256 `(menu-item ,(purecopy "Ediff Manual") ediff-documentation
257 :help ,(purecopy "Bring up the Ediff manual"))))
259 (provide 'ediff-hook)
262 ;;; ediff-hook.el ends here