comparison lisp/menu-bar.el @ 57700:0fcbc2db3d03

(menu-bar-make-toggle): Instead of interactive-p, use an arg set non-nil by the interactive spec.
author Richard M. Stallman <rms@gnu.org>
date Tue, 26 Oct 2004 08:31:40 +0000
parents aa21fe382d2a
children 5a547995da89 0fe073a08cef
comparison
equal deleted inserted replaced
57699:f633084f70ae 57700:0fcbc2db3d03
594 :button (:toggle . (and (default-boundp ',fname) 594 :button (:toggle . (and (default-boundp ',fname)
595 (default-value ',fname))))) 595 (default-value ',fname)))))
596 596
597 (defmacro menu-bar-make-toggle (name variable doc message help &rest body) 597 (defmacro menu-bar-make-toggle (name variable doc message help &rest body)
598 `(progn 598 `(progn
599 (defun ,name () 599 (defun ,name (&optional interactively)
600 ,(concat "Toggle whether to " (downcase (substring help 0 1)) 600 ,(concat "Toggle whether to " (downcase (substring help 0 1))
601 (substring help 1) ".") 601 (substring help 1) ".\
602 (interactive) 602 In an interactive call, record this option as a candidate for saving
603 by \"Save Options\" in Custom buffers.")
604 (interactive "p")
603 (if ,(if body `(progn . ,body) 605 (if ,(if body `(progn . ,body)
604 `(progn 606 `(progn
605 (custom-load-symbol ',variable) 607 (custom-load-symbol ',variable)
606 (let ((set (or (get ',variable 'custom-set) 'set-default)) 608 (let ((set (or (get ',variable 'custom-set) 'set-default))
607 (get (or (get ',variable 'custom-get) 'default-value))) 609 (get (or (get ',variable 'custom-get) 'default-value)))
610 (message ,message "disabled")) 612 (message ,message "disabled"))
611 ;; The function `customize-mark-as-set' must only be called when 613 ;; The function `customize-mark-as-set' must only be called when
612 ;; a variable is set interactively, as the purpose is to mark it as 614 ;; a variable is set interactively, as the purpose is to mark it as
613 ;; a candidate for "Save Options", and we do not want to save options 615 ;; a candidate for "Save Options", and we do not want to save options
614 ;; the user have already set explicitly in his init file. 616 ;; the user have already set explicitly in his init file.
615 (if (interactive-p) (customize-mark-as-set ',variable))) 617 (if interactively (customize-mark-as-set ',variable)))
616 '(menu-item ,doc ,name 618 '(menu-item ,doc ,name
617 :help ,help 619 :help ,help
618 :button (:toggle . (and (default-boundp ',variable) 620 :button (:toggle . (and (default-boundp ',variable)
619 (default-value ',variable)))))) 621 (default-value ',variable))))))
620 622