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