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