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