summaryrefslogtreecommitdiff
path: root/lisp/menu-bar.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-08-29 02:12:38 +0000
committerRichard M. Stallman <rms@gnu.org>1997-08-29 02:12:38 +0000
commitbacb2d1246040efa53a4b39b74016a106b1dc1a8 (patch)
tree18f53a0e5a5009d165d9bb6fe537d0bbfcd08268 /lisp/menu-bar.el
parentd2705a1815f4ec01ce0c5cc60f6698cec9b8228e (diff)
downloademacs-bacb2d1246040efa53a4b39b74016a106b1dc1a8.tar.gz
(menu-bar-make-toggle): New macro.
(menu-bar-options-menu): New submenu of Help menu. Define several menu items for it.
Diffstat (limited to 'lisp/menu-bar.el')
-rw-r--r--lisp/menu-bar.el55
1 files changed, 55 insertions, 0 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index ce0f5bc7edb..9e40fe3f2c6 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -358,6 +358,59 @@ Do the same for the keys of the same name."
(define-key menu-bar-custom-menu [customize]
'("Top-level Customization Group" . customize))
+;; Options menu
+(defvar menu-bar-options-menu (make-sparse-keymap "Options"))
+
+(defmacro menu-bar-make-toggle (name variable doc message &rest body)
+ `(progn
+ (defun ,name ()
+ ,(concat doc ".")
+ (interactive)
+ (if ,(if body `(progn . ,body)
+ `(setq ,variable (not ,variable)))
+ (message ,message "enabled")
+ (message ,message "disabled")))
+ '(,doc . ,name)))
+
+(define-key menu-bar-options-menu [debug-on-quit]
+ (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
+ "Toggle Debug on Quit" "Debug on Quit %s"))
+(define-key menu-bar-options-menu [debug-on-error]
+ (menu-bar-make-toggle toggle-debug-on-error debug-on-error
+ "Toggle Debug on Error" "Debug on Error %s"))
+(define-key menu-bar-options-menu [options-separator]
+ '("--"))
+(define-key menu-bar-options-menu [save-place]
+ (menu-bar-make-toggle toggle-save-place-globally save-place
+ "Toggle Saving Place in Files between Sessions"
+ "Saving place in files %s"
+ (setq-default save-place (not (default-value save-place)))))
+(define-key menu-bar-options-menu [uniquify]
+ (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
+ "Toggle Directory Names in Buffer Names"
+ "Directory name in buffer names (uniquify) %s"
+ (require 'uniquify)
+ (setq uniquify-buffer-name-style
+ (if (not uniquify-buffer-name-style)
+ 'forward))))
+(define-key menu-bar-options-menu [transient-mark-mode]
+ (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
+ "Toggle Transient Mark Mode (highlights region)"
+ "Transient Mark mode %s"))
+(define-key menu-bar-options-menu [toggle-auto-compression]
+ '("Toggle Automatic File De/compression" . auto-compression-mode))
+(define-key menu-bar-options-menu [auto-fill-mode]
+ '("Toggle Auto Fill (word wrap) in Text modes"
+ . toggle-text-mode-auto-fill))
+(define-key menu-bar-options-menu [font-lock-mode]
+ (menu-bar-make-toggle toggle-font-lock-mode font-lock-mode
+ "Toggle Font Lock (syntax highlighting)"
+ "Font Lock mode %s"
+ (global-font-lock-mode)
+ (if font-lock-mode
+ (lazy-lock-mode t))
+ font-lock-mode))
+
(define-key menu-bar-help-menu [emacs-version]
'("Show Version" . emacs-version))
(define-key menu-bar-help-menu [report-emacs-bug]
@@ -383,6 +436,8 @@ Do the same for the keys of the same name."
(define-key menu-bar-help-menu [info] '("Browse Manuals" . info))
(define-key menu-bar-help-menu [emacs-faq] '("Emacs FAQ" . view-emacs-FAQ))
(define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news))
+(define-key menu-bar-help-menu [options-menu]
+ (cons "Options" menu-bar-options-menu))
(define-key menu-bar-help-menu [customize-menu]
(cons "Customize" menu-bar-custom-menu))