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