428
|
1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs.
|
|
2
|
|
3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
|
|
5 ;; Copyright (C) 1995 Sun Microsystems.
|
771
|
6 ;; Copyright (C) 1995, 1996, 2000, 2001, 2002 Ben Wing.
|
442
|
7 ;; Copyright (C) 1997 MORIOKA Tomohiko.
|
428
|
8
|
|
9 ;; Maintainer: XEmacs Development Team
|
|
10 ;; Keywords: frames, extensions, internal, dumped
|
|
11
|
|
12 ;; This file is part of XEmacs.
|
|
13
|
|
14 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
15 ;; under the terms of the GNU General Public License as published by
|
|
16 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
17 ;; any later version.
|
|
18
|
|
19 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
22 ;; General Public License for more details.
|
|
23
|
|
24 ;; You should have received a copy of the GNU General Public License
|
|
25 ;; along with Xmacs; see the file COPYING. If not, write to the
|
|
26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
27 ;; Boston, MA 02111-1307, USA.
|
|
28
|
442
|
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
|
428
|
50 ;;; Commentary:
|
|
51
|
|
52 ;; This file is dumped with XEmacs (when window system and menubar support is
|
|
53 ;; compiled in).
|
|
54
|
|
55 ;;; Code:
|
|
56
|
679
|
57 (defun Menubar-items-truncate-history (list count label-length)
|
|
58 "Truncate a history LIST to first COUNT items.
|
|
59 Return a list of (label value) lists with labels truncated to last
|
|
60 LABEL-LENGTH characters of value."
|
464
|
61 (mapcar #'(lambda (x)
|
679
|
62 (if (<= (length x) label-length)
|
|
63 (list x x)
|
|
64 (list
|
|
65 (concat "..." (substring x (- label-length))) x)))
|
|
66 (if (<= (length list) count)
|
464
|
67 list
|
679
|
68 (butlast list (- (length list) count)))))
|
442
|
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 "")))
|
428
|
130
|
771
|
131 (defcustom menu-max-items 25
|
|
132 "*Maximum number of items in generated menus.
|
|
133 If number of entries in such a menu is larger than this value, split menu
|
|
134 into submenus of nearly equal length (see `menu-submenu-max-items'). If
|
|
135 nil, never split menu into submenus."
|
|
136 :group 'menu
|
|
137 :type '(choice (const :tag "no submenus" nil)
|
|
138 (integer)))
|
|
139
|
|
140 (defcustom menu-submenu-max-items 20
|
|
141 "*Maximum number of items in submenus when splitting menus.
|
|
142 We split large menus into submenus of this many items, and then balance
|
|
143 them out as much as possible (otherwise the last submenu may have very few
|
|
144 items)."
|
|
145 :group 'menu
|
|
146 :type 'integer)
|
|
147
|
|
148 (defcustom menu-submenu-name-format "%-12.12s ... %.12s"
|
|
149 "*Format specification of the submenu name when splitting menus.
|
|
150 Used by `menu-split-long-menu' if the number of entries in a menu is
|
|
151 larger than `menu-menu-max-items'.
|
|
152 This string should contain one %s for the name of the first entry and
|
|
153 one %s for the name of the last entry in the submenu.
|
|
154 If the value is a function, it should return the submenu name. The
|
|
155 function is be called with two arguments, the names of the first and
|
|
156 the last entry in the menu."
|
|
157 :group 'menu
|
|
158 :type '(choice (string :tag "Format string")
|
|
159 (function)))
|
|
160
|
|
161 (defun menu-split-long-menu (menu)
|
|
162 "Split MENU according to `menu-max-items' and add accelerator specs."
|
|
163 (let ((len (length menu)))
|
|
164 (if (or (null menu-max-items)
|
|
165 (<= len menu-max-items))
|
|
166 (submenu-generate-accelerator-spec menu)
|
|
167 (let* ((outer (/ (+ len (1- menu-submenu-max-items))
|
|
168 menu-submenu-max-items))
|
|
169 (inner (/ (+ len (1- outer)) outer))
|
|
170 (result nil))
|
|
171 (while menu
|
|
172 (let ((sub nil)
|
|
173 (from (car menu)))
|
|
174 (dotimes (foo (min inner len))
|
|
175 (setq sub (cons (car menu) sub)
|
|
176 menu (cdr menu)))
|
|
177 (setq len (- len inner))
|
|
178 (let ((to (car sub)))
|
|
179 (setq sub (nreverse sub))
|
|
180 (setq result
|
|
181 (cons (cons (if (stringp menu-submenu-name-format)
|
|
182 (format menu-submenu-name-format
|
|
183 (menu-item-strip-accelerator-spec
|
|
184 (aref from 0))
|
|
185 (menu-item-strip-accelerator-spec
|
|
186 (aref to 0)))
|
|
187 (funcall menu-submenu-name-format
|
|
188 (menu-item-strip-accelerator-spec
|
|
189 (aref from 0))
|
|
190 (menu-item-strip-accelerator-spec
|
|
191 (aref to 0))))
|
|
192 (submenu-generate-accelerator-spec sub))
|
|
193 result)))))
|
|
194 (submenu-generate-accelerator-spec (nreverse result))))))
|
|
195
|
|
196 (defun menu-sort-menu (menu)
|
|
197 "Sort MENU alphabetically."
|
|
198 (sort menu
|
|
199 #'(lambda (a b) (string-lessp (aref a 0) (aref b 0)))))
|
|
200
|
|
201 (defun coding-system-menu-filter (fun active &optional dots)
|
|
202 "Filter for menu entries with a submenu listing all coding systems.
|
|
203 This is for operations that take a coding system as an argument. FUN
|
|
204 should be a function of one argument, which will be a coding system symbol.
|
|
205 ACTIVE should be a function one argument (again, a coding system symbol),
|
|
206 indicating whether the entry is active. If DOTS is given, the menu entries
|
|
207 will have three dots appended.
|
|
208
|
|
209 Write your filter like this:
|
|
210
|
|
211 :filter
|
|
212 (lambda (menu)
|
|
213 (lambda (entry) ...)
|
|
214 (lambda (entry) ...))
|
|
215 "
|
|
216 (menu-split-long-menu
|
|
217 (menu-sort-menu
|
|
218 (mapcar
|
|
219 #'(lambda (_csmf_entry)
|
|
220 `[ ,(concat (coding-system-description _csmf_entry)
|
|
221 (if dots "..." ""))
|
|
222 (funcall ,fun ',_csmf_entry)
|
|
223 :active (funcall ,active ',_csmf_entry)
|
|
224 ])
|
|
225 (delete-if
|
|
226 #'(lambda (name)
|
|
227 (or (coding-system-alias-p name)
|
|
228 (not (eq name (coding-system-name
|
|
229 (coding-system-base name))))))
|
|
230 (coding-system-list))))))
|
|
231
|
428
|
232 (defconst default-menubar
|
444
|
233 ; (purecopy-menubar ;purespace is dead
|
428
|
234 ;; note backquote.
|
|
235 `(
|
442
|
236 ("%_File"
|
|
237 ["%_Open..." find-file]
|
|
238 ["Open in Other %_Window..." find-file-other-window]
|
|
239 ["Open in New %_Frame..." find-file-other-frame]
|
771
|
240 ("Open with Specified %_Encoding"
|
|
241 :filter
|
|
242 (lambda (menu)
|
|
243 (coding-system-menu-filter
|
|
244 (lambda (entry)
|
|
245 (let ((coding-system-for-read entry))
|
|
246 (call-interactively 'find-file)))
|
|
247 (lambda (entry) t)
|
|
248 t))
|
|
249 )
|
442
|
250 ["%_Hex Edit File..." hexl-find-file
|
|
251 :active (fboundp 'hexl-find-file)]
|
|
252 ["%_Insert File..." insert-file]
|
|
253 ["%_View File..." view-file]
|
428
|
254 "------"
|
788
|
255 ["%_New Frame" make-frame]
|
|
256 ["Frame on Other %_Display..." make-frame-on-display
|
|
257 :active (fboundp 'make-frame-on-display)]
|
|
258 ["%_Close Frame" delete-frame
|
|
259 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
|
|
260 (selected-frame)))]
|
|
261 "-----"
|
442
|
262 ["%_Save" save-buffer
|
428
|
263 :active (buffer-modified-p)
|
|
264 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
442
|
265 ["Save %_As..." write-file]
|
|
266 ["Save So%_me Buffers" save-some-buffers]
|
428
|
267 "-----"
|
506
|
268 ,@(if (eq system-type 'windows-nt)
|
|
269 '(["Page Set%_up..." generic-page-setup]))
|
442
|
270 ["%_Print" generic-print-buffer
|
|
271 :active (or (valid-specifier-tag-p 'msprinter)
|
|
272 (and (not (eq system-type 'windows-nt))
|
506
|
273 (fboundp 'lpr-region)))
|
510
|
274 :suffix (if (region-active-p) "Selection..."
|
|
275 (if put-buffer-names-in-file-menu (concat (buffer-name) "...")
|
|
276 "..."))]
|
506
|
277 ,@(unless (eq system-type 'windows-nt)
|
|
278 '(["Prett%_y-Print" ps-print-buffer-with-faces
|
|
279 :active (fboundp 'ps-print-buffer-with-faces)
|
|
280 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]))
|
428
|
281 "-----"
|
442
|
282 ["%_Revert Buffer" revert-buffer
|
428
|
283 :active (or buffer-file-name revert-buffer-function)
|
|
284 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
788
|
285 ("%_Rever%_t/Recover"
|
|
286 ("Revert Buffer with Specified %_Encoding"
|
771
|
287 :filter
|
|
288 (lambda (menu)
|
|
289 (coding-system-menu-filter
|
|
290 (lambda (entry)
|
|
291 (let ((coding-system-for-read entry))
|
|
292 (revert-buffer)))
|
|
293 (lambda (entry) (or buffer-file-name revert-buffer-function))
|
|
294 t))
|
|
295 )
|
788
|
296 ["Re%_cover Buffer from Autosave" (recover-file buffer-file-name)
|
|
297 :active buffer-file-name
|
|
298 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
299 ["Recover %_Session..." recover-session]
|
|
300 )
|
428
|
301 "-----"
|
442
|
302 ["E%_xit XEmacs" save-buffers-kill-emacs]
|
428
|
303 )
|
|
304
|
442
|
305 ("%_Edit"
|
771
|
306 ["%_Undo" undo
|
428
|
307 :active (and (not (eq buffer-undo-list t))
|
|
308 (or buffer-undo-list pending-undo-list))
|
771
|
309 :suffix (if (eq last-command 'undo) "More" "")]
|
442
|
310 ["%_Redo" redo
|
428
|
311 :included (fboundp 'redo)
|
|
312 :active (not (or (eq buffer-undo-list t)
|
438
|
313 (eq last-buffer-undo-list nil)
|
|
314 (not (or (eq last-buffer-undo-list buffer-undo-list)
|
|
315 (and (null (car-safe buffer-undo-list))
|
|
316 (eq last-buffer-undo-list
|
|
317 (cdr-safe buffer-undo-list)))))
|
|
318 (or (eq buffer-undo-list pending-undo-list)
|
|
319 (eq (cdr buffer-undo-list) pending-undo-list))))
|
428
|
320 :suffix (if (eq last-command 'redo) "More" "")]
|
442
|
321 "----"
|
|
322 ["Cu%_t" kill-primary-selection
|
428
|
323 :active (selection-owner-p)]
|
442
|
324 ["%_Copy" copy-primary-selection
|
|
325 :active (selection-owner-p)]
|
|
326 ["%_Paste" yank-clipboard-selection
|
428
|
327 :active (selection-exists-p 'CLIPBOARD)]
|
442
|
328 ["%_Delete" delete-primary-selection
|
428
|
329 :active (selection-owner-p)]
|
|
330 "----"
|
442
|
331 ["Select %_All" mark-whole-buffer]
|
|
332 ["Select Pa%_ge" mark-page]
|
502
|
333 ["Select Paragrap%_h" mark-paragraph]
|
|
334 ["Re%_select Region" activate-region :active (mark t)]
|
428
|
335 "----"
|
442
|
336 ["%_Find..." make-search-dialog]
|
|
337 ["R%_eplace..." query-replace]
|
|
338 ["Replace (Rege%_xp)..." query-replace-regexp]
|
771
|
339 ["List %_Matching Lines..." list-matching-lines]
|
442
|
340 )
|
428
|
341
|
442
|
342 ("%_View"
|
|
343 ["%_Split Window" split-window-vertically]
|
|
344 ["S%_plit Window (Side by Side)" split-window-horizontally]
|
|
345 ["%_Un-Split (Keep This)" delete-other-windows
|
|
346 :active (not (one-window-p t))]
|
|
347 ["Un-Split (Keep %_Others)" delete-window
|
|
348 :active (not (one-window-p t))]
|
428
|
349 "----"
|
442
|
350 ("N%_arrow"
|
|
351 ["%_Narrow to Region" narrow-to-region :active (region-exists-p)]
|
|
352 ["Narrow to %_Page" narrow-to-page]
|
|
353 ["Narrow to %_Defun" narrow-to-defun]
|
|
354 "----"
|
|
355 ["%_Widen" widen :active (or (/= (point-min) 1)
|
|
356 (/= (point-max) (1+ (buffer-size))))]
|
|
357 )
|
428
|
358 "----"
|
442
|
359 ["Show Message %_Log" show-message-log]
|
|
360 "----"
|
|
361 ["%_Goto Line..." goto-line]
|
|
362 ["%_What Line" what-line]
|
|
363 ("%_Bookmarks"
|
|
364 :filter bookmark-menu-filter)
|
|
365 "----"
|
|
366 ["%_Jump to Previous Mark" (set-mark-command t)
|
|
367 :active (mark t)]
|
|
368 )
|
428
|
369
|
442
|
370 ("C%_mds"
|
|
371 ["Repeat %_Last Complex Command..." repeat-complex-command]
|
|
372 ["E%_valuate Lisp Expression..." eval-expression]
|
|
373 ["Execute %_Named Command..." execute-extended-command]
|
|
374 "----"
|
|
375 ["Start %_Macro Recording" start-kbd-macro
|
|
376 :included (not defining-kbd-macro)]
|
|
377 ["End %_Macro Recording" end-kbd-macro
|
|
378 :included defining-kbd-macro]
|
|
379 ["E%_xecute Last Macro" call-last-kbd-macro
|
|
380 :active last-kbd-macro]
|
|
381 ("%_Other Macro"
|
|
382 ["%_Append to Last Macro" (start-kbd-macro t)
|
|
383 :active (and (not defining-kbd-macro) last-kbd-macro)]
|
|
384 ["%_Query User During Macro" kbd-macro-query
|
|
385 :active defining-kbd-macro]
|
|
386 ["Enter %_Recursive Edit During Macro" (kbd-macro-query t)
|
|
387 :active defining-kbd-macro]
|
|
388 "---"
|
|
389 ["E%_xecute Last Macro on Region Lines"
|
|
390 :active (and last-kbd-macro (region-exists-p))]
|
|
391 "---"
|
|
392 ["%_Name Last Macro..." name-last-kbd-macro
|
|
393 :active last-kbd-macro]
|
|
394 ["Assign Last Macro to %_Key..." assign-last-kbd-macro-to-key
|
|
395 :active (and last-kbd-macro
|
|
396 (fboundp 'assign-last-kbd-macro-to-key))]
|
|
397 "---"
|
|
398 ["%_Edit Macro..." edit-kbd-macro]
|
|
399 ["Edit %_Last Macro" edit-last-kbd-macro
|
|
400 :active last-kbd-macro]
|
|
401 "---"
|
|
402 ["%_Insert Named Macro into Buffer..." insert-kbd-macro]
|
|
403 ["Read Macro from Re%_gion" read-kbd-macro
|
|
404 :active (region-exists-p)]
|
|
405 )
|
|
406 "----"
|
|
407 ("%_Abbrev"
|
|
408 ["D%_ynamic Abbrev Expand" dabbrev-expand]
|
|
409 ["Dynamic Abbrev %_Complete" dabbrev-completion]
|
|
410 ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)]
|
|
411 "----"
|
|
412 "----"
|
|
413 ["%_Define Global Abbrev for " add-global-abbrev
|
|
414 :suffix (abbrev-string-to-be-defined nil)
|
|
415 :active abbrev-mode]
|
|
416 ["Define %_Mode-Specific Abbrev for " add-mode-abbrev
|
|
417 :suffix (abbrev-string-to-be-defined nil)
|
|
418 :active abbrev-mode]
|
|
419 ["Define Global Ex%_pansion for " inverse-add-global-abbrev
|
|
420 :suffix (inverse-abbrev-string-to-be-defined 1)
|
|
421 :active abbrev-mode]
|
|
422 ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev
|
|
423 :suffix (inverse-abbrev-string-to-be-defined 1)
|
|
424 :active abbrev-mode]
|
|
425 "---"
|
|
426 ["E%_xpand Abbrev" expand-abbrev]
|
|
427 ["Expand Abbrevs in Re%_gion" expand-region-abbrevs
|
|
428 :active (region-exists-p)]
|
|
429 ["%_Unexpand Last Abbrev" unexpand-abbrev
|
|
430 :active (and (stringp last-abbrev-text)
|
|
431 (> last-abbrev-location 0))]
|
|
432 "---"
|
|
433 ["%_Kill All Abbrevs" kill-all-abbrevs]
|
|
434 ["%_Insert All Abbrevs into Buffer" insert-abbrevs]
|
|
435 ["%_List Abbrevs" list-abbrevs]
|
|
436 "---"
|
|
437 ["%_Edit Abbrevs" edit-abbrevs]
|
|
438 ["%_Redefine Abbrevs from Buffer" edit-abbrevs-redefine
|
|
439 :active (eq major-mode 'edit-abbrevs-mode)]
|
|
440 "---"
|
|
441 ["%_Save Abbrevs As..." write-abbrev-file]
|
|
442 ["L%_oad Abbrevs..." read-abbrev-file]
|
|
443 )
|
502
|
444 ("%_Rectangles"
|
442
|
445 ["%_Kill Rectangle" kill-rectangle]
|
|
446 ["%_Yank Rectangle" yank-rectangle]
|
|
447 ["Rectangle %_to Register" copy-rectangle-to-register]
|
|
448 ["Rectangle %_from Register" insert-register]
|
|
449 ["%_Clear Rectangle" clear-rectangle]
|
|
450 ["%_Open Rectangle" open-rectangle]
|
|
451 ["%_Prefix Rectangle..." string-rectangle]
|
|
452 ["Rectangle %_Mousing"
|
|
453 (customize-set-variable 'mouse-track-rectangle-p
|
|
454 (not mouse-track-rectangle-p))
|
|
455 :style toggle :selected mouse-track-rectangle-p]
|
|
456 )
|
502
|
457 ("Re%_gister"
|
|
458 ["%_Copy to Register..." copy-to-register :active (region-exists-p)]
|
|
459 ["%_Paste Register..." insert-register]
|
|
460 "---"
|
|
461 ["%_Save Point to Register" point-to-register]
|
|
462 ["%_Jump to Register" register-to-point]
|
|
463 )
|
442
|
464 ("%_Sort"
|
|
465 ["%_Lines in Region" sort-lines :active (region-exists-p)]
|
|
466 ["%_Paragraphs in Region" sort-paragraphs :active (region-exists-p)]
|
|
467 ["P%_ages in Region" sort-pages :active (region-exists-p)]
|
|
468 ["%_Columns in Region" sort-columns :active (region-exists-p)]
|
|
469 ["%_Regexp..." sort-regexp-fields :active (region-exists-p)]
|
|
470 )
|
|
471 ("%_Change Case"
|
|
472 ["%_Upcase Region" upcase-region :active (region-exists-p)]
|
|
473 ["%_Downcase Region" downcase-region :active (region-exists-p)]
|
|
474 ["%_Capitalize Region" capitalize-region :active (region-exists-p)]
|
|
475 ["%_Title-Case Region" capitalize-region-as-title
|
|
476 :active (region-exists-p)]
|
|
477 )
|
|
478 ("Ce%_nter"
|
|
479 ["%_Line" center-line]
|
|
480 ["%_Paragraph" center-paragraph]
|
|
481 ["%_Region" center-region :active (region-exists-p)]
|
|
482 )
|
|
483 ("%_Indent"
|
|
484 ["%_As Previous Line" indent-relative]
|
|
485 ["%_To Column..." indent-to-column]
|
|
486 "---"
|
|
487 ["%_Region" indent-region :active (region-exists-p)]
|
|
488 ["%_Balanced Expression" indent-sexp]
|
|
489 ["%_C Expression" indent-c-exp]
|
|
490 )
|
502
|
491 ("%_Tabs"
|
|
492 ["%_Convert Tabs to Spaces" untabify :active (and (region-exists-p)
|
|
493 (fboundp 'untabify))]
|
|
494 ["Convert %_Spaces to Tabs" tabify :active (and (region-exists-p)
|
|
495 (fboundp 'tabify))]
|
|
496 "---"
|
|
497 ["%_Tab to Tab Stop" tab-to-tab-stop]
|
|
498 ["%_Move to Tab Stop" move-to-tab-stop]
|
|
499 ["%_Edit Tab Stops" edit-tab-stops]
|
|
500 )
|
442
|
501 ("S%_pell-Check"
|
|
502 ["%_Buffer" ispell-buffer
|
|
503 :active (fboundp 'ispell-buffer)]
|
|
504 "---"
|
|
505 ["%_Word" ispell-word]
|
|
506 ["%_Complete Word" ispell-complete-word]
|
|
507 ["%_Region" ispell-region]
|
|
508 )
|
|
509 )
|
428
|
510
|
442
|
511 ("%_Tools"
|
|
512 ("%_Packages"
|
|
513 ("%_Add Download Site"
|
428
|
514 :filter (lambda (&rest junk)
|
442
|
515 (submenu-generate-accelerator-spec
|
|
516 (package-get-download-menu))))
|
|
517 ["%_Update Package Index" package-get-update-base]
|
|
518 ["%_List and Install" pui-list-packages]
|
|
519 ["U%_pdate Installed Packages" package-get-update-all]
|
440
|
520 ;; hack-o-matic, we can't force a load of package-base here
|
428
|
521 ;; since it triggers dialog box interactions which we can't
|
440
|
522 ;; deal with while using a menu
|
454
|
523 ("Using %_Custom"
|
428
|
524 :filter (lambda (&rest junk)
|
|
525 (if package-get-base
|
442
|
526 (submenu-generate-accelerator-spec
|
|
527 (cdr (custom-menu-create 'packages)))
|
|
528 '("Please load Package Index"))))
|
454
|
529
|
442
|
530 ["%_Help" (Info-goto-node "(xemacs)Packages")])
|
|
531 ("%_Internet"
|
|
532 ["Read Mail %_1 (VM)..." vm
|
|
533 :active (fboundp 'vm)]
|
|
534 ["Read Mail %_2 (MH)..." (mh-rmail t)
|
|
535 :active (fboundp 'mh-rmail)]
|
|
536 ["Send %_Mail..." compose-mail
|
|
537 :active (fboundp 'compose-mail)]
|
|
538 ["Usenet %_News" gnus
|
|
539 :active (fboundp 'gnus)]
|
|
540 ["Browse the %_Web" w3
|
|
541 :active (fboundp 'w3)])
|
|
542 "---"
|
|
543 ("%_Grep"
|
|
544 :filter
|
|
545 (lambda (menu)
|
|
546 (if (or (not (boundp 'grep-history)) (null grep-history))
|
|
547 menu
|
|
548 (let ((items
|
|
549 (submenu-generate-accelerator-spec
|
679
|
550 (mapcar #'(lambda (label-value)
|
|
551 (vector (first label-value)
|
|
552 (list 'grep (second label-value))))
|
|
553 (Menubar-items-truncate-history
|
|
554 grep-history 10 50)))))
|
442
|
555 (append menu '("---") items))))
|
|
556 ["%_Grep..." grep :active (fboundp 'grep)]
|
|
557 ["%_Kill Grep" kill-compilation
|
|
558 :active (and (fboundp 'kill-compilation)
|
|
559 (fboundp 'compilation-find-buffer)
|
|
560 (let ((buffer (condition-case nil
|
|
561 (compilation-find-buffer)
|
|
562 (error nil))))
|
|
563 (and buffer (get-buffer-process buffer))))]
|
|
564 "---"
|
|
565 ["Grep %_All Files in Current Directory..."
|
771
|
566 grep-all-files-in-current-directory
|
|
567 :active (fboundp 'grep-all-files-in-current-directory)]
|
|
568 ["G%_rep All Files in Current Directory and Below..."
|
|
569 grep-all-files-in-current-directory-and-below
|
|
570 :active (fboundp 'grep-all-files-in-current-directory-and-below)]
|
|
571 "---"
|
442
|
572 ["Grep %_C and C Header Files in Current Directory..."
|
|
573 (progn
|
|
574 (require 'compile)
|
|
575 (let ((grep-command
|
|
576 (cons (concat grep-command " *.[chCH]"
|
|
577 ; i wanted to also use *.cc and *.hh.
|
|
578 ; see long comment below under Perl.
|
|
579 )
|
|
580 (length grep-command))))
|
|
581 (call-interactively 'grep)))
|
|
582 :active (fboundp 'grep)]
|
|
583 ["Grep C Hea%_der Files in Current Directory..."
|
|
584 (progn
|
|
585 (require 'compile)
|
|
586 (let ((grep-command
|
|
587 (cons (concat grep-command " *.[hH]"
|
|
588 ; i wanted to also use *.hh.
|
|
589 ; see long comment below under Perl.
|
|
590 )
|
|
591 (length grep-command))))
|
|
592 (call-interactively 'grep)))
|
|
593 :active (fboundp 'grep)]
|
|
594 ["Grep %_E-Lisp Files in Current Directory..."
|
|
595 (progn
|
|
596 (require 'compile)
|
|
597 (let ((grep-command
|
|
598 (cons (concat grep-command " *.el")
|
|
599 (length grep-command))))
|
|
600 (call-interactively 'grep)))
|
|
601 :active (fboundp 'grep)]
|
|
602 ["Grep %_Perl Files in Current Directory..."
|
|
603 (progn
|
|
604 (require 'compile)
|
|
605 (let ((grep-command
|
|
606 (cons (concat grep-command " *.pl"
|
|
607 ; i wanted to use this:
|
|
608 ; " *.pl *.pm *.am"
|
|
609 ; but grep complains if it can't
|
|
610 ; match anything in a glob, and
|
|
611 ; that screws other things up.
|
|
612 ; perhaps we need to first scan
|
|
613 ; each separate glob in the directory
|
|
614 ; to see if there are any files in
|
|
615 ; that glob, and if not, omit it.
|
|
616 )
|
|
617 (length grep-command))))
|
|
618 (call-interactively 'grep)))
|
|
619 :active (fboundp 'grep)]
|
|
620 ["Grep %_HTML Files in Current Directory..."
|
|
621 (progn
|
|
622 (require 'compile)
|
|
623 (let ((grep-command
|
|
624 (cons (concat grep-command " *.*htm*")
|
|
625 (length grep-command))))
|
|
626 (call-interactively 'grep)))
|
|
627 :active (fboundp 'grep)]
|
|
628 "---"
|
|
629 ["%_Next Match" next-error
|
|
630 :active (and (fboundp 'compilation-errors-exist-p)
|
|
631 (compilation-errors-exist-p))]
|
|
632 ["Pre%_vious Match" previous-error
|
|
633 :active (and (fboundp 'compilation-errors-exist-p)
|
|
634 (compilation-errors-exist-p))]
|
|
635 ["%_First Match" first-error
|
|
636 :active (and (fboundp 'compilation-errors-exist-p)
|
|
637 (compilation-errors-exist-p))]
|
|
638 ["G%_oto Match" compile-goto-error
|
|
639 :active (and (fboundp 'compilation-errors-exist-p)
|
|
640 (compilation-errors-exist-p))]
|
|
641 "---"
|
|
642 ["%_Set Grep Command..."
|
|
643 (progn
|
|
644 (require 'compile)
|
|
645 (customize-set-variable
|
|
646 'grep-command
|
|
647 (read-shell-command "Default Grep Command: " grep-command)))
|
|
648 :active (fboundp 'grep)
|
|
649 ]
|
|
650 )
|
|
651 ("%_Compile"
|
|
652 :filter
|
|
653 (lambda (menu)
|
|
654 (if (or (not (boundp 'compile-history)) (null compile-history))
|
|
655 menu
|
|
656 (let ((items
|
|
657 (submenu-generate-accelerator-spec
|
679
|
658 (mapcar #'(lambda (label-value)
|
|
659 (vector (first label-value)
|
|
660 (list 'compile (second label-value))))
|
|
661 (Menubar-items-truncate-history
|
|
662 compile-history 10 50)))))
|
442
|
663 (append menu '("---") items))))
|
|
664 ["%_Compile..." compile :active (fboundp 'compile)]
|
|
665 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]
|
|
666 ["%_Kill Compilation" kill-compilation
|
|
667 :active (and (fboundp 'kill-compilation)
|
|
668 (fboundp 'compilation-find-buffer)
|
|
669 (let ((buffer (condition-case nil
|
|
670 (compilation-find-buffer)
|
|
671 (error nil))))
|
|
672 (and buffer (get-buffer-process buffer))))]
|
|
673 "---"
|
|
674 ["%_Next Error" next-error
|
|
675 :active (and (fboundp 'compilation-errors-exist-p)
|
|
676 (compilation-errors-exist-p))]
|
|
677 ["Pre%_vious Error" previous-error
|
|
678 :active (and (fboundp 'compilation-errors-exist-p)
|
|
679 (compilation-errors-exist-p))]
|
|
680 ["%_First Error" first-error
|
|
681 :active (and (fboundp 'compilation-errors-exist-p)
|
|
682 (compilation-errors-exist-p))]
|
|
683 ["G%_oto Error" compile-goto-error
|
|
684 :active (and (fboundp 'compilation-errors-exist-p)
|
|
685 (compilation-errors-exist-p))]
|
|
686 )
|
|
687 ("%_Debug"
|
|
688 ["%_GDB..." gdb
|
|
689 :active (fboundp 'gdb)]
|
|
690 ["%_DBX..." dbx
|
|
691 :active (fboundp 'dbx)])
|
|
692 ("%_Shell"
|
|
693 ["%_Shell" shell
|
|
694 :active (fboundp 'shell)]
|
|
695 ["S%_hell Command..." shell-command
|
|
696 :active (fboundp 'shell-command)]
|
|
697 ["Shell Command on %_Region..." shell-command-on-region
|
|
698 :active (and (fboundp 'shell-command-on-region) (region-exists-p))])
|
428
|
699
|
442
|
700 ("%_Tags"
|
|
701 ["%_Find Tag..." find-tag]
|
|
702 ["Find %_Other Window..." find-tag-other-window]
|
|
703 ["%_Next Tag..." (find-tag nil)]
|
|
704 ["N%_ext Other Window..." (find-tag-other-window nil)]
|
|
705 ["Next %_File" next-file]
|
|
706 "-----"
|
|
707 ["Tags %_Search..." tags-search]
|
|
708 ["Tags %_Replace..." tags-query-replace]
|
|
709 ["%_Continue Search/Replace" tags-loop-continue]
|
|
710 "-----"
|
|
711 ["%_Pop stack" pop-tag-mark]
|
|
712 ["%_Apropos..." tags-apropos]
|
|
713 "-----"
|
|
714 ["%_Set Tags Table File..." visit-tags-table]
|
|
715 )
|
|
716
|
|
717 "----"
|
|
718
|
|
719 ("Ca%_lendar"
|
|
720 ["%_3-Month Calendar" calendar
|
|
721 :active (fboundp 'calendar)]
|
|
722 ["%_Diary" diary
|
|
723 :active (fboundp 'diary)]
|
|
724 ["%_Holidays" holidays
|
|
725 :active (fboundp 'holidays)]
|
|
726 ;; we're all pagans at heart ...
|
|
727 ["%_Phases of the Moon" phases-of-moon
|
|
728 :active (fboundp 'phases-of-moon)]
|
|
729 ["%_Sunrise/Sunset" sunrise-sunset
|
|
730 :active (fboundp 'sunrise-sunset)])
|
428
|
731
|
442
|
732 ("Ga%_mes"
|
|
733 ["%_Mine Game" xmine
|
|
734 :active (fboundp 'xmine)]
|
|
735 ["%_Tetris" tetris
|
|
736 :active (fboundp 'tetris)]
|
|
737 ["%_Sokoban" sokoban
|
|
738 :active (fboundp 'sokoban)]
|
|
739 ["Quote from %_Zippy" yow
|
|
740 :active (fboundp 'yow)]
|
|
741 ["%_Psychoanalyst" doctor
|
|
742 :active (fboundp 'doctor)]
|
|
743 ["Ps%_ychoanalyze Zippy!" psychoanalyze-pinhead
|
|
744 :active (fboundp 'psychoanalyze-pinhead)]
|
|
745 ["%_Random Flames" flame
|
|
746 :active (fboundp 'flame)]
|
|
747 ["%_Dunnet (Adventure)" dunnet
|
|
748 :active (fboundp 'dunnet)]
|
|
749 ["Towers of %_Hanoi" hanoi
|
|
750 :active (fboundp 'hanoi)]
|
|
751 ["Game of %_Life" life
|
|
752 :active (fboundp 'life)]
|
|
753 ["M%_ultiplication Puzzle" mpuz
|
|
754 :active (fboundp 'mpuz)])
|
|
755
|
|
756 "----"
|
|
757 )
|
|
758
|
|
759 ("%_Options"
|
|
760 ("%_Advanced (Customize)"
|
|
761 ("%_Emacs" :filter (lambda (&rest junk)
|
|
762 (cdr (custom-menu-create 'emacs))))
|
|
763 ["%_Group..." customize-group]
|
|
764 ["%_Variable..." customize-variable]
|
|
765 ["%_Face..." customize-face]
|
|
766 ["%_Saved..." customize-saved]
|
|
767 ["Se%_t..." customize-customized]
|
|
768 ["%_Apropos..." customize-apropos]
|
|
769 ["%_Browse..." customize-browse])
|
|
770 "---"
|
|
771 ("%_Editing"
|
|
772 ["This Buffer %_Read Only" (toggle-read-only)
|
|
773 :style toggle :selected buffer-read-only]
|
|
774 ["%_Yank/Kill Interact With Clipboard"
|
|
775 (if (eq interprogram-cut-function 'own-clipboard)
|
|
776 (progn
|
|
777 (customize-set-variable 'interprogram-cut-function nil)
|
|
778 (customize-set-variable 'interprogram-paste-function nil))
|
|
779 (customize-set-variable 'interprogram-cut-function 'own-clipboard)
|
|
780 (customize-set-variable 'interprogram-paste-function 'get-clipboard))
|
|
781 :style toggle
|
|
782 :selected (eq interprogram-cut-function 'own-clipboard)]
|
|
783 ["%_Overstrike"
|
428
|
784 (progn
|
|
785 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
|
|
786 (customize-set-variable 'overwrite-mode overwrite-mode))
|
|
787 :style toggle :selected overwrite-mode]
|
442
|
788 ["%_Abbrev Mode"
|
|
789 (customize-set-variable 'abbrev-mode
|
|
790 (not (default-value 'abbrev-mode)))
|
|
791 :style toggle
|
|
792 :selected (default-value 'abbrev-mode)]
|
|
793 ["Active Re%_gions"
|
|
794 (customize-set-variable 'zmacs-regions (not zmacs-regions))
|
|
795 :style toggle :selected zmacs-regions]
|
|
796 "---"
|
|
797 ["%_Case Sensitive Search"
|
428
|
798 (customize-set-variable 'case-fold-search
|
|
799 (setq case-fold-search (not case-fold-search)))
|
|
800 :style toggle :selected (not case-fold-search)]
|
442
|
801 ["Case %_Matching Replace"
|
428
|
802 (customize-set-variable 'case-replace (not case-replace))
|
|
803 :style toggle :selected case-replace]
|
442
|
804 "---"
|
|
805 ("%_Newline at End of File..."
|
|
806 ["%_Don't Require"
|
|
807 (customize-set-variable 'require-final-newline nil)
|
|
808 :style radio :selected (not require-final-newline)]
|
|
809 ["%_Require"
|
|
810 (customize-set-variable 'require-final-newline t)
|
|
811 :style radio :selected (eq require-final-newline t)]
|
|
812 ["%_Ask"
|
|
813 (customize-set-variable 'require-final-newline 'ask)
|
|
814 :style radio :selected (and require-final-newline
|
|
815 (not (eq require-final-newline t)))])
|
|
816 ["Add Newline When Moving Past %_End"
|
|
817 (customize-set-variable 'next-line-add-newlines
|
|
818 (not next-line-add-newlines))
|
|
819 :style toggle :selected next-line-add-newlines])
|
|
820 ("%_Keyboard and Mouse"
|
|
821 ["%_Delete Key Deletes Selection"
|
428
|
822 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
|
|
823 :style toggle
|
|
824 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
|
|
825 :active (boundp 'pending-delete-mode)]
|
462
|
826 ["`%_kill-line' Kills Whole Line at %_Beg"
|
|
827 (customize-set-variable 'kill-whole-line (not kill-whole-line))
|
|
828 :style toggle
|
|
829 :selected kill-whole-line]
|
442
|
830 ["Size for %_Block-Movement Commands..."
|
|
831 (customize-set-variable 'block-movement-size
|
|
832 (read-number "Block Movement Size: "
|
|
833 t block-movement-size))]
|
|
834 ["%_VI Emulation"
|
|
835 (progn
|
|
836 (toggle-viper-mode)
|
|
837 (customize-set-variable 'viper-mode viper-mode))
|
|
838 :style toggle :selected (and (boundp 'viper-mode) viper-mode)
|
|
839 :active (fboundp 'toggle-viper-mode)]
|
|
840 "----"
|
462
|
841 ["S%_hifted Motion Keys Select Region"
|
|
842 (customize-set-variable 'shifted-motion-keys-select-region
|
|
843 (not shifted-motion-keys-select-region))
|
|
844 :style toggle
|
|
845 :selected shifted-motion-keys-select-region]
|
|
846 ["%_After Shifted Motion, Unshifted Motion Keys Deselect"
|
|
847 (customize-set-variable 'unshifted-motion-keys-deselect-region
|
|
848 (not unshifted-motion-keys-deselect-region))
|
|
849 :style toggle
|
|
850 :selected unshifted-motion-keys-deselect-region]
|
|
851 "----"
|
442
|
852 ["%_Set Key..." global-set-key]
|
|
853 ["%_Unset Key..." global-unset-key]
|
|
854 "---"
|
|
855 ["%_Mouse Paste at Text Cursor (not Clicked Location)"
|
428
|
856 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
|
|
857 :style toggle :selected mouse-yank-at-point]
|
442
|
858 "---"
|
|
859 ["%_Teach Extended Commands"
|
428
|
860 (customize-set-variable 'teach-extended-commands-p
|
|
861 (not teach-extended-commands-p))
|
|
862 :style toggle :selected teach-extended-commands-p]
|
|
863 )
|
442
|
864 ("%_Printing"
|
|
865 ["Set Printer %_Name for Generic Print Support..."
|
|
866 (customize-set-variable
|
|
867 'printer-name
|
|
868 (read-string "Set printer name: " printer-name))]
|
|
869 "---"
|
|
870 ["Command-Line %_Switches for `lpr'/`lp'..."
|
428
|
871 ;; better to directly open a customization buffer, since the value
|
|
872 ;; must be a list of strings, which is somewhat complex to prompt for.
|
|
873 (customize-variable 'lpr-switches)
|
|
874 (boundp 'lpr-switches)]
|
442
|
875 ("%_Pretty-Print Paper Size"
|
|
876 ["%_Letter"
|
428
|
877 (customize-set-variable 'ps-paper-type 'letter)
|
|
878 :style radio
|
|
879 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
|
|
880 :active (boundp 'ps-paper-type)]
|
442
|
881 ["Lette%_r-Small"
|
428
|
882 (customize-set-variable 'ps-paper-type 'letter-small)
|
|
883 :style radio
|
|
884 :selected (and (boundp 'ps-paper-type)
|
|
885 (eq ps-paper-type 'letter-small))
|
|
886 :active (boundp 'ps-paper-type)]
|
442
|
887 ["Le%_gal"
|
428
|
888 (customize-set-variable 'ps-paper-type 'legal)
|
|
889 :style radio
|
|
890 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
|
|
891 :active (boundp 'ps-paper-type)]
|
442
|
892 ["%_Statement"
|
428
|
893 (customize-set-variable 'ps-paper-type 'statement)
|
|
894 :style radio
|
|
895 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
|
|
896 :active (boundp 'ps-paper-type)]
|
442
|
897 ["%_Executive"
|
428
|
898 (customize-set-variable 'ps-paper-type 'executive)
|
|
899 :style radio
|
|
900 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
|
|
901 :active (boundp 'ps-paper-type)]
|
442
|
902 ["%_Tabloid"
|
428
|
903 (customize-set-variable 'ps-paper-type 'tabloid)
|
|
904 :style radio
|
|
905 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
|
|
906 :active (boundp 'ps-paper-type)]
|
442
|
907 ["Le%_dger"
|
428
|
908 (customize-set-variable 'ps-paper-type 'ledger)
|
|
909 :style radio
|
|
910 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
|
|
911 :active (boundp 'ps-paper-type)]
|
442
|
912 ["A%_3"
|
428
|
913 (customize-set-variable 'ps-paper-type 'a3)
|
|
914 :style radio
|
|
915 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
|
|
916 :active (boundp 'ps-paper-type)]
|
442
|
917 ["%_A4"
|
428
|
918 (customize-set-variable 'ps-paper-type 'a4)
|
|
919 :style radio
|
|
920 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
|
|
921 :active (boundp 'ps-paper-type)]
|
442
|
922 ["A4s%_mall"
|
428
|
923 (customize-set-variable 'ps-paper-type 'a4small)
|
|
924 :style radio
|
|
925 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
|
|
926 :active (boundp 'ps-paper-type)]
|
442
|
927 ["B%_4"
|
428
|
928 (customize-set-variable 'ps-paper-type 'b4)
|
|
929 :style radio
|
|
930 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
|
|
931 :active (boundp 'ps-paper-type)]
|
442
|
932 ["%_B5"
|
428
|
933 (customize-set-variable 'ps-paper-type 'b5)
|
|
934 :style radio
|
|
935 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
|
|
936 :active (boundp 'ps-paper-type)]
|
|
937 )
|
442
|
938 ["%_Color Printing"
|
428
|
939 (cond (ps-print-color-p
|
|
940 (customize-set-variable 'ps-print-color-p nil)
|
440
|
941 ;; I'm wondering whether all this muck is useful.
|
428
|
942 (and (boundp 'original-face-background)
|
|
943 original-face-background
|
|
944 (set-face-background 'default original-face-background)))
|
|
945 (t
|
|
946 (customize-set-variable 'ps-print-color-p t)
|
|
947 (setq original-face-background
|
|
948 (face-background-instance 'default))
|
|
949 (set-face-background 'default "white")))
|
|
950 :style toggle
|
|
951 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
|
|
952 :active (boundp 'ps-print-color-p)])
|
442
|
953 ("%_Internet"
|
|
954 ("%_Compose Mail With"
|
|
955 ["Default Emacs Mailer"
|
|
956 (customize-set-variable 'mail-user-agent 'sendmail-user-agent)
|
|
957 :style radio
|
|
958 :selected (eq mail-user-agent 'sendmail-user-agent)]
|
|
959 ["MH"
|
|
960 (customize-set-variable 'mail-user-agent 'mh-e-user-agent)
|
|
961 :style radio
|
|
962 :selected (eq mail-user-agent 'mh-e-user-agent)
|
|
963 :active (get 'mh-e-user-agent 'composefunc)]
|
|
964 ["GNUS"
|
|
965 (customize-set-variable 'mail-user-agent 'message-user-agent)
|
|
966 :style radio
|
|
967 :selected (eq mail-user-agent 'message-user-agent)
|
|
968 :active (get 'message-user-agent 'composefunc)]
|
|
969 )
|
|
970 ["Set My %_Email Address..."
|
|
971 (customize-set-variable
|
|
972 'user-mail-address
|
|
973 (read-string "Set email address: " user-mail-address))]
|
|
974 ["Set %_Machine Email Name..."
|
428
|
975 (customize-set-variable
|
442
|
976 'mail-host-address
|
|
977 (read-string "Set machine email name: " mail-host-address))]
|
|
978 ["Set %_SMTP Server..."
|
|
979 (progn
|
|
980 (require 'smtpmail)
|
|
981 (customize-set-variable
|
|
982 'smtpmail-smtp-server
|
|
983 (read-string "Set SMTP server: " smtpmail-smtp-server)))
|
|
984 :active (and (boundp 'send-mail-function)
|
|
985 (eq send-mail-function 'smtpmail-send-it))]
|
|
986 ["SMTP %_Debug Info"
|
|
987 (progn
|
|
988 (require 'smtpmail)
|
|
989 (customize-set-variable 'smtpmail-debug-info
|
|
990 (not smtpmail-debug-info)))
|
428
|
991 :style toggle
|
442
|
992 :selected (and (boundp 'smtpmail-debug-info) smtpmail-debug-info)
|
|
993 :active (and (boundp 'send-mail-function)
|
732
|
994 (eq send-mail-function 'smtpmail-send-it))])
|
442
|
995 ("%_Troubleshooting"
|
771
|
996 ["%_Debug on Error [not saved]"
|
|
997 (setq debug-on-error (not debug-on-error))
|
442
|
998 :style toggle :selected debug-on-error]
|
771
|
999 ["Debug on %_Quit [not saved]"
|
|
1000 (setq debug-on-quit (not debug-on-quit))
|
442
|
1001 :style toggle :selected debug-on-quit]
|
771
|
1002 ["Debug on S%_ignal [not saved]"
|
|
1003 (setq debug-on-signal (not debug-on-signal))
|
442
|
1004 :style toggle :selected debug-on-signal]
|
771
|
1005 ["%_Stack Trace on Error [not saved]"
|
|
1006 (setq stack-trace-on-error (not stack-trace-on-error))
|
442
|
1007 :style toggle :selected stack-trace-on-error]
|
771
|
1008 ["Stack Trace on Si%_gnal [not saved]"
|
|
1009 (setq stack-trace-on-signal (not stack-trace-on-signal))
|
442
|
1010 :style toggle :selected stack-trace-on-signal]
|
428
|
1011 )
|
771
|
1012 ("Encodin%_g"
|
|
1013 ["Automatic %_EOL Detection"
|
|
1014 (customize-set-variable 'eol-detection-enabled-p
|
|
1015 (not eol-detection-enabled-p))
|
|
1016 :style toggle
|
|
1017 :selected eol-detection-enabled-p
|
|
1018 :included (not (memq system-type '(windows-nt cygwin32)))]
|
|
1019 ("Set Coding System of %_Buffer File"
|
|
1020 :filter
|
|
1021 (lambda (menu)
|
|
1022 (coding-system-menu-filter
|
|
1023 (lambda (entry)
|
|
1024 (set-buffer-file-coding-system entry))
|
|
1025 (lambda (entry) t)
|
|
1026 ))
|
|
1027 )
|
|
1028 ;; not implemented yet
|
|
1029 ("Set Coding System of %_Terminal"
|
|
1030 :filter
|
|
1031 (lambda (menu)
|
|
1032 (coding-system-menu-filter
|
|
1033 (lambda (entry)
|
|
1034 (set-terminal-coding-system entry))
|
|
1035 (lambda (entry) nil)
|
|
1036 ))
|
|
1037 )
|
|
1038 ;; not implemented yet
|
|
1039 ("Set Coding System of %_Keyboard"
|
|
1040 :filter
|
|
1041 (lambda (menu)
|
|
1042 (coding-system-menu-filter
|
|
1043 (lambda (entry)
|
|
1044 (set-keyboard-coding-system entry))
|
|
1045 (lambda (entry) nil)
|
|
1046 ))
|
|
1047 )
|
|
1048 ("Set Coding System of %_Process"
|
|
1049 :filter
|
|
1050 (lambda (menu)
|
|
1051 (coding-system-menu-filter
|
|
1052 (lambda (entry)
|
|
1053 (set-buffer-process-coding-system entry))
|
|
1054 (lambda (entry) (get-buffer-process (current-buffer)))
|
|
1055 ))
|
|
1056 )
|
|
1057 )
|
|
1058 ,@(when (featurep 'mule)
|
|
1059 '(("Internationa%_l"
|
|
1060 ("Set %_Language Environment"
|
|
1061 :filter
|
|
1062 (lambda (menu)
|
|
1063 (menu-split-long-menu
|
|
1064 (menu-sort-menu
|
|
1065 (mapcar #'(lambda (entry)
|
|
1066 `[ ,(car entry)
|
|
1067 (set-language-environment ',(car entry))
|
|
1068 :style radio
|
|
1069 :selected
|
|
1070 ,(equal (car entry)
|
|
1071 current-language-environment)])
|
|
1072 language-info-alist)
|
|
1073 ))))
|
|
1074 ["%_Toggle Input Method" toggle-input-method]
|
|
1075 ["Select %_Input Method" set-input-method]
|
|
1076 )))
|
428
|
1077 "-----"
|
442
|
1078 ("%_Display"
|
|
1079 ,@(if (featurep 'scrollbar)
|
|
1080 '(["%_Scrollbars"
|
|
1081 (customize-set-variable 'scrollbars-visible-p
|
|
1082 (not scrollbars-visible-p))
|
|
1083 :style toggle
|
|
1084 :selected scrollbars-visible-p]))
|
|
1085 ["%_Wrap Long Lines"
|
|
1086 (progn;; becomes buffer-local
|
|
1087 (setq truncate-lines (not truncate-lines))
|
|
1088 (customize-set-variable 'truncate-lines truncate-lines))
|
|
1089 :style toggle
|
|
1090 :selected (not truncate-lines)]
|
454
|
1091 "----"
|
|
1092 ["%_3D Modeline"
|
|
1093 (customize-set-variable 'modeline-3d-p
|
|
1094 (not modeline-3d-p))
|
|
1095 :style toggle
|
|
1096 :selected modeline-3d-p]
|
|
1097 ("Modeline %_Horizontal Scrolling"
|
|
1098 ["%_None"
|
|
1099 (customize-set-variable 'modeline-scrolling-method nil)
|
|
1100 :style radio
|
|
1101 :selected (not modeline-scrolling-method)]
|
|
1102 ["As %_Text"
|
|
1103 (customize-set-variable 'modeline-scrolling-method t)
|
|
1104 :style radio
|
|
1105 :selected (eq modeline-scrolling-method t)]
|
|
1106 ["As %_Scrollbar"
|
|
1107 (customize-set-variable 'modeline-scrolling-method 'scrollbar)
|
|
1108 :style radio
|
|
1109 :selected (eq modeline-scrolling-method 'scrollbar)]
|
|
1110 )
|
442
|
1111 ,@(if (featurep 'toolbar)
|
|
1112 '("---"
|
|
1113 ["%_Toolbars Visible"
|
|
1114 (customize-set-variable 'toolbar-visible-p
|
|
1115 (not toolbar-visible-p))
|
|
1116 :style toggle
|
|
1117 :selected toolbar-visible-p]
|
|
1118 ["Toolbars Ca%_ptioned"
|
|
1119 (customize-set-variable 'toolbar-captioned-p
|
|
1120 (not toolbar-captioned-p))
|
|
1121 :style toggle
|
|
1122 :active toolbar-visible-p
|
|
1123 :selected toolbar-captioned-p]
|
|
1124 ("Default Toolba%_r Location"
|
|
1125 ["%_Top"
|
|
1126 (customize-set-variable 'default-toolbar-position 'top)
|
|
1127 :style radio
|
|
1128 :active toolbar-visible-p
|
|
1129 :selected (eq default-toolbar-position 'top)]
|
|
1130 ["%_Bottom"
|
|
1131 (customize-set-variable 'default-toolbar-position 'bottom)
|
|
1132 :style radio
|
|
1133 :active toolbar-visible-p
|
|
1134 :selected (eq default-toolbar-position 'bottom)]
|
|
1135 ["%_Left"
|
|
1136 (customize-set-variable 'default-toolbar-position 'left)
|
|
1137 :style radio
|
|
1138 :active toolbar-visible-p
|
|
1139 :selected (eq default-toolbar-position 'left)]
|
|
1140 ["%_Right"
|
|
1141 (customize-set-variable 'default-toolbar-position 'right)
|
|
1142 :style radio
|
|
1143 :active toolbar-visible-p
|
|
1144 :selected (eq default-toolbar-position 'right)]
|
|
1145 )
|
|
1146 ))
|
|
1147 ,@(if (featurep 'gutter)
|
|
1148 '("---"
|
|
1149 ["B%_uffers Tab Visible"
|
|
1150 (customize-set-variable 'gutter-buffers-tab-visible-p
|
|
1151 (not gutter-buffers-tab-visible-p))
|
|
1152 :style toggle
|
|
1153 :selected gutter-buffers-tab-visible-p]
|
|
1154 ("Default %_Gutter Location"
|
|
1155 ["%_Top"
|
|
1156 (customize-set-variable 'default-gutter-position 'top)
|
|
1157 :style radio
|
|
1158 :selected (eq default-gutter-position 'top)]
|
|
1159 ["%_Bottom"
|
|
1160 (customize-set-variable 'default-gutter-position 'bottom)
|
|
1161 :style radio
|
|
1162 :selected (eq default-gutter-position 'bottom)]
|
|
1163 ["%_Left"
|
|
1164 (customize-set-variable 'default-gutter-position 'left)
|
|
1165 :style radio
|
|
1166 :selected (eq default-gutter-position 'left)]
|
|
1167 ["%_Right"
|
|
1168 (customize-set-variable 'default-gutter-position 'right)
|
|
1169 :style radio
|
|
1170 :selected (eq default-gutter-position 'right)]
|
|
1171 )
|
|
1172 ))
|
|
1173 "-----"
|
|
1174 ["%_Blinking Cursor"
|
|
1175 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
|
|
1176 :style toggle
|
|
1177 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
|
|
1178 :active (boundp 'blink-cursor-mode)]
|
|
1179 ["Bl%_ock Cursor"
|
|
1180 (progn
|
|
1181 (customize-set-variable 'bar-cursor nil)
|
|
1182 (force-cursor-redisplay))
|
|
1183 :style radio
|
|
1184 :selected (null bar-cursor)]
|
|
1185 ["Bar Cursor (%_1 Pixel)"
|
|
1186 (progn
|
|
1187 (customize-set-variable 'bar-cursor t)
|
|
1188 (force-cursor-redisplay))
|
|
1189 :style radio
|
|
1190 :selected (eq bar-cursor t)]
|
|
1191 ["Bar Cursor (%_2 Pixels)"
|
|
1192 (progn
|
|
1193 (customize-set-variable 'bar-cursor 2)
|
|
1194 (force-cursor-redisplay))
|
|
1195 :style radio
|
|
1196 :selected (and bar-cursor (not (eq bar-cursor t)))]
|
|
1197 "----"
|
|
1198 ("Pa%_ren Highlighting"
|
|
1199 ["%_None"
|
|
1200 (customize-set-variable 'paren-mode nil)
|
|
1201 :style radio
|
|
1202 :selected (and (boundp 'paren-mode) (not paren-mode))
|
|
1203 :active (boundp 'paren-mode)]
|
|
1204 ["%_Blinking Paren"
|
|
1205 (customize-set-variable 'paren-mode 'blink-paren)
|
|
1206 :style radio
|
|
1207 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
|
|
1208 :active (boundp 'paren-mode)]
|
|
1209 ["%_Steady Paren"
|
|
1210 (customize-set-variable 'paren-mode 'paren)
|
|
1211 :style radio
|
|
1212 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
|
|
1213 :active (boundp 'paren-mode)]
|
|
1214 ["%_Expression"
|
|
1215 (customize-set-variable 'paren-mode 'sexp)
|
|
1216 :style radio
|
|
1217 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
|
|
1218 :active (boundp 'paren-mode)]
|
|
1219 ;; ["Nes%_ted Shading"
|
|
1220 ;; (customize-set-variable 'paren-mode 'nested)
|
|
1221 ;; :style radio
|
|
1222 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
|
|
1223 ;; :active (boundp 'paren-mode)]
|
|
1224 )
|
|
1225 "------"
|
|
1226 ["%_Line Numbers"
|
|
1227 (progn
|
|
1228 (customize-set-variable 'line-number-mode (not line-number-mode))
|
|
1229 (redraw-modeline))
|
|
1230 :style toggle :selected line-number-mode]
|
|
1231 ["%_Column Numbers"
|
|
1232 (progn
|
|
1233 (customize-set-variable 'column-number-mode
|
|
1234 (not column-number-mode))
|
|
1235 (redraw-modeline))
|
|
1236 :style toggle :selected column-number-mode]
|
454
|
1237
|
442
|
1238 ("\"Other %_Window\" Location"
|
|
1239 ["%_Always in Same Frame"
|
|
1240 (customize-set-variable
|
|
1241 'get-frame-for-buffer-default-instance-limit nil)
|
|
1242 :style radio
|
|
1243 :selected (null get-frame-for-buffer-default-instance-limit)]
|
|
1244 ["Other Frame (%_2 Frames Max)"
|
|
1245 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
|
|
1246 2)
|
|
1247 :style radio
|
|
1248 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
|
|
1249 ["Other Frame (%_3 Frames Max)"
|
|
1250 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
|
|
1251 3)
|
|
1252 :style radio
|
|
1253 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
|
|
1254 ["Other Frame (%_4 Frames Max)"
|
|
1255 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
|
|
1256 4)
|
|
1257 :style radio
|
|
1258 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
|
|
1259 ["Other Frame (%_5 Frames Max)"
|
|
1260 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
|
|
1261 5)
|
|
1262 :style radio
|
|
1263 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
|
|
1264 ["Always Create %_New Frame"
|
|
1265 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
|
|
1266 0)
|
|
1267 :style radio
|
|
1268 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
|
|
1269 "-----"
|
|
1270 ["%_Temp Buffers Always in Same Frame"
|
|
1271 (customize-set-variable 'temp-buffer-show-function
|
|
1272 'show-temp-buffer-in-current-frame)
|
|
1273 :style radio
|
|
1274 :selected (eq temp-buffer-show-function
|
|
1275 'show-temp-buffer-in-current-frame)]
|
|
1276 ["Temp Buffers %_Like Other Buffers"
|
|
1277 (customize-set-variable 'temp-buffer-show-function nil)
|
|
1278 :style radio
|
|
1279 :selected (null temp-buffer-show-function)]
|
|
1280 "-----"
|
|
1281 ["%_Make Current Frame Gnuserv Target"
|
|
1282 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil
|
|
1283 t))
|
|
1284 :style toggle
|
|
1285 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
|
|
1286 :active (boundp 'gnuserv-frame)]
|
|
1287 )
|
454
|
1288 )
|
442
|
1289 ("%_Menubars"
|
|
1290 ["%_Frame-Local Font Menu"
|
|
1291 (customize-set-variable 'font-menu-this-frame-only-p
|
|
1292 (not font-menu-this-frame-only-p))
|
|
1293 :style toggle
|
|
1294 :selected (and (boundp 'font-menu-this-frame-only-p)
|
|
1295 font-menu-this-frame-only-p)]
|
|
1296 ["%_Alt/Meta Selects Menu Items"
|
|
1297 (if (eq menu-accelerator-enabled 'menu-force)
|
|
1298 (customize-set-variable 'menu-accelerator-enabled nil)
|
|
1299 (customize-set-variable 'menu-accelerator-enabled 'menu-force))
|
|
1300 :style toggle
|
|
1301 :selected (eq menu-accelerator-enabled 'menu-force)]
|
|
1302 "----"
|
|
1303 ["Buffers Menu %_Length..."
|
|
1304 (customize-set-variable
|
|
1305 'buffers-menu-max-size
|
|
1306 ;; would it be better to open a customization buffer ?
|
|
1307 (let ((val
|
|
1308 (read-number
|
|
1309 "Enter number of buffers to display (or 0 for unlimited): ")))
|
|
1310 (if (eq val 0) nil val)))]
|
|
1311 ["%_Multi-Operation Buffers Sub-Menus"
|
|
1312 (customize-set-variable 'complex-buffers-menu-p
|
|
1313 (not complex-buffers-menu-p))
|
|
1314 :style toggle
|
|
1315 :selected complex-buffers-menu-p]
|
|
1316 ["S%_ubmenus for Buffer Groups"
|
|
1317 (customize-set-variable 'buffers-menu-submenus-for-groups-p
|
|
1318 (not buffers-menu-submenus-for-groups-p))
|
|
1319 :style toggle
|
|
1320 :selected buffers-menu-submenus-for-groups-p]
|
|
1321 ["%_Verbose Buffer Menu Entries"
|
|
1322 (if (eq buffers-menu-format-buffer-line-function
|
|
1323 'slow-format-buffers-menu-line)
|
|
1324 (customize-set-variable 'buffers-menu-format-buffer-line-function
|
|
1325 'format-buffers-menu-line)
|
|
1326 (customize-set-variable 'buffers-menu-format-buffer-line-function
|
|
1327 'slow-format-buffers-menu-line))
|
|
1328 :style toggle
|
|
1329 :selected (eq buffers-menu-format-buffer-line-function
|
|
1330 'slow-format-buffers-menu-line)]
|
|
1331 ("Buffers Menu %_Sorting"
|
|
1332 ["%_Most Recently Used"
|
|
1333 (progn
|
|
1334 (customize-set-variable 'buffers-menu-sort-function nil)
|
|
1335 (customize-set-variable 'buffers-menu-grouping-function nil))
|
|
1336 :style radio
|
|
1337 :selected (null buffers-menu-sort-function)]
|
|
1338 ["%_Alphabetically"
|
|
1339 (progn
|
|
1340 (customize-set-variable 'buffers-menu-sort-function
|
|
1341 'sort-buffers-menu-alphabetically)
|
|
1342 (customize-set-variable 'buffers-menu-grouping-function nil))
|
|
1343 :style radio
|
|
1344 :selected (eq 'sort-buffers-menu-alphabetically
|
|
1345 buffers-menu-sort-function)]
|
|
1346 ["%_By Major Mode, Then Alphabetically"
|
|
1347 (progn
|
|
1348 (customize-set-variable
|
|
1349 'buffers-menu-sort-function
|
|
1350 'sort-buffers-menu-by-mode-then-alphabetically)
|
|
1351 (customize-set-variable
|
|
1352 'buffers-menu-grouping-function
|
|
1353 'group-buffers-menu-by-mode-then-alphabetically))
|
|
1354 :style radio
|
|
1355 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
|
|
1356 buffers-menu-sort-function)])
|
|
1357 "---"
|
|
1358 ["%_Ignore Scaled Fonts"
|
|
1359 (customize-set-variable 'font-menu-ignore-scaled-fonts
|
|
1360 (not font-menu-ignore-scaled-fonts))
|
|
1361 :style toggle
|
|
1362 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
|
|
1363 font-menu-ignore-scaled-fonts)]
|
|
1364 )
|
|
1365 ("S%_yntax Highlighting"
|
|
1366 ["%_In This Buffer"
|
|
1367 (progn;; becomes buffer local
|
428
|
1368 (font-lock-mode)
|
|
1369 (customize-set-variable 'font-lock-mode font-lock-mode))
|
|
1370 :style toggle
|
|
1371 :selected (and (boundp 'font-lock-mode) font-lock-mode)
|
|
1372 :active (boundp 'font-lock-mode)]
|
442
|
1373 ["%_Automatic"
|
428
|
1374 (customize-set-variable 'font-lock-auto-fontify
|
|
1375 (not font-lock-auto-fontify))
|
|
1376 :style toggle
|
|
1377 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
|
|
1378 :active (fboundp 'font-lock-mode)]
|
|
1379 "-----"
|
442
|
1380 ["Force %_Rehighlight in this Buffer"
|
|
1381 (customize-set-variable 'font-lock-auto-fontify
|
|
1382 (not font-lock-auto-fontify))
|
|
1383 :style toggle
|
|
1384 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
|
|
1385 :active (fboundp 'font-lock-mode)]
|
|
1386 "-----"
|
|
1387 ["%_Fonts"
|
428
|
1388 (progn
|
|
1389 (require 'font-lock)
|
|
1390 (font-lock-use-default-fonts)
|
|
1391 (customize-set-variable 'font-lock-use-fonts t)
|
|
1392 (customize-set-variable 'font-lock-use-colors nil)
|
|
1393 (font-lock-mode 1))
|
|
1394 :style radio
|
|
1395 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
|
|
1396 :active (fboundp 'font-lock-mode)]
|
442
|
1397 ["%_Colors"
|
428
|
1398 (progn
|
|
1399 (require 'font-lock)
|
|
1400 (font-lock-use-default-colors)
|
|
1401 (customize-set-variable 'font-lock-use-colors t)
|
|
1402 (customize-set-variable 'font-lock-use-fonts nil)
|
|
1403 (font-lock-mode 1))
|
|
1404 :style radio
|
|
1405 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
|
|
1406 :active (boundp 'font-lock-mode)]
|
|
1407 "-----"
|
442
|
1408 ["%_1 Least"
|
428
|
1409 (progn
|
|
1410 (require 'font-lock)
|
|
1411 (if (or (and (not (integerp font-lock-maximum-decoration))
|
|
1412 (not (eq t font-lock-maximum-decoration)))
|
|
1413 (and (integerp font-lock-maximum-decoration)
|
|
1414 (<= font-lock-maximum-decoration 0)))
|
|
1415 nil
|
|
1416 (customize-set-variable 'font-lock-maximum-decoration nil)
|
|
1417 (font-lock-recompute-variables)))
|
|
1418 :style radio
|
|
1419 :active (fboundp 'font-lock-mode)
|
442
|
1420 :selected (and (boundp 'font-lock-maximum-decoration)
|
428
|
1421 (or (and (not (integerp font-lock-maximum-decoration))
|
|
1422 (not (eq t font-lock-maximum-decoration)))
|
|
1423 (and (integerp font-lock-maximum-decoration)
|
|
1424 (<= font-lock-maximum-decoration 0))))]
|
442
|
1425 ["%_2 More"
|
428
|
1426 (progn
|
|
1427 (require 'font-lock)
|
|
1428 (if (and (integerp font-lock-maximum-decoration)
|
|
1429 (= 1 font-lock-maximum-decoration))
|
|
1430 nil
|
|
1431 (customize-set-variable 'font-lock-maximum-decoration 1)
|
|
1432 (font-lock-recompute-variables)))
|
|
1433 :style radio
|
|
1434 :active (fboundp 'font-lock-mode)
|
442
|
1435 :selected (and (boundp 'font-lock-maximum-decoration)
|
428
|
1436 (integerp font-lock-maximum-decoration)
|
|
1437 (= 1 font-lock-maximum-decoration))]
|
442
|
1438 ["%_3 Even More"
|
428
|
1439 (progn
|
|
1440 (require 'font-lock)
|
|
1441 (if (and (integerp font-lock-maximum-decoration)
|
|
1442 (= 2 font-lock-maximum-decoration))
|
|
1443 nil
|
|
1444 (customize-set-variable 'font-lock-maximum-decoration 2)
|
|
1445 (font-lock-recompute-variables)))
|
|
1446 :style radio
|
|
1447 :active (fboundp 'font-lock-mode)
|
|
1448 :selected (and (boundp 'font-lock-maximum-decoration)
|
|
1449 (integerp font-lock-maximum-decoration)
|
|
1450 (= 2 font-lock-maximum-decoration))]
|
442
|
1451 ["%_4 Most"
|
428
|
1452 (progn
|
|
1453 (require 'font-lock)
|
|
1454 (if (or (eq font-lock-maximum-decoration t)
|
|
1455 (and (integerp font-lock-maximum-decoration)
|
|
1456 (>= font-lock-maximum-decoration 3)))
|
|
1457 nil
|
|
1458 (customize-set-variable 'font-lock-maximum-decoration t)
|
|
1459 (font-lock-recompute-variables)))
|
|
1460 :style radio
|
|
1461 :active (fboundp 'font-lock-mode)
|
|
1462 :selected (and (boundp 'font-lock-maximum-decoration)
|
|
1463 (or (eq font-lock-maximum-decoration t)
|
|
1464 (and (integerp font-lock-maximum-decoration)
|
|
1465 (>= font-lock-maximum-decoration 3))))]
|
|
1466 "-----"
|
442
|
1467 ["Lazy %_Lock"
|
|
1468 (progn;; becomes buffer local
|
|
1469 (lazy-lock-mode)
|
|
1470 (customize-set-variable 'lazy-lock-mode lazy-lock-mode)
|
|
1471 ;; this shouldn't be necessary so there has to
|
|
1472 ;; be a redisplay bug lurking somewhere (or
|
|
1473 ;; possibly another event handler bug)
|
|
1474 (redraw-modeline))
|
|
1475 :active (and (boundp 'font-lock-mode) (boundp 'lazy-lock-mode)
|
|
1476 font-lock-mode)
|
|
1477 :style toggle
|
|
1478 :selected (and (boundp 'lazy-lock-mode) lazy-lock-mode)]
|
|
1479 ["Lazy %_Shot"
|
|
1480 (progn;; becomes buffer local
|
428
|
1481 (lazy-shot-mode)
|
|
1482 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
|
|
1483 ;; this shouldn't be necessary so there has to
|
|
1484 ;; be a redisplay bug lurking somewhere (or
|
|
1485 ;; possibly another event handler bug)
|
|
1486 (redraw-modeline))
|
|
1487 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
|
|
1488 font-lock-mode)
|
|
1489 :style toggle
|
|
1490 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
|
442
|
1491 ["Cac%_hing"
|
|
1492 (progn;; becomes buffer local
|
428
|
1493 (fast-lock-mode)
|
|
1494 (customize-set-variable 'fast-lock-mode fast-lock-mode)
|
|
1495 ;; this shouldn't be necessary so there has to
|
|
1496 ;; be a redisplay bug lurking somewhere (or
|
|
1497 ;; possibly another event handler bug)
|
|
1498 (redraw-modeline))
|
|
1499 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
|
|
1500 font-lock-mode)
|
|
1501 :style toggle
|
|
1502 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
|
|
1503 )
|
442
|
1504 ("%_Font" :filter font-menu-family-constructor)
|
|
1505 ("Font Si%_ze" :filter font-menu-size-constructor)
|
|
1506 ;; ("Font Weig%_ht" :filter font-menu-weight-constructor)
|
|
1507 ["Edit Fa%_ces..." (customize-face nil)]
|
428
|
1508 "-----"
|
442
|
1509 ["Edit I%_nit File"
|
|
1510 ;; #### there should be something that holds the name that the init
|
|
1511 ;; file should be created as, when it's not present.
|
502
|
1512 (let ((el-file (or user-init-file "~/.xemacs/init.el")))
|
|
1513 (if (string-match "\\.elc$" el-file)
|
|
1514 (setq el-file
|
|
1515 (substring user-init-file 0 (1- (length el-file)))))
|
|
1516 (find-file el-file)
|
|
1517 (or (eq major-mode 'emacs-lisp-mode)
|
|
1518 (emacs-lisp-mode)))]
|
442
|
1519 ["%_Save Options to Init File" customize-save-customized]
|
|
1520 )
|
|
1521
|
|
1522 ("%_Buffers"
|
|
1523 :filter buffers-menu-filter
|
|
1524 ["Go To %_Previous Buffer" switch-to-other-buffer]
|
|
1525 ["Go To %_Buffer..." switch-to-buffer]
|
|
1526 "----"
|
792
|
1527 ["%_List All Buffers" list-all-buffers]
|
442
|
1528 ["%_Delete Buffer" kill-this-buffer
|
|
1529 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
|
|
1530 "----"
|
428
|
1531 )
|
|
1532
|
442
|
1533 nil ; the partition: menus after this are flushright
|
428
|
1534
|
442
|
1535 ("%_Help"
|
|
1536 ["%_About XEmacs..." about-xemacs]
|
502
|
1537 ["%_Home Page (www.xemacs.org)" xemacs-www-page
|
|
1538 :active (fboundp 'browse-url)]
|
442
|
1539 "-----"
|
479
|
1540 ["What's %_New in XEmacs" view-emacs-news]
|
442
|
1541 ["%_Obtaining XEmacs" describe-distribution]
|
428
|
1542 "-----"
|
442
|
1543 ("%_Info (Online Docs)"
|
502
|
1544 ["Info Con%_tents" (Info-goto-node "(dir)")]
|
|
1545 "-----"
|
|
1546 ["XEmacs %_User's Manual" (Info-goto-node "(XEmacs)")]
|
|
1547 ["XEmacs %_Lisp Reference Manual" (Info-goto-node "(Lispref)")]
|
|
1548 ["All About %_Packages" (Info-goto-node "(xemacs)Packages")]
|
|
1549 ["%_Getting Started with XEmacs" (Info-goto-node "(New-Users-Guide)")]
|
|
1550 ["XEmacs In%_ternals Manual" (Info-goto-node "(Internals)")]
|
|
1551 ["%_How to Use Info" (Info-goto-node "(Info)")]
|
|
1552 "-----"
|
|
1553 ["Lookup %_Key Sequence in User's Manual..."
|
|
1554 Info-goto-emacs-key-command-node]
|
|
1555 ["Lookup %_Command in User's Manual..." Info-goto-emacs-command-node]
|
|
1556 ["Lookup %_Function in Lisp Reference..." Info-elisp-ref]
|
|
1557 "-----"
|
|
1558 ["Search %_Index in User's Manual/Lispref..."
|
|
1559 Info-search-index-in-xemacs-and-lispref]
|
|
1560 ["%_Search Text in User's Manual..." Info-search-text-in-xemacs]
|
|
1561 ["S%_earch Text in Lisp Reference..."
|
|
1562 Info-search-text-in-lispref]
|
|
1563 )
|
442
|
1564 ("XEmacs %_FAQ"
|
|
1565 ["%_FAQ (local)" xemacs-local-faq]
|
|
1566 ["FAQ via %_WWW" xemacs-www-faq
|
|
1567 :active (fboundp 'browse-url)])
|
|
1568 ("%_Tutorials"
|
|
1569 :filter tutorials-menu-filter)
|
|
1570 ("%_Samples"
|
502
|
1571 ["View Sample %_init.el" view-sample-init-el
|
462
|
1572 :active (locate-data-file "sample.init.el")]
|
502
|
1573 ["View Sample .%_gtkrc"
|
|
1574 (Help-find-file (locate-data-file "sample.gtkrc"))
|
462
|
1575 :included (featurep 'gtk)
|
|
1576 :active (locate-data-file "sample.gtkrc")]
|
502
|
1577 ["View Sample .%_Xdefaults"
|
|
1578 (Help-find-file (locate-data-file "sample.Xdefaults"))
|
462
|
1579 :included (featurep 'x)
|
442
|
1580 :active (locate-data-file "sample.Xdefaults")]
|
502
|
1581 ["View Sample %_enriched.doc"
|
|
1582 (Help-find-file (locate-data-file "enriched.doc"))
|
442
|
1583 :active (locate-data-file "enriched.doc")])
|
502
|
1584 ("%_Commands, Variables, Keys"
|
|
1585 ["Describe %_Mode" describe-mode]
|
442
|
1586 ["%_Apropos..." hyper-apropos]
|
502
|
1587 ["%_Command-Only Apropos..." command-hyper-apropos]
|
442
|
1588 ["Apropos %_Docs..." apropos-documentation]
|
428
|
1589 "-----"
|
502
|
1590 ["Describe %_Key..." describe-key]
|
|
1591 ["Show %_Bindings" describe-bindings]
|
|
1592 ["Show M%_ouse Bindings" describe-pointer]
|
442
|
1593 ["%_Recent Keys" view-lossage]
|
428
|
1594 "-----"
|
502
|
1595 ["Describe %_Function..." describe-function]
|
|
1596 ["Describe %_Variable..." describe-variable]
|
|
1597 ["%_Locate Command in Keymap..." where-is])
|
771
|
1598 ,@(when (featurep 'mule)
|
|
1599 '(("Internationa%_l"
|
|
1600 ("Describe %_Language Support"
|
|
1601 :filter
|
|
1602 (lambda (menu)
|
|
1603 (menu-split-long-menu
|
|
1604 (menu-sort-menu
|
|
1605 (mapcar #'(lambda (entry)
|
|
1606 `[ ,(car entry)
|
|
1607 (describe-language-environment
|
|
1608 ',(car entry))
|
|
1609 :style radio
|
|
1610 :selected
|
|
1611 ,(equal (car entry)
|
|
1612 current-language-environment)])
|
|
1613 language-info-alist)
|
|
1614 ))))
|
|
1615 ["Describe %_Input Method" describe-input-method]
|
|
1616 ["Describe Current %_Coding Systems"
|
|
1617 describe-current-coding-system]
|
|
1618 ["Show Character %_Table" view-charset-by-menu]
|
|
1619 ;; not implemented yet
|
|
1620 ["Show %_Diagnosis for MULE" mule-diag :active nil]
|
|
1621 ["Show \"%_hello\" in Many Languages" view-hello-file]
|
|
1622 )))
|
442
|
1623 ("%_Misc"
|
|
1624 ["%_Current Installation Info" describe-installation
|
428
|
1625 :active (boundp 'Installation-string)]
|
442
|
1626 ["%_No Warranty" describe-no-warranty]
|
|
1627 ["XEmacs %_License" describe-copying]
|
|
1628 ["Find %_Packages" finder-by-keyword]
|
|
1629 ["View %_Splash Screen" xemacs-splash-buffer]
|
|
1630 ["%_Unix Manual..." manual-entry])
|
502
|
1631 "-----"
|
|
1632 ["%_Recent Messages" view-lossage]
|
644
|
1633 ["Send %_Bug Report..." report-xemacs-bug
|
|
1634 :active (fboundp 'report-xemacs-bug)])))
|
428
|
1635
|
|
1636
|
771
|
1637 (defun init-menubar-at-startup ()
|
428
|
1638 "Don't call this.
|
|
1639 Adds `Load .emacs' button to menubar when starting up with -q."
|
442
|
1640 (when (and (not load-user-init-file-p)
|
|
1641 (file-exists-p (expand-file-name ".emacs" "~")))
|
|
1642 (add-menu-button
|
|
1643 nil
|
|
1644 ["%_Load .emacs"
|
|
1645 (progn
|
|
1646 (mapc #'(lambda (buf)
|
|
1647 (with-current-buffer buf
|
|
1648 (delete-menu-item '("Load .emacs"))))
|
|
1649 (buffer-list))
|
|
1650 (load-user-init-file))
|
|
1651 ]
|
|
1652 "Help")))
|
428
|
1653
|
|
1654
|
|
1655 ;;; The File menu
|
|
1656
|
|
1657 (defvar put-buffer-names-in-file-menu t)
|
|
1658
|
|
1659
|
|
1660 ;;; The Bookmarks menu
|
|
1661
|
|
1662 (defun bookmark-menu-filter (&rest ignore)
|
442
|
1663 (declare (special bookmark-alist))
|
428
|
1664 (let ((definedp (and (boundp 'bookmark-alist)
|
|
1665 bookmark-alist
|
|
1666 t)))
|
|
1667 `(,(if definedp
|
442
|
1668 '("%_Jump to Bookmark"
|
428
|
1669 :filter (lambda (&rest junk)
|
442
|
1670 (submenu-generate-accelerator-spec
|
|
1671 (mapcar #'(lambda (bmk)
|
|
1672 `[,bmk (bookmark-jump ',bmk)])
|
|
1673 (bookmark-all-names)))))
|
|
1674 ["%_Jump to Bookmark" nil nil])
|
|
1675 ["Set %_Bookmark" bookmark-set
|
428
|
1676 :active (fboundp 'bookmark-set)]
|
|
1677 "---"
|
442
|
1678 ["Insert %_Contents" bookmark-menu-insert
|
428
|
1679 :active (fboundp 'bookmark-menu-insert)]
|
442
|
1680 ["Insert L%_ocation" bookmark-menu-locate
|
428
|
1681 :active (fboundp 'bookmark-menu-locate)]
|
|
1682 "---"
|
442
|
1683 ["%_Rename Bookmark" bookmark-menu-rename
|
428
|
1684 :active (fboundp 'bookmark-menu-rename)]
|
|
1685 ,(if definedp
|
442
|
1686 '("%_Delete Bookmark"
|
428
|
1687 :filter (lambda (&rest junk)
|
442
|
1688 (submenu-generate-accelerator-spec
|
|
1689 (mapcar #'(lambda (bmk)
|
|
1690 `[,bmk (bookmark-delete ',bmk)])
|
|
1691 (bookmark-all-names)))))
|
|
1692 ["%_Delete Bookmark" nil nil])
|
|
1693 ["%_Edit Bookmark List" bookmark-bmenu-list ,definedp]
|
428
|
1694 "---"
|
442
|
1695 ["%_Save Bookmarks" bookmark-save ,definedp]
|
|
1696 ["Save Bookmarks %_As..." bookmark-write ,definedp]
|
|
1697 ["%_Load a Bookmark File" bookmark-load
|
428
|
1698 :active (fboundp 'bookmark-load)])))
|
|
1699
|
|
1700 ;;; The Buffers menu
|
|
1701
|
|
1702 (defgroup buffers-menu nil
|
|
1703 "Customization of `Buffers' menu."
|
|
1704 :group 'menu)
|
|
1705
|
442
|
1706 (defvar buffers-menu-omit-chars-list '(?b ?p ?l ?d))
|
|
1707
|
428
|
1708 (defcustom buffers-menu-max-size 25
|
|
1709 "*Maximum number of entries which may appear on the \"Buffers\" menu.
|
|
1710 If this is 10, then only the ten most-recently-selected buffers will be
|
|
1711 shown. If this is nil, then all buffers will be shown. Setting this to
|
|
1712 a large number or nil will slow down menu responsiveness."
|
|
1713 :type '(choice (const :tag "Show all" nil)
|
|
1714 (integer 10))
|
|
1715 :group 'buffers-menu)
|
|
1716
|
|
1717 (defcustom complex-buffers-menu-p nil
|
|
1718 "*If non-nil, the buffers menu will contain several commands.
|
|
1719 Commands will be presented as submenus of each buffer line. If this
|
|
1720 is false, then there will be only one command: select that buffer."
|
|
1721 :type 'boolean
|
|
1722 :group 'buffers-menu)
|
|
1723
|
|
1724 (defcustom buffers-menu-submenus-for-groups-p nil
|
|
1725 "*If non-nil, the buffers menu will contain one submenu per group of buffers.
|
|
1726 The grouping function is specified in `buffers-menu-grouping-function'.
|
|
1727 If this is an integer, do not build submenus if the number of buffers
|
|
1728 is not larger than this value."
|
|
1729 :type '(choice (const :tag "No Subgroups" nil)
|
|
1730 (integer :tag "Max. submenus" 10)
|
|
1731 (sexp :format "%t\n" :tag "Allow Subgroups" :value t))
|
|
1732 :group 'buffers-menu)
|
|
1733
|
|
1734 (defcustom buffers-menu-switch-to-buffer-function 'switch-to-buffer
|
|
1735 "*The function to call to select a buffer from the buffers menu.
|
|
1736 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
|
|
1737 :type '(radio (function-item switch-to-buffer)
|
|
1738 (function-item pop-to-buffer)
|
|
1739 (function :tag "Other"))
|
|
1740 :group 'buffers-menu)
|
|
1741
|
|
1742 (defcustom buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
|
|
1743 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
|
|
1744 This is passed a buffer and should return non-nil if the buffer should be
|
|
1745 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
|
|
1746 buffers that are normally considered \"invisible\" (those whose name
|
|
1747 begins with a space)."
|
|
1748 :type '(choice (const :tag "None" nil)
|
|
1749 function)
|
|
1750 :group 'buffers-menu)
|
|
1751
|
|
1752 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
|
442
|
1753 "*The function to call to return a string to represent a buffer in
|
|
1754 the buffers menu. The function is passed a buffer and a number
|
|
1755 (starting with 1) indicating which buffer line in the menu is being
|
|
1756 processed and should return a string containing an accelerator
|
|
1757 spec. (Check out `menu-item-generate-accelerator-spec' as a convenient
|
|
1758 way of generating the accelerator specs.) The default value
|
|
1759 `format-buffers-menu-line' just returns the name of the buffer and
|
|
1760 uses the number as the accelerator. Also check out
|
|
1761 `slow-format-buffers-menu-line' which returns a whole bunch of info
|
|
1762 about a buffer.
|
|
1763
|
|
1764 Note: Gross Compatibility Hack: Older versions of this function prototype
|
|
1765 only expected one argument, not two. We deal gracefully with such
|
|
1766 functions by simply calling them with one argument and leaving out the
|
|
1767 line number. However, this may go away at any time, so make sure to
|
|
1768 update all of your functions of this type."
|
428
|
1769 :type 'function
|
|
1770 :group 'buffers-menu)
|
|
1771
|
|
1772 (defcustom buffers-menu-sort-function
|
|
1773 'sort-buffers-menu-by-mode-then-alphabetically
|
|
1774 "*If non-nil, a function to sort the list of buffers in the buffers menu.
|
|
1775 It will be passed two arguments (two buffers to compare) and should return
|
|
1776 t if the first is \"less\" than the second. One possible value is
|
|
1777 `sort-buffers-menu-alphabetically'; another is
|
|
1778 `sort-buffers-menu-by-mode-then-alphabetically'."
|
|
1779 :type '(choice (const :tag "None" nil)
|
|
1780 function)
|
|
1781 :group 'buffers-menu)
|
|
1782
|
|
1783 (defcustom buffers-menu-grouping-function
|
|
1784 'group-buffers-menu-by-mode-then-alphabetically
|
|
1785 "*If non-nil, a function to group buffers in the buffers menu together.
|
|
1786 It will be passed two arguments, successive members of the sorted buffers
|
|
1787 list after being passed through `buffers-menu-sort-function'. It should
|
|
1788 return non-nil if the second buffer begins a new group. The return value
|
|
1789 should be the name of the old group, which may be used in hierarchical
|
|
1790 buffers menus. The last invocation of the function contains nil as the
|
|
1791 second argument, so that the name of the last group can be determined.
|
|
1792
|
|
1793 The sensible values of this function are dependent on the value specified
|
|
1794 for `buffers-menu-sort-function'."
|
|
1795 :type '(choice (const :tag "None" nil)
|
|
1796 function)
|
|
1797 :group 'buffers-menu)
|
|
1798
|
792
|
1799 (defcustom list-all-buffers-function 'list-buffers
|
|
1800 "*Function that `list-all-buffers' calls."
|
|
1801 :type '(choice (const list-buffers)
|
|
1802 (const ibuffer)
|
|
1803 (const ibuffer-other-window)
|
|
1804 function)
|
|
1805 :group 'buffers-menu)
|
|
1806
|
428
|
1807 (defun sort-buffers-menu-alphabetically (buf1 buf2)
|
|
1808 "For use as a value of `buffers-menu-sort-function'.
|
|
1809 Sorts the buffers in alphabetical order by name, but puts buffers beginning
|
|
1810 with a star at the end of the list."
|
|
1811 (let* ((nam1 (buffer-name buf1))
|
|
1812 (nam2 (buffer-name buf2))
|
438
|
1813 (inv1p (not (null (string-match "\\` " nam1))))
|
|
1814 (inv2p (not (null (string-match "\\` " nam2))))
|
428
|
1815 (star1p (not (null (string-match "\\`*" nam1))))
|
|
1816 (star2p (not (null (string-match "\\`*" nam2)))))
|
438
|
1817 (cond ((not (eq inv1p inv2p))
|
|
1818 (not inv1p))
|
|
1819 ((not (eq star1p star2p))
|
|
1820 (not star1p))
|
|
1821 (t
|
|
1822 (string-lessp nam1 nam2)))))
|
428
|
1823
|
|
1824 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
|
|
1825 "For use as a value of `buffers-menu-sort-function'.
|
|
1826 Sorts first by major mode and then alphabetically by name, but puts buffers
|
|
1827 beginning with a star at the end of the list."
|
|
1828 (let* ((nam1 (buffer-name buf1))
|
|
1829 (nam2 (buffer-name buf2))
|
438
|
1830 (inv1p (not (null (string-match "\\` " nam1))))
|
|
1831 (inv2p (not (null (string-match "\\` " nam2))))
|
428
|
1832 (star1p (not (null (string-match "\\`*" nam1))))
|
|
1833 (star2p (not (null (string-match "\\`*" nam2))))
|
|
1834 (mode1 (symbol-value-in-buffer 'major-mode buf1))
|
|
1835 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
|
438
|
1836 (cond ((not (eq inv1p inv2p))
|
|
1837 (not inv1p))
|
|
1838 ((not (eq star1p star2p))
|
|
1839 (not star1p))
|
428
|
1840 ((and star1p star2p (string-lessp nam1 nam2)))
|
438
|
1841 ((string-lessp mode1 mode2)
|
|
1842 t)
|
|
1843 ((string-lessp mode2 mode1)
|
|
1844 nil)
|
|
1845 (t
|
|
1846 (string-lessp nam1 nam2)))))
|
428
|
1847
|
|
1848 ;; this version is too slow on some machines.
|
442
|
1849 ;; (vintage 1990, that is)
|
|
1850 (defun slow-format-buffers-menu-line (buffer n)
|
428
|
1851 "For use as a value of `buffers-menu-format-buffer-line-function'.
|
|
1852 This returns a string containing a bunch of info about the buffer."
|
442
|
1853 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
|
|
1854 (format "%s%s %-19s %6s %-15s %s"
|
|
1855 (if (buffer-modified-p buffer) "*" " ")
|
|
1856 (if (symbol-value-in-buffer 'buffer-read-only buffer)
|
|
1857 "%" " ")
|
|
1858 (buffer-name buffer)
|
|
1859 (buffer-size buffer)
|
|
1860 (symbol-value-in-buffer 'mode-name buffer)
|
|
1861 (or (buffer-file-name buffer) ""))))
|
428
|
1862
|
442
|
1863 (defun format-buffers-menu-line (buffer n)
|
428
|
1864 "For use as a value of `buffers-menu-format-buffer-line-function'.
|
|
1865 This just returns the buffer's name."
|
442
|
1866 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
|
|
1867 (buffer-name buffer)))
|
428
|
1868
|
|
1869 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
|
|
1870 "For use as a value of `buffers-menu-grouping-function'.
|
|
1871 This groups buffers by major mode. It only really makes sense if
|
|
1872 `buffers-menu-sorting-function' is
|
|
1873 `sort-buffers-menu-by-mode-then-alphabetically'."
|
|
1874 (cond ((string-match "\\`*" (buffer-name buf1))
|
|
1875 (and (null buf2) "*Misc*"))
|
|
1876 ((or (null buf2)
|
|
1877 (string-match "\\`*" (buffer-name buf2))
|
|
1878 (not (eq (symbol-value-in-buffer 'major-mode buf1)
|
|
1879 (symbol-value-in-buffer 'major-mode buf2))))
|
|
1880 (symbol-value-in-buffer 'mode-name buf1))
|
|
1881 (t nil)))
|
|
1882
|
|
1883 (defun buffer-menu-save-buffer (buffer)
|
|
1884 (save-excursion
|
|
1885 (set-buffer buffer)
|
|
1886 (save-buffer)))
|
|
1887
|
|
1888 (defun buffer-menu-write-file (buffer)
|
|
1889 (save-excursion
|
|
1890 (set-buffer buffer)
|
|
1891 (write-file (read-file-name
|
|
1892 (format "Write %s to file: "
|
|
1893 (buffer-name (current-buffer)))))))
|
|
1894
|
|
1895 (defsubst build-buffers-menu-internal (buffers)
|
442
|
1896 (let (name line (n 0))
|
428
|
1897 (mapcar
|
|
1898 #'(lambda (buffer)
|
|
1899 (if (eq buffer t)
|
|
1900 "---"
|
442
|
1901 (setq n (1+ n))
|
|
1902 (setq line
|
|
1903 ; #### a truly Kyle-friendly hack.
|
|
1904 (let ((fn buffers-menu-format-buffer-line-function))
|
|
1905 (if (= (function-max-args fn) 1)
|
|
1906 (funcall fn buffer)
|
|
1907 (funcall fn buffer n))))
|
428
|
1908 (if complex-buffers-menu-p
|
|
1909 (delq nil
|
|
1910 (list line
|
442
|
1911 (vector "S%_witch to Buffer"
|
428
|
1912 (list buffers-menu-switch-to-buffer-function
|
|
1913 (setq name (buffer-name buffer)))
|
|
1914 t)
|
|
1915 (if (eq buffers-menu-switch-to-buffer-function
|
|
1916 'switch-to-buffer)
|
442
|
1917 (vector "Switch to Buffer, Other %_Frame"
|
428
|
1918 (list 'switch-to-buffer-other-frame
|
|
1919 (setq name (buffer-name buffer)))
|
|
1920 t)
|
|
1921 nil)
|
|
1922 (if (and (buffer-modified-p buffer)
|
|
1923 (buffer-file-name buffer))
|
442
|
1924 (vector "%_Save Buffer"
|
428
|
1925 (list 'buffer-menu-save-buffer name) t)
|
442
|
1926 ["%_Save Buffer" nil nil]
|
428
|
1927 )
|
442
|
1928 (vector "Save %_As..."
|
428
|
1929 (list 'buffer-menu-write-file name) t)
|
442
|
1930 (vector "%_Delete Buffer" (list 'kill-buffer name)
|
428
|
1931 t)))
|
440
|
1932 ;; #### We don't want buffer names to be translated,
|
|
1933 ;; #### so we put the buffer name in the suffix.
|
|
1934 ;; #### Also, avoid losing with non-ASCII buffer names.
|
|
1935 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb
|
428
|
1936 (vector ""
|
|
1937 (list buffers-menu-switch-to-buffer-function
|
|
1938 (buffer-name buffer))
|
|
1939 t line))))
|
|
1940 buffers)))
|
|
1941
|
|
1942 (defun buffers-menu-filter (menu)
|
|
1943 "This is the menu filter for the top-level buffers \"Buffers\" menu.
|
|
1944 It dynamically creates a list of buffers to use as the contents of the menu.
|
|
1945 Only the most-recently-used few buffers will be listed on the menu, for
|
|
1946 efficiency reasons. You can control how many buffers will be shown by
|
|
1947 setting `buffers-menu-max-size'. You can control the text of the menu
|
|
1948 items by redefining the function `format-buffers-menu-line'."
|
|
1949 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
|
|
1950 (and (integerp buffers-menu-max-size)
|
|
1951 (> buffers-menu-max-size 1)
|
|
1952 (> (length buffers) buffers-menu-max-size)
|
|
1953 ;; shorten list of buffers (not with submenus!)
|
|
1954 (not (and buffers-menu-grouping-function
|
|
1955 buffers-menu-submenus-for-groups-p))
|
|
1956 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
|
|
1957 (if buffers-menu-sort-function
|
|
1958 (setq buffers (sort buffers buffers-menu-sort-function)))
|
|
1959 (if (and buffers-menu-grouping-function
|
|
1960 buffers-menu-submenus-for-groups-p
|
|
1961 (or (not (integerp buffers-menu-submenus-for-groups-p))
|
|
1962 (> (length buffers) buffers-menu-submenus-for-groups-p)))
|
|
1963 (let (groups groupnames current-group)
|
|
1964 (mapl
|
|
1965 #'(lambda (sublist)
|
|
1966 (let ((groupname (funcall buffers-menu-grouping-function
|
|
1967 (car sublist) (cadr sublist))))
|
|
1968 (setq current-group (cons (car sublist) current-group))
|
|
1969 (if groupname
|
|
1970 (progn
|
|
1971 (setq groups (cons (nreverse current-group)
|
|
1972 groups))
|
|
1973 (setq groupnames (cons groupname groupnames))
|
|
1974 (setq current-group nil)))))
|
|
1975 buffers)
|
|
1976 (setq buffers
|
|
1977 (mapcar*
|
|
1978 #'(lambda (groupname group)
|
|
1979 (cons groupname (build-buffers-menu-internal group)))
|
|
1980 (nreverse groupnames)
|
|
1981 (nreverse groups))))
|
|
1982 (if buffers-menu-grouping-function
|
|
1983 (progn
|
|
1984 (setq buffers
|
|
1985 (mapcon
|
|
1986 #'(lambda (sublist)
|
|
1987 (cond ((funcall buffers-menu-grouping-function
|
|
1988 (car sublist) (cadr sublist))
|
|
1989 (list (car sublist) t))
|
|
1990 (t (list (car sublist)))))
|
|
1991 buffers))
|
|
1992 ;; remove a trailing separator.
|
|
1993 (and (>= (length buffers) 2)
|
|
1994 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
|
|
1995 (if (eq t (cadr lastcdr))
|
|
1996 (setcdr lastcdr nil))))))
|
|
1997 (setq buffers (build-buffers-menu-internal buffers)))
|
|
1998 (append menu buffers)
|
|
1999 ))
|
|
2000
|
792
|
2001 (defun list-all-buffers ()
|
|
2002 "Display a list of buffers. Calls `list-all-buffers-function'."
|
|
2003 (interactive)
|
|
2004 (funcall (if (fboundp list-all-buffers-function)
|
|
2005 list-all-buffers-function
|
|
2006 'list-buffers)))
|
|
2007
|
428
|
2008
|
|
2009 ;;; The Options menu
|
|
2010
|
|
2011 ;; We'll keep those variables here for a while, in order to provide a
|
|
2012 ;; function for porting the old options file that a user may own to Custom.
|
|
2013
|
|
2014 (defvar options-save-faces nil
|
|
2015 "*Non-nil value means save-options will save information about faces.
|
|
2016 A nil value means save-options will not save face information.
|
|
2017 Set this non-nil only if you use M-x edit-faces to change face
|
|
2018 settings. If you use M-x customize-face or the \"Browse Faces...\"
|
|
2019 menu entry, you will see a button in the Customize Face buffer that you
|
|
2020 can use to permanently save your face changes.
|
|
2021
|
|
2022 M-x edit-faces is deprecated. Support for it and this variable will
|
|
2023 be discontinued in a future release.")
|
|
2024
|
|
2025 (defvar save-options-init-file nil
|
|
2026 "File into which to save forms to load the options file (nil for .emacs).
|
|
2027 Normally this is nil, which means save into your .emacs file (the value
|
|
2028 of `user-init-file'.")
|
|
2029
|
|
2030 (defvar save-options-file ".xemacs-options"
|
|
2031 "File to save options into.
|
|
2032 This file is loaded from your .emacs file.
|
|
2033 If this is a relative filename, it is put into the same directory as your
|
|
2034 .emacs file.")
|
|
2035
|
|
2036
|
|
2037
|
|
2038 ;;; The Help menu
|
|
2039
|
442
|
2040 (defun tutorials-menu-filter (menu-items)
|
|
2041 (declare (special language-info-alist
|
|
2042 current-language-environment
|
|
2043 tutorial-supported-languages))
|
|
2044 (append
|
|
2045 (if (featurep 'mule)
|
|
2046 (if (assq 'tutorial
|
|
2047 (assoc current-language-environment language-info-alist))
|
|
2048 `([,(concat "%_Default (" current-language-environment ")")
|
|
2049 help-with-tutorial]))
|
|
2050 '(["%_English" help-with-tutorial]))
|
|
2051 (submenu-generate-accelerator-spec
|
|
2052 (if (featurep 'mule)
|
|
2053 ;; Mule tutorials.
|
|
2054 (mapcan #'(lambda (lang)
|
|
2055 (let ((tut (assq 'tutorial lang)))
|
|
2056 (and tut
|
|
2057 (not (string= (car lang) "ASCII"))
|
|
2058 ;; skip current language, since we already
|
|
2059 ;; included it first
|
|
2060 (not (string= (car lang)
|
|
2061 current-language-environment))
|
|
2062 `([,(car lang)
|
771
|
2063 (help-with-tutorial nil ,(car lang))]))))
|
442
|
2064 language-info-alist)
|
|
2065 ;; Non mule tutorials.
|
|
2066 (mapcar #'(lambda (lang)
|
|
2067 `[,(car lang)
|
771
|
2068 (help-with-tutorial nil ,(car lang))])
|
442
|
2069 tutorial-supported-languages)))))
|
428
|
2070
|
|
2071 (set-menubar default-menubar)
|
|
2072
|
|
2073
|
|
2074 ;;; Popup menus.
|
|
2075
|
|
2076 (defconst default-popup-menu
|
|
2077 '("XEmacs Commands"
|
502
|
2078 ["%_Split Window" split-window-vertically]
|
|
2079 ["S%_plit Window (Side by Side)" split-window-horizontally]
|
|
2080 ["%_Un-Split (Keep This)" delete-other-windows
|
|
2081 :active (not (one-window-p t))]
|
|
2082 ["Un-Split (Keep %_Others)" delete-window
|
|
2083 :active (not (one-window-p t))]
|
428
|
2084 ))
|
|
2085
|
|
2086 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
|
440
|
2087 ;; superseded by any local popup menu...
|
428
|
2088 (setq-default mode-popup-menu default-popup-menu)
|
|
2089
|
442
|
2090
|
|
2091 ;; misc
|
428
|
2092
|
|
2093 (defun xemacs-splash-buffer ()
|
|
2094 "Redisplay XEmacs splash screen in a buffer."
|
|
2095 (interactive)
|
|
2096 (let ((buffer (get-buffer-create "*Splash*"))
|
|
2097 tmout)
|
|
2098 (set-buffer buffer)
|
|
2099 (setq buffer-read-only t)
|
|
2100 (erase-buffer buffer)
|
|
2101 (setq tmout (display-splash-frame))
|
|
2102 (when tmout
|
|
2103 (make-local-hook 'kill-buffer-hook)
|
|
2104 (add-hook 'kill-buffer-hook
|
|
2105 `(lambda ()
|
|
2106 (disable-timeout ,tmout))
|
|
2107 nil t))
|
|
2108 (pop-to-buffer buffer)
|
|
2109 (delete-other-windows)))
|
|
2110
|
|
2111
|
|
2112 ;;; backwards compatibility
|
|
2113 (provide 'x-menubar)
|
|
2114 (provide 'menubar-items)
|
|
2115
|
438
|
2116 ;;; menubar-items.el ends here.
|