Changeset 4018 for vendor/emacs-CVS_HEAD/lisp/cus-edit.el
- Timestamp:
- 2006年01月28日 09時46分44秒 (3 years ago)
- Files:
-
- vendor/emacs-CVS_HEAD/lisp/cus-edit.el (modified) (75 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
vendor/emacs-CVS_HEAD/lisp/cus-edit.el
r3988 r4018 2 2 ;; 3 3 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 4 ;; 2005 Free Software Foundation, Inc.4 ;; 2005, 2006 Free Software Foundation, Inc. 5 5 ;; 6 6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> … … 89 89 90 90 ;; You can see (and modify and save) this unevaluated value by selecting 91 ;; "Show initial Lisp expression" from the Lisp interface. This will91 ;; "Show Saved Lisp Expression" from the Lisp interface. This will 92 92 ;; give you the unevaluated saved value, if any, otherwise the 93 93 ;; unevaluated standard value. … … 122 122 123 123 ;; There is no standard value. This means that the variable was 124 ;; not defined with defcustom, nor handled in cus-start.el. You 125 ;; can not create a Custom buffer for such variables using the 126 ;; normal interactive Custom commands. However, such Custom 127 ;; buffers can be created in other ways, for instance, by calling 124 ;; not defined with defcustom, nor handled in cus-start.el. Most 125 ;; standard interactive Custom commands do not let you create a 126 ;; Custom buffer containing such variables. However, such Custom 127 ;; buffers can be created, for instance, by calling 128 ;; `customize-apropos' with a prefix arg or by calling 128 129 ;; `customize-option' non-interactively. 129 130 … … 458 459 :link '(custom-manual "(emacs)Windows") 459 460 :group 'environment) 461 462 (defgroup mac nil 463 "Mac specific features." 464 :link '(custom-manual "(emacs)Mac OS") 465 :group 'environment 466 :version "22.1" 467 :prefix "mac-") 460 468 461 469 ;;; Utilities. … … 499 507 val) 500 508 (setq val (completing-read 501 (if default (format "Customize option(default %s): " default)502 "Customize option: ")509 (if default (format "Customize variable (default %s): " default) 510 "Customize variable: ") 503 511 obarray 'custom-variable-p t nil nil default)) 504 512 (list (if (equal val "") … … 612 620 customize." 613 621 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) 614 :group 'custom ize)622 :group 'custom-buffer) 615 623 616 624 (defcustom custom-guess-doc-alist … … 626 634 customize." 627 635 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) 628 :group 'custom ize)636 :group 'custom-buffer) 629 637 630 638 (defun custom-guess-type (symbol) … … 737 745 738 746 (defun Custom-set () 739 "Set changes in all modified options."747 "Set the current value of all edited settings in the buffer." 740 748 (interactive) 741 749 (let ((children custom-options)) 742 (mapc (lambda (child) 743 (when (eq (widget-get child :custom-state) 'modified) 744 (widget-apply child :custom-set))) 745 children))) 750 (if (or (and (= 1 (length children)) 751 (memq (widget-type (car children)) 752 '(custom-variable custom-face))) 753 (y-or-n-p "Set all values according to this buffer? ")) 754 (mapc (lambda (child) 755 (when (eq (widget-get child :custom-state) 'modified) 756 (widget-apply child :custom-set))) 757 children) 758 (message "Aborted")))) 746 759 747 760 (defun Custom-save () 748 "Set all modified group members and save them." 761 "Set all edited settings, then save all settings that have been set. 762 If a setting was edited and set before, this saves it. 763 If a setting was merely edited before, this sets it then saves it." 749 764 (interactive) 750 765 (let ((children custom-options)) 751 (mapc (lambda (child) 752 (when (memq (widget-get child :custom-state) 753 '(modified set changed rogue)) 754 (widget-apply child :custom-save))) 755 children)) 756 (custom-save-all)) 766 (if (or (and (= 1 (length children)) 767 (memq (widget-type (car children)) 768 '(custom-variable custom-face))) 769 (yes-or-no-p "Save all settings in this buffer? ")) 770 (progn 771 (mapc (lambda (child) 772 (when (memq (widget-get child :custom-state) 773 '(modified set changed rogue)) 774 (widget-apply child :custom-save))) 775 children) 776 (custom-save-all)) 777 (message "Aborted")))) 757 778 758 779 (defvar custom-reset-menu 759 '((" Current" . Custom-reset-current)760 (" Saved" . Custom-reset-saved)761 ("Erase Customization (use standard settings)" . Custom-reset-standard))780 '(("Undo Edits" . Custom-reset-current) 781 ("Reset to Saved" . Custom-reset-saved) 782 ("Erase Customization (use standard values)" . Custom-reset-standard)) 762 783 "Alist of actions for the `Reset' button. 763 784 The key is a string containing the name of the action, the value is a … … 768 789 "Select item from reset menu." 769 790 (let* ((completion-ignore-case t) 770 (answer (widget-choose "Reset to"791 (answer (widget-choose "Reset settings" 771 792 custom-reset-menu 772 793 event))) … … 775 796 776 797 (defun Custom-reset-current (&rest ignore) 777 "Reset all modified group members to their current value."798 "Reset all edited settings in the buffer to show their current values." 778 799 (interactive) 779 800 (let ((children custom-options)) 780 (mapc (lambda (widget) 781 (if (memq (widget-get widget :custom-state) 782 '(modified changed)) 783 (widget-apply widget :custom-reset-current))) 784 children))) 801 (if (or (and (= 1 (length children)) 802 (memq (widget-type (car children)) 803 '(custom-variable custom-face))) 804 (y-or-n-p "Reset all settings' buffer text to show current values? ")) 805 (mapc (lambda (widget) 806 (if (memq (widget-get widget :custom-state) 807 '(modified changed)) 808 (widget-apply widget :custom-reset-current))) 809 children) 810 (message "Aborted")))) 785 811 786 812 (defun Custom-reset-saved (&rest ignore) 787 "Reset all modified or set group members to their saved value." 813 "Reset all edited or set settings in the buffer to their saved value. 814 This also shows the saved values in the buffer." 788 815 (interactive) 789 816 (let ((children custom-options)) 790 (mapc (lambda (widget) 791 (if (memq (widget-get widget :custom-state) 792 '(modified set changed rogue)) 793 (widget-apply widget :custom-reset-saved))) 794 children))) 817 (if (or (and (= 1 (length children)) 818 (memq (widget-type (car children)) 819 '(custom-variable custom-face))) 820 (y-or-n-p "Reset all settings (current values and buffer text) to saved values? ")) 821 (mapc (lambda (widget) 822 (if (memq (widget-get widget :custom-state) 823 '(modified set changed rogue)) 824 (widget-apply widget :custom-reset-saved))) 825 children) 826 (message "Aborted")))) 795 827 796 828 (defun Custom-reset-standard (&rest ignore) 797 829 "Erase all customization (either current or saved) for the group members. 798 The immediate result is to restore them to their standard settings.799 This operation eliminates any saved settings for the group members,830 The immediate result is to restore them to their standard values. 831 This operation eliminates any saved values for the group members, 800 832 making them as if they had never been customized at all." 801 833 (interactive) 802 834 (let ((children custom-options)) 803 (when (or (and (= 1 (length children)) 804 (memq (widget-type (car children)) 805 '(custom-variable custom-face))) 806 (yes-or-no-p "Really erase all customizations in this buffer? ")) 807 (mapc (lambda (widget) 808 (and (if (widget-get widget :custom-standard-value) 809 (widget-apply widget :custom-standard-value) 810 t) 811 (memq (widget-get widget :custom-state) 812 '(modified set changed saved rogue)) 813 (widget-apply widget :custom-reset-standard))) 814 children)))) 835 (if (or (and (= 1 (length children)) 836 (memq (widget-type (car children)) 837 '(custom-variable custom-face))) 838 (yes-or-no-p "Erase all customizations for settings in this buffer? ")) 839 (mapc (lambda (widget) 840 (and (if (widget-get widget :custom-standard-value) 841 (widget-apply widget :custom-standard-value) 842 t) 843 (memq (widget-get widget :custom-state) 844 '(modified set changed saved rogue)) 845 (widget-apply widget :custom-reset-standard))) 846 children) 847 (message "Aborted")))) 815 848 816 849 ;;; The Customize Commands … … 933 966 (funcall (or (get variable 'custom-set) 'set-default) variable value) 934 967 (put variable 'saved-value (list (custom-quote value))) 935 (custom-push-theme 'theme-value variable 'user 'set ( list (custom-quote value)))968 (custom-push-theme 'theme-value variable 'user 'set (custom-quote value)) 936 969 (cond ((string= comment "") 937 970 (put variable 'variable-comment nil) … … 976 1009 (defun customize-group (group) 977 1010 "Customize GROUP, which must be a customization group." 978 (interactive (list (let ((completion-ignore-case t)) 979 (completing-read "Customize group (default emacs): " 980 obarray 981 (lambda (symbol) 982 (or (get symbol 'custom-loads) 983 (get symbol 'custom-group))) 984 t)))) 1011 (interactive 1012 (list (let ((completion-ignore-case t)) 1013 (completing-read "Customize group (default emacs): " 1014 obarray 1015 (lambda (symbol) 1016 (or (and (get symbol 'custom-loads) 1017 (not (get symbol 'custom-autoload))) 1018 (get symbol 'custom-group))) 1019 t)))) 985 1020 (when (stringp group) 986 1021 (if (string-equal "" group) … … 999 1034 (defun customize-group-other-window (group) 1000 1035 "Customize GROUP, which must be a customization group." 1001 (interactive (list (let ((completion-ignore-case t)) 1002 (completing-read "Customize group (default emacs): " 1003 obarray 1004 (lambda (symbol) 1005 (or (get symbol 'custom-loads) 1006 (get symbol 'custom-group))) 1007 t)))) 1036 (interactive 1037 (list (let ((completion-ignore-case t)) 1038 (completing-read "Customize group (default emacs): " 1039 obarray 1040 (lambda (symbol) 1041 (or (and (get symbol 'custom-loads) 1042 (not (get symbol 'custom-autoload))) 1043 (get symbol 'custom-group))) 1044 t)))) 1008 1045 (when (stringp group) 1009 1046 (if (string-equal "" group) … … 1054 1091 (message "`%s' is an alias for `%s'" symbol basevar)))) 1055 1092 1056 (defvar customize-changed-options-previous-release "2 0.2"1093 (defvar customize-changed-options-previous-release "21.1" 1057 1094 "Version for `customize-changed-options' to refer back to by default.") 1095 1096 ;;;###autoload 1097 (defalias 'customize-changed 'customize-changed-options) 1058 1098 1059 1099 ;;;###autoload 1060 1100 (defun customize-changed-options (since-version) 1061 "Customize all user option variableschanged in Emacs itself.1101 "Customize all settings whose meanings have changed in Emacs itself. 1062 1102 This includes new user option variables and faces, and new 1063 customization groups, as well as older options and faces whose default 1064 values have changed since the previous major Emacs release. 1065 1066 With argument SINCE-VERSION (a string), customize all user option 1067 variables that were added (or their meanings were changed) since that 1068 version." 1103 customization groups, as well as older options and faces whose meanings 1104 or default values have changed since the previous major Emacs release. 1105 1106 With argument SINCE-VERSION (a string), customize all settings 1107 that were added or redefined since that version." 1069 1108 1070 1109 (interactive "sCustomize options changed, since version (default all versions): ") … … 1211 1250 ;;;###autoload 1212 1251 (defun customize-rogue () 1213 "Customize all user variable modified outside customize."1252 "Customize all user variables modified outside customize." 1214 1253 (interactive) 1215 1254 (let ((found nil)) … … 1249 1288 ;;;###autoload 1250 1289 (defun customize-apropos (regexp &optional all) 1251 "Customize all user options matching REGEXP.1290 "Customize all loaded options, faces and groups matching REGEXP. 1252 1291 If ALL is `options', include only options. 1253 1292 If ALL is `faces', include only faces. 1254 1293 If ALL is `groups', include only groups. 1255 If ALL is t (interactively, with prefix arg), include options which are not 1256 user-settable, as well as faces and groups." 1294 If ALL is t (interactively, with prefix arg), include variables 1295 that are not customizable options, as well as faces and groups 1296 \(but we recommend using `apropos-variable' instead)." 1257 1297 (interactive "sCustomize regexp: \nP") 1258 1298 (let ((found nil)) … … 1267 1307 (when (and (not (memq all '(groups faces))) 1268 1308 (boundp symbol) 1309 (eq (indirect-variable symbol) symbol) 1269 1310 (or (get symbol 'saved-value) 1270 1311 (custom-variable-p symbol) 1271 (if (memq all '(nil options)) 1272 (user-variable-p symbol) 1273 (get symbol 'variable-documentation)))) 1312 (and (not (memq all '(nil options))) 1313 (get symbol 'variable-documentation)))) 1274 1314 (push (list symbol 'custom-variable) found))))) 1275 1315 (if (not found) … … 1281 1321 ;;;###autoload 1282 1322 (defun customize-apropos-options (regexp &optional arg) 1283 "Customize all user options matching REGEXP. 1284 With prefix arg, include options which are not user-settable." 1323 "Customize all loaded customizable options matching REGEXP. 1324 With prefix arg, include variables that are not customizable options 1325 \(but we recommend using `apropos-variable' instead)." 1285 1326 (interactive "sCustomize regexp: \nP") 1286 1327 (customize-apropos regexp (or arg 'options))) … … 1288 1329 ;;;###autoload 1289 1330 (defun customize-apropos-faces (regexp) 1290 "Customize all userfaces matching REGEXP."1331 "Customize all loaded faces matching REGEXP." 1291 1332 (interactive "sCustomize regexp: \n") 1292 1333 (customize-apropos regexp 'faces)) … … 1294 1335 ;;;###autoload 1295 1336 (defun customize-apropos-groups (regexp) 1296 "Customize all usergroups matching REGEXP."1337 "Customize all loaded groups matching REGEXP." 1297 1338 (interactive "sCustomize regexp: \n") 1298 1339 (customize-apropos regexp 'groups)) … … 1390 1431 "Face used for buttons in customization buffers.") 1391 1432 1433 (defvar custom-button-mouse nil 1434 "Mouse face used for buttons in customization buffers.") 1435 1392 1436 (defvar custom-button-pressed nil 1393 1437 "Face used for pressed buttons in customization buffers.") … … 1404 1448 (setq custom-button 1405 1449 (if value 'custom-button 'custom-button-unraised)) 1450 (setq custom-button-mouse 1451 (if value 'custom-button-mouse 'highlight)) 1406 1452 (setq custom-button-pressed 1407 1453 (if value … … 1417 1463 (widget-insert description)) 1418 1464 (widget-insert (format ". 1419 %s show active fields; type RET or click mouse-11420 on an active field to invoke its action. Editing an option value 1421 changes only the text in the buffer. Invoke the State button to set or 1422 save the option value. Saving an option normally edits yourinit file.1423 Invoke "1465 %s buttons; type RET or click mouse-1 to actuate one. 1466 Editing a setting changes only the text in the buffer. 1467 Use the setting's State button to set it or save changes in it. 1468 Saving a change normally works by editing your Emacs init file. 1469 See " 1424 1470 (if custom-raised-buttons 1425 "`Raised' buttons"1426 "Square brackets ")))1427 (widget-create ' info-link1471 "`Raised' text indicates" 1472 "Square brackets indicate"))) 1473 (widget-create 'custom-manual 1428 1474 :tag "Custom file" 1429 1475 "(emacs)Saving Customizations") 1430 1476 (widget-insert 1431 " for information on how to save in a different file. 1432 Invoke ")1433 (widget-create ' info-link1477 " for information on how to save in a different file.\n 1478 See ") 1479 (widget-create 'custom-manual 1434 1480 :tag "Help" 1435 1481 :help-echo "Read the online help." 1436 1482 "(emacs)Easy Customization") 1437 (widget-insert " for general information.\n\n") 1438 (widget-insert "Operate on everything in this buffer:\n ")) 1483 (widget-insert " for more information.\n\n") 1484 (widget-insert "Operate on all settings in this buffer that \ 1485 are not marked HIDDEN:\n ")) 1439 1486 (widget-insert " ")) 1440 1487 (widget-create 'push-button … … 1444 1491 :action (lambda (widget &optional event) 1445 1492 (Custom-set))) 1446 (widget-insert " ") 1447 (widget-create 'push-button 1448 :tag "Save for Future Sessions" 1449 :help-echo "\ 1493 (if (not custom-buffer-verbose-help) 1494 (progn 1495 (widget-insert " ") 1496 (widget-create 'custom-manual 1497 :tag "Help" 1498 :help-echo "Read the online help." 1499 "(emacs)Easy Customization"))) 1500 (when (or custom-file user-init-file) 1501 (widget-insert " ") 1502 (widget-create 'push-button 1503 :tag "Save for Future Sessions" 1504 :help-echo "\ 1450 1505 Make your editing in this buffer take effect for future Emacs sessions. 1451 1506 This updates your Emacs initialization file or creates a new one." 1452 :action (lambda (widget &optional event)1453 (Custom-save)))1507 :action (lambda (widget &optional event) 1508 (Custom-save)))) 1454 1509 (if custom-reset-button-menu 1455 1510 (progn 1456 1511 (widget-insert " ") 1457 1512 (widget-create 'push-button 1458 :tag "Reset "1513 :tag "Reset buffer" 1459 1514 :help-echo "Show a menu with reset operations." 1460 1515 :mouse-down-action (lambda (&rest junk) t) … … 1463 1518 (widget-insert "\n ") 1464 1519 (widget-create 'push-button 1465 :tag " Reset"1520 :tag "Undo Edits" 1466 1521 :help-echo "\ 1467 1522 Reset all edited text in this buffer to reflect current values." … … 1471 1526 :tag "Reset to Saved" 1472 1527 :help-echo "\ 1473 Reset all values in this buffer to their saved settings."1528 Reset all settings in this buffer to their saved values." 1474 1529 :action 'Custom-reset-saved) 1475 1530 (widget-insert " ") 1476 (widget-create 'push-button 1477 :tag "Erase Customization" 1478 :help-echo "\ 1479 Un-customize all values in this buffer. They get their standard settings." 1480 :action 'Custom-reset-standard)) 1481 (if (not custom-buffer-verbose-help) 1482 (progn 1483 (widget-insert " ") 1484 (widget-create 'info-link 1485 :tag "Help" 1486 :help-echo "Read the online help." 1487 "(emacs)Easy Customization"))) 1531 (when (or custom-file user-init-file) 1532 (widget-create 'push-button 1533 :tag "Erase Customization" 1534 :help-echo "\ 1535 Un-customize all settings in this buffer and save them with standard values." 1536 :action 'Custom-reset-standard))) 1488 1537 (widget-insert " ") 1489 1538 (widget-create 'push-button … … 1547 1596 (pop-to-buffer (custom-get-fresh-buffer name))) 1548 1597 (custom-mode) 1549 (widget-insert "\ 1550 Square brackets show active fields; type RET or click mouse-1 1551 on an active field to invoke its action. 1552 Invoke [+] below to expand a group, and [-] to collapse an expanded group.\n") 1598 (widget-insert (format "\ 1599 %s buttons; type RET or click mouse-1 1600 on a button to invoke its action. 1601 Invoke [+] to expand a group, and [-] to collapse an expanded group.\n" 1602 (if custom-raised-buttons 1603 "`Raised' text indicates" 1604 "Square brackets indicate"))) 1605 1606 1553 1607 (if custom-browse-only-groups 1554 1608 (widget-insert "\ … … 1589 1643 (custom-toggle-parent widget))) 1590 1644 1591 (define-widget 'custom-browse-group-tag ' push-button1645 (define-widget 'custom-browse-group-tag 'custom-group-link 1592 1646 "Show parent in other window when activated." 1593 1647 :tag "Group" … … 1599 1653 (customize-group-other-window (widget-value parent)))) 1600 1654 1601 (define-widget 'custom-browse-variable-tag ' push-button1655 (define-widget 'custom-browse-variable-tag 'custom-group-link 1602 1656 "Show parent in other window when activated." 1603 1657 :tag "Option" … … 1609 1663 (customize-variable-other-window (widget-value parent)))) 1610 1664 1611 (define-widget 'custom-browse-face-tag ' push-button1665 (define-widget 'custom-browse-face-tag 'custom-group-link 1612 1666 "Show parent in other window when activated." 1613 1667 :tag "Face" … … 1665 1719 "Link to the manual entry for this customization option." 1666 1720 :help-echo "Read the manual entry for this option." 1721 :button-face 'custom-link 1722 :mouse-face 'highlight 1667 1723 :tag "Manual") 1668 1724 … … 1724 1780 ;; backward-compatibility alias 1725 1781 (put 'custom-changed-face 'face-alias 'custom-changed) 1782 1783 (defface custom-themed '((((min-colors 88) (class color)) 1784 (:foreground "white" :background "blue1")) 1785 (((class color)) 1786 (:foreground "white" :background "blue")) 1787 (t 1788 (:slant italic))) 1789 "Face used when the customize item has been set by a theme." 1790 :group 'custom-magic-faces) 1726 1791 1727 1792 (defface custom-saved '((t (:underline t))) … … 1753 1818 SAVED and set." "\ 1754 1819 something in this group has been set and saved.") 1820 (themed "o" custom-themed "\ 1821 THEMED." "\ 1822 visible group members are all at standard values.") 1755 1823 (rogue "@" custom-rogue "\ 1756 NO CUSTOMIZATION DATA; you should not see this." "\1824 NO CUSTOMIZATION DATA; not intended to be customized." "\ 1757 1825 something in this group is not prepared for customization.") 1758 1826 (standard " " nil "\ 1759 1827 STANDARD." "\ 1760 visible group members are all at standard settings."))1828 visible group members are all at standard values.")) 1761 1829 "Alist of customize option states. 1762 1830 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where … … 1926 1994 (put 'custom-button-face 'face-alias 'custom-button) 1927 1995 1996 (defface custom-button-mouse 1997 '((((type x w32 mac) (class color)) 1998 (:box (:line-width 2 :style released-button) 1999 :background "grey90" :foreground "black")) 2000 (t 2001 nil)) 2002 "Mouse face for custom buffer buttons if `custom-raised-buttons' is non-nil." 2003 :version "22.1" 2004 :group 'custom-faces) 2005 1928 2006 (defface custom-button-unraised 1929 '((((min-colors 88) 1930 (class color) (background light)) :foreground "blue1" :underline t) 1931 (((class color) (background light)) :foreground "blue" :underline t) 1932 (((min-colors 88) 1933 (class color) (background dark)) :foreground "cyan1" :underline t) 1934 (((class color) (background dark)) :foreground "cyan" :underline t) 1935 (t :underline t)) 2007 '((t :inherit underline)) 1936 2008 "Face for custom buffer buttons if `custom-raised-buttons' is nil." 1937 2009 :version "22.1" … … 1940 2012 (setq custom-button 1941 2013 (if custom-raised-buttons 'custom-button 'custom-button-unraised)) 2014 2015 (setq custom-button-mouse 2016 (if custom-raised-buttons 'custom-button-mouse 'highlight)) 1942 2017 1943 2018 (defface custom-button-pressed … … 1983 2058 ;; backward-compatibility alias 1984 2059 (put 'custom-state-face 'face-alias 'custom-state) 2060 2061 (defface custom-link 2062 '((t :inherit link)) 2063 "Face for links in customization buffers." 2064 :version "22.1" 2065 :group 'custom-faces) 1985 2066 1986 2067 (define-widget 'custom 'default … … 2118 2199 (insert "See also ") 2119 2200 (while links 2120 (push (widget-create-child-and-convert widget (car links)) 2201 (push (widget-create-child-and-convert 2202 widget (car links) 2203 :button-face 'custom-link 2204 :mouse-face 'highlight) 2121 2205 buttons) 2122 2206 (setq links (cdr links)) … … 2152 2236 (and (null (get name 'custom-links)) ;No links of its own. 2153 2237 (= (length parents) 1) ;A single parent. 2154 (let* ((links (get (car parents) 'custom-links)) 2238 (let* ((links (delq nil (mapcar (lambda (w) 2239 (unless (eq (widget-type w) 2240 'custom-group-link) 2241 w)) 2242 (get (car parents) 'custom-links)))) 2155 2243 (many (> (length links) 2))) 2156 2244 (when links 2157 2245 (insert "\nParent documentation: ") 2158 2246 (while links 2159 (push (widget-create-child-and-convert widget (car links)) 2247 (push (widget-create-child-and-convert 2248 widget (car links) 2249 :button-face 'custom-link 2250 :mouse-face 'highlight) 2160 2251 buttons) 2161 2252 (setq links (cdr links)) … … 2177 2268 2178 2269 ;; like the editable field 2179 (defface custom-comment '((((class grayscale color) 2270 (defface custom-comment '((((type tty)) 2271 :background "yellow3" 2272 :foreground "black") 2273 (((class grayscale color) 2180 2274 (background light)) 2181 (:background "gray85"))2275 :background "gray85") 2182 2276 (((class grayscale color) 2183 2277 (background dark)) 2184 (:background "dim gray"))2278 :background "dim gray") 2185 2279 (t 2186 (:slant italic)))2280 :slant italic)) 2187 2281 "Face used for comments on variables or faces" 2188 2282 :version "21.1" … … 2507 2601 'set 2508 2602 'changed)) 2509 ((progn (setq tmp (get symbol ' saved-value))2603 ((progn (setq tmp (get symbol 'theme-value)) 2510 2604 (setq temp (get symbol 'saved-variable-comment)) 2511 2605 (or tmp temp)) 2512 2606 (if (condition-case nil 2513 (and (equal value (eval (car tmp))) 2514 (equal comment temp)) 2607 (and (equal comment temp) 2608 (equal value 2609 (eval 2610 (car (custom-variable-theme-value 2611 symbol))))) 2515 2612 (error nil)) 2516 'saved 2613 (cond 2614 ((eq (caar tmp) 'user) 'saved) 2615 ((eq (caar tmp) 'changed) 'changed) 2616 (t 'themed)) 2517 2617 'changed)) 2518 2618 ((setq tmp (get symbol 'standard-value)) … … 2530 2630 2531 2631 (defvar custom-variable-menu 2532 '(("Set for Current Session" custom-variable-set2632 `(("Set for Current Session" custom-variable-set 2533 2633 (lambda (widget) 2534 2634 (eq (widget-get widget :custom-state) 'modified))) 2535 ("Save for Future Sessions" custom-variable-save 2536 (lambda (widget) 2537 (memq (widget-get widget :custom-state) '(modified set changed rogue)))) 2538 ("Reset to Current" custom-redraw 2635 ,@(when (or custom-file user-init-file) 2636 '(("Save for Future Sessions" custom-variable-save 2637 (lambda (widget) 2638 (memq (widget-get widget :custom-state) 2639 '(modified set changed rogue)))))) 2640 ("Undo Edits" custom-redraw 2539 2641 (lambda (widget) 2540 2642 (and (default-boundp (widget-value widget)) … … 2546 2648 (memq (widget-get widget :custom-state) 2547 2649 '(modified set changed rogue))))) 2548 ("Erase Customization" custom-variable-reset-standard 2549 (lambda (widget) 2550 (and (get (widget-value widget) 'standard-value) 2551 (memq (widget-get widget :custom-state) 2552 '(modified set changed saved rogue))))) 2553 ("Use Backup Value" custom-variable-reset-backup 2650 ,@(when (or custom-file user-init-file) 2651 '(("Erase Customization" custom-variable-reset-standard 2652 (lambda (widget) 2653 (and (get (widget-value widget) 'standard-value) 2654 (memq (widget-get widget :custom-state) 2655 '(modified set changed saved rogue))))))) 2656 ("Set to Backup Value" custom-variable-reset-backup 2554 2657 (lambda (widget) 2555 2658 (get (widget-value widget) 'backup-value))) … … 2557 2660 ("Add Comment" custom-comment-show custom-comment-invisible-p) 2558 2661 ("---" ignore ignore) 2559 (" Don't show as Lisp expression" custom-variable-edit2662 ("Show Current Value" custom-variable-edit 2560 2663 (lambda (widget) 2561 2664 (eq (widget-get widget :custom-form) 'lisp))) 2562 ("Show initial Lisp expression" custom-variable-edit-lisp2665 ("Show Saved Lisp Expression" custom-variable-edit-lisp 2563 2666 (lambda (widget) 2564 2667 (eq (widget-get widget :custom-form) 'edit)))) … … 2621 2724 (custom-comment-hide comment-widget)) 2622 2725 (custom-variable-backup-value widget) 2726 (custom-push-theme 'theme-value symbol 'user 2727 'set (custom-quote (widget-value child))) 2623 2728 (funcall set symbol (eval (setq val (widget-value child)))) 2624 2729 (put symbol 'customized-value (list val)) … … 2631 2736 (custom-comment-hide comment-widget)) 2632 2737 (custom-variable-backup-value widget) 2738 (custom-push-theme 'theme-value symbol 'user 2739 'set (custom-quote (widget-value child))) 2633 2740 (funcall set symbol (setq val (widget-value child))) 2634 2741 (put symbol 'customized-value (list (custom-quote val))) … … 2660 2767 (put symbol 'saved-value (list (widget-value child))) 2661 2768 (custom-push-theme 'theme-value symbol 'user 2662 'set ( list(widget-value child)))2769 'set (custom-quote (widget-value child))) 2663 2770 (funcall set symbol (eval (widget-value child))) 2664 2771 (put symbol 'variable-comment comment) … … 2672 2779 (list (custom-quote (widget-value child)))) 2673 2780 (custom-push-theme 'theme-value symbol 'user 2674 'set (list (custom-quote (widget-value 2675 child)))) 2781 'set (custom-quote (widget-value child))) 2676 2782 (funcall set symbol (widget-value child)) 2677 2783 (put symbol 'variable-comment comment) … … 2685 2791 (defun custom-variable-reset-saved (widget) 2686 2792 "Restore the saved value for the variable being edited by WIDGET. 2793 This also updates the buffer to show that value. 2687 2794 The value that was current before this operation 2688 2795 becomes the backup value, so you can get it again." … … 2694 2801 (put symbol 'variable-comment comment) 2695 2802 (custom-variable-backup-value widget) 2803 (custom-push-theme 'theme-value symbol 'user 'set (car-safe value)) 2696 2804 (condition-case nil 2697 2805 (funcall set symbol (eval (car value))) … … 2711 2819 The value that was current before this operation 2712 2820 becomes the backup value, so you can get it again." 2713 (let* ((symbol (widget-value widget)) 2714 (set (or (get symbol 'custom-set) 'set-default))) 2821 (let* ((symbol (widget-value widget))) 2715 2822 (if (get symbol 'standard-value) 2716 (progn 2717 (custom-variable-backup-value widget) 2718 (funcall set symbol (eval (car (get symbol 'standard-value))))) 2823 (custom-variable-backup-value widget) 2719 2824 (error "No standard setting known for %S" symbol)) 2720 2825 (put symbol 'variable-comment nil) 2721 2826 (put symbol 'customized-value nil) 2722 2827 (put symbol 'customized-variable-comment nil) 2828 (custom-push-theme 'theme-value symbol 'user 'reset) 2829 (custom-theme-recalc-variable symbol) 2723 2830 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) 2724 2831 (put symbol 'saved-value nil) 2725 (custom-push-theme 'theme-value symbol 'user 'reset 'standard)2726 ;; As a special optimizations we do not (explictly)2727 ;; save resets to standard when no theme set the value.2728 (if (null (cdr (get symbol 'theme-value)))2729 (put symbol 'theme-value nil))2730 2832 (put symbol 'saved-variable-comment nil) 2731 2833 (custom-save-all)) … … 2759 2861 (progn 2760 2862 (custom-variable-backup-value widget) 2863 (custom-push-theme 'theme-value symbol 'user 'set value) 2761 2864 (condition-case nil 2762 2865 (funcall set symbol (car value)) … … 3201 3304 3202 3305 (defvar custom-face-menu 3203 '(("Set for Current Session" custom-face-set) 3204 ("Save for Future Sessions" custom-face-save-command) 3306 `(("Set for Current Session" custom-face-set) 3307 ,@(when (or custom-file user-init-file) 3308 '(("Save for Future Sessions" custom-face-save))) 3309 ("Undo Edits" custom-redraw 3310 (lambda (widget) 3311 (memq (widget-get widget :custom-state) '(modified changed)))) 3205 3312 ("Reset to Saved" custom-face-reset-saved 3206 3313 (lambda (widget) 3207 3314 (or (get (widget-value widget) 'saved-face) 3208 3315 (get (widget-value widget) 'saved-face-comment)))) 3209 ("Erase Customization" custom-face-reset-standard 3210 (lambda (widget) 3211 (get (widget-value widget) 'face-defface-spec))) 3316 ,@(when (or custom-file user-init-file) 3317 '(("Erase Customization" custom-face-reset-standard 3318 (lambda (widget) 3319 (get (widget-value widget) 'face-defface-spec))))) 3212 3320 ("---" ignore ignore) 3213 3321 ("Add Comment" custom-comment-show custom-comment-invisible-p) 3214 3322 ("---" ignore ignore) 3215 ("Show all display specs" custom-face-edit-all 3323 ("For Current Display" custom-face-edit-selected 3324 (lambda (widget) 3325 (not (eq (widget-get widget :custom-form) 'selected)))) 3326 ("For All Kinds of Displays" custom-face-edit-all 3216 3327 (lambda (widget) 3217 3328 (not (eq (widget-get widget :custom-form) 'all)))) 3218 ("Just current attributes" custom-face-edit-selected 3219 (lambda (widget) 3220 (not (eq (widget-get widget :custom-form) 'selected)))) 3221 ("Show as Lisp expression" custom-face-edit-lisp 3329 ("Show Lisp Expression" custom-face-edit-lisp 3222 3330 (lambda (widget) 3223 3331 (not (eq (widget-get widget :custom-form) 'lisp))))) … … 3265 3373 (or tmp temp)) 3266 3374 (if (equal temp comment) 3267 'saved 3375 (cond 3376 ((eq 'user (caar (get symbol 'theme-face))) 3377 'saved) 3378 ((eq 'changed (caar (get symbol 'theme-face))) 3379 'changed) 3380 (t 'themed)) 3268 3381 'changed)) 3269 3382 ((get symbol 'face-defface-spec) … … 3312 3425 ;; something harmless instead. 3313 3426 (face-spec-set symbol '((t :foreground unspecified)))) 3427 (custom-push-theme 'theme-face symbol 'user 'set value) 3314 3428 (put symbol 'customized-face-comment comment) 3315 3429 (put symbol 'face-comment comment) … … 3317 3431 (custom-redraw-magic widget))) 3318 3432 3319 (defun custom-face-save -command(widget)3433 (defun custom-face-save (widget) 3320 3434 "Save in `.emacs' the face attributes in WIDGET." 3321 (custom-face-save widget)3322 (custom-save-all))3323 3324 (defun custom-face-save (widget)3325 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'."3326 3435 (let* ((symbol (widget-value widget)) 3327 3436 (child (car (widget-get widget :children))) … … 3333 3442 ;; Make the comment invisible by hand if it's empty 3334 3443 (custom-comment-hide comment-widget)) 3444 (custom-push-theme 'theme-face symbol 'user 'set value) 3335 3445 (if (face-spec-choose value) 3336 3446 (face-spec-set symbol value) … …
