comparison lisp/menu-bar.el @ 105835:72831603960b

(menu-bar-make-mm-toggle, menu-bar-make-toggle) (menu-bar-options-menu): Fix list quoting (Bug#4429).
author Juri Linkov <juri@jurta.org>
date Tue, 03 Nov 2009 07:28:19 +0000
parents cdc718e48308
children 20a7667a5619
comparison
equal deleted inserted replaced
105834:a120770e3f00 105835:72831603960b
599 DOC is the text to use for the menu entry. 599 DOC is the text to use for the menu entry.
600 HELP is the text to use for the tooltip. 600 HELP is the text to use for the tooltip.
601 PROPS are additional properties." 601 PROPS are additional properties."
602 `(list 'menu-item (purecopy ,doc) ',fname 602 `(list 'menu-item (purecopy ,doc) ',fname
603 ,@props 603 ,@props
604 ':help (purecopy ,help) 604 :help (purecopy ,help)
605 ':button '(:toggle . (and (default-boundp ',fname) 605 :button '(:toggle . (and (default-boundp ',fname)
606 (default-value ',fname))))) 606 (default-value ',fname)))))
607 607
608 (defmacro menu-bar-make-toggle (name variable doc message help &rest body) 608 (defmacro menu-bar-make-toggle (name variable doc message help &rest body)
609 `(progn 609 `(progn
610 (defun ,name (&optional interactively) 610 (defun ,name (&optional interactively)
611 ,(concat "Toggle whether to " (downcase (substring help 0 1)) 611 ,(concat "Toggle whether to " (downcase (substring help 0 1))
625 ;; a variable is set interactively, as the purpose is to mark it as 625 ;; a variable is set interactively, as the purpose is to mark it as
626 ;; a candidate for "Save Options", and we do not want to save options 626 ;; a candidate for "Save Options", and we do not want to save options
627 ;; the user have already set explicitly in his init file. 627 ;; the user have already set explicitly in his init file.
628 (if interactively (customize-mark-as-set ',variable))) 628 (if interactively (customize-mark-as-set ',variable)))
629 (list 'menu-item (purecopy ,doc) ',name 629 (list 'menu-item (purecopy ,doc) ',name
630 ':help (purecopy ,help) 630 :help (purecopy ,help)
631 ':button '(:toggle . (and (default-boundp ',variable) 631 :button '(:toggle . (and (default-boundp ',variable)
632 (default-value ',variable)))))) 632 (default-value ',variable))))))
633 633
634 ;; Function for setting/saving default font. 634 ;; Function for setting/saving default font.
635 635
636 (defun menu-set-font () 636 (defun menu-set-font ()
637 "Interactively select a font and make it the default." 637 "Interactively select a font and make it the default."
1037 '("--")) 1037 '("--"))
1038 (define-key menu-bar-options-menu [cua-mode] 1038 (define-key menu-bar-options-menu [cua-mode]
1039 (menu-bar-make-mm-toggle cua-mode 1039 (menu-bar-make-mm-toggle cua-mode
1040 "C-x/C-c/C-v Cut and Paste (CUA)" 1040 "C-x/C-c/C-v Cut and Paste (CUA)"
1041 "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste" 1041 "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
1042 (:visible (or (not (boundp 'cua-enable-cua-keys)) 1042 (:visible '(or (not (boundp 'cua-enable-cua-keys))
1043 cua-enable-cua-keys)))) 1043 cua-enable-cua-keys))))
1044 1044
1045 (define-key menu-bar-options-menu [cua-emulation-mode] 1045 (define-key menu-bar-options-menu [cua-emulation-mode]
1046 (menu-bar-make-mm-toggle cua-mode 1046 (menu-bar-make-mm-toggle cua-mode
1047 "Shift movement mark region (CUA)" 1047 "Shift movement mark region (CUA)"
1048 "Use shifted movement keys to set and extend the region." 1048 "Use shifted movement keys to set and extend the region."
1049 (:visible (and (boundp 'cua-enable-cua-keys) 1049 (:visible '(and (boundp 'cua-enable-cua-keys)
1050 (not cua-enable-cua-keys))))) 1050 (not cua-enable-cua-keys)))))
1051 1051
1052 (define-key menu-bar-options-menu [case-fold-search] 1052 (define-key menu-bar-options-menu [case-fold-search]
1053 (menu-bar-make-toggle toggle-case-fold-search case-fold-search 1053 (menu-bar-make-toggle toggle-case-fold-search case-fold-search
1054 "Case-Insensitive Search" 1054 "Case-Insensitive Search"
1055 "Case-Insensitive Search %s" 1055 "Case-Insensitive Search %s"
1125 "Highlight matching/mismatched parentheses at cursor (Show Paren mode)")) 1125 "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
1126 (define-key menu-bar-options-menu [transient-mark-mode] 1126 (define-key menu-bar-options-menu [transient-mark-mode]
1127 (menu-bar-make-mm-toggle transient-mark-mode 1127 (menu-bar-make-mm-toggle transient-mark-mode
1128 "Active Region Highlighting" 1128 "Active Region Highlighting"
1129 "Make text in active region stand out in color (Transient Mark mode)" 1129 "Make text in active region stand out in color (Transient Mark mode)"
1130 (:enable (not cua-mode)))) 1130 (:enable '(not cua-mode))))
1131 1131
1132 1132
1133 ;; The "Tools" menu items 1133 ;; The "Tools" menu items
1134 1134
1135 (defun send-mail-item-name () 1135 (defun send-mail-item-name ()