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