comparison lisp/menu-bar.el @ 21302:77a4a1ce8d26

(menu-bar-options-menu): Remove "Toggle" from item names, using buttons instead. (menu-bar-make-toggle): Define a menu-item toggle button. (menu-bar-options-menu [save-place]): (require 'saveplace). (menu-bar-options-menu [toggle-auto-compression], [auto-fill-mode]) (menu-bar-options-menu [toggle-global-lazy-font-lock-mode]): Define a menu-item button.
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 Mar 1998 05:43:01 +0000
parents ec3a35db5352
children f485fe3e433e
comparison
equal deleted inserted replaced
21301:129d706946d5 21302:77a4a1ce8d26
386 (interactive) 386 (interactive)
387 (if ,(if body `(progn . ,body) 387 (if ,(if body `(progn . ,body)
388 `(setq ,variable (not ,variable))) 388 `(setq ,variable (not ,variable)))
389 (message ,message "enabled") 389 (message ,message "enabled")
390 (message ,message "disabled"))) 390 (message ,message "disabled")))
391 '(,doc . ,name))) 391 '(menu-item ,doc ,name .
392 (:button (:toggle . (and (boundp ',variable) ,variable))))))
392 393
393 (define-key menu-bar-options-menu [debug-on-quit] 394 (define-key menu-bar-options-menu [debug-on-quit]
394 (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit 395 (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
395 "Toggle Debug on Quit" "Debug on Quit %s")) 396 "Debug on Quit" "Debug on Quit %s"))
396 (define-key menu-bar-options-menu [debug-on-error] 397 (define-key menu-bar-options-menu [debug-on-error]
397 (menu-bar-make-toggle toggle-debug-on-error debug-on-error 398 (menu-bar-make-toggle toggle-debug-on-error debug-on-error
398 "Toggle Debug on Error" "Debug on Error %s")) 399 "Debug on Error" "Debug on Error %s"))
399 (define-key menu-bar-options-menu [options-separator] 400 (define-key menu-bar-options-menu [options-separator]
400 '("--")) 401 '("--"))
401 (define-key menu-bar-options-menu [save-place] 402 (define-key menu-bar-options-menu [save-place]
402 (menu-bar-make-toggle toggle-save-place-globally save-place 403 (menu-bar-make-toggle toggle-save-place-globally save-place
403 "Toggle Saving Place in Files between Sessions" 404 "Save Place in Files between Sessions"
404 "Saving place in files %s" 405 "Saving place in files %s"
406 (require 'saveplace)
405 (setq-default save-place (not (default-value save-place))))) 407 (setq-default save-place (not (default-value save-place)))))
406 (define-key menu-bar-options-menu [uniquify] 408 (define-key menu-bar-options-menu [uniquify]
407 (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style 409 (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
408 "Toggle Directory Names in Buffer Names" 410 "Use Directory Names in Buffer Names"
409 "Directory name in buffer names (uniquify) %s" 411 "Directory name in buffer names (uniquify) %s"
410 (require 'uniquify) 412 (require 'uniquify)
411 (setq uniquify-buffer-name-style 413 (setq uniquify-buffer-name-style
412 (if (not uniquify-buffer-name-style) 414 (if (not uniquify-buffer-name-style)
413 'forward)))) 415 'forward))))
414 (define-key menu-bar-options-menu [transient-mark-mode] 416 (define-key menu-bar-options-menu [transient-mark-mode]
415 (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode 417 (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
416 "Toggle Transient Mark Mode (highlights region)" 418 "Transient Mark Mode (highlights region)"
417 "Transient Mark mode %s")) 419 "Transient Mark mode %s"))
418 (define-key menu-bar-options-menu [toggle-auto-compression] 420 (define-key menu-bar-options-menu [toggle-auto-compression]
419 '("Toggle Automatic File De/compression" . auto-compression-mode)) 421 '(menu-item "Automatic File De/compression"
422 auto-compression-mode .
423 (:button (:toggle . (rassq 'jka-compr-handler
424 file-name-handler-alist)))))
420 (define-key menu-bar-options-menu [auto-fill-mode] 425 (define-key menu-bar-options-menu [auto-fill-mode]
421 '("Toggle Auto Fill (word wrap) in Text modes" 426 '(menu-item "Auto Fill (word wrap) in Text modes"
422 . toggle-text-mode-auto-fill)) 427 toggle-text-mode-auto-fill .
428 (:button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))))
423 (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode] 429 (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
424 (menu-bar-make-toggle toggle-global-lazy-font-lock-mode nil 430 (menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode
425 "Toggle Global Font Lock (highlights syntax)" 431 "Global Font Lock (highlights syntax)"
426 "Global Font Lock mode %s" 432 "Global Font Lock mode %s"
427 ;; Make sure a support mode is used; 433 ;; Make sure a support mode is used;
428 ;; otherwise Font Lock will be too slow. 434 ;; otherwise Font Lock will be too slow.
429 (require 'font-lock) 435 (require 'font-lock)
430 (if (not global-font-lock-mode) 436 (if (not global-font-lock-mode)