comparison lisp/menu-bar.el @ 19617:6337e9a0ed92

(menu-bar-make-toggle): New macro. (menu-bar-options-menu): New submenu of Help menu. Define several menu items for it.
author Richard M. Stallman <rms@gnu.org>
date Fri, 29 Aug 1997 02:12:38 +0000
parents cb17c9cd025b
children 920d0a7b5930
comparison
equal deleted inserted replaced
19616:bc9b6200a609 19617:6337e9a0ed92
355 '("--")) 355 '("--"))
356 (define-key menu-bar-custom-menu [customize-browse] 356 (define-key menu-bar-custom-menu [customize-browse]
357 '("Browse Customization Groups" . customize-browse)) 357 '("Browse Customization Groups" . customize-browse))
358 (define-key menu-bar-custom-menu [customize] 358 (define-key menu-bar-custom-menu [customize]
359 '("Top-level Customization Group" . customize)) 359 '("Top-level Customization Group" . customize))
360
361 ;; Options menu
362 (defvar menu-bar-options-menu (make-sparse-keymap "Options"))
363
364 (defmacro menu-bar-make-toggle (name variable doc message &rest body)
365 `(progn
366 (defun ,name ()
367 ,(concat doc ".")
368 (interactive)
369 (if ,(if body `(progn . ,body)
370 `(setq ,variable (not ,variable)))
371 (message ,message "enabled")
372 (message ,message "disabled")))
373 '(,doc . ,name)))
374
375 (define-key menu-bar-options-menu [debug-on-quit]
376 (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
377 "Toggle Debug on Quit" "Debug on Quit %s"))
378 (define-key menu-bar-options-menu [debug-on-error]
379 (menu-bar-make-toggle toggle-debug-on-error debug-on-error
380 "Toggle Debug on Error" "Debug on Error %s"))
381 (define-key menu-bar-options-menu [options-separator]
382 '("--"))
383 (define-key menu-bar-options-menu [save-place]
384 (menu-bar-make-toggle toggle-save-place-globally save-place
385 "Toggle Saving Place in Files between Sessions"
386 "Saving place in files %s"
387 (setq-default save-place (not (default-value save-place)))))
388 (define-key menu-bar-options-menu [uniquify]
389 (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
390 "Toggle Directory Names in Buffer Names"
391 "Directory name in buffer names (uniquify) %s"
392 (require 'uniquify)
393 (setq uniquify-buffer-name-style
394 (if (not uniquify-buffer-name-style)
395 'forward))))
396 (define-key menu-bar-options-menu [transient-mark-mode]
397 (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
398 "Toggle Transient Mark Mode (highlights region)"
399 "Transient Mark mode %s"))
400 (define-key menu-bar-options-menu [toggle-auto-compression]
401 '("Toggle Automatic File De/compression" . auto-compression-mode))
402 (define-key menu-bar-options-menu [auto-fill-mode]
403 '("Toggle Auto Fill (word wrap) in Text modes"
404 . toggle-text-mode-auto-fill))
405 (define-key menu-bar-options-menu [font-lock-mode]
406 (menu-bar-make-toggle toggle-font-lock-mode font-lock-mode
407 "Toggle Font Lock (syntax highlighting)"
408 "Font Lock mode %s"
409 (global-font-lock-mode)
410 (if font-lock-mode
411 (lazy-lock-mode t))
412 font-lock-mode))
360 413
361 (define-key menu-bar-help-menu [emacs-version] 414 (define-key menu-bar-help-menu [emacs-version]
362 '("Show Version" . emacs-version)) 415 '("Show Version" . emacs-version))
363 (define-key menu-bar-help-menu [report-emacs-bug] 416 (define-key menu-bar-help-menu [report-emacs-bug]
364 '("Send Bug Report..." . report-emacs-bug)) 417 '("Send Bug Report..." . report-emacs-bug))
381 (define-key menu-bar-help-menu [describe-mode] 434 (define-key menu-bar-help-menu [describe-mode]
382 '("Describe Mode" . describe-mode)) 435 '("Describe Mode" . describe-mode))
383 (define-key menu-bar-help-menu [info] '("Browse Manuals" . info)) 436 (define-key menu-bar-help-menu [info] '("Browse Manuals" . info))
384 (define-key menu-bar-help-menu [emacs-faq] '("Emacs FAQ" . view-emacs-FAQ)) 437 (define-key menu-bar-help-menu [emacs-faq] '("Emacs FAQ" . view-emacs-FAQ))
385 (define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news)) 438 (define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news))
439 (define-key menu-bar-help-menu [options-menu]
440 (cons "Options" menu-bar-options-menu))
386 (define-key menu-bar-help-menu [customize-menu] 441 (define-key menu-bar-help-menu [customize-menu]
387 (cons "Customize" menu-bar-custom-menu)) 442 (cons "Customize" menu-bar-custom-menu))
388 443
389 (defun kill-this-buffer () ; for the menubar 444 (defun kill-this-buffer () ; for the menubar
390 "Kills the current buffer." 445 "Kills the current buffer."