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