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