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