aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Abrahamsen1997-05-14 17:22:46 +0000
committerPer Abrahamsen1997-05-14 17:22:46 +0000
commit86bd10bcd8c1c2c189d8599287daa7d2bb3d4c70 (patch)
treeb2c1205eb01db20d8a9aad5e703fadca0d1e0c41
parente28449ed4b58cb59416314eaa9b1c84f4f28e910 (diff)
downloademacs-86bd10bcd8c1c2c189d8599287daa7d2bb3d4c70.tar.gz
emacs-86bd10bcd8c1c2c189d8599287daa7d2bb3d4c70.zip
Synched with version 1.97.
-rw-r--r--lisp/cus-edit.el177
1 files changed, 98 insertions, 79 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 023592a88a9..da0f6166b91 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4,7 +4,7 @@
4;; 4;;
5;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 5;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6;; Keywords: help, faces 6;; Keywords: help, faces
7;; Version: 1.90 7;; Version: 1.97
8;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ 8;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
@@ -41,12 +41,6 @@
41 (require 'cus-load) 41 (require 'cus-load)
42 (error nil)) 42 (error nil))
43 43
44(defun custom-face-display-set (face spec &optional frame)
45 (face-spec-set face spec frame))
46
47(defun custom-display-match-frame (display frame)
48 (face-spec-set-match-display display frame))
49
50(define-widget-keywords :custom-prefixes :custom-menu :custom-show 44(define-widget-keywords :custom-prefixes :custom-menu :custom-show
51 :custom-magic :custom-state :custom-level :custom-form 45 :custom-magic :custom-state :custom-level :custom-form
52 :custom-set :custom-save :custom-reset-current :custom-reset-saved 46 :custom-set :custom-save :custom-reset-current :custom-reset-saved
@@ -198,6 +192,10 @@
198 :group 'environment 192 :group 'environment
199 :group 'editing) 193 :group 'editing)
200 194
195(defgroup x nil
196 "The X Window system."
197 :group 'environment)
198
201(defgroup frames nil 199(defgroup frames nil
202 "Support for Emacs frames and window systems." 200 "Support for Emacs frames and window systems."
203 :group 'environment) 201 :group 'environment)
@@ -318,7 +316,7 @@
318 316
319(defgroup windows nil 317(defgroup windows nil
320 "Windows within a frame." 318 "Windows within a frame."
321 :group 'processes) 319 :group 'environment)
322 320
323;;; Utilities. 321;;; Utilities.
324 322
@@ -360,7 +358,7 @@ Return a list suitable for use in `interactive'."
360 val) 358 val)
361 (setq val (completing-read 359 (setq val (completing-read
362 (if v 360 (if v
363 (format "Customize variable (default %s): " v) 361 (format "Customize variable: (default %s) " v)
364 "Customize variable: ") 362 "Customize variable: ")
365 obarray (lambda (symbol) 363 obarray (lambda (symbol)
366 (and (boundp symbol) 364 (and (boundp symbol)
@@ -669,7 +667,9 @@ are shown; the contents of those subgroups are initially hidden."
669 (if (string-equal "" group) 667 (if (string-equal "" group)
670 (setq group 'emacs) 668 (setq group 'emacs)
671 (setq group (intern group)))) 669 (setq group (intern group))))
672 (custom-buffer-create (list (list group 'custom-group)))) 670 (custom-buffer-create (list (list group 'custom-group))
671 (format "*Customize Group: %s*"
672 (custom-unlispify-tag-name group))))
673 673
674;;;###autoload 674;;;###autoload
675(defun customize-other-window (symbol) 675(defun customize-other-window (symbol)
@@ -684,20 +684,26 @@ are shown; the contents of those subgroups are initially hidden."
684 (if (string-equal "" symbol) 684 (if (string-equal "" symbol)
685 (setq symbol 'emacs) 685 (setq symbol 'emacs)
686 (setq symbol (intern symbol)))) 686 (setq symbol (intern symbol))))
687 (custom-buffer-create-other-window (list (list symbol 'custom-group)))) 687 (custom-buffer-create-other-window
688 (list (list symbol 'custom-group))
689 (format "*Customize Group: %s*" (custom-unlispify-tag-name symbol))))
688 690
689;;;###autoload 691;;;###autoload
690(defun customize-variable (symbol) 692(defun customize-variable (symbol)
691 "Customize SYMBOL, which must be a variable." 693 "Customize SYMBOL, which must be a variable."
692 (interactive (custom-variable-prompt)) 694 (interactive (custom-variable-prompt))
693 (custom-buffer-create (list (list symbol 'custom-variable)))) 695 (custom-buffer-create (list (list symbol 'custom-variable))
696 (format "*Customize Variable: %s*"
697 (custom-unlispify-tag-name symbol))))
694 698
695;;;###autoload 699;;;###autoload
696(defun customize-variable-other-window (symbol) 700(defun customize-variable-other-window (symbol)
697 "Customize SYMBOL, which must be a variable. 701 "Customize SYMBOL, which must be a variable.
698Show the buffer in another window, but don't select it." 702Show the buffer in another window, but don't select it."
699 (interactive (custom-variable-prompt)) 703 (interactive (custom-variable-prompt))
700 (custom-buffer-create-other-window (list (list symbol 'custom-variable)))) 704 (custom-buffer-create-other-window
705 (list (list symbol 'custom-variable))
706 (format "*Customize Variable: %s*" (custom-unlispify-tag-name symbol))))
701 707
702;;;###autoload 708;;;###autoload
703(defun customize-face (&optional symbol) 709(defun customize-face (&optional symbol)
@@ -714,12 +720,14 @@ If SYMBOL is nil, customize all faces."
714 (sort (mapcar 'symbol-name (face-list)) 720 (sort (mapcar 'symbol-name (face-list))
715 'string<)))) 721 'string<))))
716 722
717 (custom-buffer-create found)) 723 (custom-buffer-create found "*Customize Faces*"))
718 (if (stringp symbol) 724 (if (stringp symbol)
719 (setq symbol (intern symbol))) 725 (setq symbol (intern symbol)))
720 (unless (symbolp symbol) 726 (unless (symbolp symbol)
721 (error "Should be a symbol %S" symbol)) 727 (error "Should be a symbol %S" symbol))
722 (custom-buffer-create (list (list symbol 'custom-face))))) 728 (custom-buffer-create (list (list symbol 'custom-face))
729 (format "*Customize Face: %s*"
730 (custom-unlispify-tag-name symbol)))))
723 731
724;;;###autoload 732;;;###autoload
725(defun customize-face-other-window (&optional symbol) 733(defun customize-face-other-window (&optional symbol)
@@ -732,7 +740,9 @@ If SYMBOL is nil, customize all faces."
732 (setq symbol (intern symbol))) 740 (setq symbol (intern symbol)))
733 (unless (symbolp symbol) 741 (unless (symbolp symbol)
734 (error "Should be a symbol %S" symbol)) 742 (error "Should be a symbol %S" symbol))
735 (custom-buffer-create-other-window (list (list symbol 'custom-face))))) 743 (custom-buffer-create-other-window
744 (list (list symbol 'custom-face))
745 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol)))))
736 746
737;;;###autoload 747;;;###autoload
738(defun customize-customized () 748(defun customize-customized ()
@@ -748,7 +758,7 @@ If SYMBOL is nil, customize all faces."
748 (setq found 758 (setq found
749 (cons (list symbol 'custom-variable) found))))) 759 (cons (list symbol 'custom-variable) found)))))
750 (if found 760 (if found
751 (custom-buffer-create found) 761 (custom-buffer-create found "*Customize Customized*")
752 (error "No customized user options")))) 762 (error "No customized user options"))))
753 763
754;;;###autoload 764;;;###autoload
@@ -765,7 +775,7 @@ If SYMBOL is nil, customize all faces."
765 (setq found 775 (setq found
766 (cons (list symbol 'custom-variable) found))))) 776 (cons (list symbol 'custom-variable) found)))))
767 (if found 777 (if found
768 (custom-buffer-create found) 778 (custom-buffer-create found "*Customize Saved*")
769 (error "No saved user options")))) 779 (error "No saved user options"))))
770 780
771;;;###autoload 781;;;###autoload
@@ -790,30 +800,34 @@ user-settable."
790 (setq found 800 (setq found
791 (cons (list symbol 'custom-variable) found)))))) 801 (cons (list symbol 'custom-variable) found))))))
792 (if found 802 (if found
793 (custom-buffer-create found) 803 (custom-buffer-create found "*Customize Apropos*")
794 (error "No matches")))) 804 (error "No matches"))))
795 805
796;;; Buffer. 806;;; Buffer.
797 807
798;;;###autoload 808;;;###autoload
799(defun custom-buffer-create (options) 809(defun custom-buffer-create (options &optional name)
800 "Create a buffer containing OPTIONS. 810 "Create a buffer containing OPTIONS.
811Optional NAME is the name of the buffer.
801OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where 812OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
802SYMBOL is a customization option, and WIDGET is a widget for editing 813SYMBOL is a customization option, and WIDGET is a widget for editing
803that option." 814that option."
804 (kill-buffer (get-buffer-create "*Customization*")) 815 (unless name (setq name "*Customization*"))
805 (switch-to-buffer (get-buffer-create "*Customization*")) 816 (kill-buffer (get-buffer-create name))
817 (switch-to-buffer (get-buffer-create name))
806 (custom-buffer-create-internal options)) 818 (custom-buffer-create-internal options))
807 819
808;;;###autoload 820;;;###autoload
809(defun custom-buffer-create-other-window (options) 821(defun custom-buffer-create-other-window (options &optional name)
810 "Create a buffer containing OPTIONS. 822 "Create a buffer containing OPTIONS.
823Optional NAME is the name of the buffer.
811OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where 824OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
812SYMBOL is a customization option, and WIDGET is a widget for editing 825SYMBOL is a customization option, and WIDGET is a widget for editing
813that option." 826that option."
814 (kill-buffer (get-buffer-create "*Customization*")) 827 (unless name (setq name "*Customization*"))
828 (kill-buffer (get-buffer-create name))
815 (let ((window (selected-window))) 829 (let ((window (selected-window)))
816 (switch-to-buffer-other-window (get-buffer-create "*Customization*")) 830 (switch-to-buffer-other-window (get-buffer-create name))
817 (custom-buffer-create-internal options) 831 (custom-buffer-create-internal options)
818 (select-window window))) 832 (select-window window)))
819 833
@@ -882,22 +896,19 @@ Make the modifications default for future sessions."
882 :tag "Done" 896 :tag "Done"
883 :help-echo "Bury the buffer." 897 :help-echo "Bury the buffer."
884 :action (lambda (widget &optional event) 898 :action (lambda (widget &optional event)
885 (bury-buffer) 899 (bury-buffer)))
886 ;; Steal button release event.
887 (if (and (fboundp 'button-press-event-p)
888 (fboundp 'next-command-event))
889 ;; XEmacs
890 (and event
891 (button-press-event-p event)
892 (next-command-event))
893 ;; Emacs
894 (when (memq 'down (event-modifiers event))
895 (read-event)))))
896 (widget-insert "\n") 900 (widget-insert "\n")
897 (message "Creating customization setup...") 901 (message "Creating customization setup...")
898 (widget-setup) 902 (widget-setup)
899 (goto-char (point-min)) 903 (goto-char (point-min))
900 (forward-line 3) ;Kludge: bob is writable in XEmacs. 904 (when (fboundp 'map-extents)
905 ;; This horrible kludge should make bob and eob read-only in XEmacs.
906 (map-extents (lambda (extent &rest junk)
907 (set-extent-property extent 'start-closed t))
908 nil (point-min) (1+ (point-min)))
909 (map-extents (lambda (extent &rest junk)
910 (set-extent-property extent 'end-closed t))
911 nil (1- (point-max)) (point-max)))
901 (message "Creating customization buffer...done")) 912 (message "Creating customization buffer...done"))
902 913
903;;; Modification of Basic Widgets. 914;;; Modification of Basic Widgets.
@@ -1180,30 +1191,36 @@ The list should be sorted most significant first."
1180(define-widget 'custom-magic 'default 1191(define-widget 'custom-magic 'default
1181 "Show and manipulate state for a customization option." 1192 "Show and manipulate state for a customization option."
1182 :format "%v" 1193 :format "%v"
1183 :action 'widget-choice-item-action 1194 :action 'widget-parent-action
1184 :notify 'ignore 1195 :notify 'ignore
1185 :value-get 'ignore 1196 :value-get 'ignore
1186 :value-create 'custom-magic-value-create 1197 :value-create 'custom-magic-value-create
1187 :value-delete 'widget-children-value-delete) 1198 :value-delete 'widget-children-value-delete)
1188 1199
1200(defun widget-magic-mouse-down-action (widget &optional event)
1201 ;; Non-nil unless hidden.
1202 (not (eq (widget-get (widget-get (widget-get widget :parent) :parent)
1203 :custom-state)
1204 'hidden)))
1205
1189(defun custom-magic-value-create (widget) 1206(defun custom-magic-value-create (widget)
1190 ;; Create compact status report for WIDGET. 1207 ;; Create compact status report for WIDGET.
1191 (let* ((parent (widget-get widget :parent)) 1208 (let* ((parent (widget-get widget :parent))
1192 (state (widget-get parent :custom-state)) 1209 (state (widget-get parent :custom-state))
1193 (entry (assq state (if (eq (car parent) 'custom-group) 1210 (entry (assq state custom-magic-alist))
1194 custom-group-magic-alist
1195 custom-magic-alist)))
1196 (magic (nth 1 entry)) 1211 (magic (nth 1 entry))
1197 (face (nth 2 entry)) 1212 (face (nth 2 entry))
1198 (text (nth 3 entry)) 1213 (text (nth 3 entry))
1199 (lisp (eq (widget-get parent :custom-form) 'lisp)) 1214 (lisp (eq (widget-get parent :custom-form) 'lisp))
1200 children) 1215 children)
1201 (when custom-magic-show 1216 (when custom-magic-show
1202 (push (widget-create-child-and-convert widget 'choice-item 1217 (push (widget-create-child-and-convert
1203 :help-echo "\ 1218 widget 'choice-item
1219 :help-echo "\
1204Change the state of this item." 1220Change the state of this item."
1205 :format "%[%t%]" 1221 :format "%[%t%]"
1206 :tag "State") 1222 :mouse-down-action 'widget-magic-mouse-down-action
1223 :tag "State")
1207 children) 1224 children)
1208 (insert ": ") 1225 (insert ": ")
1209 (if (eq custom-magic-show 'long) 1226 (if (eq custom-magic-show 'long)
@@ -1217,13 +1234,15 @@ Change the state of this item."
1217 (let ((indent (widget-get parent :indent))) 1234 (let ((indent (widget-get parent :indent)))
1218 (when indent 1235 (when indent
1219 (insert-char ? indent)))) 1236 (insert-char ? indent))))
1220 (push (widget-create-child-and-convert widget 'choice-item 1237 (push (widget-create-child-and-convert
1221 :button-face face 1238 widget 'choice-item
1222 :help-echo "Change the state." 1239 :mouse-down-action 'widget-magic-mouse-down-action
1223 :format "%[%t%]" 1240 :button-face face
1224 :tag (if lisp 1241 :help-echo "Change the state."
1225 (concat "(" magic ")") 1242 :format "%[%t%]"
1226 (concat "[" magic "]"))) 1243 :tag (if lisp
1244 (concat "(" magic ")")
1245 (concat "[" magic "]")))
1227 children) 1246 children)
1228 (insert " ")) 1247 (insert " "))
1229 (widget-put widget :children children))) 1248 (widget-put widget :children children)))
@@ -1258,8 +1277,8 @@ Change the state of this item."
1258 :documentation-property 'widget-subclass-responsibility 1277 :documentation-property 'widget-subclass-responsibility
1259 :value-create 'widget-subclass-responsibility 1278 :value-create 'widget-subclass-responsibility
1260 :value-delete 'widget-children-value-delete 1279 :value-delete 'widget-children-value-delete
1261 :value-get 'widget-item-value-get 1280 :value-get 'widget-value-value-get
1262 :validate 'widget-editable-list-validate 1281 :validate 'widget-children-validate
1263 :match (lambda (widget value) (symbolp value))) 1282 :match (lambda (widget value) (symbolp value)))
1264 1283
1265(defun custom-convert-widget (widget) 1284(defun custom-convert-widget (widget)
@@ -1342,7 +1361,9 @@ Change the state of this item."
1342 (when (and (>= pos from) (<= pos to)) 1361 (when (and (>= pos from) (<= pos to))
1343 (condition-case nil 1362 (condition-case nil
1344 (progn 1363 (progn
1345 (goto-line line) 1364 (if (> column 0)
1365 (goto-line line)
1366 (goto-line (1+ line)))
1346 (move-to-column column)) 1367 (move-to-column column))
1347 (error nil))))) 1368 (error nil)))))
1348 1369
@@ -1458,7 +1479,6 @@ Otherwise, look up symbol in `custom-guess-type-alist'."
1458 (type (custom-variable-type symbol)) 1479 (type (custom-variable-type symbol))
1459 (conv (widget-convert type)) 1480 (conv (widget-convert type))
1460 (get (or (get symbol 'custom-get) 'default-value)) 1481 (get (or (get symbol 'custom-get) 'default-value))
1461 (set (or (get symbol 'custom-set) 'set-default))
1462 (value (if (default-boundp symbol) 1482 (value (if (default-boundp symbol)
1463 (funcall get symbol) 1483 (funcall get symbol)
1464 (widget-get conv :value)))) 1484 (widget-get conv :value))))
@@ -1567,7 +1587,7 @@ Otherwise, look up symbol in `custom-guess-type-alist'."
1567 ("Reset to Current" custom-redraw 1587 ("Reset to Current" custom-redraw
1568 (lambda (widget) 1588 (lambda (widget)
1569 (and (default-boundp (widget-value widget)) 1589 (and (default-boundp (widget-value widget))
1570 (memq (widget-get widget :custom-state) '(modified))))) 1590 (memq (widget-get widget :custom-state) '(modified changed)))))
1571 ("Reset to Saved" custom-variable-reset-saved 1591 ("Reset to Saved" custom-variable-reset-saved
1572 (lambda (widget) 1592 (lambda (widget)
1573 (and (get (widget-value widget) 'saved-value) 1593 (and (get (widget-value widget) 'saved-value)
@@ -1590,6 +1610,9 @@ widget. If FILTER is nil, ACTION is always valid.")
1590Optional EVENT is the location for the menu." 1610Optional EVENT is the location for the menu."
1591 (if (eq (widget-get widget :custom-state) 'hidden) 1611 (if (eq (widget-get widget :custom-state) 'hidden)
1592 (custom-toggle-hide widget) 1612 (custom-toggle-hide widget)
1613 (unless (eq (widget-get widget :custom-state) 'modified)
1614 (custom-variable-state-set widget))
1615 (custom-redraw-magic widget)
1593 (let* ((completion-ignore-case t) 1616 (let* ((completion-ignore-case t)
1594 (answer (widget-choose (custom-unlispify-tag-name 1617 (answer (widget-choose (custom-unlispify-tag-name
1595 (widget-get widget :value)) 1618 (widget-get widget :value))
@@ -1834,7 +1857,7 @@ Match frames with dark backgrounds.")
1834 1857
1835(defun custom-display-unselected-match (widget value) 1858(defun custom-display-unselected-match (widget value)
1836 "Non-nil if VALUE is an unselected display specification." 1859 "Non-nil if VALUE is an unselected display specification."
1837 (not (custom-display-match-frame value (selected-frame)))) 1860 (not (face-spec-set-match-display value (selected-frame))))
1838 1861
1839(define-widget 'custom-face-selected 'group 1862(define-widget 'custom-face-selected 'group
1840 "Edit the attributes of the selected display in a face specification." 1863 "Edit the attributes of the selected display in a face specification."
@@ -1858,7 +1881,7 @@ Match frames with dark backgrounds.")
1858 (custom-load-widget widget) 1881 (custom-load-widget widget)
1859 (let* ((symbol (widget-value widget)) 1882 (let* ((symbol (widget-value widget))
1860 (spec (or (get symbol 'saved-face) 1883 (spec (or (get symbol 'saved-face)
1861 (get symbol 'factory-face) 1884 (get symbol 'face-defface-spec)
1862 ;; Attempt to construct it. 1885 ;; Attempt to construct it.
1863 (list (list t (custom-face-attributes-get 1886 (list (list t (custom-face-attributes-get
1864 symbol (selected-frame)))))) 1887 symbol (selected-frame))))))
@@ -1901,7 +1924,7 @@ Match frames with dark backgrounds.")
1901 (get (widget-value widget) 'saved-face))) 1924 (get (widget-value widget) 'saved-face)))
1902 ("Reset to Standard Setting" custom-face-reset-factory 1925 ("Reset to Standard Setting" custom-face-reset-factory
1903 (lambda (widget) 1926 (lambda (widget)
1904 (get (widget-value widget) 'factory-face)))) 1927 (get (widget-value widget) 'face-defface-spec))))
1905 "Alist of actions for the `custom-face' widget. 1928 "Alist of actions for the `custom-face' widget.
1906Each entry has the form (NAME ACTION FILTER) where NAME is the name of 1929Each entry has the form (NAME ACTION FILTER) where NAME is the name of
1907the menu entry, ACTION is the function to call on the widget when the 1930the menu entry, ACTION is the function to call on the widget when the
@@ -1934,7 +1957,7 @@ widget. If FILTER is nil, ACTION is always valid.")
1934 'set) 1957 'set)
1935 ((get symbol 'saved-face) 1958 ((get symbol 'saved-face)
1936 'saved) 1959 'saved)
1937 ((get symbol 'factory-face) 1960 ((get symbol 'face-defface-spec)
1938 'factory) 1961 'factory)
1939 (t 1962 (t
1940 'rogue))))) 1963 'rogue)))))
@@ -1991,7 +2014,7 @@ Optional EVENT is the location for the menu."
1991 "Restore WIDGET to the face's standard settings." 2014 "Restore WIDGET to the face's standard settings."
1992 (let* ((symbol (widget-value widget)) 2015 (let* ((symbol (widget-value widget))
1993 (child (car (widget-get widget :children))) 2016 (child (car (widget-get widget :children)))
1994 (value (get symbol 'factory-face))) 2017 (value (get symbol 'face-defface-spec)))
1995 (unless value 2018 (unless value
1996 (error "No standard setting for this face")) 2019 (error "No standard setting for this face"))
1997 (put symbol 'customized-face nil) 2020 (put symbol 'customized-face nil)
@@ -2007,14 +2030,14 @@ Optional EVENT is the location for the menu."
2007 2030
2008(define-widget 'face 'default 2031(define-widget 'face 'default
2009 "Select and customize a face." 2032 "Select and customize a face."
2010 :convert-widget 'widget-item-convert-widget 2033 :convert-widget 'widget-value-convert-widget
2011 :format "%[%t%]: %v" 2034 :format "%[%t%]: %v"
2012 :tag "Face" 2035 :tag "Face"
2013 :value 'default 2036 :value 'default
2014 :value-create 'widget-face-value-create 2037 :value-create 'widget-face-value-create
2015 :value-delete 'widget-face-value-delete 2038 :value-delete 'widget-face-value-delete
2016 :value-get 'widget-item-value-get 2039 :value-get 'widget-value-value-get
2017 :validate 'widget-editable-list-validate 2040 :validate 'widget-children-validate
2018 :action 'widget-face-action 2041 :action 'widget-face-action
2019 :match '(lambda (widget value) (symbolp value))) 2042 :match '(lambda (widget value) (symbolp value)))
2020 2043
@@ -2173,16 +2196,13 @@ and so forth. The remaining group tags are shown with
2173 (memq (widget-get widget :custom-state) '(modified set)))) 2196 (memq (widget-get widget :custom-state) '(modified set))))
2174 ("Reset to Current" custom-group-reset-current 2197 ("Reset to Current" custom-group-reset-current
2175 (lambda (widget) 2198 (lambda (widget)
2176 (and (default-boundp (widget-value widget)) 2199 (memq (widget-get widget :custom-state) '(modified))))
2177 (memq (widget-get widget :custom-state) '(modified)))))
2178 ("Reset to Saved" custom-group-reset-saved 2200 ("Reset to Saved" custom-group-reset-saved
2179 (lambda (widget) 2201 (lambda (widget)
2180 (and (get (widget-value widget) 'saved-value) 2202 (memq (widget-get widget :custom-state) '(modified set))))
2181 (memq (widget-get widget :custom-state) '(modified set))))) 2203 ("Reset to standard setting" custom-group-reset-factory
2182 ("Reset to Standard Settings" custom-group-reset-factory
2183 (lambda (widget) 2204 (lambda (widget)
2184 (and (get (widget-value widget) 'factory-value) 2205 (memq (widget-get widget :custom-state) '(modified set saved)))))
2185 (memq (widget-get widget :custom-state) '(modified set saved))))))
2186 "Alist of actions for the `custom-group' widget. 2206 "Alist of actions for the `custom-group' widget.
2187Each entry has the form (NAME ACTION FILTER) where NAME is the name of 2207Each entry has the form (NAME ACTION FILTER) where NAME is the name of
2188the menu entry, ACTION is the function to call on the widget when the 2208the menu entry, ACTION is the function to call on the widget when the
@@ -2337,7 +2357,7 @@ Leave point at the location of the call, or after the last expression."
2337 (when value 2357 (when value
2338 (princ "\n '(default ") 2358 (princ "\n '(default ")
2339 (prin1 value) 2359 (prin1 value)
2340 (if (or (get 'default 'factory-face) 2360 (if (or (get 'default 'face-defface-spec)
2341 (and (not (custom-facep 'default)) 2361 (and (not (custom-facep 'default))
2342 (not (get 'default 'force-face)))) 2362 (not (get 'default 'force-face))))
2343 (princ ")") 2363 (princ ")")
@@ -2351,7 +2371,7 @@ Leave point at the location of the call, or after the last expression."
2351 (princ symbol) 2371 (princ symbol)
2352 (princ " ") 2372 (princ " ")
2353 (prin1 value) 2373 (prin1 value)
2354 (if (or (get symbol 'factory-face) 2374 (if (or (get symbol 'face-defface-spec)
2355 (and (not (custom-facep symbol)) 2375 (and (not (custom-facep symbol))
2356 (not (get symbol 'force-face)))) 2376 (not (get symbol 'force-face))))
2357 (princ ")") 2377 (princ ")")
@@ -2428,7 +2448,7 @@ Leave point at the location of the call, or after the last expression."
2428(defun custom-face-menu-create (widget symbol) 2448(defun custom-face-menu-create (widget symbol)
2429 "Ignoring WIDGET, create a menu entry for customization face SYMBOL." 2449 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
2430 (vector (custom-unlispify-menu-entry symbol) 2450 (vector (custom-unlispify-menu-entry symbol)
2431 `(custom-buffer-create '((,symbol custom-face))) 2451 `(customize-face ',symbol)
2432 t)) 2452 t))
2433 2453
2434(defun custom-variable-menu-create (widget symbol) 2454(defun custom-variable-menu-create (widget symbol)
@@ -2439,15 +2459,14 @@ Leave point at the location of the call, or after the last expression."
2439 (if (and type (widget-get type :custom-menu)) 2459 (if (and type (widget-get type :custom-menu))
2440 (widget-apply type :custom-menu symbol) 2460 (widget-apply type :custom-menu symbol)
2441 (vector (custom-unlispify-menu-entry symbol) 2461 (vector (custom-unlispify-menu-entry symbol)
2442 `(custom-buffer-create '((,symbol custom-variable))) 2462 `(customize-variable ',symbol)
2443 t)))) 2463 t))))
2444 2464
2445;; Add checkboxes to boolean variable entries. 2465;; Add checkboxes to boolean variable entries.
2446(widget-put (get 'boolean 'widget-type) 2466(widget-put (get 'boolean 'widget-type)
2447 :custom-menu (lambda (widget symbol) 2467 :custom-menu (lambda (widget symbol)
2448 (vector (custom-unlispify-menu-entry symbol) 2468 (vector (custom-unlispify-menu-entry symbol)
2449 `(custom-buffer-create 2469 `(customize-variable ',symbol)
2450 '((,symbol custom-variable)))
2451 ':style 'toggle 2470 ':style 'toggle
2452 ':selected symbol))) 2471 ':selected symbol)))
2453 2472
@@ -2470,7 +2489,7 @@ Leave point at the location of the call, or after the last expression."
2470 "Create menu for customization group SYMBOL. 2489 "Create menu for customization group SYMBOL.
2471The menu is in a format applicable to `easy-menu-define'." 2490The menu is in a format applicable to `easy-menu-define'."
2472 (let* ((item (vector (custom-unlispify-menu-entry symbol) 2491 (let* ((item (vector (custom-unlispify-menu-entry symbol)
2473 `(custom-buffer-create '((,symbol custom-group))) 2492 `(customize-group ',symbol)
2474 t))) 2493 t)))
2475 (if (and (or (not (boundp 'custom-menu-nesting)) 2494 (if (and (or (not (boundp 'custom-menu-nesting))
2476 (>= custom-menu-nesting 0)) 2495 (>= custom-menu-nesting 0))