282
|
1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs.
|
|
2
|
|
3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
5 ;; Copyright (C) 1995 Sun Microsystems.
|
|
6 ;; Copyright (C) 1995, 1996 Ben Wing.
|
|
7 ;; Copyright (C) 1997 MORIOKA Tomohiko
|
|
8
|
|
9 ;; Maintainer: XEmacs Development Team
|
|
10 ;; Keywords: frames, extensions, internal, dumped
|
|
11
|
|
12 ;; This file is part of XEmacs.
|
|
13
|
|
14 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
15 ;; under the terms of the GNU General Public License as published by
|
|
16 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
17 ;; any later version.
|
|
18
|
|
19 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
22 ;; General Public License for more details.
|
|
23
|
|
24 ;; You should have received a copy of the GNU General Public License
|
|
25 ;; along with Xmacs; see the file COPYING. If not, write to the
|
|
26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
27 ;; Boston, MA 02111-1307, USA.
|
|
28
|
|
29 ;;; Commentary:
|
|
30
|
|
31 ;; This file is dumped with XEmacs (when window system and menubar support is
|
|
32 ;; compiled in).
|
|
33
|
|
34 ;;; Code:
|
|
35
|
|
36 ;;; Warning-free compile
|
|
37 (eval-when-compile
|
|
38 (defvar language-environment-list)
|
|
39 (defvar bookmark-alist)
|
|
40 (defvar language-info-alist)
|
|
41 (defvar current-language-environment)
|
|
42 (defvar tutorial-supported-languages))
|
|
43
|
|
44 (defconst default-menubar
|
|
45 (purecopy-menubar
|
|
46 ;; note backquote.
|
|
47 `(
|
|
48 ("File"
|
|
49 ["Open..." find-file]
|
|
50 ["Open in Other Window..." find-file-other-window]
|
|
51 ["Open in New Frame..." find-file-other-frame]
|
|
52 ["Insert File..." insert-file]
|
|
53 ["View File..." view-file]
|
|
54 "------"
|
|
55 ["Save" save-buffer
|
|
56 :active (buffer-modified-p)
|
|
57 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
58 ["Save As..." write-file]
|
|
59 ["Save Some Buffers" save-some-buffers]
|
|
60 "-----"
|
|
61 ["Print Buffer" lpr-buffer
|
|
62 :active (fboundp 'lpr-buffer)
|
|
63 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
64 ["Pretty-Print Buffer" ps-print-buffer-with-faces
|
|
65 :active (fboundp 'ps-print-buffer-with-faces)
|
|
66 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
67 "-----"
|
|
68 ["New Frame" make-frame]
|
|
69 ["Frame on Other Display..." make-frame-on-display]
|
|
70 ["Delete Frame" delete-frame
|
|
71 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
|
|
72 (selected-frame)))]
|
|
73 "-----"
|
|
74 ["Split Window" split-window-vertically]
|
|
75 ["Un-Split (Keep This)" delete-other-windows
|
|
76 :active (not (one-window-p t))]
|
|
77 ["Un-Split (Keep Others)" delete-window
|
|
78 :active (not (one-window-p t))]
|
|
79 "-----"
|
|
80 ["Revert Buffer" revert-buffer
|
|
81 :active (or buffer-file-name revert-buffer-function)
|
|
82 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
83 ["Delete Buffer" kill-this-buffer
|
|
84 :active t
|
|
85 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
86 "-----"
|
|
87 ["Exit XEmacs" save-buffers-kill-emacs]
|
|
88 )
|
|
89
|
|
90 ("Edit"
|
|
91 ["Undo" advertised-undo
|
|
92 :active (and (not (eq buffer-undo-list t))
|
|
93 (or buffer-undo-list pending-undo-list))
|
|
94 :suffix (if (or (eq last-command 'undo)
|
|
95 (eq last-command 'advertised-undo))
|
|
96 "More" "")]
|
|
97 ["Redo" redo
|
|
98 :included (fboundp 'redo)
|
|
99 :active (not (or (eq buffer-undo-list t)
|
|
100 (eq last-buffer-undo-list nil)
|
|
101 (not (or (eq last-buffer-undo-list buffer-undo-list)
|
|
102 (and (null (car-safe buffer-undo-list))
|
|
103 (eq last-buffer-undo-list
|
|
104 (cdr-safe buffer-undo-list)))))
|
|
105 (or (eq buffer-undo-list pending-undo-list)
|
|
106 (eq (cdr buffer-undo-list) pending-undo-list))))
|
|
107 :suffix (if (eq last-command 'redo) "More" "")]
|
|
108 ["Cut" kill-primary-selection
|
|
109 :active (selection-owner-p)]
|
|
110 ["Copy" copy-primary-selection
|
|
111 :active (selection-owner-p)]
|
|
112 ["Paste" yank-clipboard-selection
|
|
113 :active (selection-exists-p 'CLIPBOARD)]
|
|
114 ["Clear" delete-primary-selection
|
|
115 :active (selection-owner-p)]
|
|
116 "----"
|
|
117 ["Search..." isearch-forward]
|
|
118 ["Search Backward..." isearch-backward]
|
|
119 ["Replace..." query-replace]
|
|
120 "----"
|
|
121 ["Search (Regexp)..." isearch-forward-regexp]
|
|
122 ["Search Backward (Regexp)..." isearch-backward-regexp]
|
|
123 ["Replace (Regexp)..." query-replace-regexp]
|
|
124 "----"
|
|
125 ["Goto Line..." goto-line]
|
|
126 ["What Line" what-line]
|
|
127 ("Bookmarks"
|
|
128 :filter bookmark-menu-filter)
|
|
129 "----"
|
|
130 ["Start Macro Recording" start-kbd-macro
|
|
131 :active (not defining-kbd-macro)]
|
|
132 ["End Macro Recording" end-kbd-macro
|
|
133 :active defining-kbd-macro]
|
|
134 ["Execute Last Macro" call-last-kbd-macro
|
|
135 :active last-kbd-macro]
|
|
136 "----"
|
|
137 ["Show Message Log" show-message-log]
|
|
138 )
|
|
139
|
|
140 ,@(if (featurep 'mule)
|
|
141 '(("Mule"
|
|
142 ("Describe language support")
|
|
143 ("Set language environment")
|
|
144 "--"
|
|
145 ["Toggle input method" toggle-input-method]
|
|
146 ["Select input method" select-input-method]
|
|
147 ["Describe input method" describe-input-method]
|
|
148 "--"
|
|
149 ["Describe current coding systems"
|
|
150 describe-current-coding-system]
|
|
151 ["Set coding system of buffer file"
|
|
152 set-buffer-file-coding-system]
|
|
153 ;; not implemented yet
|
|
154 ["Set coding system of terminal"
|
|
155 set-terminal-coding-system :active nil]
|
|
156 ;; not implemented yet
|
|
157 ["Set coding system of keyboard"
|
|
158 set-keyboard-coding-system :active nil]
|
|
159 ["Set coding system of process"
|
335
|
160 set-buffer-process-coding-system
|
|
161 :active (get-buffer-process (current-buffer))]
|
282
|
162 "--"
|
|
163 ["Show character table" view-charset-by-menu]
|
|
164 ;; not implemented yet
|
|
165 ["Show diagnosis for MULE" mule-diag :active nil]
|
|
166 ["Show many languages" view-hello-file])))
|
|
167
|
|
168 ("Apps"
|
|
169 ["Read Mail (VM)..." vm
|
|
170 :active (fboundp 'vm)]
|
|
171 ["Read Mail (MH)..." (mh-rmail t)
|
|
172 :active (fboundp 'mh-rmail)]
|
|
173 ["Send mail..." compose-mail
|
|
174 :active (fboundp 'compose-mail)]
|
|
175 ["Usenet News" gnus
|
|
176 :active (fboundp 'gnus)]
|
|
177 ["Browse the Web" w3
|
|
178 :active (fboundp 'w3)]
|
|
179 "----"
|
|
180 ["Spell-Check Buffer" ispell-buffer
|
|
181 :active (fboundp 'ispell-buffer)]
|
|
182 ["Toggle VI emulation" toggle-viper-mode
|
|
183 :active (fboundp 'toggle-viper-mode)]
|
|
184 "----"
|
|
185 ("Calendar"
|
|
186 ["3-Month Calendar" calendar
|
|
187 :active (fboundp 'calendar)]
|
|
188 ["Diary" diary
|
|
189 :active (fboundp 'diary)]
|
|
190 ["Holidays" holidays
|
|
191 :active (fboundp 'holidays)]
|
|
192 ;; we're all pagans at heart ...
|
|
193 ["Phases of the Moon" phases-of-moon
|
|
194 :active (fboundp 'phases-of-moon)]
|
|
195 ["Sunrise/Sunset" sunrise-sunset
|
|
196 :active (fboundp 'sunrise-sunset)])
|
|
197
|
|
198 ("Games"
|
|
199 ["Mine Game" xmine
|
|
200 :active (fboundp 'xmine)]
|
|
201 ["Tetris" tetris
|
|
202 :active (fboundp 'tetris)]
|
|
203 ["Sokoban" sokoban
|
|
204 :active (fboundp 'sokoban)]
|
|
205 ["Quote from Zippy" yow
|
|
206 :active (fboundp 'yow)]
|
|
207 ["Psychoanalyst" doctor
|
|
208 :active (fboundp 'doctor)]
|
|
209 ["Psychoanalyze Zippy!" psychoanalyze-pinhead
|
|
210 :active (fboundp 'psychoanalyze-pinhead)]
|
|
211 ["Random Flames" flame
|
|
212 :active (fboundp 'flame)]
|
|
213 ["Dunnet (Adventure)" dunnet
|
|
214 :active (fboundp 'dunnet)]
|
|
215 ["Towers of Hanoi" hanoi
|
|
216 :active (fboundp 'hanoi)]
|
|
217 ["Game of Life" life
|
|
218 :active (fboundp 'life)]
|
|
219 ["Multiplication Puzzle" mpuz
|
|
220 :active (fboundp 'mpuz)]))
|
|
221
|
|
222 ("Options"
|
|
223 ("Customize"
|
|
224 ("Emacs" :filter (lambda (&rest junk)
|
|
225 (cdr (custom-menu-create 'emacs))))
|
|
226 ["Group..." customize-group]
|
|
227 ["Variable..." customize-variable]
|
|
228 ["Face..." customize-face]
|
|
229 ["Saved..." customize-saved]
|
|
230 ["Set..." customize-customized]
|
|
231 ["Apropos..." customize-apropos]
|
321
|
232 ["Browse..." customize-browse])
|
|
233
|
|
234 ("Manage Packages"
|
|
235 ("Add Download Site"
|
|
236 :filter (lambda (&rest junk)
|
|
237 (package-get-download-menu)))
|
|
238 ["Update Package Index" package-get-update-base]
|
|
239 ["List & Install" pui-list-packages]
|
337
|
240 ["Update Installed Packages" package-get-update-all]
|
|
241 ;; hack-o-matic, we can't force a laod of package-base here
|
|
242 ;; since it triggers dialog box interactions which we can't
|
|
243 ;; deal while using a menu
|
|
244 ("Using Custom"
|
|
245 :filter (lambda (&rest junk)
|
|
246 (if package-get-base
|
|
247 (cdr (custom-menu-create 'packages))
|
|
248 '(["Please load Package Index" (lamda (&rest junk) ()) nil]))))
|
|
249
|
321
|
250 ["Help" (Info-goto-node "(xemacs)Packages")])
|
|
251
|
|
252 "---"
|
|
253
|
282
|
254 ("Editing Options"
|
|
255 ["Overstrike"
|
|
256 (progn
|
|
257 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
|
|
258 (customize-set-variable 'overwrite-mode overwrite-mode))
|
|
259 :style toggle :selected overwrite-mode]
|
|
260 ["Case Sensitive Search"
|
|
261 (customize-set-variable 'case-fold-search
|
|
262 (setq case-fold-search (not case-fold-search)))
|
|
263 :style toggle :selected (not case-fold-search)]
|
|
264 ["Case Matching Replace"
|
|
265 (customize-set-variable 'case-replace (not case-replace))
|
|
266 :style toggle :selected case-replace]
|
|
267 ["Auto Delete Selection"
|
|
268 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
|
|
269 :style toggle
|
|
270 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
|
|
271 :active (boundp 'pending-delete-mode)]
|
|
272 ["Active Regions"
|
|
273 (customize-set-variable 'zmacs-regions (not zmacs-regions))
|
|
274 :style toggle :selected zmacs-regions]
|
|
275 ["Mouse Paste At Text Cursor"
|
|
276 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
|
|
277 :style toggle :selected mouse-yank-at-point]
|
|
278 ("Newline at end of file..."
|
|
279 ["Don't require"
|
|
280 (customize-set-variable 'require-final-newline nil)
|
|
281 :style radio :selected (not require-final-newline)]
|
|
282 ["Require"
|
|
283 (customize-set-variable 'require-final-newline t)
|
|
284 :style radio :selected (eq require-final-newline t)]
|
|
285 ["Ask"
|
|
286 (customize-set-variable 'require-final-newline 'ask)
|
|
287 :style radio :selected (and require-final-newline
|
|
288 (not (eq require-final-newline t)))])
|
|
289 ["Add Newline When Moving Past End"
|
|
290 (customize-set-variable 'next-line-add-newlines
|
|
291 (not next-line-add-newlines))
|
|
292 :style toggle :selected next-line-add-newlines]
|
|
293 )
|
|
294 ("General Options"
|
|
295 ["Teach Extended Commands"
|
|
296 (customize-set-variable 'teach-extended-commands-p
|
|
297 (not teach-extended-commands-p))
|
|
298 :style toggle :selected teach-extended-commands-p]
|
|
299 ["Debug On Error"
|
|
300 (customize-set-variable 'debug-on-error (not debug-on-error))
|
|
301 :style toggle :selected debug-on-error]
|
|
302 ["Debug On Quit"
|
|
303 (customize-set-variable 'debug-on-quit (not debug-on-quit))
|
|
304 :style toggle :selected debug-on-quit]
|
|
305 )
|
|
306 ("Printing Options"
|
|
307 ["Command-Line Switches for `lpr'/`lp'..."
|
|
308 ;; better to directly open a customization buffer, since the value
|
|
309 ;; must be a list of strings, which is somewhat complex to prompt for.
|
|
310 (customize-variable 'lpr-switches)
|
|
311 (boundp 'lpr-switches)]
|
|
312 ("Pretty-Print Paper Size"
|
|
313 ["Letter"
|
|
314 (customize-set-variable 'ps-paper-type 'letter)
|
|
315 :style radio
|
|
316 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
|
|
317 :active (boundp 'ps-paper-type)]
|
|
318 ["Letter-small"
|
|
319 (customize-set-variable 'ps-paper-type 'letter-small)
|
|
320 :style radio
|
|
321 :selected (and (boundp 'ps-paper-type)
|
|
322 (eq ps-paper-type 'letter-small))
|
|
323 :active (boundp 'ps-paper-type)]
|
|
324 ["Legal"
|
|
325 (customize-set-variable 'ps-paper-type 'legal)
|
|
326 :style radio
|
|
327 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
|
|
328 :active (boundp 'ps-paper-type)]
|
|
329 ["Statement"
|
|
330 (customize-set-variable 'ps-paper-type 'statement)
|
|
331 :style radio
|
|
332 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
|
|
333 :active (boundp 'ps-paper-type)]
|
|
334 ["Executive"
|
|
335 (customize-set-variable 'ps-paper-type 'executive)
|
|
336 :style radio
|
|
337 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
|
|
338 :active (boundp 'ps-paper-type)]
|
|
339 ["Tabloid"
|
|
340 (customize-set-variable 'ps-paper-type 'tabloid)
|
|
341 :style radio
|
|
342 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
|
|
343 :active (boundp 'ps-paper-type)]
|
|
344 ["Ledger"
|
|
345 (customize-set-variable 'ps-paper-type 'ledger)
|
|
346 :style radio
|
|
347 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
|
|
348 :active (boundp 'ps-paper-type)]
|
|
349 ["A3"
|
|
350 (customize-set-variable 'ps-paper-type 'a3)
|
|
351 :style radio
|
|
352 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
|
|
353 :active (boundp 'ps-paper-type)]
|
|
354 ["A4"
|
|
355 (customize-set-variable 'ps-paper-type 'a4)
|
|
356 :style radio
|
|
357 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
|
|
358 :active (boundp 'ps-paper-type)]
|
|
359 ["A4small"
|
|
360 (customize-set-variable 'ps-paper-type 'a4small)
|
|
361 :style radio
|
|
362 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
|
|
363 :active (boundp 'ps-paper-type)]
|
|
364 ["B4"
|
|
365 (customize-set-variable 'ps-paper-type 'b4)
|
|
366 :style radio
|
|
367 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
|
|
368 :active (boundp 'ps-paper-type)]
|
|
369 ["B5"
|
|
370 (customize-set-variable 'ps-paper-type 'b5)
|
|
371 :style radio
|
|
372 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
|
|
373 :active (boundp 'ps-paper-type)]
|
|
374 )
|
|
375 ["Color Printing"
|
|
376 (cond (ps-print-color-p
|
|
377 (customize-set-variable 'ps-print-color-p nil)
|
|
378 ;; I'm wondering whether all this muck is usefull.
|
|
379 (and (boundp 'original-face-background)
|
|
380 original-face-background
|
|
381 (set-face-background 'default original-face-background)))
|
|
382 (t
|
|
383 (customize-set-variable 'ps-print-color-p t)
|
|
384 (setq original-face-background
|
|
385 (face-background-instance 'default))
|
|
386 (set-face-background 'default "white")))
|
|
387 :style toggle
|
|
388 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
|
|
389 :active (boundp 'ps-print-color-p)])
|
|
390 ("\"Other Window\" Location"
|
|
391 ["Always in Same Frame"
|
|
392 (customize-set-variable
|
|
393 'get-frame-for-buffer-default-instance-limit nil)
|
|
394 :style radio
|
|
395 :selected (null get-frame-for-buffer-default-instance-limit)]
|
|
396 ["Other Frame (2 Frames Max)"
|
|
397 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 2)
|
|
398 :style radio
|
|
399 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
|
|
400 ["Other Frame (3 Frames Max)"
|
|
401 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 3)
|
|
402 :style radio
|
|
403 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
|
|
404 ["Other Frame (4 Frames Max)"
|
|
405 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 4)
|
|
406 :style radio
|
|
407 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
|
|
408 ["Other Frame (5 Frames Max)"
|
|
409 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 5)
|
|
410 :style radio
|
|
411 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
|
|
412 ["Always Create New Frame"
|
|
413 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 0)
|
|
414 :style radio
|
|
415 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
|
|
416 "-----"
|
|
417 ["Temp Buffers Always in Same Frame"
|
|
418 (customize-set-variable 'temp-buffer-show-function
|
|
419 'show-temp-buffer-in-current-frame)
|
|
420 :style radio
|
|
421 :selected (eq temp-buffer-show-function
|
|
422 'show-temp-buffer-in-current-frame)]
|
|
423 ["Temp Buffers Like Other Buffers"
|
|
424 (customize-set-variable 'temp-buffer-show-function nil)
|
|
425 :style radio
|
|
426 :selected (null temp-buffer-show-function)]
|
|
427 "-----"
|
|
428 ["Make current frame gnuserv target"
|
|
429 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil t))
|
|
430 :style toggle
|
|
431 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
|
|
432 :active (boundp 'gnuserv-frame)]
|
|
433 )
|
|
434 "-----"
|
|
435 ("Syntax Highlighting"
|
|
436 ["In This Buffer"
|
|
437 (progn ;; becomes buffer local
|
|
438 (font-lock-mode)
|
|
439 (customize-set-variable 'font-lock-mode font-lock-mode))
|
|
440 :style toggle
|
|
441 :selected (and (boundp 'font-lock-mode) font-lock-mode)
|
|
442 :active (boundp 'font-lock-mode)]
|
|
443 ["Automatic"
|
|
444 (customize-set-variable 'font-lock-auto-fontify
|
|
445 (not font-lock-auto-fontify))
|
|
446 :style toggle
|
|
447 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
|
|
448 :active (fboundp 'font-lock-mode)]
|
|
449 "-----"
|
|
450 ["Fonts"
|
|
451 (progn
|
|
452 (require 'font-lock)
|
|
453 (font-lock-use-default-fonts)
|
|
454 (customize-set-variable 'font-lock-use-fonts t)
|
|
455 (customize-set-variable 'font-lock-use-colors nil)
|
|
456 (font-lock-mode 1))
|
|
457 :style radio
|
|
458 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
|
|
459 :active (fboundp 'font-lock-mode)]
|
|
460 ["Colors"
|
|
461 (progn
|
|
462 (require 'font-lock)
|
|
463 (font-lock-use-default-colors)
|
|
464 (customize-set-variable 'font-lock-use-colors t)
|
|
465 (customize-set-variable 'font-lock-use-fonts nil)
|
|
466 (font-lock-mode 1))
|
|
467 :style radio
|
|
468 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
|
|
469 :active (boundp 'font-lock-mode)]
|
|
470 "-----"
|
|
471 ["Least"
|
|
472 (progn
|
|
473 (require 'font-lock)
|
|
474 (if (or (and (not (integerp font-lock-maximum-decoration))
|
|
475 (not (eq t font-lock-maximum-decoration)))
|
|
476 (and (integerp font-lock-maximum-decoration)
|
|
477 (<= font-lock-maximum-decoration 0)))
|
|
478 nil
|
|
479 (customize-set-variable 'font-lock-maximum-decoration nil)
|
|
480 (font-lock-recompute-variables)))
|
|
481 :style radio
|
|
482 :active (fboundp 'font-lock-mode)
|
|
483 :selected (and (boundp 'font-lock-maximium-decoration)
|
|
484 (or (and (not (integerp font-lock-maximum-decoration))
|
|
485 (not (eq t font-lock-maximum-decoration)))
|
|
486 (and (integerp font-lock-maximum-decoration)
|
|
487 (<= font-lock-maximum-decoration 0))))]
|
|
488 ["More"
|
|
489 (progn
|
|
490 (require 'font-lock)
|
|
491 (if (and (integerp font-lock-maximum-decoration)
|
|
492 (= 1 font-lock-maximum-decoration))
|
|
493 nil
|
|
494 (customize-set-variable 'font-lock-maximum-decoration 1)
|
|
495 (font-lock-recompute-variables)))
|
|
496 :style radio
|
|
497 :active (fboundp 'font-lock-mode)
|
|
498 :selected (and (boundp 'font-lock-maximium-decoration)
|
|
499 (integerp font-lock-maximum-decoration)
|
|
500 (= 1 font-lock-maximum-decoration))]
|
|
501 ["Even More"
|
|
502 (progn
|
|
503 (require 'font-lock)
|
|
504 (if (and (integerp font-lock-maximum-decoration)
|
|
505 (= 2 font-lock-maximum-decoration))
|
|
506 nil
|
|
507 (customize-set-variable 'font-lock-maximum-decoration 2)
|
|
508 (font-lock-recompute-variables)))
|
|
509 :style radio
|
|
510 :active (fboundp 'font-lock-mode)
|
|
511 :selected (and (boundp 'font-lock-maximum-decoration)
|
|
512 (integerp font-lock-maximum-decoration)
|
|
513 (= 2 font-lock-maximum-decoration))]
|
|
514 ["Most"
|
|
515 (progn
|
|
516 (require 'font-lock)
|
|
517 (if (or (eq font-lock-maximum-decoration t)
|
|
518 (and (integerp font-lock-maximum-decoration)
|
|
519 (>= font-lock-maximum-decoration 3)))
|
|
520 nil
|
|
521 (customize-set-variable 'font-lock-maximum-decoration t)
|
|
522 (font-lock-recompute-variables)))
|
|
523 :style radio
|
|
524 :active (fboundp 'font-lock-mode)
|
|
525 :selected (and (boundp 'font-lock-maximum-decoration)
|
|
526 (or (eq font-lock-maximum-decoration t)
|
|
527 (and (integerp font-lock-maximum-decoration)
|
|
528 (>= font-lock-maximum-decoration 3))))]
|
|
529 "-----"
|
|
530 ["Lazy"
|
|
531 (progn ;; becomes buffer local
|
|
532 (lazy-shot-mode)
|
|
533 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
|
|
534 ;; this shouldn't be necessary so there has to
|
|
535 ;; be a redisplay bug lurking somewhere (or
|
|
536 ;; possibly another event handler bug)
|
|
537 (redraw-modeline))
|
|
538 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
|
|
539 font-lock-mode)
|
|
540 :style toggle
|
|
541 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
|
|
542 ["Caching"
|
|
543 (progn ;; becomes buffer local
|
|
544 (fast-lock-mode)
|
|
545 (customize-set-variable 'fast-lock-mode fast-lock-mode)
|
|
546 ;; this shouldn't be necessary so there has to
|
|
547 ;; be a redisplay bug lurking somewhere (or
|
|
548 ;; possibly another event handler bug)
|
|
549 (redraw-modeline))
|
|
550 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
|
|
551 font-lock-mode)
|
|
552 :style toggle
|
|
553 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
|
|
554 )
|
|
555 ("Paren Highlighting"
|
|
556 ["None"
|
|
557 (customize-set-variable 'paren-mode nil)
|
|
558 :style radio
|
|
559 :selected (and (boundp 'paren-mode) (not paren-mode))
|
|
560 :active (boundp 'paren-mode)]
|
|
561 ["Blinking Paren"
|
|
562 (customize-set-variable 'paren-mode 'blink-paren)
|
|
563 :style radio
|
|
564 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
|
|
565 :active (boundp 'paren-mode)]
|
|
566 ["Steady Paren"
|
|
567 (customize-set-variable 'paren-mode 'paren)
|
|
568 :style radio
|
|
569 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
|
|
570 :active (boundp 'paren-mode)]
|
|
571 ["Expression"
|
|
572 (customize-set-variable 'paren-mode 'sexp)
|
|
573 :style radio
|
|
574 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
|
|
575 :active (boundp 'paren-mode)]
|
|
576 ;; ["Nested Shading"
|
|
577 ;; (customize-set-variable 'paren-mode 'nested)
|
|
578 ;; :style radio
|
|
579 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
|
|
580 ;; :active (boundp 'paren-mode)]
|
|
581 )
|
|
582 "-----"
|
|
583 ("Frame Appearance"
|
|
584 ["Frame-Local Font Menu"
|
|
585 (customize-set-variable 'font-menu-this-frame-only-p
|
|
586 (not font-menu-this-frame-only-p))
|
|
587 :style toggle
|
|
588 :selected (and (boundp 'font-menu-this-frame-only-p)
|
|
589 font-menu-this-frame-only-p)]
|
|
590 ,@(if (featurep 'scrollbar)
|
|
591 '(["Scrollbars"
|
|
592 (customize-set-variable 'scrollbars-visible-p
|
|
593 (not scrollbars-visible-p))
|
|
594 :style toggle
|
|
595 :selected scrollbars-visible-p]))
|
|
596 ;; I don't think this is of any interest. - dverna apr. 98
|
298
|
597 ;; #### I beg to differ! Many FSFmacs converts hate the 3D
|
|
598 ;; modeline, and it was perfectly fine to be able to turn them
|
|
599 ;; off through the Options menu. I would have uncommented this
|
|
600 ;; source, but the code for saving options would not save the
|
|
601 ;; modeline 3D-ness. Grrr. --hniksic
|
282
|
602 ;; ["3D Modeline"
|
|
603 ;; (progn
|
|
604 ;; (if (zerop (specifier-instance modeline-shadow-thickness))
|
|
605 ;; (set-specifier modeline-shadow-thickness 2)
|
|
606 ;; (set-specifier modeline-shadow-thickness 0))
|
|
607 ;; (redraw-modeline t))
|
|
608 ;; :style toggle
|
|
609 ;; :selected (let ((thickness
|
|
610 ;; (specifier-instance modeline-shadow-thickness)))
|
|
611 ;; (and (integerp thickness)
|
|
612 ;; (> thickness 0)))]
|
|
613 ["Truncate Lines"
|
|
614 (progn ;; becomes buffer-local
|
|
615 (setq truncate-lines (not truncate-lines))
|
|
616 (customize-set-variable 'truncate-lines truncate-lines))
|
|
617 :style toggle
|
|
618 :selected truncate-lines]
|
|
619 ["Blinking Cursor"
|
|
620 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
|
|
621 :style toggle
|
|
622 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
|
|
623 :active (boundp 'blink-cursor-mode)]
|
|
624 "-----"
|
|
625 ["Block cursor"
|
|
626 (progn
|
|
627 (customize-set-variable 'bar-cursor nil)
|
|
628 (force-cursor-redisplay))
|
|
629 :style radio
|
|
630 :selected (null bar-cursor)]
|
|
631 ["Bar cursor (1 pixel)"
|
|
632 (progn
|
|
633 (customize-set-variable 'bar-cursor t)
|
|
634 (force-cursor-redisplay))
|
|
635 :style radio
|
|
636 :selected (eq bar-cursor t)]
|
|
637 ["Bar cursor (2 pixels)"
|
|
638 (progn
|
|
639 (customize-set-variable 'bar-cursor 2)
|
|
640 (force-cursor-redisplay))
|
|
641 :style radio
|
|
642 :selected (and bar-cursor (not (eq bar-cursor t)))]
|
|
643 "------"
|
|
644 ["Line Numbers"
|
|
645 (progn
|
|
646 (customize-set-variable 'line-number-mode (not line-number-mode))
|
|
647 (redraw-modeline))
|
|
648 :style toggle :selected line-number-mode]
|
|
649 ["Column Numbers"
|
|
650 (progn
|
|
651 (customize-set-variable 'column-number-mode
|
|
652 (not column-number-mode))
|
|
653 (redraw-modeline))
|
|
654 :style toggle :selected column-number-mode]
|
|
655 )
|
|
656 ("Menubar Appearance"
|
|
657 ["Buffers Menu Length..."
|
|
658 (customize-set-variable
|
|
659 'buffers-menu-max-size
|
|
660 ;; would it be better to open a customization buffer ?
|
|
661 (let ((val
|
|
662 (read-number
|
|
663 "Enter number of buffers to display (or 0 for unlimited): ")))
|
|
664 (if (eq val 0) nil val)))]
|
|
665 ["Multi-Operation Buffers Sub-Menus"
|
|
666 (customize-set-variable 'complex-buffers-menu-p
|
|
667 (not complex-buffers-menu-p))
|
|
668 :style toggle
|
|
669 :selected complex-buffers-menu-p]
|
|
670 ("Buffers Menu Sorting"
|
|
671 ["Most Recently Used"
|
|
672 (progn
|
|
673 (customize-set-variable 'buffers-menu-sort-function nil)
|
|
674 (customize-set-variable 'buffers-menu-grouping-function nil))
|
|
675 :style radio
|
|
676 :selected (null buffers-menu-sort-function)]
|
|
677 ["Alphabetically"
|
|
678 (progn
|
|
679 (customize-set-variable 'buffers-menu-sort-function
|
|
680 'sort-buffers-menu-alphabetically)
|
|
681 (customize-set-variable 'buffers-menu-grouping-function nil))
|
|
682 :style radio
|
|
683 :selected (eq 'sort-buffers-menu-alphabetically
|
|
684 buffers-menu-sort-function)]
|
|
685 ["By Major Mode, Then Alphabetically"
|
|
686 (progn
|
|
687 (customize-set-variable
|
|
688 'buffers-menu-sort-function
|
|
689 'sort-buffers-menu-by-mode-then-alphabetically)
|
|
690 (customize-set-variable
|
|
691 'buffers-menu-grouping-function
|
|
692 'group-buffers-menu-by-mode-then-alphabetically))
|
|
693 :style radio
|
|
694 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
|
|
695 buffers-menu-sort-function)])
|
|
696 ["Submenus for Buffer Groups"
|
|
697 (customize-set-variable 'buffers-menu-submenus-for-groups-p
|
|
698 (not buffers-menu-submenus-for-groups-p))
|
|
699 :style toggle
|
|
700 :selected buffers-menu-submenus-for-groups-p]
|
|
701 "---"
|
|
702 ["Ignore Scaled Fonts"
|
|
703 (customize-set-variable 'font-menu-ignore-scaled-fonts
|
|
704 (not font-menu-ignore-scaled-fonts))
|
|
705 :style toggle
|
|
706 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
|
|
707 font-menu-ignore-scaled-fonts)]
|
|
708 )
|
|
709 ,@(if (featurep 'toolbar)
|
|
710 '(("Toolbar Appearance"
|
|
711 ["Visible"
|
|
712 (customize-set-variable 'toolbar-visible-p
|
|
713 (not toolbar-visible-p))
|
|
714 :style toggle
|
|
715 :selected toolbar-visible-p]
|
|
716 ["Captioned"
|
|
717 (customize-set-variable 'toolbar-captioned-p
|
|
718 (not toolbar-captioned-p))
|
|
719 :style toggle
|
|
720 :selected toolbar-captioned-p]
|
|
721 ("Default Location"
|
|
722 ["Top"
|
|
723 (customize-set-variable 'default-toolbar-position 'top)
|
|
724 :style radio
|
|
725 :selected (eq default-toolbar-position 'top)]
|
|
726 ["Bottom"
|
|
727 (customize-set-variable 'default-toolbar-position 'bottom)
|
|
728 :style radio
|
|
729 :selected (eq default-toolbar-position 'bottom)]
|
|
730 ["Left"
|
|
731 (customize-set-variable 'default-toolbar-position 'left)
|
|
732 :style radio
|
|
733 :selected (eq default-toolbar-position 'left)]
|
|
734 ["Right"
|
|
735 (customize-set-variable 'default-toolbar-position 'right)
|
|
736 :style radio
|
|
737 :selected (eq default-toolbar-position 'right)]
|
|
738 )
|
|
739 )))
|
|
740 ("Mouse"
|
|
741 ["Avoid Text..."
|
|
742 (customize-set-variable 'mouse-avoidance-mode
|
|
743 (if mouse-avoidance-mode nil 'banish))
|
|
744 :style toggle
|
|
745 :selected (and (boundp 'mouse-avoidance-mode) mouse-avoidance-mode)
|
284
|
746 :active (and (boundp 'mouse-avoidance-mode)
|
|
747 (device-on-window-system-p))]
|
282
|
748 ["strokes-mode"
|
|
749 (customize-set-variable 'strokes-mode (not strokes-mode))
|
|
750 :style toggle
|
|
751 :selected (and (boundp 'strokes-mode) strokes-mode)
|
|
752 :active (and (boundp 'strokes-mode)
|
284
|
753 (device-on-window-system-p))]
|
282
|
754 )
|
|
755 ("Open URLs With"
|
|
756 ["Emacs-W3"
|
|
757 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
|
|
758 :style radio
|
|
759 :selected (and (boundp 'browse-url-browser-function)
|
|
760 (eq browse-url-browser-function 'browse-url-w3))
|
|
761 :active (and (boundp 'browse-url-browser-function)
|
|
762 (fboundp 'browse-url-w3)
|
|
763 (fboundp 'w3-fetch))]
|
|
764 ["Netscape"
|
|
765 (customize-set-variable 'browse-url-browser-function
|
|
766 'browse-url-netscape)
|
|
767 :style radio
|
|
768 :selected (and (boundp 'browse-url-browser-function)
|
|
769 (eq browse-url-browser-function 'browse-url-netscape))
|
|
770 :active (and (boundp 'browse-url-browser-function)
|
|
771 (fboundp 'browse-url-netscape))]
|
|
772 ["Mosaic"
|
|
773 (customize-set-variable 'browse-url-browser-function
|
|
774 'browse-url-mosaic)
|
|
775 :style radio
|
|
776 :selected (and (boundp 'browse-url-browser-function)
|
|
777 (eq browse-url-browser-function 'browse-url-mosaic))
|
|
778 :active (and (boundp 'browse-url-browser-function)
|
|
779 (fboundp 'browse-url-mosaic))]
|
|
780 ["Mosaic (CCI)"
|
|
781 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
|
|
782 :style radio
|
|
783 :selected (and (boundp 'browse-url-browser-function)
|
|
784 (eq browse-url-browser-function 'browse-url-cci))
|
|
785 :active (and (boundp 'browse-url-browser-function)
|
|
786 (fboundp 'browse-url-cci))]
|
|
787 ["IXI Mosaic"
|
|
788 (customize-set-variable 'browse-url-browser-function
|
|
789 'browse-url-iximosaic)
|
|
790 :style radio
|
|
791 :selected (and (boundp 'browse-url-browser-function)
|
|
792 (eq browse-url-browser-function 'browse-url-iximosaic))
|
|
793 :active (and (boundp 'browse-url-browser-function)
|
|
794 (fboundp 'browse-url-iximosaic))]
|
|
795 ["Lynx (xterm)"
|
|
796 (customize-set-variable 'browse-url-browser-function
|
|
797 'browse-url-lynx-xterm)
|
|
798 :style radio
|
|
799 :selected (and (boundp 'browse-url-browser-function)
|
|
800 (eq browse-url-browser-function 'browse-url-lynx-xterm))
|
|
801 :active (and (boundp 'browse-url-browser-function)
|
|
802 (fboundp 'browse-url-lynx-xterm))]
|
|
803 ["Lynx (xemacs)"
|
|
804 (customize-set-variable 'browse-url-browser-function
|
|
805 'browse-url-lynx-emacs)
|
|
806 :style radio
|
|
807 :selected (and (boundp 'browse-url-browser-function)
|
|
808 (eq browse-url-browser-function 'browse-url-lynx-emacs))
|
|
809 :active (and (boundp 'browse-url-browser-function)
|
|
810 (fboundp 'browse-url-lynx-emacs))]
|
|
811 ["Grail"
|
|
812 (customize-set-variable 'browse-url-browser-function
|
|
813 'browse-url-grail)
|
|
814 :style radio
|
|
815 :selected (and (boundp 'browse-url-browser-function)
|
|
816 (eq browse-url-browser-function 'browse-url-grail))
|
|
817 :active (and (boundp 'browse-url-browser-function)
|
|
818 (fboundp 'browse-url-grail))]
|
335
|
819 ["Kfm"
|
|
820 (customize-set-variable 'browse-url-browser-function
|
|
821 'browse-url-kfm)
|
|
822 :style radio
|
|
823 :selected (and (boundp 'browse-url-browser-function)
|
|
824 (eq browse-url-browser-function 'browse-url-kfm))
|
|
825 :active (and (boundp 'browse-url-browser-function)
|
|
826 (fboundp 'browse-url-kfm))]
|
282
|
827 )
|
|
828 "-----"
|
314
|
829 ["Edit Faces..." (customize-face nil)]
|
282
|
830 ("Font" :filter font-menu-family-constructor)
|
|
831 ("Size" :filter font-menu-size-constructor)
|
314
|
832 ; ("Weight" :filter font-menu-weight-constructor)
|
282
|
833 "-----"
|
|
834 ["Save Options" customize-save-customized]
|
|
835 )
|
|
836
|
|
837 ("Buffers"
|
|
838 :filter buffers-menu-filter
|
|
839 ["Read Only" (toggle-read-only)
|
|
840 :style toggle :selected buffer-read-only]
|
|
841 ["List All Buffers" list-buffers]
|
|
842 "--"
|
|
843 )
|
|
844
|
|
845 ("Tools"
|
|
846 ["Grep..." grep
|
|
847 :active (fboundp 'grep)]
|
|
848 ["Compile..." compile
|
|
849 :active (fboundp 'compile)]
|
|
850 ["Shell" shell
|
|
851 :active (fboundp 'shell)]
|
|
852 ["Shell Command..." shell-command
|
|
853 :active (fboundp 'shell-command)]
|
|
854 ["Shell Command on Region..." shell-command-on-region
|
|
855 :active (and (fboundp 'shell-command-on-region) (region-exists-p))]
|
|
856 ["Debug (GDB)..." gdb
|
|
857 :active (fboundp 'gdb)]
|
|
858 ["Debug (DBX)..." dbx
|
|
859 :active (fboundp 'dbx)]
|
|
860 "-----"
|
|
861 ("Tags"
|
|
862 ["Find Tag..." find-tag]
|
|
863 ["Find Other Window..." find-tag-other-window]
|
|
864 ["Next Tag..." (find-tag nil)]
|
|
865 ["Next Other Window..." (find-tag-other-window nil)]
|
|
866 ["Next File" next-file]
|
|
867 "-----"
|
|
868 ["Tags Search..." tags-search]
|
|
869 ["Tags Replace..." tags-query-replace]
|
|
870 ["Continue Search/Replace" tags-loop-continue]
|
|
871 "-----"
|
|
872 ["Pop stack" pop-tag-mark]
|
|
873 ["Apropos..." tags-apropos]
|
|
874 "-----"
|
|
875 ["Set Tags Table File..." visit-tags-table]
|
|
876 ))
|
|
877
|
|
878 nil ; the partition: menus after this are flushright
|
|
879
|
|
880 ("Help"
|
|
881 ["About XEmacs..." about-xemacs]
|
|
882 ("Basics"
|
|
883 ["Installation" describe-installation
|
|
884 :active (boundp 'Installation-string)]
|
|
885 ;; Tutorials.
|
|
886 ,(if (featurep 'mule)
|
|
887 ;; Mule tutorials.
|
|
888 (let ((lang language-info-alist)
|
|
889 submenu tut)
|
|
890 (while lang
|
|
891 (and (setq tut (assq 'tutorial (car lang)))
|
|
892 (not (string= (caar lang) "ASCII"))
|
|
893 (setq
|
|
894 submenu
|
|
895 (cons
|
|
896 `[,(caar lang) (help-with-tutorial nil ,(cdr tut))]
|
|
897 submenu)))
|
|
898 (setq lang (cdr lang)))
|
|
899 (append `("Tutorials"
|
|
900 :filter tutorials-menu-filter
|
|
901 ["Default" help-with-tutorial t
|
|
902 ,(concat "(" current-language-environment ")")])
|
|
903 submenu))
|
|
904 ;; Non mule tutorials.
|
|
905 (let ((lang tutorial-supported-languages)
|
|
906 submenu)
|
|
907 (while lang
|
|
908 (setq submenu
|
|
909 (cons
|
|
910 `[,(caar lang)
|
|
911 (help-with-tutorial ,(format "TUTORIAL.%s"
|
|
912 (cadr (car lang))))]
|
|
913 submenu))
|
|
914 (setq lang (cdr lang)))
|
|
915 (append '("Tutorials"
|
|
916 ["English" help-with-tutorial])
|
|
917 submenu)))
|
|
918 ["News" view-emacs-news]
|
|
919 ["Packages" finder-by-keyword]
|
|
920 ["Splash" xemacs-splash-buffer])
|
|
921 "-----"
|
|
922 ("XEmacs FAQ"
|
|
923 ["FAQ (local)" xemacs-local-faq]
|
|
924 ["FAQ via WWW" xemacs-www-faq (boundp 'browse-url-browser-function)]
|
|
925 ["Home Page" xemacs-www-page (boundp 'browse-url-browser-function)])
|
|
926 ("Samples"
|
304
|
927 ["Sample .emacs" (find-file (locate-data-file "sample.emacs")) (locate-data-file "sample.emacs")]
|
|
928 ["Sample .Xdefaults" (find-file (locate-data-file "sample.Xdefaults")) (locate-data-file "sample.Xdefaults")]
|
|
929 ["Sample enriched" (find-file (locate-data-file "enriched.doc")) (locate-data-file "enriched.doc")])
|
282
|
930 "-----"
|
|
931 ("Lookup in Info"
|
|
932 ["Key Binding..." Info-goto-emacs-key-command-node]
|
|
933 ["Command..." Info-goto-emacs-command-node]
|
|
934 ["Function..." Info-elisp-ref]
|
|
935 ["Topic..." Info-query])
|
|
936 ("Manuals"
|
|
937 ["Info" info]
|
|
938 ["Unix Manual..." manual-entry])
|
|
939 ("Commands & Keys"
|
|
940 ["Mode" describe-mode]
|
|
941 ["Apropos..." hyper-apropos]
|
|
942 ["Apropos Docs..." apropos-documentation]
|
|
943 "-----"
|
|
944 ["Key..." describe-key]
|
|
945 ["Bindings" describe-bindings]
|
|
946 ["Mouse Bindings" describe-pointer]
|
|
947 ["Recent Keys" view-lossage]
|
|
948 "-----"
|
|
949 ["Function..." describe-function]
|
|
950 ["Variable..." describe-variable]
|
|
951 ["Locate Command..." where-is])
|
|
952 "-----"
|
|
953 ["Recent Messages" view-lossage]
|
|
954 ("Misc"
|
|
955 ["No Warranty" describe-no-warranty]
|
|
956 ["XEmacs License" describe-copying]
|
|
957 ["The Latest Version" describe-distribution])
|
349
|
958 ["Send Bug Report..." report-emacs-bug
|
|
959 :active (fboundp 'report-emacs-bug)]))))
|
282
|
960
|
|
961
|
|
962 (defun maybe-add-init-button ()
|
|
963 "Don't call this.
|
|
964 Adds `Load .emacs' button to menubar when starting up with -q."
|
|
965 ;; by Stig@hackvan.com
|
|
966 (cond
|
|
967 (init-file-user nil)
|
298
|
968 ((file-exists-p (expand-file-name ".emacs" "~"))
|
282
|
969 (add-menu-button nil
|
|
970 ["Load .emacs"
|
|
971 (progn (delete-menu-item '("Load .emacs"))
|
|
972 (load-user-init-file (user-login-name)))
|
|
973 ]
|
|
974 "Help"))
|
|
975 (t nil)))
|
|
976
|
|
977 (add-hook 'before-init-hook 'maybe-add-init-button)
|
|
978
|
|
979
|
|
980 ;;; The File menu
|
|
981
|
|
982 (defvar put-buffer-names-in-file-menu t)
|
|
983
|
|
984
|
|
985 ;;; The Bookmarks menu
|
|
986
|
|
987 (defun bookmark-menu-filter (&rest ignore)
|
|
988 (let ((definedp (and (boundp 'bookmark-alist)
|
|
989 bookmark-alist
|
|
990 t)))
|
|
991 `(,(if definedp
|
|
992 '("Jump to Bookmark"
|
|
993 :filter (lambda (&rest junk)
|
|
994 (mapcar #'(lambda (bmk)
|
|
995 `[,bmk (bookmark-jump ',bmk)])
|
|
996 (bookmark-all-names))))
|
|
997 ["Jump to Bookmark" nil nil])
|
|
998 ["Set bookmark" bookmark-set
|
|
999 :active (fboundp 'bookmark-set)]
|
|
1000 "---"
|
|
1001 ["Insert contents" bookmark-menu-insert
|
|
1002 :active (fboundp 'bookmark-menu-insert)]
|
|
1003 ["Insert location" bookmark-menu-locate
|
|
1004 :active (fboundp 'bookmark-menu-locate)]
|
|
1005 "---"
|
|
1006 ["Rename bookmark" bookmark-menu-rename
|
|
1007 :active (fboundp 'bookmark-menu-rename)]
|
|
1008 ,(if definedp
|
|
1009 '("Delete Bookmark"
|
|
1010 :filter (lambda (&rest junk)
|
|
1011 (mapcar #'(lambda (bmk)
|
|
1012 `[,bmk (bookmark-delete ',bmk)])
|
|
1013 (bookmark-all-names))))
|
|
1014 ["Delete Bookmark" nil nil])
|
|
1015 ["Edit Bookmark List" bookmark-bmenu-list ,definedp]
|
|
1016 "---"
|
|
1017 ["Save bookmarks" bookmark-save ,definedp]
|
|
1018 ["Save bookmarks as..." bookmark-write ,definedp]
|
|
1019 ["Load a bookmark file" bookmark-load
|
|
1020 :active (fboundp 'bookmark-load)])))
|
|
1021
|
|
1022 ;;; The Buffers menu
|
|
1023
|
|
1024 (defgroup buffers-menu nil
|
|
1025 "Customization of `Buffers' menu."
|
|
1026 :group 'menu)
|
|
1027
|
|
1028 (defcustom buffers-menu-max-size 25
|
|
1029 "*Maximum number of entries which may appear on the \"Buffers\" menu.
|
|
1030 If this is 10, then only the ten most-recently-selected buffers will be
|
|
1031 shown. If this is nil, then all buffers will be shown. Setting this to
|
|
1032 a large number or nil will slow down menu responsiveness."
|
|
1033 :type '(choice (const :tag "Show all" nil)
|
|
1034 (integer 10))
|
|
1035 :group 'buffers-menu)
|
|
1036
|
|
1037 (defcustom complex-buffers-menu-p nil
|
|
1038 "*If non-nil, the buffers menu will contain several commands.
|
|
1039 Commands will be presented as submenus of each buffer line. If this
|
|
1040 is false, then there will be only one command: select that buffer."
|
|
1041 :type 'boolean
|
|
1042 :group 'buffers-menu)
|
|
1043
|
|
1044 (defcustom buffers-menu-submenus-for-groups-p nil
|
|
1045 "*If non-nil, the buffers menu will contain one submenu per group of buffers.
|
|
1046 The grouping function is specified in `buffers-menu-grouping-function'.
|
|
1047 If this is an integer, do not build submenus if the number of buffers
|
|
1048 is not larger than this value."
|
|
1049 :type '(choice (const :tag "No Subgroups" nil)
|
|
1050 (integer :tag "Max. submenus" 10)
|
|
1051 (sexp :format "%t\n" :tag "Allow Subgroups" :value t))
|
|
1052 :group 'buffers-menu)
|
|
1053
|
|
1054 (defcustom buffers-menu-switch-to-buffer-function 'switch-to-buffer
|
|
1055 "*The function to call to select a buffer from the buffers menu.
|
|
1056 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
|
|
1057 :type '(radio (function-item switch-to-buffer)
|
|
1058 (function-item pop-to-buffer)
|
|
1059 (function :tag "Other"))
|
|
1060 :group 'buffers-menu)
|
|
1061
|
|
1062 (defcustom buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
|
|
1063 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
|
|
1064 This is passed a buffer and should return non-nil if the buffer should be
|
|
1065 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
|
|
1066 buffers that are normally considered \"invisible\" (those whose name
|
|
1067 begins with a space)."
|
|
1068 :type '(choice (const :tag "None" nil)
|
|
1069 function)
|
|
1070 :group 'buffers-menu)
|
|
1071
|
|
1072 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
|
|
1073 "*The function to call to return a string to represent a buffer in the
|
|
1074 buffers menu. The function is passed a buffer and should return a string.
|
|
1075 The default value `format-buffers-menu-line' just returns the name of
|
|
1076 the buffer. Also check out `slow-format-buffers-menu-line' which
|
|
1077 returns a whole bunch of info about a buffer."
|
|
1078 :type 'function
|
|
1079 :group 'buffers-menu)
|
|
1080
|
|
1081 (defcustom buffers-menu-sort-function
|
|
1082 'sort-buffers-menu-by-mode-then-alphabetically
|
|
1083 "*If non-nil, a function to sort the list of buffers in the buffers menu.
|
|
1084 It will be passed two arguments (two buffers to compare) and should return
|
|
1085 T if the first is \"less\" than the second. One possible value is
|
|
1086 `sort-buffers-menu-alphabetically'; another is
|
|
1087 `sort-buffers-menu-by-mode-then-alphabetically'."
|
|
1088 :type '(choice (const :tag "None" nil)
|
|
1089 function)
|
|
1090 :group 'buffers-menu)
|
|
1091
|
|
1092 (defcustom buffers-menu-grouping-function
|
|
1093 'group-buffers-menu-by-mode-then-alphabetically
|
|
1094 "*If non-nil, a function to group buffers in the buffers menu together.
|
|
1095 It will be passed two arguments, successive members of the sorted buffers
|
|
1096 list after being passed through `buffers-menu-sort-function'. It should
|
|
1097 return non-nil if the second buffer begins a new group. The return value
|
|
1098 should be the name of the old group, which may be used in hierarchical
|
|
1099 buffers menus. The last invocation of the function contains nil as the
|
|
1100 second argument, so that the name of the last group can be determined.
|
|
1101
|
|
1102 The sensible values of this function are dependent on the value specified
|
|
1103 for `buffers-menu-sort-function'."
|
|
1104 :type '(choice (const :tag "None" nil)
|
|
1105 function)
|
|
1106 :group 'buffers-menu)
|
|
1107
|
|
1108 (defun buffers-menu-omit-invisible-buffers (buf)
|
|
1109 "For use as a value of `buffers-menu-omit-function'.
|
|
1110 Omits normally invisible buffers (those whose name begins with a space)."
|
|
1111 (not (null (string-match "\\` " (buffer-name buf)))))
|
|
1112
|
|
1113 (defun sort-buffers-menu-alphabetically (buf1 buf2)
|
|
1114 "For use as a value of `buffers-menu-sort-function'.
|
|
1115 Sorts the buffers in alphabetical order by name, but puts buffers beginning
|
|
1116 with a star at the end of the list."
|
|
1117 (let* ((nam1 (buffer-name buf1))
|
|
1118 (nam2 (buffer-name buf2))
|
|
1119 (star1p (not (null (string-match "\\`*" nam1))))
|
|
1120 (star2p (not (null (string-match "\\`*" nam2)))))
|
|
1121 (if (not (eq star1p star2p))
|
|
1122 (not star1p)
|
|
1123 (string-lessp nam1 nam2))))
|
|
1124
|
|
1125 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
|
|
1126 "For use as a value of `buffers-menu-sort-function'.
|
|
1127 Sorts first by major mode and then alphabetically by name, but puts buffers
|
|
1128 beginning with a star at the end of the list."
|
|
1129 (let* ((nam1 (buffer-name buf1))
|
|
1130 (nam2 (buffer-name buf2))
|
|
1131 (star1p (not (null (string-match "\\`*" nam1))))
|
|
1132 (star2p (not (null (string-match "\\`*" nam2))))
|
|
1133 (mode1 (symbol-value-in-buffer 'major-mode buf1))
|
|
1134 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
|
|
1135 (cond ((not (eq star1p star2p)) (not star1p))
|
|
1136 ((and star1p star2p (string-lessp nam1 nam2)))
|
|
1137 ((string-lessp mode1 mode2) t)
|
|
1138 ((string-lessp mode2 mode1) nil)
|
|
1139 (t (string-lessp nam1 nam2)))))
|
|
1140
|
|
1141 ;; this version is too slow on some machines.
|
|
1142 (defun slow-format-buffers-menu-line (buffer)
|
|
1143 "For use as a value of `buffers-menu-format-buffer-line-function'.
|
|
1144 This returns a string containing a bunch of info about the buffer."
|
|
1145 (format "%s%s %-19s %6s %-15s %s"
|
|
1146 (if (buffer-modified-p buffer) "*" " ")
|
|
1147 (if (symbol-value-in-buffer 'buffer-read-only buffer) "%" " ")
|
|
1148 (buffer-name buffer)
|
|
1149 (buffer-size buffer)
|
|
1150 (symbol-value-in-buffer 'mode-name buffer)
|
|
1151 (or (buffer-file-name buffer) "")))
|
|
1152
|
|
1153 (defun format-buffers-menu-line (buffer)
|
|
1154 "For use as a value of `buffers-menu-format-buffer-line-function'.
|
|
1155 This just returns the buffer's name."
|
|
1156 (buffer-name buffer))
|
|
1157
|
|
1158 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
|
|
1159 "For use as a value of `buffers-menu-grouping-function'.
|
|
1160 This groups buffers by major mode. It only really makes sense if
|
|
1161 `buffers-menu-sorting-function' is
|
|
1162 `sort-buffers-menu-by-mode-then-alphabetically'."
|
|
1163 (cond ((string-match "\\`*" (buffer-name buf1))
|
|
1164 (and (null buf2) "*Misc*"))
|
|
1165 ((or (null buf2)
|
|
1166 (string-match "\\`*" (buffer-name buf2))
|
|
1167 (not (eq (symbol-value-in-buffer 'major-mode buf1)
|
|
1168 (symbol-value-in-buffer 'major-mode buf2))))
|
|
1169 (symbol-value-in-buffer 'mode-name buf1))
|
|
1170 (t nil)))
|
|
1171
|
|
1172 (defun buffer-menu-save-buffer (buffer)
|
|
1173 (save-excursion
|
|
1174 (set-buffer buffer)
|
|
1175 (save-buffer)))
|
|
1176
|
|
1177 (defun buffer-menu-write-file (buffer)
|
|
1178 (save-excursion
|
|
1179 (set-buffer buffer)
|
|
1180 (write-file (read-file-name
|
|
1181 (format "Write %s to file: "
|
|
1182 (buffer-name (current-buffer)))))))
|
|
1183
|
|
1184 (defsubst build-buffers-menu-internal (buffers)
|
|
1185 (let (name line)
|
|
1186 (mapcar
|
|
1187 #'(lambda (buffer)
|
|
1188 (if (eq buffer t)
|
|
1189 "---"
|
|
1190 (setq line (funcall buffers-menu-format-buffer-line-function
|
|
1191 buffer))
|
|
1192 (if complex-buffers-menu-p
|
|
1193 (delq nil
|
|
1194 (list line
|
|
1195 (vector "Switch to Buffer"
|
|
1196 (list buffers-menu-switch-to-buffer-function
|
|
1197 (setq name (buffer-name buffer)))
|
|
1198 t)
|
|
1199 (if (eq buffers-menu-switch-to-buffer-function
|
|
1200 'switch-to-buffer)
|
|
1201 (vector "Switch to Buffer, Other Frame"
|
|
1202 (list 'switch-to-buffer-other-frame
|
|
1203 (setq name (buffer-name buffer)))
|
|
1204 t)
|
|
1205 nil)
|
|
1206 (if (and (buffer-modified-p buffer)
|
|
1207 (buffer-file-name buffer))
|
|
1208 (vector "Save Buffer"
|
|
1209 (list 'buffer-menu-save-buffer name) t)
|
|
1210 ["Save Buffer" nil nil]
|
|
1211 )
|
|
1212 (vector "Save As..."
|
|
1213 (list 'buffer-menu-write-file name) t)
|
|
1214 (vector "Delete Buffer" (list 'kill-buffer name)
|
|
1215 t)))
|
|
1216 ;; ### We don't want buffer names to be translated,
|
|
1217 ;; ### so we put the buffer name in the suffix.
|
|
1218 ;; ### Also, avoid losing with non-ASCII buffer names.
|
|
1219 ;; ### We still lose, however, if complex-buffers-menu-p. --mrb
|
|
1220 (vector ""
|
|
1221 (list buffers-menu-switch-to-buffer-function
|
|
1222 (buffer-name buffer))
|
|
1223 t line))))
|
|
1224 buffers)))
|
|
1225
|
|
1226 (defun buffers-menu-filter (menu)
|
|
1227 "This is the menu filter for the top-level buffers \"Buffers\" menu.
|
|
1228 It dynamically creates a list of buffers to use as the contents of the menu.
|
|
1229 Only the most-recently-used few buffers will be listed on the menu, for
|
|
1230 efficiency reasons. You can control how many buffers will be shown by
|
|
1231 setting `buffers-menu-max-size'. You can control the text of the menu
|
|
1232 items by redefining the function `format-buffers-menu-line'."
|
|
1233 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
|
|
1234 (and (integerp buffers-menu-max-size)
|
|
1235 (> buffers-menu-max-size 1)
|
|
1236 (> (length buffers) buffers-menu-max-size)
|
|
1237 ;; shorten list of buffers (not with submenus!)
|
|
1238 (not (and buffers-menu-grouping-function
|
|
1239 buffers-menu-submenus-for-groups-p))
|
|
1240 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
|
|
1241 (if buffers-menu-sort-function
|
|
1242 (setq buffers (sort buffers buffers-menu-sort-function)))
|
|
1243 (if (and buffers-menu-grouping-function
|
|
1244 buffers-menu-submenus-for-groups-p
|
|
1245 (or (not (integerp buffers-menu-submenus-for-groups-p))
|
|
1246 (> (length buffers) buffers-menu-submenus-for-groups-p)))
|
|
1247 (let (groups groupnames current-group)
|
|
1248 (mapl
|
|
1249 #'(lambda (sublist)
|
|
1250 (let ((groupname (funcall buffers-menu-grouping-function
|
|
1251 (car sublist) (cadr sublist))))
|
|
1252 (setq current-group (cons (car sublist) current-group))
|
|
1253 (if groupname
|
|
1254 (progn
|
|
1255 (setq groups (cons (nreverse current-group)
|
|
1256 groups))
|
|
1257 (setq groupnames (cons groupname groupnames))
|
|
1258 (setq current-group nil)))))
|
|
1259 buffers)
|
|
1260 (setq buffers
|
|
1261 (mapcar*
|
|
1262 #'(lambda (groupname group)
|
|
1263 (cons groupname (build-buffers-menu-internal group)))
|
|
1264 (nreverse groupnames)
|
|
1265 (nreverse groups))))
|
|
1266 (if buffers-menu-grouping-function
|
|
1267 (progn
|
|
1268 (setq buffers
|
|
1269 (mapcon
|
|
1270 #'(lambda (sublist)
|
|
1271 (cond ((funcall buffers-menu-grouping-function
|
|
1272 (car sublist) (cadr sublist))
|
|
1273 (list (car sublist) t))
|
|
1274 (t (list (car sublist)))))
|
|
1275 buffers))
|
|
1276 ;; remove a trailing separator.
|
|
1277 (and (>= (length buffers) 2)
|
|
1278 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
|
|
1279 (if (eq t (cadr lastcdr))
|
|
1280 (setcdr lastcdr nil))))))
|
|
1281 (setq buffers (build-buffers-menu-internal buffers)))
|
|
1282 (append menu buffers)
|
|
1283 ))
|
|
1284
|
|
1285 (defun language-environment-menu-filter (menu)
|
|
1286 "This is the menu filter for the \"Language Environment\" submenu."
|
|
1287 (mapcar (lambda (env-sym)
|
|
1288 `[ ,(capitalize (symbol-name env-sym))
|
|
1289 (set-language-environment ',env-sym)])
|
|
1290 language-environment-list))
|
|
1291
|
|
1292
|
|
1293 ;;; The Options menu
|
|
1294
|
|
1295 ;; We'll keep those variables here for a while, in order to provide a
|
|
1296 ;; function for porting the old options file that a user may own to Custom.
|
|
1297
|
|
1298 (defvar options-save-faces nil
|
|
1299 "*Non-nil value means save-options will save information about faces.
|
|
1300 A nil value means save-options will not save face information.
|
|
1301 Set this non-nil only if you use M-x edit-faces to change face
|
|
1302 settings. If you use M-x customize-face or the \"Browse Faces...\"
|
|
1303 menu entry, you will see a button in the Customize Face buffer that you
|
|
1304 can use to permanently save your face changes.
|
|
1305
|
|
1306 M-x edit-faces is deprecated. Support for it and this variable will
|
|
1307 be discontinued in a future release.")
|
|
1308
|
|
1309 (defvar save-options-init-file nil
|
|
1310 "File into which to save forms to load the options file (nil for .emacs).
|
|
1311 Normally this is nil, which means save into your .emacs file (the value
|
|
1312 of `user-init-file'.")
|
|
1313
|
|
1314 (defvar save-options-file ".xemacs-options"
|
|
1315 "File to save options into.
|
|
1316 This file is loaded from your .emacs file.
|
|
1317 If this is a relative filename, it is put into the same directory as your
|
|
1318 .emacs file.")
|
|
1319
|
|
1320
|
|
1321
|
|
1322 ;;; The Help menu
|
|
1323
|
|
1324 (if (featurep 'mule)
|
|
1325 (defun tutorials-menu-filter (menu-items)
|
|
1326 ;; If there's a tutorial for the current language environment, make it
|
|
1327 ;; appear first as the default one. Otherwise, use the english one.
|
|
1328 (let* ((menu menu-items)
|
|
1329 (item (pop menu-items)))
|
|
1330 (aset
|
|
1331 item 3
|
|
1332 (concat "("
|
|
1333 (if (assoc
|
|
1334 'tutorial
|
|
1335 (assoc current-language-environment language-info-alist))
|
|
1336 current-language-environment
|
|
1337 "English")
|
|
1338 ")"))
|
|
1339 menu)))
|
|
1340
|
|
1341
|
|
1342 (set-menubar default-menubar)
|
|
1343
|
|
1344
|
|
1345 ;;; Popup menus.
|
|
1346
|
|
1347 (defconst default-popup-menu
|
|
1348 '("XEmacs Commands"
|
|
1349 ["Undo" advertised-undo
|
|
1350 :active (and (not (eq buffer-undo-list t))
|
|
1351 (or buffer-undo-list pending-undo-list))
|
|
1352 :suffix (if (or (eq last-command 'undo)
|
|
1353 (eq last-command 'advertised-undo))
|
|
1354 "More" "")]
|
284
|
1355 ["Cut" kill-primary-selection
|
|
1356 :active (selection-owner-p)]
|
|
1357 ["Copy" copy-primary-selection
|
|
1358 :active (selection-owner-p)]
|
|
1359 ["Paste" yank-clipboard-selection
|
|
1360 :active (selection-exists-p 'CLIPBOARD)]
|
|
1361 ["Clear" delete-primary-selection
|
|
1362 :active (selection-owner-p)]
|
282
|
1363 "-----"
|
|
1364 ["Select Block" mark-paragraph]
|
284
|
1365 ["Split Window" split-window-vertically]
|
282
|
1366 ["Unsplit Window" delete-other-windows]
|
|
1367 ))
|
|
1368
|
|
1369 (defvar global-popup-menu nil
|
|
1370 "The global popup menu. This is present in all modes.
|
|
1371 See the function `popup-menu' for a description of menu syntax.")
|
|
1372
|
|
1373 (defvar mode-popup-menu nil
|
|
1374 "The mode-specific popup menu. Automatically buffer local.
|
|
1375 This is appended to the default items in `global-popup-menu'.
|
|
1376 See the function `popup-menu' for a description of menu syntax.")
|
|
1377 (make-variable-buffer-local 'mode-popup-menu)
|
|
1378
|
|
1379 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
|
|
1380 ;; superceded by any local popup menu...
|
|
1381 (setq-default mode-popup-menu default-popup-menu)
|
|
1382
|
|
1383 (defvar activate-popup-menu-hook nil
|
|
1384 "Function or functions run before a mode-specific popup menu is made visible.
|
|
1385 These functions are called with no arguments, and should interrogate and
|
|
1386 modify the value of `global-popup-menu' or `mode-popup-menu' as desired.
|
|
1387 Note: this hook is only run if you use `popup-mode-menu' for activating the
|
|
1388 global and mode-specific commands; if you have your own binding for button3,
|
|
1389 this hook won't be run.")
|
|
1390
|
|
1391 (defun popup-mode-menu ()
|
|
1392 "Pop up a menu of global and mode-specific commands.
|
|
1393 The menu is computed by combining `global-popup-menu' and `mode-popup-menu'."
|
|
1394 (interactive "@_")
|
|
1395 (run-hooks 'activate-popup-menu-hook)
|
|
1396 (popup-menu
|
|
1397 (cond ((and global-popup-menu mode-popup-menu)
|
284
|
1398 ;; Merge global-popup-menu and mode-popup-menu
|
282
|
1399 (check-menu-syntax mode-popup-menu)
|
|
1400 (let* ((title (car mode-popup-menu))
|
|
1401 (items (cdr mode-popup-menu))
|
284
|
1402 mode-filters)
|
282
|
1403 ;; Strip keywords from local menu for attaching them at the top
|
|
1404 (while (and items
|
284
|
1405 (keywordp (car items)))
|
|
1406 ;; Push both keyword and its argument.
|
|
1407 (push (pop items) mode-filters)
|
|
1408 (push (pop items) mode-filters))
|
|
1409 (setq mode-filters (nreverse mode-filters))
|
|
1410 ;; If mode-filters contains a keyword already present in
|
|
1411 ;; `global-popup-menu', you will probably lose.
|
282
|
1412 (append (list (car global-popup-menu))
|
284
|
1413 mode-filters
|
282
|
1414 (cdr global-popup-menu)
|
|
1415 '("---" "---")
|
|
1416 (if popup-menu-titles (list title))
|
|
1417 (if popup-menu-titles '("---" "---"))
|
|
1418 items)))
|
|
1419 (t
|
|
1420 (or mode-popup-menu
|
|
1421 global-popup-menu
|
284
|
1422 (error "No menu defined in this buffer"))))))
|
282
|
1423
|
|
1424 (defun popup-buffer-menu (event)
|
|
1425 "Pop up a copy of the Buffers menu (from the menubar) where the mouse is clicked."
|
|
1426 (interactive "e")
|
|
1427 (let ((window (and (event-over-text-area-p event) (event-window event)))
|
|
1428 (bmenu nil))
|
|
1429 (or window
|
|
1430 (error "Pointer must be in a normal window"))
|
|
1431 (select-window window)
|
|
1432 (if current-menubar
|
|
1433 (setq bmenu (assoc "Buffers" current-menubar)))
|
|
1434 (if (null bmenu)
|
|
1435 (setq bmenu (assoc "Buffers" default-menubar)))
|
|
1436 (if (null bmenu)
|
|
1437 (error "Can't find the Buffers menu"))
|
|
1438 (popup-menu bmenu)))
|
|
1439
|
|
1440 (defun popup-menubar-menu (event)
|
|
1441 "Pop up a copy of menu that also appears in the menubar"
|
|
1442 ;; by Stig@hackvan.com
|
|
1443 (interactive "e")
|
|
1444 (let ((window (and (event-over-text-area-p event) (event-window event)))
|
|
1445 popup-menubar)
|
|
1446 (or window
|
|
1447 (error "Pointer must be in a normal window"))
|
|
1448 (select-window window)
|
|
1449 (and current-menubar (run-hooks 'activate-menubar-hook))
|
|
1450 ;; ##### Instead of having to copy this just to safely get rid of
|
|
1451 ;; any nil what we should really do is fix up the internal menubar
|
|
1452 ;; code to just ignore nil if generating a popup menu
|
|
1453 (setq popup-menubar (delete nil (copy-sequence (or current-menubar
|
|
1454 default-menubar))))
|
|
1455 (popup-menu (cons "Menubar Menu" popup-menubar))
|
|
1456 ))
|
|
1457
|
|
1458 (global-set-key 'button3 'popup-mode-menu)
|
|
1459 ;; shift button3 and shift button2 are reserved for Hyperbole
|
|
1460 (global-set-key '(meta control button3) 'popup-buffer-menu)
|
|
1461 ;; The following command is way too dangerous with Custom.
|
|
1462 ;; (global-set-key '(meta shift button3) 'popup-menubar-menu)
|
|
1463
|
|
1464 ;; Here's a test of the cool new menu features (from Stig).
|
|
1465
|
|
1466 ;;(setq mode-popup-menu
|
|
1467 ;; '("Test Popup Menu"
|
|
1468 ;; :filter cdr
|
|
1469 ;; ["this item won't appear because of the menu filter" ding t]
|
|
1470 ;; "--:singleLine"
|
|
1471 ;; "singleLine"
|
|
1472 ;; "--:doubleLine"
|
|
1473 ;; "doubleLine"
|
|
1474 ;; "--:singleDashedLine"
|
|
1475 ;; "singleDashedLine"
|
|
1476 ;; "--:doubleDashedLine"
|
|
1477 ;; "doubleDashedLine"
|
|
1478 ;; "--:noLine"
|
|
1479 ;; "noLine"
|
|
1480 ;; "--:shadowEtchedIn"
|
|
1481 ;; "shadowEtchedIn"
|
|
1482 ;; "--:shadowEtchedOut"
|
|
1483 ;; "shadowEtchedOut"
|
|
1484 ;; "--:shadowDoubleEtchedIn"
|
|
1485 ;; "shadowDoubleEtchedIn"
|
|
1486 ;; "--:shadowDoubleEtchedOut"
|
|
1487 ;; "shadowDoubleEtchedOut"
|
|
1488 ;; "--:shadowEtchedInDash"
|
|
1489 ;; "shadowEtchedInDash"
|
|
1490 ;; "--:shadowEtchedOutDash"
|
|
1491 ;; "shadowEtchedOutDash"
|
|
1492 ;; "--:shadowDoubleEtchedInDash"
|
|
1493 ;; "shadowDoubleEtchedInDash"
|
|
1494 ;; "--:shadowDoubleEtchedOutDash"
|
|
1495 ;; "shadowDoubleEtchedOutDash"
|
|
1496 ;; ))
|
|
1497
|
|
1498 (defun xemacs-splash-buffer ()
|
|
1499 "Redisplay XEmacs splash screen in a buffer."
|
|
1500 (interactive)
|
|
1501 (let ((buffer (get-buffer-create "*Splash*")))
|
|
1502 (set-buffer buffer)
|
|
1503 (erase-buffer buffer)
|
|
1504 (startup-splash-frame)
|
|
1505 (pop-to-buffer buffer)
|
|
1506 (delete-other-windows)))
|
|
1507
|
|
1508
|
|
1509 ;;; backwards compatibility
|
|
1510 (provide 'x-menubar)
|
|
1511 (provide 'menubar-items)
|
|
1512
|
|
1513 ;;; x-menubar.el ends here.
|