comparison lisp/menubar-items.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 501cfd01ee6d
children 41dbb7a9d5f2
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs. 1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs.
2 2
3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc. 3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
5 ;; Copyright (C) 1995 Sun Microsystems. 5 ;; Copyright (C) 1995 Sun Microsystems.
6 ;; Copyright (C) 1995, 1996, 2000 Ben Wing. 6 ;; Copyright (C) 1995, 1996 Ben Wing.
7 ;; Copyright (C) 1997 MORIOKA Tomohiko. 7 ;; Copyright (C) 1997 MORIOKA Tomohiko
8 8
9 ;; Maintainer: XEmacs Development Team 9 ;; Maintainer: XEmacs Development Team
10 ;; Keywords: frames, extensions, internal, dumped 10 ;; Keywords: frames, extensions, internal, dumped
11 11
12 ;; This file is part of XEmacs. 12 ;; This file is part of XEmacs.
23 23
24 ;; You should have received a copy of the GNU General Public License 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 25 ;; along with Xmacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, 59 Temple Place - Suite 330, 26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA. 27 ;; Boston, MA 02111-1307, USA.
28
29 ;;; Authorship:
30
31 ;; Created c. 1991 for Lucid Emacs. Originally called x-menubar.el.
32 ;; Contained four menus -- File, Edit, Buffers, Help.
33 ;; Dynamic menu changes possible only through activate-menubar-hook.
34 ;; Also contained menu manipulation funs, e.g. find-menu-item, add-menu.
35 ;; Options menu added for 19.9 by Jamie Zawinski, late 1993.
36 ;; Major reorganization c. 1994 by Ben Wing; added many items and moved
37 ;; some items to two new menus, Apps and Tools. (for 19.10?)
38 ;; Generic menubar functions moved to new file, menubar.el, by Ben Wing,
39 ;; 1995, for 19.12; also, creation of current buffers menu options,
40 ;; and buffers menu changed from purely most-recent to sorted alphabetical,
41 ;; by mode. Also added mode-popup-menu support.
42 ;; New API (add-submenu, add-menu-button) and menu filter support added
43 ;; late summer 1995 by Stig, for 19.13. Also popup-menubar-menu.
44 ;; Renamed to menubar-items.el c. 1998, with MS Win support.
45 ;; Options menu rewritten to use custom c. 1999 by ? (Jan Vroonhof?).
46 ;; Major reorganization Mar. 2000 by Ben Wing; added many items and changed
47 ;; top-level menus to File, Edit, View, Cmds, Tools, Options, Buffers.
48 ;; Accelerator spec functionality added Mar. 2000 by Ben Wing.
49 28
50 ;;; Commentary: 29 ;;; Commentary:
51 30
52 ;; This file is dumped with XEmacs (when window system and menubar support is 31 ;; This file is dumped with XEmacs (when window system and menubar support is
53 ;; compiled in). 32 ;; compiled in).
60 (defvar bookmark-alist) 39 (defvar bookmark-alist)
61 (defvar language-info-alist) 40 (defvar language-info-alist)
62 (defvar current-language-environment) 41 (defvar current-language-environment)
63 (defvar tutorial-supported-languages)) 42 (defvar tutorial-supported-languages))
64 43
65 (defun menu-truncate-list (list n)
66 (if (<= (length list) n)
67 list
68 (butlast list (- (length list) n))))
69
70 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list)
71 "Add auto-generated accelerator specifications to a submenu.
72 This can be used to add accelerators to the return value of a menu filter
73 function. It correctly ignores unselectable items. It will destructively
74 modify the list passed to it. If an item already has an auto-generated
75 accelerator spec, this will be removed before the new one is added, making
76 this function idempotent.
77
78 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
79 which will not be used as accelerators."
80 (let ((n 0))
81 (dolist (item list list)
82 (cond
83 ((vectorp item)
84 (setq n (1+ n))
85 (aset item 0
86 (concat
87 (menu-item-generate-accelerator-spec n omit-chars-list)
88 (menu-item-strip-accelerator-spec (aref item 0)))))
89 ((consp item)
90 (setq n (1+ n))
91 (setcar item
92 (concat
93 (menu-item-generate-accelerator-spec n omit-chars-list)
94 (menu-item-strip-accelerator-spec (car item)))))))))
95
96 (defun menu-item-strip-accelerator-spec (item)
97 "Strip an auto-generated accelerator spec off of ITEM.
98 ITEM should be a string. This removes specs added by
99 `menu-item-generate-accelerator-spec' and `submenu-generate-accelerator-spec'."
100 (if (string-match "%_. " item)
101 (substring item 4)
102 item))
103
104 (defun menu-item-generate-accelerator-spec (n &optional omit-chars-list)
105 "Return an accelerator specification for use with auto-generated menus.
106 This should be concat'd onto the beginning of each menu line. The spec
107 allows the Nth line to be selected by the number N. '0' is used for the
108 10th line, and 'a' through 'z' are used for the following 26 lines.
109
110 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
111 which will not be used as accelerators."
112 (cond ((< n 10) (concat "%_" (int-to-string n) " "))
113 ((= n 10) "%_0 ")
114 ((<= n 36)
115 (setq n (- n 10))
116 (let ((m 0))
117 (while (> n 0)
118 (setq m (1+ m))
119 (while (memq (int-to-char (+ m (- (char-to-int ?a) 1)))
120 omit-chars-list)
121 (setq m (1+ m)))
122 (setq n (1- n)))
123 (if (<= m 26)
124 (concat
125 "%_"
126 (char-to-string (int-to-char (+ m (- (char-to-int ?a) 1))))
127 " ")
128 "")))
129 (t "")))
130
131 (defconst default-menubar 44 (defconst default-menubar
132 (purecopy-menubar 45 (purecopy-menubar
133 ;; note backquote. 46 ;; note backquote.
134 `( 47 `(
135 ("%_File" 48 ("File"
136 ["%_Open..." find-file] 49 ["Open..." find-file]
137 ["Open in Other %_Window..." find-file-other-window] 50 ["Open in Other Window..." find-file-other-window]
138 ["Open in New %_Frame..." find-file-other-frame] 51 ["Open in New Frame..." find-file-other-frame]
139 ["%_Hex Edit File..." hexl-find-file 52 ["Insert File..." insert-file]
140 :active (fboundp 'hexl-find-file)] 53 ["View File..." view-file]
141 ["%_Insert File..." insert-file]
142 ["%_View File..." view-file]
143 "------" 54 "------"
144 ["%_Save" save-buffer 55 ["Save" save-buffer
145 :active (buffer-modified-p) 56 :active (buffer-modified-p)
146 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 57 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
147 ["Save %_As..." write-file] 58 ["Save As..." write-file]
148 ["Save So%_me Buffers" save-some-buffers] 59 ["Save Some Buffers" save-some-buffers]
149 "-----" 60 "-----"
150 ["%_Print Buffer" generic-print-buffer 61 ["Print Buffer" lpr-buffer
151 :active (or (valid-specifier-tag-p 'msprinter) 62 :active (fboundp 'lpr-buffer)
152 (and (not (eq system-type 'windows-nt))
153 (fboundp 'lpr-buffer)))
154 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 63 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
155 ["Prett%_y-Print Buffer" ps-print-buffer-with-faces 64 ["Pretty-Print Buffer" ps-print-buffer-with-faces
156 :active (fboundp 'ps-print-buffer-with-faces) 65 :active (fboundp 'ps-print-buffer-with-faces)
157 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 66 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
158 "-----" 67 "-----"
159 ["%_Revert Buffer" revert-buffer 68 ["New Frame" make-frame]
69 ["Frame on Other Display..." make-frame-on-display]
70 ["Delete Frame" delete-frame
71 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
72 (selected-frame)))]
73 "-----"
74 ["Split Window" split-window-vertically]
75 ["Un-Split (Keep This)" delete-other-windows
76 :active (not (one-window-p t))]
77 ["Un-Split (Keep Others)" delete-window
78 :active (not (one-window-p t))]
79 "-----"
80 ["Revert Buffer" revert-buffer
160 :active (or buffer-file-name revert-buffer-function) 81 :active (or buffer-file-name revert-buffer-function)
161 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 82 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
162 ["Re%_cover File..." recover-file] 83 ["Delete Buffer" kill-this-buffer
163 ["Recover S%_ession..." recover-session] 84 :active t
85 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
164 "-----" 86 "-----"
165 ["E%_xit XEmacs" save-buffers-kill-emacs] 87 ["Exit XEmacs" save-buffers-kill-emacs]
166 ) 88 )
167 89
168 ("%_Edit" 90 ("Edit"
169 ["%_Undo" advertised-undo 91 ["Undo" advertised-undo
170 :active (and (not (eq buffer-undo-list t)) 92 :active (and (not (eq buffer-undo-list t))
171 (or buffer-undo-list pending-undo-list)) 93 (or buffer-undo-list pending-undo-list))
172 :suffix (if (or (eq last-command 'undo) 94 :suffix (if (or (eq last-command 'undo)
173 (eq last-command 'advertised-undo)) 95 (eq last-command 'advertised-undo))
174 "More" "")] 96 "More" "")]
175 ["%_Redo" redo 97 ["Redo" redo
176 :included (fboundp 'redo) 98 :included (fboundp 'redo)
177 :active (not (or (eq buffer-undo-list t) 99 :active (not (or (eq buffer-undo-list t)
178 (eq last-buffer-undo-list nil) 100 (eq last-buffer-undo-list nil)
179 (not (or (eq last-buffer-undo-list buffer-undo-list) 101 (not (or (eq last-buffer-undo-list buffer-undo-list)
180 (and (null (car-safe buffer-undo-list)) 102 (and (null (car-safe buffer-undo-list))
181 (eq last-buffer-undo-list 103 (eq last-buffer-undo-list
182 (cdr-safe buffer-undo-list))))) 104 (cdr-safe buffer-undo-list)))))
183 (or (eq buffer-undo-list pending-undo-list) 105 (or (eq buffer-undo-list pending-undo-list)
184 (eq (cdr buffer-undo-list) pending-undo-list)))) 106 (eq (cdr buffer-undo-list) pending-undo-list))))
185 :suffix (if (eq last-command 'redo) "More" "")] 107 :suffix (if (eq last-command 'redo) "More" "")]
186 "----" 108 ["Cut" kill-primary-selection
187 ["Cu%_t" kill-primary-selection
188 :active (selection-owner-p)] 109 :active (selection-owner-p)]
189 ["%_Copy" copy-primary-selection 110 ["Copy" copy-primary-selection
190 :active (selection-owner-p)] 111 :active (selection-owner-p)]
191 ["%_Paste" yank-clipboard-selection 112 ["Paste" yank-clipboard-selection
192 :active (selection-exists-p 'CLIPBOARD)] 113 :active (selection-exists-p 'CLIPBOARD)]
193 ["%_Delete" delete-primary-selection 114 ["Clear" delete-primary-selection
194 :active (selection-owner-p)] 115 :active (selection-owner-p)]
195 "----" 116 "----"
196 ["Select %_All" mark-whole-buffer] 117 ["Search..." isearch-forward]
197 ["Select %_Page" mark-page] 118 ["Search Backward..." isearch-backward]
119 ["Replace..." query-replace]
198 "----" 120 "----"
199 ["%_Search..." make-search-dialog] 121 ["Search (Regexp)..." isearch-forward-regexp]
200 ["%_1 Replace..." query-replace] 122 ["Search Backward (Regexp)..." isearch-backward-regexp]
123 ["Replace (Regexp)..." query-replace-regexp]
201 "----" 124 "----"
202 ["%_2 Search (Regexp)..." isearch-forward-regexp] 125 ["Goto Line..." goto-line]
203 ["%_3 Search Backward (Regexp)..." isearch-backward-regexp] 126 ["What Line" what-line]
204 ["%_4 Replace (Regexp)..." query-replace-regexp] 127 ("Bookmarks"
205 128 :filter bookmark-menu-filter)
206 ,@(when (featurep 'mule) 129 "----"
207 '("----" 130 ["Start Macro Recording" start-kbd-macro
208 ("%_Multilingual (\"Mule\")" 131 :active (not defining-kbd-macro)]
209 ("%_Describe Language Support") 132 ["End Macro Recording" end-kbd-macro
210 ("%_Set Language Environment") 133 :active defining-kbd-macro]
134 ["Execute Last Macro" call-last-kbd-macro
135 :active last-kbd-macro]
136 "----"
137 ["Show Message Log" show-message-log]
138 )
139
140 ,@(when (featurep 'mule)
141 '(("Mule"
142 ("Describe language support")
143 ("Set language environment")
211 "--" 144 "--"
212 ["T%_oggle Input Method" toggle-input-method] 145 ["Toggle input method" toggle-input-method]
213 ["Select %_Input Method" set-input-method] 146 ["Select input method" select-input-method]
214 ["D%_escribe Input Method" describe-input-method] 147 ["Describe input method" describe-input-method]
215 "--" 148 "--"
216 ["Describe Current %_Coding Systems" 149 ["Describe current coding systems"
217 describe-current-coding-system] 150 describe-current-coding-system]
218 ["Set Coding System of %_Buffer File..." 151 ["Set coding system of buffer file"
219 set-buffer-file-coding-system] 152 set-buffer-file-coding-system]
220 ;; not implemented yet 153 ;; not implemented yet
221 ["Set Coding System of %_Terminal..." 154 ["Set coding system of terminal"
222 set-terminal-coding-system :active nil] 155 set-terminal-coding-system :active nil]
223 ;; not implemented yet 156 ;; not implemented yet
224 ["Set Coding System of %_Keyboard..." 157 ["Set coding system of keyboard"
225 set-keyboard-coding-system :active nil] 158 set-keyboard-coding-system :active nil]
226 ["Set Coding System of %_Process..." 159 ["Set coding system of process"
227 set-buffer-process-coding-system 160 set-buffer-process-coding-system
228 :active (get-buffer-process (current-buffer))] 161 :active (get-buffer-process (current-buffer))]
229 "--" 162 "--"
230 ["Show Cha%_racter Table" view-charset-by-menu] 163 ["Show character table" view-charset-by-menu]
231 ;; not implemented yet 164 ;; not implemented yet
232 ["Show Dia%_gnosis for MULE" mule-diag :active nil] 165 ["Show diagnosis for MULE" mule-diag :active nil]
233 ["Show \"%_hello\" in Many Languages" view-hello-file])) 166 ["Show many languages" view-hello-file])))
234 ) 167
235 ) 168 ("Apps"
236 169 ["Read Mail (VM)..." vm
237 ("%_View" 170 :active (fboundp 'vm)]
238 ["%_New Frame" make-frame] 171 ["Read Mail (MH)..." (mh-rmail t)
239 ["Frame on Other Displa%_y..." make-frame-on-display] 172 :active (fboundp 'mh-rmail)]
240 ["%_Delete Frame" delete-frame 173 ["Send mail..." compose-mail
241 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system) 174 :active (fboundp 'compose-mail)]
242 (selected-frame)))] 175 ["Usenet News" gnus
243 "-----" 176 :active (fboundp 'gnus)]
244 ["%_Split Window" split-window-vertically] 177 ["Browse the Web" w3
245 ["S%_plit Window (Side by Side)" split-window-horizontally] 178 :active (fboundp 'w3)]
246 ["%_Un-Split (Keep This)" delete-other-windows
247 :active (not (one-window-p t))]
248 ["Un-Split (Keep %_Others)" delete-window
249 :active (not (one-window-p t))]
250 "----" 179 "----"
251 ("N%_arrow" 180 ["Spell-Check Buffer" ispell-buffer
252 ["%_Narrow to Region" narrow-to-region :active (region-exists-p)] 181 :active (fboundp 'ispell-buffer)]
253 ["Narrow to %_Page" narrow-to-page] 182 ["Toggle VI emulation" toggle-viper-mode
254 ["Narrow to %_Defun" narrow-to-defun] 183 :active (fboundp 'toggle-viper-mode)]
255 "----" 184 "----"
256 ["%_Widen" widen :active (or (/= (point-min) 1) 185 ("Calendar"
257 (/= (point-max) (1+ (buffer-size))))] 186 ["3-Month Calendar" calendar
258 )
259 "----"
260 ["Show Message %_Log" show-message-log]
261 "----"
262 ["%_Goto Line..." goto-line]
263 ["%_What Line" what-line]
264 ("%_Bookmarks"
265 :filter bookmark-menu-filter)
266 "----"
267 ["%_Jump to Previous Mark" (set-mark-command t)
268 :active (mark t)]
269 )
270
271 ("C%_mds"
272 ["Repeat %_Last Complex Command..." repeat-complex-command]
273 ["E%_valuate Lisp Expression..." eval-expression]
274 ["Execute %_Named Command..." execute-extended-command]
275 "----"
276 ["Start %_Macro Recording" start-kbd-macro
277 :included (not defining-kbd-macro)]
278 ["End %_Macro Recording" end-kbd-macro
279 :included defining-kbd-macro]
280 ["E%_xecute Last Macro" call-last-kbd-macro
281 :active last-kbd-macro]
282 ("%_Other Macro"
283 ["%_Append to Last Macro" (start-kbd-macro t)
284 :active (and (not defining-kbd-macro) last-kbd-macro)]
285 ["%_Query User During Macro" kbd-macro-query
286 :active defining-kbd-macro]
287 ["Enter %_Recursive Edit During Macro" (kbd-macro-query t)
288 :active defining-kbd-macro]
289 "---"
290 ["E%_xecute Last Macro on Region Lines"
291 :active (and last-kbd-macro (region-exists-p))]
292 "---"
293 ["%_Name Last Macro..." name-last-kbd-macro
294 :active last-kbd-macro]
295 ["Assign Last Macro to %_Key..." assign-last-kbd-macro-to-key
296 :active (and last-kbd-macro
297 (fboundp 'assign-last-kbd-macro-to-key))]
298 "---"
299 ["%_Edit Macro..." edit-kbd-macro]
300 ["Edit %_Last Macro" edit-last-kbd-macro
301 :active last-kbd-macro]
302 "---"
303 ["%_Insert Named Macro into Buffer..." insert-kbd-macro]
304 ["Read Macro from Re%_gion" read-kbd-macro
305 :active (region-exists-p)]
306 )
307 "----"
308 ("%_Abbrev"
309 ["D%_ynamic Abbrev Expand" dabbrev-expand]
310 ["Dynamic Abbrev %_Complete" dabbrev-completion]
311 ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)]
312 "----"
313 "----"
314 ["%_Define Global Abbrev for " add-global-abbrev
315 :suffix (abbrev-string-to-be-defined nil)
316 :active abbrev-mode]
317 ["Define %_Mode-Specific Abbrev for " add-mode-abbrev
318 :suffix (abbrev-string-to-be-defined nil)
319 :active abbrev-mode]
320 ["Define Global Ex%_pansion for " inverse-add-global-abbrev
321 :suffix (inverse-abbrev-string-to-be-defined 1)
322 :active abbrev-mode]
323 ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev
324 :suffix (inverse-abbrev-string-to-be-defined 1)
325 :active abbrev-mode]
326 "---"
327 ["E%_xpand Abbrev" expand-abbrev]
328 ["Expand Abbrevs in Re%_gion" expand-region-abbrevs
329 :active (region-exists-p)]
330 ["%_Unexpand Last Abbrev" unexpand-abbrev
331 :active (and (stringp last-abbrev-text)
332 (> last-abbrev-location 0))]
333 "---"
334 ["%_Kill All Abbrevs" kill-all-abbrevs]
335 ["%_Insert All Abbrevs into Buffer" insert-abbrevs]
336 ["%_List Abbrevs" list-abbrevs]
337 "---"
338 ["%_Edit Abbrevs" edit-abbrevs]
339 ["%_Redefine Abbrevs from Buffer" edit-abbrevs-redefine
340 :active (eq major-mode 'edit-abbrevs-mode)]
341 "---"
342 ["%_Save Abbrevs As..." write-abbrev-file]
343 ["L%_oad Abbrevs..." read-abbrev-file]
344 )
345 ("%_Register"
346 ["%_Copy to Register..." copy-to-register :active (region-exists-p)]
347 ["%_Paste Register..." insert-register]
348 "---"
349 ["%_Save Point to Register" point-to-register]
350 ["%_Jump to Register" register-to-point]
351 )
352 ("R%_ectangles"
353 ["%_Kill Rectangle" kill-rectangle]
354 ["%_Yank Rectangle" yank-rectangle]
355 ["Rectangle %_to Register" copy-rectangle-to-register]
356 ["Rectangle %_from Register" insert-register]
357 ["%_Clear Rectangle" clear-rectangle]
358 ["%_Open Rectangle" open-rectangle]
359 ["%_Prefix Rectangle..." string-rectangle]
360 ["Rectangle %_Mousing"
361 (customize-set-variable 'mouse-track-rectangle-p
362 (not mouse-track-rectangle-p))
363 :style toggle :selected mouse-track-rectangle-p]
364 )
365 ("%_Sort"
366 ["%_Lines" sort-lines :active (region-exists-p)]
367 ["%_Paragraphs" sort-paragraphs :active (region-exists-p)]
368 ["P%_ages" sort-pages :active (region-exists-p)]
369 ["%_Columns" sort-columns :active (region-exists-p)]
370 ["%_Regexp..." sort-regexp-fields :active (region-exists-p)]
371 )
372 ("%_Center"
373 ["%_Line" center-line]
374 ["%_Paragraph" center-paragraph]
375 ["%_Region" center-region :active (region-exists-p)]
376 )
377 ("%_Indent"
378 ["%_As Previous Line" indent-relative]
379 ["%_To Column..." indent-to-column]
380 "---"
381 ["%_Region" indent-region :active (region-exists-p)]
382 ["%_Balanced Expression" indent-sexp]
383 ["%_C Expression" indent-c-exp]
384 )
385 ("S%_pell-Check"
386 ["%_Buffer" ispell-buffer
387 :active (fboundp 'ispell-buffer)]
388 "---"
389 ["%_Word" ispell-word]
390 ["%_Complete Word" ispell-complete-word]
391 ["%_Region" ispell-region]
392 )
393 )
394
395 ("%_Tools"
396 ("%_Internet"
397 ["Read Mail %_1 (VM)..." vm
398 :active (fboundp 'vm)]
399 ["Read Mail %_2 (MH)..." (mh-rmail t)
400 :active (fboundp 'mh-rmail)]
401 ["Send %_Mail..." compose-mail
402 :active (fboundp 'compose-mail)]
403 ["Usenet %_News" gnus
404 :active (fboundp 'gnus)]
405 ["Browse the %_Web" w3
406 :active (fboundp 'w3)])
407 "---"
408 ("%_Grep"
409 :filter
410 (lambda (menu)
411 (if (or (not (boundp 'grep-history)) (null grep-history))
412 menu
413 (let ((items
414 (submenu-generate-accelerator-spec
415 (mapcar #'(lambda (string)
416 (vector string
417 (list 'grep string)))
418 (menu-truncate-list grep-history 10)))))
419 (append menu '("---") items))))
420 ["%_Grep..." grep :active (fboundp 'grep)]
421 ["%_Kill Grep" kill-compilation
422 :active (and (fboundp 'kill-compilation)
423 (fboundp 'compilation-find-buffer)
424 (let ((buffer (condition-case nil
425 (compilation-find-buffer)
426 (error nil))))
427 (and buffer (get-buffer-process buffer))))]
428 "---"
429 ["Grep %_All Files in Current Directory..."
430 (progn
431 (require 'compile)
432 (let ((grep-command
433 (cons (concat grep-command " *")
434 (length grep-command))))
435 (call-interactively 'grep)))
436 :active (fboundp 'grep)]
437 ["Grep %_C and C Header Files in Current Directory..."
438 (progn
439 (require 'compile)
440 (let ((grep-command
441 (cons (concat grep-command " *.[chCH]"
442 ; i wanted to also use *.cc and *.hh.
443 ; see long comment below under Perl.
444 )
445 (length grep-command))))
446 (call-interactively 'grep)))
447 :active (fboundp 'grep)]
448 ["Grep C Hea%_der Files in Current Directory..."
449 (progn
450 (require 'compile)
451 (let ((grep-command
452 (cons (concat grep-command " *.[hH]"
453 ; i wanted to also use *.hh.
454 ; see long comment below under Perl.
455 )
456 (length grep-command))))
457 (call-interactively 'grep)))
458 :active (fboundp 'grep)]
459 ["Grep %_E-Lisp Files in Current Directory..."
460 (progn
461 (require 'compile)
462 (let ((grep-command
463 (cons (concat grep-command " *.el")
464 (length grep-command))))
465 (call-interactively 'grep)))
466 :active (fboundp 'grep)]
467 ["Grep %_Perl Files in Current Directory..."
468 (progn
469 (require 'compile)
470 (let ((grep-command
471 (cons (concat grep-command " *.pl"
472 ; i wanted to use this:
473 ; " *.pl *.pm *.am"
474 ; but grep complains if it can't
475 ; match anything in a glob, and
476 ; that screws other things up.
477 ; perhaps we need to first scan
478 ; each separate glob in the directory
479 ; to see if there are any files in
480 ; that glob, and if not, omit it.
481 )
482 (length grep-command))))
483 (call-interactively 'grep)))
484 :active (fboundp 'grep)]
485 ["Grep %_HTML Files in Current Directory..."
486 (progn
487 (require 'compile)
488 (let ((grep-command
489 (cons (concat grep-command " *.*htm*")
490 (length grep-command))))
491 (call-interactively 'grep)))
492 :active (fboundp 'grep)]
493 "---"
494 ["%_Next Match" next-error
495 :active (and (fboundp 'compilation-errors-exist-p)
496 (compilation-errors-exist-p))]
497 ["Pre%_vious Match" previous-error
498 :active (and (fboundp 'compilation-errors-exist-p)
499 (compilation-errors-exist-p))]
500 ["%_First Match" first-error
501 :active (and (fboundp 'compilation-errors-exist-p)
502 (compilation-errors-exist-p))]
503 ["G%_oto Match" compile-goto-error
504 :active (and (fboundp 'compilation-errors-exist-p)
505 (compilation-errors-exist-p))]
506 "---"
507 ["%_Set Grep Command..."
508 (progn
509 (require 'compile)
510 (customize-set-variable
511 'grep-command
512 (read-shell-command "Default Grep Command: " grep-command)))
513 :active (fboundp 'grep)
514 ]
515 )
516 ("%_Compile"
517 :filter
518 (lambda (menu)
519 (if (or (not (boundp 'compile-history)) (null compile-history))
520 menu
521 (let ((items
522 (submenu-generate-accelerator-spec
523 (mapcar #'(lambda (string)
524 (vector string
525 (list 'compile string)))
526 (menu-truncate-list compile-history 10)))))
527 (append menu '("---") items))))
528 ["%_Compile..." compile :active (fboundp 'compile)]
529 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]
530 ["%_Kill Compilation" kill-compilation
531 :active (and (fboundp 'kill-compilation)
532 (fboundp 'compilation-find-buffer)
533 (let ((buffer (condition-case nil
534 (compilation-find-buffer)
535 (error nil))))
536 (and buffer (get-buffer-process buffer))))]
537 "---"
538 ["%_Next Error" next-error
539 :active (and (fboundp 'compilation-errors-exist-p)
540 (compilation-errors-exist-p))]
541 ["Pre%_vious Error" previous-error
542 :active (and (fboundp 'compilation-errors-exist-p)
543 (compilation-errors-exist-p))]
544 ["%_First Error" first-error
545 :active (and (fboundp 'compilation-errors-exist-p)
546 (compilation-errors-exist-p))]
547 ["G%_oto Error" compile-goto-error
548 :active (and (fboundp 'compilation-errors-exist-p)
549 (compilation-errors-exist-p))]
550 )
551 ("%_Debug"
552 ["%_GDB..." gdb
553 :active (fboundp 'gdb)]
554 ["%_DBX..." dbx
555 :active (fboundp 'dbx)])
556 ("%_Shell"
557 ["%_Shell" shell
558 :active (fboundp 'shell)]
559 ["S%_hell Command..." shell-command
560 :active (fboundp 'shell-command)]
561 ["Shell Command on %_Region..." shell-command-on-region
562 :active (and (fboundp 'shell-command-on-region) (region-exists-p))])
563
564 ("%_Tags"
565 ["%_Find Tag..." find-tag]
566 ["Find %_Other Window..." find-tag-other-window]
567 ["%_Next Tag..." (find-tag nil)]
568 ["N%_ext Other Window..." (find-tag-other-window nil)]
569 ["Next %_File" next-file]
570 "-----"
571 ["Tags %_Search..." tags-search]
572 ["Tags %_Replace..." tags-query-replace]
573 ["%_Continue Search/Replace" tags-loop-continue]
574 "-----"
575 ["%_Pop stack" pop-tag-mark]
576 ["%_Apropos..." tags-apropos]
577 "-----"
578 ["%_Set Tags Table File..." visit-tags-table]
579 )
580
581 "----"
582
583 ("Ca%_lendar"
584 ["%_3-Month Calendar" calendar
585 :active (fboundp 'calendar)] 187 :active (fboundp 'calendar)]
586 ["%_Diary" diary 188 ["Diary" diary
587 :active (fboundp 'diary)] 189 :active (fboundp 'diary)]
588 ["%_Holidays" holidays 190 ["Holidays" holidays
589 :active (fboundp 'holidays)] 191 :active (fboundp 'holidays)]
590 ;; we're all pagans at heart ... 192 ;; we're all pagans at heart ...
591 ["%_Phases of the Moon" phases-of-moon 193 ["Phases of the Moon" phases-of-moon
592 :active (fboundp 'phases-of-moon)] 194 :active (fboundp 'phases-of-moon)]
593 ["%_Sunrise/Sunset" sunrise-sunset 195 ["Sunrise/Sunset" sunrise-sunset
594 :active (fboundp 'sunrise-sunset)]) 196 :active (fboundp 'sunrise-sunset)])
595 197
596 ("Ga%_mes" 198 ("Games"
597 ["%_Mine Game" xmine 199 ["Mine Game" xmine
598 :active (fboundp 'xmine)] 200 :active (fboundp 'xmine)]
599 ["%_Tetris" tetris 201 ["Tetris" tetris
600 :active (fboundp 'tetris)] 202 :active (fboundp 'tetris)]
601 ["%_Sokoban" sokoban 203 ["Sokoban" sokoban
602 :active (fboundp 'sokoban)] 204 :active (fboundp 'sokoban)]
603 ["Quote from %_Zippy" yow 205 ["Quote from Zippy" yow
604 :active (fboundp 'yow)] 206 :active (fboundp 'yow)]
605 ["%_Psychoanalyst" doctor 207 ["Psychoanalyst" doctor
606 :active (fboundp 'doctor)] 208 :active (fboundp 'doctor)]
607 ["Ps%_ychoanalyze Zippy!" psychoanalyze-pinhead 209 ["Psychoanalyze Zippy!" psychoanalyze-pinhead
608 :active (fboundp 'psychoanalyze-pinhead)] 210 :active (fboundp 'psychoanalyze-pinhead)]
609 ["%_Random Flames" flame 211 ["Random Flames" flame
610 :active (fboundp 'flame)] 212 :active (fboundp 'flame)]
611 ["%_Dunnet (Adventure)" dunnet 213 ["Dunnet (Adventure)" dunnet
612 :active (fboundp 'dunnet)] 214 :active (fboundp 'dunnet)]
613 ["Towers of %_Hanoi" hanoi 215 ["Towers of Hanoi" hanoi
614 :active (fboundp 'hanoi)] 216 :active (fboundp 'hanoi)]
615 ["Game of %_Life" life 217 ["Game of Life" life
616 :active (fboundp 'life)] 218 :active (fboundp 'life)]
617 ["M%_ultiplication Puzzle" mpuz 219 ["Multiplication Puzzle" mpuz
618 :active (fboundp 'mpuz)]) 220 :active (fboundp 'mpuz)]))
619 221
620 "----" 222 ("Options"
621 ) 223 ("Customize"
622 224 ("Emacs" :filter (lambda (&rest junk)
623 ("%_Options" 225 (cdr (custom-menu-create 'emacs))))
624 ("%_Advanced (Customize)" 226 ["Group..." customize-group]
625 ("%_Emacs" :filter (lambda (&rest junk) 227 ["Variable..." customize-variable]
626 (cdr (custom-menu-create 'emacs)))) 228 ["Face..." customize-face]
627 ["%_Group..." customize-group] 229 ["Saved..." customize-saved]
628 ["%_Variable..." customize-variable] 230 ["Set..." customize-customized]
629 ["%_Face..." customize-face] 231 ["Apropos..." customize-apropos]
630 ["%_Saved..." customize-saved] 232 ["Browse..." customize-browse])
631 ["Se%_t..." customize-customized] 233
632 ["%_Apropos..." customize-apropos] 234 ("Manage Packages"
633 ["%_Browse..." customize-browse]) 235 ("Add Download Site"
634 ("Manage %_Packages"
635 ("%_Add Download Site"
636 :filter (lambda (&rest junk) 236 :filter (lambda (&rest junk)
637 (submenu-generate-accelerator-spec 237 (package-get-download-menu)))
638 (package-get-download-menu)))) 238 ["Update Package Index" package-get-update-base]
639 ["%_Update Package Index" package-get-update-base] 239 ["List & Install" pui-list-packages]
640 ["%_List and Install" pui-list-packages] 240 ["Update Installed Packages" package-get-update-all]
641 ["U%_pdate Installed Packages" package-get-update-all] 241 ;; hack-o-matic, we can't force a laod of package-base here
642 ;; hack-o-matic, we can't force a load of package-base here
643 ;; since it triggers dialog box interactions which we can't 242 ;; since it triggers dialog box interactions which we can't
644 ;; deal with while using a menu 243 ;; deal while using a menu
645 ("Using %_Custom" 244 ("Using Custom"
646 :filter (lambda (&rest junk) 245 :filter (lambda (&rest junk)
647 (if package-get-base 246 (if package-get-base
648 (submenu-generate-accelerator-spec 247 (cdr (custom-menu-create 'packages))
649 (cdr (custom-menu-create 'packages))) 248 '(["Please load Package Index" (lamda (&rest junk) ()) nil]))))
650 '(["Please load Package Index"
651 (lamda (&rest junk) ()) nil]))))
652 249
653 ["%_Help" (Info-goto-node "(xemacs)Packages")]) 250 ["Help" (Info-goto-node "(xemacs)Packages")])
251
654 "---" 252 "---"
655 ("%_Keyboard and Mouse" 253
656 ["%_Abbrev Mode" 254 ("Editing Options"
657 (customize-set-variable 'abbrev-mode 255 ["Overstrike"
658 (not (default-value 'abbrev-mode))) 256 (progn
659 :style toggle 257 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
660 :selected (default-value 'abbrev-mode)] 258 (customize-set-variable 'overwrite-mode overwrite-mode))
661 ["%_Delete Key Deletes Selection" 259 :style toggle :selected overwrite-mode]
260 ["Case Sensitive Search"
261 (customize-set-variable 'case-fold-search
262 (setq case-fold-search (not case-fold-search)))
263 :style toggle :selected (not case-fold-search)]
264 ["Case Matching Replace"
265 (customize-set-variable 'case-replace (not case-replace))
266 :style toggle :selected case-replace]
267 ["Auto Delete Selection"
662 (customize-set-variable 'pending-delete-mode (not pending-delete-mode)) 268 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
663 :style toggle 269 :style toggle
664 :selected (and (boundp 'pending-delete-mode) pending-delete-mode) 270 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
665 :active (boundp 'pending-delete-mode)] 271 :active (boundp 'pending-delete-mode)]
666 ["%_Yank/Kill Interact With Clipboard" 272 ["Active Regions"
667 (if (eq interprogram-cut-function 'own-clipboard)
668 (progn
669 (customize-set-variable 'interprogram-cut-function nil)
670 (customize-set-variable 'interprogram-paste-function nil))
671 (customize-set-variable 'interprogram-cut-function 'own-clipboard)
672 (customize-set-variable 'interprogram-paste-function 'get-clipboard))
673 :style toggle
674 :selected (eq interprogram-cut-function 'own-clipboard)]
675 ["%_Overstrike"
676 (progn
677 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
678 (customize-set-variable 'overwrite-mode overwrite-mode))
679 :style toggle :selected overwrite-mode]
680 ("`%_kill-line' Behavior..."
681 ["Kill %_Whole Line"
682 (customize-set-variable 'kill-whole-line 'always)
683 :style radio :selected (eq kill-whole-line 'always)]
684 ["Kill to %_End of Line"
685 (customize-set-variable 'kill-whole-line nil)
686 :style radio :selected (eq kill-whole-line nil)]
687 ["Kill Whole Line at %_Beg, Otherwise to End"
688 (customize-set-variable 'kill-whole-line t)
689 :style radio :selected (eq kill-whole-line t)])
690 ["Size for %_Block-Movement Commands..."
691 (customize-set-variable 'block-movement-size
692 (read-number "Block Movement Size: "
693 t block-movement-size))]
694 ["%_VI Emulation"
695 (progn
696 (toggle-viper-mode)
697 (customize-set-variable 'viper-mode viper-mode))
698 :style toggle :selected (and (boundp 'viper-mode) viper-mode)
699 :active (fboundp 'toggle-viper-mode)]
700 ["Active Re%_gions"
701 (customize-set-variable 'zmacs-regions (not zmacs-regions)) 273 (customize-set-variable 'zmacs-regions (not zmacs-regions))
702 :style toggle :selected zmacs-regions] 274 :style toggle :selected zmacs-regions]
703 "----" 275 ["Mouse Paste At Text Cursor"
704 ["%_Set Key..." global-set-key] 276 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
705 ["%_Unset Key..." global-unset-key] 277 :style toggle :selected mouse-yank-at-point]
706 "---" 278 ("Newline at end of file..."
707 ["%_Case Sensitive Search" 279 ["Don't require"
708 (customize-set-variable 'case-fold-search
709 (setq case-fold-search (not case-fold-search)))
710 :style toggle :selected (not case-fold-search)]
711 ["Case Matching %_Replace"
712 (customize-set-variable 'case-replace (not case-replace))
713 :style toggle :selected case-replace]
714 "---"
715 ("%_Newline at End of File..."
716 ["%_Don't Require"
717 (customize-set-variable 'require-final-newline nil) 280 (customize-set-variable 'require-final-newline nil)
718 :style radio :selected (not require-final-newline)] 281 :style radio :selected (not require-final-newline)]
719 ["%_Require" 282 ["Require"
720 (customize-set-variable 'require-final-newline t) 283 (customize-set-variable 'require-final-newline t)
721 :style radio :selected (eq require-final-newline t)] 284 :style radio :selected (eq require-final-newline t)]
722 ["%_Ask" 285 ["Ask"
723 (customize-set-variable 'require-final-newline 'ask) 286 (customize-set-variable 'require-final-newline 'ask)
724 :style radio :selected (and require-final-newline 287 :style radio :selected (and require-final-newline
725 (not (eq require-final-newline t)))]) 288 (not (eq require-final-newline t)))])
726 ["Add Newline When Moving Past %_End" 289 ["Add Newline When Moving Past End"
727 (customize-set-variable 'next-line-add-newlines 290 (customize-set-variable 'next-line-add-newlines
728 (not next-line-add-newlines)) 291 (not next-line-add-newlines))
729 :style toggle :selected next-line-add-newlines] 292 :style toggle :selected next-line-add-newlines]
730 "---"
731 ["%_Mouse Paste at Text Cursor"
732 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
733 :style toggle :selected mouse-yank-at-point]
734 ["A%_void Text..."
735 (customize-set-variable 'mouse-avoidance-mode
736 (if mouse-avoidance-mode nil 'banish))
737 :style toggle
738 :selected (and (boundp 'mouse-avoidance-mode) mouse-avoidance-mode)
739 :active (and (boundp 'mouse-avoidance-mode)
740 (device-on-window-system-p))]
741 ["%_Strokes Mode"
742 (customize-set-variable 'strokes-mode (not strokes-mode))
743 :style toggle
744 :selected (and (boundp 'strokes-mode) strokes-mode)
745 :active (and (boundp 'strokes-mode)
746 (device-on-window-system-p))]
747 ) 293 )
748 ("%_General" 294 ("General Options"
749 ["This Buffer %_Read Only" (toggle-read-only) 295 ["Teach Extended Commands"
750 :style toggle :selected buffer-read-only]
751 ["%_Teach Extended Commands"
752 (customize-set-variable 'teach-extended-commands-p 296 (customize-set-variable 'teach-extended-commands-p
753 (not teach-extended-commands-p)) 297 (not teach-extended-commands-p))
754 :style toggle :selected teach-extended-commands-p] 298 :style toggle :selected teach-extended-commands-p]
755 ["Debug on %_Error" 299 ["Debug On Error"
756 (customize-set-variable 'debug-on-error (not debug-on-error)) 300 (customize-set-variable 'debug-on-error (not debug-on-error))
757 :style toggle :selected debug-on-error] 301 :style toggle :selected debug-on-error]
758 ["Debug on %_Quit" 302 ["Debug On Quit"
759 (customize-set-variable 'debug-on-quit (not debug-on-quit)) 303 (customize-set-variable 'debug-on-quit (not debug-on-quit))
760 :style toggle :selected debug-on-quit] 304 :style toggle :selected debug-on-quit]
761 ["Debug on %_Signal"
762 (customize-set-variable 'debug-on-signal (not debug-on-signal))
763 :style toggle :selected debug-on-signal]
764 ) 305 )
765 306 ("Printing Options"
766 ("%_Printing" 307 ["Command-Line Switches for `lpr'/`lp'..."
767 ["Set Printer %_Name for Generic Print Support..."
768 (customize-set-variable
769 'printer-name
770 (read-string "Set printer name: " printer-name))]
771 "---"
772 ["Command-Line %_Switches for `lpr'/`lp'..."
773 ;; better to directly open a customization buffer, since the value 308 ;; better to directly open a customization buffer, since the value
774 ;; must be a list of strings, which is somewhat complex to prompt for. 309 ;; must be a list of strings, which is somewhat complex to prompt for.
775 (customize-variable 'lpr-switches) 310 (customize-variable 'lpr-switches)
776 (boundp 'lpr-switches)] 311 (boundp 'lpr-switches)]
777 ("%_Pretty-Print Paper Size" 312 ("Pretty-Print Paper Size"
778 ["%_Letter" 313 ["Letter"
779 (customize-set-variable 'ps-paper-type 'letter) 314 (customize-set-variable 'ps-paper-type 'letter)
780 :style radio 315 :style radio
781 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter)) 316 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
782 :active (boundp 'ps-paper-type)] 317 :active (boundp 'ps-paper-type)]
783 ["Lette%_r-Small" 318 ["Letter-small"
784 (customize-set-variable 'ps-paper-type 'letter-small) 319 (customize-set-variable 'ps-paper-type 'letter-small)
785 :style radio 320 :style radio
786 :selected (and (boundp 'ps-paper-type) 321 :selected (and (boundp 'ps-paper-type)
787 (eq ps-paper-type 'letter-small)) 322 (eq ps-paper-type 'letter-small))
788 :active (boundp 'ps-paper-type)] 323 :active (boundp 'ps-paper-type)]
789 ["Le%_gal" 324 ["Legal"
790 (customize-set-variable 'ps-paper-type 'legal) 325 (customize-set-variable 'ps-paper-type 'legal)
791 :style radio 326 :style radio
792 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal)) 327 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
793 :active (boundp 'ps-paper-type)] 328 :active (boundp 'ps-paper-type)]
794 ["%_Statement" 329 ["Statement"
795 (customize-set-variable 'ps-paper-type 'statement) 330 (customize-set-variable 'ps-paper-type 'statement)
796 :style radio 331 :style radio
797 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement)) 332 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
798 :active (boundp 'ps-paper-type)] 333 :active (boundp 'ps-paper-type)]
799 ["%_Executive" 334 ["Executive"
800 (customize-set-variable 'ps-paper-type 'executive) 335 (customize-set-variable 'ps-paper-type 'executive)
801 :style radio 336 :style radio
802 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive)) 337 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
803 :active (boundp 'ps-paper-type)] 338 :active (boundp 'ps-paper-type)]
804 ["%_Tabloid" 339 ["Tabloid"
805 (customize-set-variable 'ps-paper-type 'tabloid) 340 (customize-set-variable 'ps-paper-type 'tabloid)
806 :style radio 341 :style radio
807 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid)) 342 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
808 :active (boundp 'ps-paper-type)] 343 :active (boundp 'ps-paper-type)]
809 ["Le%_dger" 344 ["Ledger"
810 (customize-set-variable 'ps-paper-type 'ledger) 345 (customize-set-variable 'ps-paper-type 'ledger)
811 :style radio 346 :style radio
812 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger)) 347 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
813 :active (boundp 'ps-paper-type)] 348 :active (boundp 'ps-paper-type)]
814 ["A%_3" 349 ["A3"
815 (customize-set-variable 'ps-paper-type 'a3) 350 (customize-set-variable 'ps-paper-type 'a3)
816 :style radio 351 :style radio
817 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3)) 352 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
818 :active (boundp 'ps-paper-type)] 353 :active (boundp 'ps-paper-type)]
819 ["%_A4" 354 ["A4"
820 (customize-set-variable 'ps-paper-type 'a4) 355 (customize-set-variable 'ps-paper-type 'a4)
821 :style radio 356 :style radio
822 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4)) 357 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
823 :active (boundp 'ps-paper-type)] 358 :active (boundp 'ps-paper-type)]
824 ["A4s%_mall" 359 ["A4small"
825 (customize-set-variable 'ps-paper-type 'a4small) 360 (customize-set-variable 'ps-paper-type 'a4small)
826 :style radio 361 :style radio
827 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small)) 362 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
828 :active (boundp 'ps-paper-type)] 363 :active (boundp 'ps-paper-type)]
829 ["B%_4" 364 ["B4"
830 (customize-set-variable 'ps-paper-type 'b4) 365 (customize-set-variable 'ps-paper-type 'b4)
831 :style radio 366 :style radio
832 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4)) 367 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
833 :active (boundp 'ps-paper-type)] 368 :active (boundp 'ps-paper-type)]
834 ["%_B5" 369 ["B5"
835 (customize-set-variable 'ps-paper-type 'b5) 370 (customize-set-variable 'ps-paper-type 'b5)
836 :style radio 371 :style radio
837 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5)) 372 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
838 :active (boundp 'ps-paper-type)] 373 :active (boundp 'ps-paper-type)]
839 ) 374 )
840 ["%_Color Printing" 375 ["Color Printing"
841 (cond (ps-print-color-p 376 (cond (ps-print-color-p
842 (customize-set-variable 'ps-print-color-p nil) 377 (customize-set-variable 'ps-print-color-p nil)
843 ;; I'm wondering whether all this muck is useful. 378 ;; I'm wondering whether all this muck is usefull.
844 (and (boundp 'original-face-background) 379 (and (boundp 'original-face-background)
845 original-face-background 380 original-face-background
846 (set-face-background 'default original-face-background))) 381 (set-face-background 'default original-face-background)))
847 (t 382 (t
848 (customize-set-variable 'ps-print-color-p t) 383 (customize-set-variable 'ps-print-color-p t)
850 (face-background-instance 'default)) 385 (face-background-instance 'default))
851 (set-face-background 'default "white"))) 386 (set-face-background 'default "white")))
852 :style toggle 387 :style toggle
853 :selected (and (boundp 'ps-print-color-p) ps-print-color-p) 388 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
854 :active (boundp 'ps-print-color-p)]) 389 :active (boundp 'ps-print-color-p)])
855 ("%_Internet" 390 ("\"Other Window\" Location"
856 ("%_Compose Mail With" 391 ["Always in Same Frame"
857 ["Default Emacs Mailer"
858 (customize-set-variable 'mail-user-agent 'sendmail-user-agent)
859 :style radio
860 :selected (eq mail-user-agent 'sendmail-user-agent)]
861 ["MH"
862 (customize-set-variable 'mail-user-agent 'mh-e-user-agent)
863 :style radio
864 :selected (eq mail-user-agent 'mh-e-user-agent)
865 :active (get 'mh-e-user-agent 'composefunc)]
866 ["GNUS"
867 (customize-set-variable 'mail-user-agent 'message-user-agent)
868 :style radio
869 :selected (eq mail-user-agent 'message-user-agent)
870 :active (get 'message-user-agent 'composefunc)]
871 )
872 ["Set My %_Email Address..."
873 (customize-set-variable 392 (customize-set-variable
874 'user-mail-address 393 'get-frame-for-buffer-default-instance-limit nil)
875 (read-string "Set email address: " user-mail-address))] 394 :style radio
876 ["Set %_Machine Email Name..." 395 :selected (null get-frame-for-buffer-default-instance-limit)]
877 (customize-set-variable 396 ["Other Frame (2 Frames Max)"
878 'mail-host-address 397 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 2)
879 (read-string "Set machine email name: " mail-host-address))] 398 :style radio
880 ["Set %_SMTP Server..." 399 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
881 (progn 400 ["Other Frame (3 Frames Max)"
882 (require 'smtpmail) 401 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 3)
883 (customize-set-variable 402 :style radio
884 'smtpmail-smtp-server 403 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
885 (read-string "Set SMTP server: " smtpmail-smtp-server))) 404 ["Other Frame (4 Frames Max)"
886 :active (and (boundp 'send-mail-function) 405 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 4)
887 (eq send-mail-function 'smtpmail-send-it))] 406 :style radio
888 ["SMTP %_Debug Info" 407 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
889 (progn 408 ["Other Frame (5 Frames Max)"
890 (require 'smtpmail) 409 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 5)
891 (customize-set-variable 'smtpmail-debug-info 410 :style radio
892 (not smtpmail-debug-info))) 411 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
412 ["Always Create New Frame"
413 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 0)
414 :style radio
415 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
416 "-----"
417 ["Temp Buffers Always in Same Frame"
418 (customize-set-variable 'temp-buffer-show-function
419 'show-temp-buffer-in-current-frame)
420 :style radio
421 :selected (eq temp-buffer-show-function
422 'show-temp-buffer-in-current-frame)]
423 ["Temp Buffers Like Other Buffers"
424 (customize-set-variable 'temp-buffer-show-function nil)
425 :style radio
426 :selected (null temp-buffer-show-function)]
427 "-----"
428 ["Make current frame gnuserv target"
429 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil t))
893 :style toggle 430 :style toggle
894 :selected (and (boundp 'smtpmail-debug-info) smtpmail-debug-info) 431 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
895 :active (and (boundp 'send-mail-function) 432 :active (boundp 'gnuserv-frame)]
896 (eq send-mail-function 'smtpmail-send-it))] 433 )
897 "---"
898 ("%_Open URLs With"
899 ["%_Emacs-W3"
900 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
901 :style radio
902 :selected (and (boundp 'browse-url-browser-function)
903 (eq browse-url-browser-function 'browse-url-w3))
904 :active (and (boundp 'browse-url-browser-function)
905 (fboundp 'browse-url-w3)
906 (fboundp 'w3-fetch))]
907 ["%_Netscape"
908 (customize-set-variable 'browse-url-browser-function
909 'browse-url-netscape)
910 :style radio
911 :selected (and (boundp 'browse-url-browser-function)
912 (eq browse-url-browser-function 'browse-url-netscape))
913 :active (and (boundp 'browse-url-browser-function)
914 (fboundp 'browse-url-netscape))]
915 ["%_Mosaic"
916 (customize-set-variable 'browse-url-browser-function
917 'browse-url-mosaic)
918 :style radio
919 :selected (and (boundp 'browse-url-browser-function)
920 (eq browse-url-browser-function 'browse-url-mosaic))
921 :active (and (boundp 'browse-url-browser-function)
922 (fboundp 'browse-url-mosaic))]
923 ["Mosaic (%_CCI)"
924 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
925 :style radio
926 :selected (and (boundp 'browse-url-browser-function)
927 (eq browse-url-browser-function 'browse-url-cci))
928 :active (and (boundp 'browse-url-browser-function)
929 (fboundp 'browse-url-cci))]
930 ["%_IXI Mosaic"
931 (customize-set-variable 'browse-url-browser-function
932 'browse-url-iximosaic)
933 :style radio
934 :selected (and (boundp 'browse-url-browser-function)
935 (eq browse-url-browser-function 'browse-url-iximosaic))
936 :active (and (boundp 'browse-url-browser-function)
937 (fboundp 'browse-url-iximosaic))]
938 ["%_Lynx (xterm)"
939 (customize-set-variable 'browse-url-browser-function
940 'browse-url-lynx-xterm)
941 :style radio
942 :selected (and (boundp 'browse-url-browser-function)
943 (eq browse-url-browser-function 'browse-url-lynx-xterm))
944 :active (and (boundp 'browse-url-browser-function)
945 (fboundp 'browse-url-lynx-xterm))]
946 ["L%_ynx (xemacs)"
947 (customize-set-variable 'browse-url-browser-function
948 'browse-url-lynx-emacs)
949 :style radio
950 :selected (and (boundp 'browse-url-browser-function)
951 (eq browse-url-browser-function 'browse-url-lynx-emacs))
952 :active (and (boundp 'browse-url-browser-function)
953 (fboundp 'browse-url-lynx-emacs))]
954 ["%_Grail"
955 (customize-set-variable 'browse-url-browser-function
956 'browse-url-grail)
957 :style radio
958 :selected (and (boundp 'browse-url-browser-function)
959 (eq browse-url-browser-function 'browse-url-grail))
960 :active (and (boundp 'browse-url-browser-function)
961 (fboundp 'browse-url-grail))]
962 ["%_Kfm"
963 (customize-set-variable 'browse-url-browser-function
964 'browse-url-kfm)
965 :style radio
966 :selected (and (boundp 'browse-url-browser-function)
967 (eq browse-url-browser-function 'browse-url-kfm))
968 :active (and (boundp 'browse-url-browser-function)
969 (fboundp 'browse-url-kfm))]
970 ))
971
972
973 "-----" 434 "-----"
974 ("Display" 435 ("Syntax Highlighting"
975 ,@(if (featurep 'scrollbar) 436 ["In This Buffer"
976 '(["%_Scrollbars" 437 (progn ;; becomes buffer local
977 (customize-set-variable 'scrollbars-visible-p
978 (not scrollbars-visible-p))
979 :style toggle
980 :selected scrollbars-visible-p]))
981 ;; I don't think this is of any interest. - dverna apr. 98
982 ;; #### I beg to differ! Many FSFmacs converts hate the 3D
983 ;; modeline, and it was perfectly fine to be able to turn them
984 ;; off through the Options menu. I would have uncommented this
985 ;; source, but the code for saving options would not save the
986 ;; modeline 3D-ness. Grrr. --hniksic
987 ;; ["%_3D Modeline"
988 ;; (progn
989 ;; (if (zerop (specifier-instance modeline-shadow-thickness))
990 ;; (set-specifier modeline-shadow-thickness 2)
991 ;; (set-specifier modeline-shadow-thickness 0))
992 ;; (redraw-modeline t))
993 ;; :style toggle
994 ;; :selected (let ((thickness
995 ;; (specifier-instance modeline-shadow-thickness)))
996 ;; (and (integerp thickness)
997 ;; (> thickness 0)))]
998 ["%_Truncate Lines"
999 (progn;; becomes buffer-local
1000 (setq truncate-lines (not truncate-lines))
1001 (customize-set-variable 'truncate-lines truncate-lines))
1002 :style toggle
1003 :selected truncate-lines]
1004 ["%_Blinking Cursor"
1005 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
1006 :style toggle
1007 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
1008 :active (boundp 'blink-cursor-mode)]
1009 "-----"
1010 ["Bl%_ock Cursor"
1011 (progn
1012 (customize-set-variable 'bar-cursor nil)
1013 (force-cursor-redisplay))
1014 :style radio
1015 :selected (null bar-cursor)]
1016 ["Bar Cursor (%_1 Pixel)"
1017 (progn
1018 (customize-set-variable 'bar-cursor t)
1019 (force-cursor-redisplay))
1020 :style radio
1021 :selected (eq bar-cursor t)]
1022 ["Bar Cursor (%_2 Pixels)"
1023 (progn
1024 (customize-set-variable 'bar-cursor 2)
1025 (force-cursor-redisplay))
1026 :style radio
1027 :selected (and bar-cursor (not (eq bar-cursor t)))]
1028 "------"
1029 ["%_Line Numbers"
1030 (progn
1031 (customize-set-variable 'line-number-mode (not line-number-mode))
1032 (redraw-modeline))
1033 :style toggle :selected line-number-mode]
1034 ["%_Column Numbers"
1035 (progn
1036 (customize-set-variable 'column-number-mode
1037 (not column-number-mode))
1038 (redraw-modeline))
1039 :style toggle :selected column-number-mode]
1040
1041 ("\"Other %_Window\" Location"
1042 ["%_Always in Same Frame"
1043 (customize-set-variable
1044 'get-frame-for-buffer-default-instance-limit nil)
1045 :style radio
1046 :selected (null get-frame-for-buffer-default-instance-limit)]
1047 ["Other Frame (%_2 Frames Max)"
1048 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 2)
1049 :style radio
1050 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
1051 ["Other Frame (%_3 Frames Max)"
1052 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 3)
1053 :style radio
1054 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
1055 ["Other Frame (%_4 Frames Max)"
1056 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 4)
1057 :style radio
1058 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
1059 ["Other Frame (%_5 Frames Max)"
1060 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 5)
1061 :style radio
1062 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
1063 ["Always Create %_New Frame"
1064 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 0)
1065 :style radio
1066 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
1067 "-----"
1068 ["%_Temp Buffers Always in Same Frame"
1069 (customize-set-variable 'temp-buffer-show-function
1070 'show-temp-buffer-in-current-frame)
1071 :style radio
1072 :selected (eq temp-buffer-show-function
1073 'show-temp-buffer-in-current-frame)]
1074 ["Temp Buffers %_Like Other Buffers"
1075 (customize-set-variable 'temp-buffer-show-function nil)
1076 :style radio
1077 :selected (null temp-buffer-show-function)]
1078 "-----"
1079 ["%_Make Current Frame Gnuserv Target"
1080 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil t))
1081 :style toggle
1082 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
1083 :active (boundp 'gnuserv-frame)]
1084 )
1085 )
1086 ("%_Menubars"
1087 ["%_Frame-Local Font Menu"
1088 (customize-set-variable 'font-menu-this-frame-only-p
1089 (not font-menu-this-frame-only-p))
1090 :style toggle
1091 :selected (and (boundp 'font-menu-this-frame-only-p)
1092 font-menu-this-frame-only-p)]
1093 ["%_Alt/Meta Selects Menu Items"
1094 (if (eq menu-accelerator-enabled 'menu-force)
1095 (customize-set-variable 'menu-accelerator-enabled nil)
1096 (customize-set-variable 'menu-accelerator-enabled 'menu-force))
1097 :style toggle
1098 :selected (eq menu-accelerator-enabled 'menu-force)]
1099 "----"
1100 ["Buffers Menu %_Length..."
1101 (customize-set-variable
1102 'buffers-menu-max-size
1103 ;; would it be better to open a customization buffer ?
1104 (let ((val
1105 (read-number
1106 "Enter number of buffers to display (or 0 for unlimited): ")))
1107 (if (eq val 0) nil val)))]
1108 ["%_Multi-Operation Buffers Sub-Menus"
1109 (customize-set-variable 'complex-buffers-menu-p
1110 (not complex-buffers-menu-p))
1111 :style toggle
1112 :selected complex-buffers-menu-p]
1113 ["S%_ubmenus for Buffer Groups"
1114 (customize-set-variable 'buffers-menu-submenus-for-groups-p
1115 (not buffers-menu-submenus-for-groups-p))
1116 :style toggle
1117 :selected buffers-menu-submenus-for-groups-p]
1118 ["%_Verbose Buffer Menu Entries"
1119 (if (eq buffers-menu-format-buffer-line-function
1120 'slow-format-buffers-menu-line)
1121 (customize-set-variable 'buffers-menu-format-buffer-line-function
1122 'format-buffers-menu-line)
1123 (customize-set-variable 'buffers-menu-format-buffer-line-function
1124 'slow-format-buffers-menu-line))
1125 :style toggle
1126 :selected (eq buffers-menu-format-buffer-line-function
1127 'slow-format-buffers-menu-line)]
1128 ("Buffers Menu %_Sorting"
1129 ["%_Most Recently Used"
1130 (progn
1131 (customize-set-variable 'buffers-menu-sort-function nil)
1132 (customize-set-variable 'buffers-menu-grouping-function nil))
1133 :style radio
1134 :selected (null buffers-menu-sort-function)]
1135 ["%_Alphabetically"
1136 (progn
1137 (customize-set-variable 'buffers-menu-sort-function
1138 'sort-buffers-menu-alphabetically)
1139 (customize-set-variable 'buffers-menu-grouping-function nil))
1140 :style radio
1141 :selected (eq 'sort-buffers-menu-alphabetically
1142 buffers-menu-sort-function)]
1143 ["%_By Major Mode, Then Alphabetically"
1144 (progn
1145 (customize-set-variable
1146 'buffers-menu-sort-function
1147 'sort-buffers-menu-by-mode-then-alphabetically)
1148 (customize-set-variable
1149 'buffers-menu-grouping-function
1150 'group-buffers-menu-by-mode-then-alphabetically))
1151 :style radio
1152 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
1153 buffers-menu-sort-function)])
1154 "---"
1155 ["%_Ignore Scaled Fonts"
1156 (customize-set-variable 'font-menu-ignore-scaled-fonts
1157 (not font-menu-ignore-scaled-fonts))
1158 :style toggle
1159 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
1160 font-menu-ignore-scaled-fonts)]
1161 )
1162 ,@(if (featurep 'toolbar)
1163 '(("%_Toolbars"
1164 ["%_Visible"
1165 (customize-set-variable 'toolbar-visible-p
1166 (not toolbar-visible-p))
1167 :style toggle
1168 :selected toolbar-visible-p]
1169 ["%_Captioned"
1170 (customize-set-variable 'toolbar-captioned-p
1171 (not toolbar-captioned-p))
1172 :style toggle
1173 :selected toolbar-captioned-p]
1174 ("%_Default Location"
1175 ["%_Top"
1176 (customize-set-variable 'default-toolbar-position 'top)
1177 :style radio
1178 :selected (eq default-toolbar-position 'top)]
1179 ["%_Bottom"
1180 (customize-set-variable 'default-toolbar-position 'bottom)
1181 :style radio
1182 :selected (eq default-toolbar-position 'bottom)]
1183 ["%_Left"
1184 (customize-set-variable 'default-toolbar-position 'left)
1185 :style radio
1186 :selected (eq default-toolbar-position 'left)]
1187 ["%_Right"
1188 (customize-set-variable 'default-toolbar-position 'right)
1189 :style radio
1190 :selected (eq default-toolbar-position 'right)]
1191 )
1192 )))
1193 ,@(if (featurep 'gutter)
1194 '(("G%_utters"
1195 ["Buffers Tab %_Visible"
1196 (customize-set-variable 'gutter-buffers-tab-visible-p
1197 (not gutter-buffers-tab-visible-p))
1198 :style toggle
1199 :selected gutter-buffers-tab-visible-p]
1200 ("%_Default Location"
1201 ["%_Top"
1202 (customize-set-variable 'default-gutter-position 'top)
1203 :style radio
1204 :selected (eq default-gutter-position 'top)]
1205 ["%_Bottom"
1206 (customize-set-variable 'default-gutter-position 'bottom)
1207 :style radio
1208 :selected (eq default-gutter-position 'bottom)]
1209 ["%_Left"
1210 (customize-set-variable 'default-gutter-position 'left)
1211 :style radio
1212 :selected (eq default-gutter-position 'left)]
1213 ["%_Right"
1214 (customize-set-variable 'default-gutter-position 'right)
1215 :style radio
1216 :selected (eq default-gutter-position 'right)]
1217 )
1218 )))
1219 "-----"
1220 ("S%_yntax Highlighting"
1221 ["%_In This Buffer"
1222 (progn;; becomes buffer local
1223 (font-lock-mode) 438 (font-lock-mode)
1224 (customize-set-variable 'font-lock-mode font-lock-mode)) 439 (customize-set-variable 'font-lock-mode font-lock-mode))
1225 :style toggle 440 :style toggle
1226 :selected (and (boundp 'font-lock-mode) font-lock-mode) 441 :selected (and (boundp 'font-lock-mode) font-lock-mode)
1227 :active (boundp 'font-lock-mode)] 442 :active (boundp 'font-lock-mode)]
1228 ["%_Automatic" 443 ["Automatic"
1229 (customize-set-variable 'font-lock-auto-fontify 444 (customize-set-variable 'font-lock-auto-fontify
1230 (not font-lock-auto-fontify)) 445 (not font-lock-auto-fontify))
1231 :style toggle 446 :style toggle
1232 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify) 447 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1233 :active (fboundp 'font-lock-mode)] 448 :active (fboundp 'font-lock-mode)]
1234 "-----" 449 "-----"
1235 ["%_Fonts" 450 ["Fonts"
1236 (progn 451 (progn
1237 (require 'font-lock) 452 (require 'font-lock)
1238 (font-lock-use-default-fonts) 453 (font-lock-use-default-fonts)
1239 (customize-set-variable 'font-lock-use-fonts t) 454 (customize-set-variable 'font-lock-use-fonts t)
1240 (customize-set-variable 'font-lock-use-colors nil) 455 (customize-set-variable 'font-lock-use-colors nil)
1241 (font-lock-mode 1)) 456 (font-lock-mode 1))
1242 :style radio 457 :style radio
1243 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts) 458 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
1244 :active (fboundp 'font-lock-mode)] 459 :active (fboundp 'font-lock-mode)]
1245 ["%_Colors" 460 ["Colors"
1246 (progn 461 (progn
1247 (require 'font-lock) 462 (require 'font-lock)
1248 (font-lock-use-default-colors) 463 (font-lock-use-default-colors)
1249 (customize-set-variable 'font-lock-use-colors t) 464 (customize-set-variable 'font-lock-use-colors t)
1250 (customize-set-variable 'font-lock-use-fonts nil) 465 (customize-set-variable 'font-lock-use-fonts nil)
1251 (font-lock-mode 1)) 466 (font-lock-mode 1))
1252 :style radio 467 :style radio
1253 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors) 468 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
1254 :active (boundp 'font-lock-mode)] 469 :active (boundp 'font-lock-mode)]
1255 "-----" 470 "-----"
1256 ["%_Least" 471 ["Least"
1257 (progn 472 (progn
1258 (require 'font-lock) 473 (require 'font-lock)
1259 (if (or (and (not (integerp font-lock-maximum-decoration)) 474 (if (or (and (not (integerp font-lock-maximum-decoration))
1260 (not (eq t font-lock-maximum-decoration))) 475 (not (eq t font-lock-maximum-decoration)))
1261 (and (integerp font-lock-maximum-decoration) 476 (and (integerp font-lock-maximum-decoration)
1268 :selected (and (boundp 'font-lock-maximium-decoration) 483 :selected (and (boundp 'font-lock-maximium-decoration)
1269 (or (and (not (integerp font-lock-maximum-decoration)) 484 (or (and (not (integerp font-lock-maximum-decoration))
1270 (not (eq t font-lock-maximum-decoration))) 485 (not (eq t font-lock-maximum-decoration)))
1271 (and (integerp font-lock-maximum-decoration) 486 (and (integerp font-lock-maximum-decoration)
1272 (<= font-lock-maximum-decoration 0))))] 487 (<= font-lock-maximum-decoration 0))))]
1273 ["M%_ore" 488 ["More"
1274 (progn 489 (progn
1275 (require 'font-lock) 490 (require 'font-lock)
1276 (if (and (integerp font-lock-maximum-decoration) 491 (if (and (integerp font-lock-maximum-decoration)
1277 (= 1 font-lock-maximum-decoration)) 492 (= 1 font-lock-maximum-decoration))
1278 nil 493 nil
1281 :style radio 496 :style radio
1282 :active (fboundp 'font-lock-mode) 497 :active (fboundp 'font-lock-mode)
1283 :selected (and (boundp 'font-lock-maximium-decoration) 498 :selected (and (boundp 'font-lock-maximium-decoration)
1284 (integerp font-lock-maximum-decoration) 499 (integerp font-lock-maximum-decoration)
1285 (= 1 font-lock-maximum-decoration))] 500 (= 1 font-lock-maximum-decoration))]
1286 ["%_Even More" 501 ["Even More"
1287 (progn 502 (progn
1288 (require 'font-lock) 503 (require 'font-lock)
1289 (if (and (integerp font-lock-maximum-decoration) 504 (if (and (integerp font-lock-maximum-decoration)
1290 (= 2 font-lock-maximum-decoration)) 505 (= 2 font-lock-maximum-decoration))
1291 nil 506 nil
1294 :style radio 509 :style radio
1295 :active (fboundp 'font-lock-mode) 510 :active (fboundp 'font-lock-mode)
1296 :selected (and (boundp 'font-lock-maximum-decoration) 511 :selected (and (boundp 'font-lock-maximum-decoration)
1297 (integerp font-lock-maximum-decoration) 512 (integerp font-lock-maximum-decoration)
1298 (= 2 font-lock-maximum-decoration))] 513 (= 2 font-lock-maximum-decoration))]
1299 ["%_Most" 514 ["Most"
1300 (progn 515 (progn
1301 (require 'font-lock) 516 (require 'font-lock)
1302 (if (or (eq font-lock-maximum-decoration t) 517 (if (or (eq font-lock-maximum-decoration t)
1303 (and (integerp font-lock-maximum-decoration) 518 (and (integerp font-lock-maximum-decoration)
1304 (>= font-lock-maximum-decoration 3))) 519 (>= font-lock-maximum-decoration 3)))
1310 :selected (and (boundp 'font-lock-maximum-decoration) 525 :selected (and (boundp 'font-lock-maximum-decoration)
1311 (or (eq font-lock-maximum-decoration t) 526 (or (eq font-lock-maximum-decoration t)
1312 (and (integerp font-lock-maximum-decoration) 527 (and (integerp font-lock-maximum-decoration)
1313 (>= font-lock-maximum-decoration 3))))] 528 (>= font-lock-maximum-decoration 3))))]
1314 "-----" 529 "-----"
1315 ["La%_zy" 530 ["Lazy"
1316 (progn;; becomes buffer local 531 (progn ;; becomes buffer local
1317 (lazy-shot-mode) 532 (lazy-shot-mode)
1318 (customize-set-variable 'lazy-shot-mode lazy-shot-mode) 533 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
1319 ;; this shouldn't be necessary so there has to 534 ;; this shouldn't be necessary so there has to
1320 ;; be a redisplay bug lurking somewhere (or 535 ;; be a redisplay bug lurking somewhere (or
1321 ;; possibly another event handler bug) 536 ;; possibly another event handler bug)
1322 (redraw-modeline)) 537 (redraw-modeline))
1323 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode) 538 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
1324 font-lock-mode) 539 font-lock-mode)
1325 :style toggle 540 :style toggle
1326 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)] 541 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
1327 ["Cac%_hing" 542 ["Caching"
1328 (progn;; becomes buffer local 543 (progn ;; becomes buffer local
1329 (fast-lock-mode) 544 (fast-lock-mode)
1330 (customize-set-variable 'fast-lock-mode fast-lock-mode) 545 (customize-set-variable 'fast-lock-mode fast-lock-mode)
1331 ;; this shouldn't be necessary so there has to 546 ;; this shouldn't be necessary so there has to
1332 ;; be a redisplay bug lurking somewhere (or 547 ;; be a redisplay bug lurking somewhere (or
1333 ;; possibly another event handler bug) 548 ;; possibly another event handler bug)
1335 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode) 550 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
1336 font-lock-mode) 551 font-lock-mode)
1337 :style toggle 552 :style toggle
1338 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)] 553 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
1339 ) 554 )
1340 ("Pa%_ren Highlighting" 555 ("Paren Highlighting"
1341 ["%_None" 556 ["None"
1342 (customize-set-variable 'paren-mode nil) 557 (customize-set-variable 'paren-mode nil)
1343 :style radio 558 :style radio
1344 :selected (and (boundp 'paren-mode) (not paren-mode)) 559 :selected (and (boundp 'paren-mode) (not paren-mode))
1345 :active (boundp 'paren-mode)] 560 :active (boundp 'paren-mode)]
1346 ["%_Blinking Paren" 561 ["Blinking Paren"
1347 (customize-set-variable 'paren-mode 'blink-paren) 562 (customize-set-variable 'paren-mode 'blink-paren)
1348 :style radio 563 :style radio
1349 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren)) 564 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
1350 :active (boundp 'paren-mode)] 565 :active (boundp 'paren-mode)]
1351 ["%_Steady Paren" 566 ["Steady Paren"
1352 (customize-set-variable 'paren-mode 'paren) 567 (customize-set-variable 'paren-mode 'paren)
1353 :style radio 568 :style radio
1354 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren)) 569 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
1355 :active (boundp 'paren-mode)] 570 :active (boundp 'paren-mode)]
1356 ["%_Expression" 571 ["Expression"
1357 (customize-set-variable 'paren-mode 'sexp) 572 (customize-set-variable 'paren-mode 'sexp)
1358 :style radio 573 :style radio
1359 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp)) 574 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
1360 :active (boundp 'paren-mode)] 575 :active (boundp 'paren-mode)]
1361 ;; ["Nes%_ted Shading" 576 ;; ["Nested Shading"
1362 ;; (customize-set-variable 'paren-mode 'nested) 577 ;; (customize-set-variable 'paren-mode 'nested)
1363 ;; :style radio 578 ;; :style radio
1364 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested)) 579 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
1365 ;; :active (boundp 'paren-mode)] 580 ;; :active (boundp 'paren-mode)]
1366 ) 581 )
1367 "-----" 582 "-----"
1368 ["Edit Fa%_ces..." (customize-face nil)] 583 ("Frame Appearance"
1369 ("Fo%_nt" :filter font-menu-family-constructor) 584 ["Frame-Local Font Menu"
1370 ("Si%_ze" :filter font-menu-size-constructor) 585 (customize-set-variable 'font-menu-this-frame-only-p
1371 ;; ("Weig%_ht" :filter font-menu-weight-constructor) 586 (not font-menu-this-frame-only-p))
587 :style toggle
588 :selected (and (boundp 'font-menu-this-frame-only-p)
589 font-menu-this-frame-only-p)]
590 ,@(if (featurep 'scrollbar)
591 '(["Scrollbars"
592 (customize-set-variable 'scrollbars-visible-p
593 (not scrollbars-visible-p))
594 :style toggle
595 :selected scrollbars-visible-p]))
596 ;; I don't think this is of any interest. - dverna apr. 98
597 ;; #### I beg to differ! Many FSFmacs converts hate the 3D
598 ;; modeline, and it was perfectly fine to be able to turn them
599 ;; off through the Options menu. I would have uncommented this
600 ;; source, but the code for saving options would not save the
601 ;; modeline 3D-ness. Grrr. --hniksic
602 ;; ["3D Modeline"
603 ;; (progn
604 ;; (if (zerop (specifier-instance modeline-shadow-thickness))
605 ;; (set-specifier modeline-shadow-thickness 2)
606 ;; (set-specifier modeline-shadow-thickness 0))
607 ;; (redraw-modeline t))
608 ;; :style toggle
609 ;; :selected (let ((thickness
610 ;; (specifier-instance modeline-shadow-thickness)))
611 ;; (and (integerp thickness)
612 ;; (> thickness 0)))]
613 ["Truncate Lines"
614 (progn ;; becomes buffer-local
615 (setq truncate-lines (not truncate-lines))
616 (customize-set-variable 'truncate-lines truncate-lines))
617 :style toggle
618 :selected truncate-lines]
619 ["Blinking Cursor"
620 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
621 :style toggle
622 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
623 :active (boundp 'blink-cursor-mode)]
624 "-----"
625 ["Block cursor"
626 (progn
627 (customize-set-variable 'bar-cursor nil)
628 (force-cursor-redisplay))
629 :style radio
630 :selected (null bar-cursor)]
631 ["Bar cursor (1 pixel)"
632 (progn
633 (customize-set-variable 'bar-cursor t)
634 (force-cursor-redisplay))
635 :style radio
636 :selected (eq bar-cursor t)]
637 ["Bar cursor (2 pixels)"
638 (progn
639 (customize-set-variable 'bar-cursor 2)
640 (force-cursor-redisplay))
641 :style radio
642 :selected (and bar-cursor (not (eq bar-cursor t)))]
643 "------"
644 ["Line Numbers"
645 (progn
646 (customize-set-variable 'line-number-mode (not line-number-mode))
647 (redraw-modeline))
648 :style toggle :selected line-number-mode]
649 ["Column Numbers"
650 (progn
651 (customize-set-variable 'column-number-mode
652 (not column-number-mode))
653 (redraw-modeline))
654 :style toggle :selected column-number-mode]
655 )
656 ("Menubar Appearance"
657 ["Buffers Menu Length..."
658 (customize-set-variable
659 'buffers-menu-max-size
660 ;; would it be better to open a customization buffer ?
661 (let ((val
662 (read-number
663 "Enter number of buffers to display (or 0 for unlimited): ")))
664 (if (eq val 0) nil val)))]
665 ["Multi-Operation Buffers Sub-Menus"
666 (customize-set-variable 'complex-buffers-menu-p
667 (not complex-buffers-menu-p))
668 :style toggle
669 :selected complex-buffers-menu-p]
670 ("Buffers Menu Sorting"
671 ["Most Recently Used"
672 (progn
673 (customize-set-variable 'buffers-menu-sort-function nil)
674 (customize-set-variable 'buffers-menu-grouping-function nil))
675 :style radio
676 :selected (null buffers-menu-sort-function)]
677 ["Alphabetically"
678 (progn
679 (customize-set-variable 'buffers-menu-sort-function
680 'sort-buffers-menu-alphabetically)
681 (customize-set-variable 'buffers-menu-grouping-function nil))
682 :style radio
683 :selected (eq 'sort-buffers-menu-alphabetically
684 buffers-menu-sort-function)]
685 ["By Major Mode, Then Alphabetically"
686 (progn
687 (customize-set-variable
688 'buffers-menu-sort-function
689 'sort-buffers-menu-by-mode-then-alphabetically)
690 (customize-set-variable
691 'buffers-menu-grouping-function
692 'group-buffers-menu-by-mode-then-alphabetically))
693 :style radio
694 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
695 buffers-menu-sort-function)])
696 ["Submenus for Buffer Groups"
697 (customize-set-variable 'buffers-menu-submenus-for-groups-p
698 (not buffers-menu-submenus-for-groups-p))
699 :style toggle
700 :selected buffers-menu-submenus-for-groups-p]
701 "---"
702 ["Ignore Scaled Fonts"
703 (customize-set-variable 'font-menu-ignore-scaled-fonts
704 (not font-menu-ignore-scaled-fonts))
705 :style toggle
706 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
707 font-menu-ignore-scaled-fonts)]
708 )
709 ,@(if (featurep 'toolbar)
710 '(("Toolbar Appearance"
711 ["Visible"
712 (customize-set-variable 'toolbar-visible-p
713 (not toolbar-visible-p))
714 :style toggle
715 :selected toolbar-visible-p]
716 ["Captioned"
717 (customize-set-variable 'toolbar-captioned-p
718 (not toolbar-captioned-p))
719 :style toggle
720 :selected toolbar-captioned-p]
721 ("Default Location"
722 ["Top"
723 (customize-set-variable 'default-toolbar-position 'top)
724 :style radio
725 :selected (eq default-toolbar-position 'top)]
726 ["Bottom"
727 (customize-set-variable 'default-toolbar-position 'bottom)
728 :style radio
729 :selected (eq default-toolbar-position 'bottom)]
730 ["Left"
731 (customize-set-variable 'default-toolbar-position 'left)
732 :style radio
733 :selected (eq default-toolbar-position 'left)]
734 ["Right"
735 (customize-set-variable 'default-toolbar-position 'right)
736 :style radio
737 :selected (eq default-toolbar-position 'right)]
738 )
739 )))
740 ("Mouse"
741 ["Avoid Text..."
742 (customize-set-variable 'mouse-avoidance-mode
743 (if mouse-avoidance-mode nil 'banish))
744 :style toggle
745 :selected (and (boundp 'mouse-avoidance-mode) mouse-avoidance-mode)
746 :active (and (boundp 'mouse-avoidance-mode)
747 (device-on-window-system-p))]
748 ["strokes-mode"
749 (customize-set-variable 'strokes-mode (not strokes-mode))
750 :style toggle
751 :selected (and (boundp 'strokes-mode) strokes-mode)
752 :active (and (boundp 'strokes-mode)
753 (device-on-window-system-p))]
754 )
755 ("Open URLs With"
756 ["Emacs-W3"
757 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
758 :style radio
759 :selected (and (boundp 'browse-url-browser-function)
760 (eq browse-url-browser-function 'browse-url-w3))
761 :active (and (boundp 'browse-url-browser-function)
762 (fboundp 'browse-url-w3)
763 (fboundp 'w3-fetch))]
764 ["Netscape"
765 (customize-set-variable 'browse-url-browser-function
766 'browse-url-netscape)
767 :style radio
768 :selected (and (boundp 'browse-url-browser-function)
769 (eq browse-url-browser-function 'browse-url-netscape))
770 :active (and (boundp 'browse-url-browser-function)
771 (fboundp 'browse-url-netscape))]
772 ["Mosaic"
773 (customize-set-variable 'browse-url-browser-function
774 'browse-url-mosaic)
775 :style radio
776 :selected (and (boundp 'browse-url-browser-function)
777 (eq browse-url-browser-function 'browse-url-mosaic))
778 :active (and (boundp 'browse-url-browser-function)
779 (fboundp 'browse-url-mosaic))]
780 ["Mosaic (CCI)"
781 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
782 :style radio
783 :selected (and (boundp 'browse-url-browser-function)
784 (eq browse-url-browser-function 'browse-url-cci))
785 :active (and (boundp 'browse-url-browser-function)
786 (fboundp 'browse-url-cci))]
787 ["IXI Mosaic"
788 (customize-set-variable 'browse-url-browser-function
789 'browse-url-iximosaic)
790 :style radio
791 :selected (and (boundp 'browse-url-browser-function)
792 (eq browse-url-browser-function 'browse-url-iximosaic))
793 :active (and (boundp 'browse-url-browser-function)
794 (fboundp 'browse-url-iximosaic))]
795 ["Lynx (xterm)"
796 (customize-set-variable 'browse-url-browser-function
797 'browse-url-lynx-xterm)
798 :style radio
799 :selected (and (boundp 'browse-url-browser-function)
800 (eq browse-url-browser-function 'browse-url-lynx-xterm))
801 :active (and (boundp 'browse-url-browser-function)
802 (fboundp 'browse-url-lynx-xterm))]
803 ["Lynx (xemacs)"
804 (customize-set-variable 'browse-url-browser-function
805 'browse-url-lynx-emacs)
806 :style radio
807 :selected (and (boundp 'browse-url-browser-function)
808 (eq browse-url-browser-function 'browse-url-lynx-emacs))
809 :active (and (boundp 'browse-url-browser-function)
810 (fboundp 'browse-url-lynx-emacs))]
811 ["Grail"
812 (customize-set-variable 'browse-url-browser-function
813 'browse-url-grail)
814 :style radio
815 :selected (and (boundp 'browse-url-browser-function)
816 (eq browse-url-browser-function 'browse-url-grail))
817 :active (and (boundp 'browse-url-browser-function)
818 (fboundp 'browse-url-grail))]
819 ["Kfm"
820 (customize-set-variable 'browse-url-browser-function
821 'browse-url-kfm)
822 :style radio
823 :selected (and (boundp 'browse-url-browser-function)
824 (eq browse-url-browser-function 'browse-url-kfm))
825 :active (and (boundp 'browse-url-browser-function)
826 (fboundp 'browse-url-kfm))]
827 )
1372 "-----" 828 "-----"
1373 ["%_Edit Init (.emacs) File" 829 ["Edit Faces..." (customize-face nil)]
1374 ;; #### there should be something that holds the name that the init 830 ("Font" :filter font-menu-family-constructor)
1375 ;; file should be created as, when it's not present. 831 ("Size" :filter font-menu-size-constructor)
1376 (progn (find-file (or user-init-file "~/.emacs")) 832 ; ("Weight" :filter font-menu-weight-constructor)
1377 (or (eq major-mode 'emacs-lisp-mode) 833 "-----"
1378 (emacs-lisp-mode)))] 834 ["Save Options" customize-save-customized]
1379 ["%_Save Options to .emacs File" customize-save-customized]
1380 ) 835 )
1381 836
1382 ("%_Buffers" 837 ("Buffers"
1383 :filter buffers-menu-filter 838 :filter buffers-menu-filter
1384 ["Go To %_Previous Buffer" switch-to-other-buffer] 839 ["Read Only" (toggle-read-only)
1385 ["Go To %_Buffer..." switch-to-buffer] 840 :style toggle :selected buffer-read-only]
1386 "----" 841 ["List All Buffers" list-buffers]
1387 ["%_List All Buffers" list-buffers] 842 "--"
1388 ["%_Delete Buffer" kill-this-buffer
1389 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
1390 "----"
1391 ) 843 )
1392 844
1393 nil ; the partition: menus after this are flushright 845 ("Tools"
1394 846 ["Grep..." grep
1395 ("%_Help" 847 :active (fboundp 'grep)]
1396 ["%_About XEmacs..." about-xemacs] 848 ["Compile..." compile
849 :active (fboundp 'compile)]
850 ["Shell" shell
851 :active (fboundp 'shell)]
852 ["Shell Command..." shell-command
853 :active (fboundp 'shell-command)]
854 ["Shell Command on Region..." shell-command-on-region
855 :active (and (fboundp 'shell-command-on-region) (region-exists-p))]
856 ["Debug (GDB)..." gdb
857 :active (fboundp 'gdb)]
858 ["Debug (DBX)..." dbx
859 :active (fboundp 'dbx)]
1397 "-----" 860 "-----"
1398 ["XEmacs %_News" view-emacs-news] 861 ("Tags"
1399 ["%_Obtaining XEmacs" describe-distribution] 862 ["Find Tag..." find-tag]
863 ["Find Other Window..." find-tag-other-window]
864 ["Next Tag..." (find-tag nil)]
865 ["Next Other Window..." (find-tag-other-window nil)]
866 ["Next File" next-file]
867 "-----"
868 ["Tags Search..." tags-search]
869 ["Tags Replace..." tags-query-replace]
870 ["Continue Search/Replace" tags-loop-continue]
871 "-----"
872 ["Pop stack" pop-tag-mark]
873 ["Apropos..." tags-apropos]
874 "-----"
875 ["Set Tags Table File..." visit-tags-table]
876 ))
877
878 nil ; the partition: menus after this are flushright
879
880 ("Help"
881 ["About XEmacs..." about-xemacs]
882 ("Basics"
883 ["Installation" describe-installation
884 :active (boundp 'Installation-string)]
885 ;; Tutorials.
886 ,(if (featurep 'mule)
887 ;; Mule tutorials.
888 (let ((lang language-info-alist)
889 submenu tut)
890 (while lang
891 (and (setq tut (assq 'tutorial (car lang)))
892 (not (string= (caar lang) "ASCII"))
893 (setq
894 submenu
895 (cons
896 `[,(caar lang) (help-with-tutorial nil ,(cdr tut))]
897 submenu)))
898 (setq lang (cdr lang)))
899 (append `("Tutorials"
900 :filter tutorials-menu-filter
901 ["Default" help-with-tutorial t
902 ,(concat "(" current-language-environment ")")])
903 submenu))
904 ;; Non mule tutorials.
905 (let ((lang tutorial-supported-languages)
906 submenu)
907 (while lang
908 (setq submenu
909 (cons
910 `[,(caar lang)
911 (help-with-tutorial ,(format "TUTORIAL.%s"
912 (cadr (car lang))))]
913 submenu))
914 (setq lang (cdr lang)))
915 (append '("Tutorials"
916 ["English" help-with-tutorial])
917 submenu)))
918 ["News" view-emacs-news]
919 ["Packages" finder-by-keyword]
920 ["Splash" xemacs-splash-buffer])
1400 "-----" 921 "-----"
1401 ("%_Info (Online Docs)" 922 ("XEmacs FAQ"
1402 ["%_Info Contents" info] 923 ["FAQ (local)" xemacs-local-faq]
1403 ["Lookup %_Key Binding..." Info-goto-emacs-key-command-node] 924 ["FAQ via WWW" xemacs-www-faq (boundp 'browse-url-browser-function)]
1404 ["Lookup %_Command..." Info-goto-emacs-command-node] 925 ["Home Page" xemacs-www-page (boundp 'browse-url-browser-function)])
1405 ["Lookup %_Function..." Info-elisp-ref] 926 ("Samples"
1406 ["Lookup %_Topic..." Info-query]) 927 ["Sample .emacs" (find-file (locate-data-file "sample.emacs")) (locate-data-file "sample.emacs")]
1407 ("XEmacs %_FAQ" 928 ["Sample .Xdefaults" (find-file (locate-data-file "sample.Xdefaults")) (locate-data-file "sample.Xdefaults")]
1408 ["%_FAQ (local)" xemacs-local-faq] 929 ["Sample enriched" (find-file (locate-data-file "enriched.doc")) (locate-data-file "enriched.doc")])
1409 ["FAQ via %_WWW" xemacs-www-faq 930 "-----"
1410 :active (boundp 'browse-url-browser-function)] 931 ("Lookup in Info"
1411 ["%_Home Page" xemacs-www-page 932 ["Key Binding..." Info-goto-emacs-key-command-node]
1412 :active (boundp 'browse-url-browser-function)]) 933 ["Command..." Info-goto-emacs-command-node]
1413 ("%_Tutorials" 934 ["Function..." Info-elisp-ref]
1414 :filter tutorials-menu-filter) 935 ["Topic..." Info-query])
1415 ("%_Samples" 936 ("Manuals"
1416 ["Sample .%_emacs" 937 ["Info" info]
1417 (find-file (locate-data-file "sample.emacs")) 938 ["Unix Manual..." manual-entry])
1418 :active (locate-data-file "sample.emacs")] 939 ("Commands & Keys"
1419 ["Sample .%_Xdefaults" 940 ["Mode" describe-mode]
1420 (find-file (locate-data-file "sample.Xdefaults")) 941 ["Apropos..." hyper-apropos]
1421 :active (locate-data-file "sample.Xdefaults")] 942 ["Apropos Docs..." apropos-documentation]
1422 ["Sample e%_nriched"
1423 (find-file (locate-data-file "enriched.doc"))
1424 :active (locate-data-file "enriched.doc")])
1425 ("%_Commands & Keys"
1426 ["%_Mode" describe-mode]
1427 ["%_Apropos..." hyper-apropos]
1428 ["Apropos %_Docs..." apropos-documentation]
1429 "-----" 943 "-----"
1430 ["%_Key..." describe-key] 944 ["Key..." describe-key]
1431 ["%_Bindings" describe-bindings] 945 ["Bindings" describe-bindings]
1432 ["%_Mouse Bindings" describe-pointer] 946 ["Mouse Bindings" describe-pointer]
1433 ["%_Recent Keys" view-lossage] 947 ["Recent Keys" view-lossage]
1434 "-----" 948 "-----"
1435 ["%_Function..." describe-function] 949 ["Function..." describe-function]
1436 ["%_Variable..." describe-variable] 950 ["Variable..." describe-variable]
1437 ["%_Locate Command..." where-is]) 951 ["Locate Command..." where-is])
1438 "-----" 952 "-----"
1439 ["%_Recent Messages" view-lossage] 953 ["Recent Messages" view-lossage]
1440 ("%_Misc" 954 ("Misc"
1441 ["%_Current Installation Info" describe-installation 955 ["No Warranty" describe-no-warranty]
1442 :active (boundp 'Installation-string)] 956 ["XEmacs License" describe-copying]
1443 ["%_No Warranty" describe-no-warranty] 957 ["The Latest Version" describe-distribution])
1444 ["XEmacs %_License" describe-copying] 958 ["Send Bug Report..." report-emacs-bug]))))
1445 ["Find %_Packages" finder-by-keyword]
1446 ["View %_Splash Screen" xemacs-splash-buffer]
1447 ["%_Unix Manual..." manual-entry])
1448 ["Send %_Bug Report..." report-emacs-bug
1449 :active (fboundp 'report-emacs-bug)]))))
1450 959
1451 960
1452 (defun maybe-add-init-button () 961 (defun maybe-add-init-button ()
1453 "Don't call this. 962 "Don't call this.
1454 Adds `Load .emacs' button to menubar when starting up with -q." 963 Adds `Load .emacs' button to menubar when starting up with -q."
1455 (when (and (not load-user-init-file-p) 964 ;; by Stig@hackvan.com
1456 (file-exists-p (expand-file-name ".emacs" "~"))) 965 (cond
1457 (add-menu-button 966 (init-file-user nil)
1458 nil 967 ((file-exists-p (expand-file-name ".emacs" "~"))
1459 ["%_Load .emacs" 968 (add-menu-button nil
1460 (progn 969 ["Load .emacs"
1461 (mapc #'(lambda (buf) 970 (progn (delete-menu-item '("Load .emacs"))
1462 (with-current-buffer buf 971 (load-user-init-file (user-login-name)))
1463 (delete-menu-item '("Load .emacs")))) 972 ]
1464 (buffer-list)) 973 "Help"))
1465 (load-user-init-file)) 974 (t nil)))
1466 ]
1467 "Help")))
1468 975
1469 (add-hook 'before-init-hook 'maybe-add-init-button) 976 (add-hook 'before-init-hook 'maybe-add-init-button)
1470 977
1471 978
1472 ;;; The File menu 979 ;;; The File menu
1479 (defun bookmark-menu-filter (&rest ignore) 986 (defun bookmark-menu-filter (&rest ignore)
1480 (let ((definedp (and (boundp 'bookmark-alist) 987 (let ((definedp (and (boundp 'bookmark-alist)
1481 bookmark-alist 988 bookmark-alist
1482 t))) 989 t)))
1483 `(,(if definedp 990 `(,(if definedp
1484 '("%_Jump to Bookmark" 991 '("Jump to Bookmark"
1485 :filter (lambda (&rest junk) 992 :filter (lambda (&rest junk)
1486 (mapcar #'(lambda (bmk) 993 (mapcar #'(lambda (bmk)
1487 `[,bmk (bookmark-jump ',bmk)]) 994 `[,bmk (bookmark-jump ',bmk)])
1488 (bookmark-all-names)))) 995 (bookmark-all-names))))
1489 ["%_Jump to Bookmark" nil nil]) 996 ["Jump to Bookmark" nil nil])
1490 ["Set %_Bookmark" bookmark-set 997 ["Set bookmark" bookmark-set
1491 :active (fboundp 'bookmark-set)] 998 :active (fboundp 'bookmark-set)]
1492 "---" 999 "---"
1493 ["Insert %_Contents" bookmark-menu-insert 1000 ["Insert contents" bookmark-menu-insert
1494 :active (fboundp 'bookmark-menu-insert)] 1001 :active (fboundp 'bookmark-menu-insert)]
1495 ["Insert L%_ocation" bookmark-menu-locate 1002 ["Insert location" bookmark-menu-locate
1496 :active (fboundp 'bookmark-menu-locate)] 1003 :active (fboundp 'bookmark-menu-locate)]
1497 "---" 1004 "---"
1498 ["%_Rename Bookmark" bookmark-menu-rename 1005 ["Rename bookmark" bookmark-menu-rename
1499 :active (fboundp 'bookmark-menu-rename)] 1006 :active (fboundp 'bookmark-menu-rename)]
1500 ,(if definedp 1007 ,(if definedp
1501 '("%_Delete Bookmark" 1008 '("Delete Bookmark"
1502 :filter (lambda (&rest junk) 1009 :filter (lambda (&rest junk)
1503 (mapcar #'(lambda (bmk) 1010 (mapcar #'(lambda (bmk)
1504 `[,bmk (bookmark-delete ',bmk)]) 1011 `[,bmk (bookmark-delete ',bmk)])
1505 (bookmark-all-names)))) 1012 (bookmark-all-names))))
1506 ["%_Delete Bookmark" nil nil]) 1013 ["Delete Bookmark" nil nil])
1507 ["%_Edit Bookmark List" bookmark-bmenu-list ,definedp] 1014 ["Edit Bookmark List" bookmark-bmenu-list ,definedp]
1508 "---" 1015 "---"
1509 ["%_Save Bookmarks" bookmark-save ,definedp] 1016 ["Save bookmarks" bookmark-save ,definedp]
1510 ["Save Bookmarks %_As..." bookmark-write ,definedp] 1017 ["Save bookmarks as..." bookmark-write ,definedp]
1511 ["%_Load a Bookmark File" bookmark-load 1018 ["Load a bookmark file" bookmark-load
1512 :active (fboundp 'bookmark-load)]))) 1019 :active (fboundp 'bookmark-load)])))
1513 1020
1514 ;;; The Buffers menu 1021 ;;; The Buffers menu
1515 1022
1516 (defgroup buffers-menu nil 1023 (defgroup buffers-menu nil
1517 "Customization of `Buffers' menu." 1024 "Customization of `Buffers' menu."
1518 :group 'menu) 1025 :group 'menu)
1519
1520 (defvar buffers-menu-omit-chars-list '(?b ?p ?l))
1521 1026
1522 (defcustom buffers-menu-max-size 25 1027 (defcustom buffers-menu-max-size 25
1523 "*Maximum number of entries which may appear on the \"Buffers\" menu. 1028 "*Maximum number of entries which may appear on the \"Buffers\" menu.
1524 If this is 10, then only the ten most-recently-selected buffers will be 1029 If this is 10, then only the ten most-recently-selected buffers will be
1525 shown. If this is nil, then all buffers will be shown. Setting this to 1030 shown. If this is nil, then all buffers will be shown. Setting this to
1562 :type '(choice (const :tag "None" nil) 1067 :type '(choice (const :tag "None" nil)
1563 function) 1068 function)
1564 :group 'buffers-menu) 1069 :group 'buffers-menu)
1565 1070
1566 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line 1071 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
1567 "*The function to call to return a string to represent a buffer in 1072 "*The function to call to return a string to represent a buffer in the
1568 the buffers menu. The function is passed a buffer and a number 1073 buffers menu. The function is passed a buffer and should return a string.
1569 (starting with 1) indicating which buffer line in the menu is being 1074 The default value `format-buffers-menu-line' just returns the name of
1570 processed and should return a string containing an accelerator 1075 the buffer. Also check out `slow-format-buffers-menu-line' which
1571 spec. (Check out `menu-item-generate-accelerator-spec' as a convenient 1076 returns a whole bunch of info about a buffer."
1572 way of generating the accelerator specs.) The default value
1573 `format-buffers-menu-line' just returns the name of the buffer and
1574 uses the number as the accelerator. Also check out
1575 `slow-format-buffers-menu-line' which returns a whole bunch of info
1576 about a buffer.
1577
1578 Note: Gross Compatibility Hack: Older versions of this function prototype
1579 only expected one argument, not two. We deal gracefully with such
1580 functions by simply calling them with one argument and leaving out the
1581 line number. However, this may go away at any time, so make sure to
1582 update all of your functions of this type."
1583 :type 'function 1077 :type 'function
1584 :group 'buffers-menu) 1078 :group 'buffers-menu)
1585 1079
1586 (defcustom buffers-menu-sort-function 1080 (defcustom buffers-menu-sort-function
1587 'sort-buffers-menu-by-mode-then-alphabetically 1081 'sort-buffers-menu-by-mode-then-alphabetically
1588 "*If non-nil, a function to sort the list of buffers in the buffers menu. 1082 "*If non-nil, a function to sort the list of buffers in the buffers menu.
1589 It will be passed two arguments (two buffers to compare) and should return 1083 It will be passed two arguments (two buffers to compare) and should return
1590 t if the first is \"less\" than the second. One possible value is 1084 T if the first is \"less\" than the second. One possible value is
1591 `sort-buffers-menu-alphabetically'; another is 1085 `sort-buffers-menu-alphabetically'; another is
1592 `sort-buffers-menu-by-mode-then-alphabetically'." 1086 `sort-buffers-menu-by-mode-then-alphabetically'."
1593 :type '(choice (const :tag "None" nil) 1087 :type '(choice (const :tag "None" nil)
1594 function) 1088 function)
1595 :group 'buffers-menu) 1089 :group 'buffers-menu)
1608 for `buffers-menu-sort-function'." 1102 for `buffers-menu-sort-function'."
1609 :type '(choice (const :tag "None" nil) 1103 :type '(choice (const :tag "None" nil)
1610 function) 1104 function)
1611 :group 'buffers-menu) 1105 :group 'buffers-menu)
1612 1106
1107 (defun buffers-menu-omit-invisible-buffers (buf)
1108 "For use as a value of `buffers-menu-omit-function'.
1109 Omits normally invisible buffers (those whose name begins with a space)."
1110 (not (null (string-match "\\` " (buffer-name buf)))))
1111
1613 (defun sort-buffers-menu-alphabetically (buf1 buf2) 1112 (defun sort-buffers-menu-alphabetically (buf1 buf2)
1614 "For use as a value of `buffers-menu-sort-function'. 1113 "For use as a value of `buffers-menu-sort-function'.
1615 Sorts the buffers in alphabetical order by name, but puts buffers beginning 1114 Sorts the buffers in alphabetical order by name, but puts buffers beginning
1616 with a star at the end of the list." 1115 with a star at the end of the list."
1617 (let* ((nam1 (buffer-name buf1)) 1116 (let* ((nam1 (buffer-name buf1))
1618 (nam2 (buffer-name buf2)) 1117 (nam2 (buffer-name buf2))
1619 (inv1p (not (null (string-match "\\` " nam1))))
1620 (inv2p (not (null (string-match "\\` " nam2))))
1621 (star1p (not (null (string-match "\\`*" nam1)))) 1118 (star1p (not (null (string-match "\\`*" nam1))))
1622 (star2p (not (null (string-match "\\`*" nam2))))) 1119 (star2p (not (null (string-match "\\`*" nam2)))))
1623 (cond ((not (eq inv1p inv2p)) 1120 (if (not (eq star1p star2p))
1624 (not inv1p)) 1121 (not star1p)
1625 ((not (eq star1p star2p)) 1122 (string-lessp nam1 nam2))))
1626 (not star1p))
1627 (t
1628 (string-lessp nam1 nam2)))))
1629 1123
1630 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2) 1124 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1631 "For use as a value of `buffers-menu-sort-function'. 1125 "For use as a value of `buffers-menu-sort-function'.
1632 Sorts first by major mode and then alphabetically by name, but puts buffers 1126 Sorts first by major mode and then alphabetically by name, but puts buffers
1633 beginning with a star at the end of the list." 1127 beginning with a star at the end of the list."
1634 (let* ((nam1 (buffer-name buf1)) 1128 (let* ((nam1 (buffer-name buf1))
1635 (nam2 (buffer-name buf2)) 1129 (nam2 (buffer-name buf2))
1636 (inv1p (not (null (string-match "\\` " nam1))))
1637 (inv2p (not (null (string-match "\\` " nam2))))
1638 (star1p (not (null (string-match "\\`*" nam1)))) 1130 (star1p (not (null (string-match "\\`*" nam1))))
1639 (star2p (not (null (string-match "\\`*" nam2)))) 1131 (star2p (not (null (string-match "\\`*" nam2))))
1640 (mode1 (symbol-value-in-buffer 'major-mode buf1)) 1132 (mode1 (symbol-value-in-buffer 'major-mode buf1))
1641 (mode2 (symbol-value-in-buffer 'major-mode buf2))) 1133 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
1642 (cond ((not (eq inv1p inv2p)) 1134 (cond ((not (eq star1p star2p)) (not star1p))
1643 (not inv1p))
1644 ((not (eq star1p star2p))
1645 (not star1p))
1646 ((and star1p star2p (string-lessp nam1 nam2))) 1135 ((and star1p star2p (string-lessp nam1 nam2)))
1647 ((string-lessp mode1 mode2) 1136 ((string-lessp mode1 mode2) t)
1648 t) 1137 ((string-lessp mode2 mode1) nil)
1649 ((string-lessp mode2 mode1) 1138 (t (string-lessp nam1 nam2)))))
1650 nil)
1651 (t
1652 (string-lessp nam1 nam2)))))
1653 1139
1654 ;; this version is too slow on some machines. 1140 ;; this version is too slow on some machines.
1655 ;; (vintage 1990, that is) 1141 (defun slow-format-buffers-menu-line (buffer)
1656 (defun slow-format-buffers-menu-line (buffer n)
1657 "For use as a value of `buffers-menu-format-buffer-line-function'. 1142 "For use as a value of `buffers-menu-format-buffer-line-function'.
1658 This returns a string containing a bunch of info about the buffer." 1143 This returns a string containing a bunch of info about the buffer."
1659 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list) 1144 (format "%s%s %-19s %6s %-15s %s"
1660 (format "%s%s %-19s %6s %-15s %s" 1145 (if (buffer-modified-p buffer) "*" " ")
1661 (if (buffer-modified-p buffer) "*" " ") 1146 (if (symbol-value-in-buffer 'buffer-read-only buffer) "%" " ")
1662 (if (symbol-value-in-buffer 'buffer-read-only buffer) 1147 (buffer-name buffer)
1663 "%" " ") 1148 (buffer-size buffer)
1664 (buffer-name buffer) 1149 (symbol-value-in-buffer 'mode-name buffer)
1665 (buffer-size buffer) 1150 (or (buffer-file-name buffer) "")))
1666 (symbol-value-in-buffer 'mode-name buffer) 1151
1667 (or (buffer-file-name buffer) "")))) 1152 (defun format-buffers-menu-line (buffer)
1668
1669 (defun format-buffers-menu-line (buffer n)
1670 "For use as a value of `buffers-menu-format-buffer-line-function'. 1153 "For use as a value of `buffers-menu-format-buffer-line-function'.
1671 This just returns the buffer's name." 1154 This just returns the buffer's name."
1672 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list) 1155 (buffer-name buffer))
1673 (buffer-name buffer)))
1674 1156
1675 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2) 1157 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1676 "For use as a value of `buffers-menu-grouping-function'. 1158 "For use as a value of `buffers-menu-grouping-function'.
1677 This groups buffers by major mode. It only really makes sense if 1159 This groups buffers by major mode. It only really makes sense if
1678 `buffers-menu-sorting-function' is 1160 `buffers-menu-sorting-function' is
1697 (write-file (read-file-name 1179 (write-file (read-file-name
1698 (format "Write %s to file: " 1180 (format "Write %s to file: "
1699 (buffer-name (current-buffer))))))) 1181 (buffer-name (current-buffer)))))))
1700 1182
1701 (defsubst build-buffers-menu-internal (buffers) 1183 (defsubst build-buffers-menu-internal (buffers)
1702 (let (name line (n 0)) 1184 (let (name line)
1703 (mapcar 1185 (mapcar
1704 #'(lambda (buffer) 1186 #'(lambda (buffer)
1705 (if (eq buffer t) 1187 (if (eq buffer t)
1706 "---" 1188 "---"
1707 (setq n (1+ n)) 1189 (setq line (funcall buffers-menu-format-buffer-line-function
1708 (setq line 1190 buffer))
1709 ; #### a truly Kyle-friendly hack.
1710 (let ((fn buffers-menu-format-buffer-line-function))
1711 (if (= (function-max-args fn) 1)
1712 (funcall fn buffer)
1713 (funcall fn buffer n))))
1714 (if complex-buffers-menu-p 1191 (if complex-buffers-menu-p
1715 (delq nil 1192 (delq nil
1716 (list line 1193 (list line
1717 (vector "S%_witch to Buffer" 1194 (vector "Switch to Buffer"
1718 (list buffers-menu-switch-to-buffer-function 1195 (list buffers-menu-switch-to-buffer-function
1719 (setq name (buffer-name buffer))) 1196 (setq name (buffer-name buffer)))
1720 t) 1197 t)
1721 (if (eq buffers-menu-switch-to-buffer-function 1198 (if (eq buffers-menu-switch-to-buffer-function
1722 'switch-to-buffer) 1199 'switch-to-buffer)
1723 (vector "Switch to Buffer, Other %_Frame" 1200 (vector "Switch to Buffer, Other Frame"
1724 (list 'switch-to-buffer-other-frame 1201 (list 'switch-to-buffer-other-frame
1725 (setq name (buffer-name buffer))) 1202 (setq name (buffer-name buffer)))
1726 t) 1203 t)
1727 nil) 1204 nil)
1728 (if (and (buffer-modified-p buffer) 1205 (if (and (buffer-modified-p buffer)
1729 (buffer-file-name buffer)) 1206 (buffer-file-name buffer))
1730 (vector "%_Save Buffer" 1207 (vector "Save Buffer"
1731 (list 'buffer-menu-save-buffer name) t) 1208 (list 'buffer-menu-save-buffer name) t)
1732 ["%_Save Buffer" nil nil] 1209 ["Save Buffer" nil nil]
1733 ) 1210 )
1734 (vector "Save %_As..." 1211 (vector "Save As..."
1735 (list 'buffer-menu-write-file name) t) 1212 (list 'buffer-menu-write-file name) t)
1736 (vector "%_Delete Buffer" (list 'kill-buffer name) 1213 (vector "Delete Buffer" (list 'kill-buffer name)
1737 t))) 1214 t)))
1738 ;; #### We don't want buffer names to be translated, 1215 ;; ### We don't want buffer names to be translated,
1739 ;; #### so we put the buffer name in the suffix. 1216 ;; ### so we put the buffer name in the suffix.
1740 ;; #### Also, avoid losing with non-ASCII buffer names. 1217 ;; ### Also, avoid losing with non-ASCII buffer names.
1741 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb 1218 ;; ### We still lose, however, if complex-buffers-menu-p. --mrb
1742 (vector "" 1219 (vector ""
1743 (list buffers-menu-switch-to-buffer-function 1220 (list buffers-menu-switch-to-buffer-function
1744 (buffer-name buffer)) 1221 (buffer-name buffer))
1745 t line)))) 1222 t line))))
1746 buffers))) 1223 buffers)))
1804 (append menu buffers) 1281 (append menu buffers)
1805 )) 1282 ))
1806 1283
1807 (defun language-environment-menu-filter (menu) 1284 (defun language-environment-menu-filter (menu)
1808 "This is the menu filter for the \"Language Environment\" submenu." 1285 "This is the menu filter for the \"Language Environment\" submenu."
1809 (let ((n 0)) 1286 (mapcar (lambda (env-sym)
1810 (mapcar (lambda (env-sym) 1287 `[ ,(capitalize (symbol-name env-sym))
1811 (setq n (1+ n)) 1288 (set-language-environment ',env-sym)])
1812 `[ ,(concat (menu-item-generate-accelerator-spec n) 1289 language-environment-list))
1813 (capitalize (symbol-name env-sym)))
1814 (set-language-environment ',env-sym)])
1815 language-environment-list)))
1816 1290
1817 1291
1818 ;;; The Options menu 1292 ;;; The Options menu
1819 1293
1820 ;; We'll keep those variables here for a while, in order to provide a 1294 ;; We'll keep those variables here for a while, in order to provide a
1844 1318
1845 1319
1846 1320
1847 ;;; The Help menu 1321 ;;; The Help menu
1848 1322
1849 (defun tutorials-menu-filter (menu-items) 1323 (if (featurep 'mule)
1850 (append 1324 (defun tutorials-menu-filter (menu-items)
1851 (if (featurep 'mule) 1325 ;; If there's a tutorial for the current language environment, make it
1852 (if (assq 'tutorial 1326 ;; appear first as the default one. Otherwise, use the english one.
1853 (assoc current-language-environment language-info-alist)) 1327 (let* ((menu menu-items)
1854 `([,(concat "%_Default (" current-language-environment ")") 1328 (item (pop menu-items)))
1855 help-with-tutorial])) 1329 (aset
1856 '(["%_English" help-with-tutorial])) 1330 item 3
1857 (submenu-generate-accelerator-spec 1331 (concat "("
1858 (if (featurep 'mule) 1332 (if (assoc
1859 ;; Mule tutorials. 1333 'tutorial
1860 (mapcan #'(lambda (lang) 1334 (assoc current-language-environment language-info-alist))
1861 (let ((tut (assq 'tutorial lang))) 1335 current-language-environment
1862 (and tut 1336 "English")
1863 (not (string= (car lang) "ASCII")) 1337 ")"))
1864 ;; skip current language, since we already 1338 menu)))
1865 ;; included it first
1866 (not (string= (car lang)
1867 current-language-environment))
1868 `([,(car lang)
1869 (help-with-tutorial nil ,(cdr tut))]))))
1870 language-info-alist)
1871 ;; Non mule tutorials.
1872 (mapcar #'(lambda (lang)
1873 `[,(car lang)
1874 (help-with-tutorial ,(format "TUTORIAL.%s"
1875 (cadr lang)))])
1876 tutorial-supported-languages)))))
1877 1339
1878 1340
1879 (set-menubar default-menubar) 1341 (set-menubar default-menubar)
1880 1342
1881 1343
1882 ;;; Popup menus. 1344 ;;; Popup menus.
1883 1345
1884 (defconst default-popup-menu 1346 (defconst default-popup-menu
1885 '("XEmacs Commands" 1347 '("XEmacs Commands"
1886 ["%_Undo" advertised-undo 1348 ["Undo" advertised-undo
1887 :active (and (not (eq buffer-undo-list t)) 1349 :active (and (not (eq buffer-undo-list t))
1888 (or buffer-undo-list pending-undo-list)) 1350 (or buffer-undo-list pending-undo-list))
1889 :suffix (if (or (eq last-command 'undo) 1351 :suffix (if (or (eq last-command 'undo)
1890 (eq last-command 'advertised-undo)) 1352 (eq last-command 'advertised-undo))
1891 "More" "")] 1353 "More" "")]
1892 ["Cu%_t" kill-primary-selection 1354 ["Cut" kill-primary-selection
1893 :active (selection-owner-p)] 1355 :active (selection-owner-p)]
1894 ["%_Copy" copy-primary-selection 1356 ["Copy" copy-primary-selection
1895 :active (selection-owner-p)] 1357 :active (selection-owner-p)]
1896 ["%_Paste" yank-clipboard-selection 1358 ["Paste" yank-clipboard-selection
1897 :active (selection-exists-p 'CLIPBOARD)] 1359 :active (selection-exists-p 'CLIPBOARD)]
1898 ["%_Delete" delete-primary-selection 1360 ["Clear" delete-primary-selection
1899 :active (selection-owner-p)] 1361 :active (selection-owner-p)]
1900 "-----" 1362 "-----"
1901 ["Select %_Block" mark-paragraph] 1363 ["Select Block" mark-paragraph]
1902 ["Sp%_lit Window" split-window-vertically] 1364 ["Split Window" split-window-vertically]
1903 ["U%_nsplit Window" delete-other-windows] 1365 ["Unsplit Window" delete-other-windows]
1904 )) 1366 ))
1905 1367
1906 (defvar global-popup-menu nil 1368 (defvar global-popup-menu nil
1907 "The global popup menu. This is present in all modes. 1369 "The global popup menu. This is present in all modes.
1908 See the function `popup-menu' for a description of menu syntax.") 1370 See the function `popup-menu' for a description of menu syntax.")
1912 This is appended to the default items in `global-popup-menu'. 1374 This is appended to the default items in `global-popup-menu'.
1913 See the function `popup-menu' for a description of menu syntax.") 1375 See the function `popup-menu' for a description of menu syntax.")
1914 (make-variable-buffer-local 'mode-popup-menu) 1376 (make-variable-buffer-local 'mode-popup-menu)
1915 1377
1916 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is 1378 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
1917 ;; superseded by any local popup menu... 1379 ;; superceded by any local popup menu...
1918 (setq-default mode-popup-menu default-popup-menu) 1380 (setq-default mode-popup-menu default-popup-menu)
1919 1381
1920 (defvar activate-popup-menu-hook nil 1382 (defvar activate-popup-menu-hook nil
1921 "Function or functions run before a mode-specific popup menu is made visible. 1383 "Function or functions run before a mode-specific popup menu is made visible.
1922 These functions are called with no arguments, and should interrogate and 1384 These functions are called with no arguments, and should interrogate and
1965 (bmenu nil)) 1427 (bmenu nil))
1966 (or window 1428 (or window
1967 (error "Pointer must be in a normal window")) 1429 (error "Pointer must be in a normal window"))
1968 (select-window window) 1430 (select-window window)
1969 (if current-menubar 1431 (if current-menubar
1970 (setq bmenu (assoc "%_Buffers" current-menubar))) 1432 (setq bmenu (assoc "Buffers" current-menubar)))
1971 (if (null bmenu) 1433 (if (null bmenu)
1972 (setq bmenu (assoc "%_Buffers" default-menubar))) 1434 (setq bmenu (assoc "Buffers" default-menubar)))
1973 (if (null bmenu) 1435 (if (null bmenu)
1974 (error "Can't find the Buffers menu")) 1436 (error "Can't find the Buffers menu"))
1975 (popup-menu bmenu))) 1437 (popup-menu bmenu)))
1976 1438
1977 (defun popup-menubar-menu (event) 1439 (defun popup-menubar-menu (event)
1978 "Pop up a copy of menu that also appears in the menubar." 1440 "Pop up a copy of menu that also appears in the menubar"
1441 ;; by Stig@hackvan.com
1979 (interactive "e") 1442 (interactive "e")
1980 (let ((window (and (event-over-text-area-p event) (event-window event))) 1443 (let ((window (and (event-over-text-area-p event) (event-window event)))
1981 popup-menubar) 1444 popup-menubar)
1982 (or window 1445 (or window
1983 (error "Pointer must be in a normal window")) 1446 (error "Pointer must be in a normal window"))
1984 (select-window window) 1447 (select-window window)
1985 (and current-menubar (run-hooks 'activate-menubar-hook)) 1448 (and current-menubar (run-hooks 'activate-menubar-hook))
1986 ;; #### Instead of having to copy this just to safely get rid of 1449 ;; ##### Instead of having to copy this just to safely get rid of
1987 ;; any nil what we should really do is fix up the internal menubar 1450 ;; any nil what we should really do is fix up the internal menubar
1988 ;; code to just ignore nil if generating a popup menu 1451 ;; code to just ignore nil if generating a popup menu
1989 (setq popup-menubar (delete nil (copy-sequence (or current-menubar 1452 (setq popup-menubar (delete nil (copy-sequence (or current-menubar
1990 default-menubar)))) 1453 default-menubar))))
1991 (popup-menu (cons "%_Menubar Menu" popup-menubar)) 1454 (popup-menu (cons "Menubar Menu" popup-menubar))
1992 )) 1455 ))
1993 1456
1994 (global-set-key 'button3 'popup-mode-menu) 1457 (global-set-key 'button3 'popup-mode-menu)
1995 ;; shift button3 and shift button2 are reserved for Hyperbole 1458 ;; shift button3 and shift button2 are reserved for Hyperbole
1996 (global-set-key '(meta control button3) 'popup-buffer-menu) 1459 (global-set-key '(meta control button3) 'popup-buffer-menu)
2052 1515
2053 ;;; backwards compatibility 1516 ;;; backwards compatibility
2054 (provide 'x-menubar) 1517 (provide 'x-menubar)
2055 (provide 'menubar-items) 1518 (provide 'menubar-items)
2056 1519
2057 ;;; menubar-items.el ends here. 1520 ;;; x-menubar.el ends here.