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