Show
Ignore:
Timestamp:
2006年01月28日 09時46分44秒 (3 years ago)
Author:
miyoshi
Message:

Update.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • vendor/emacs-CVS_HEAD/lisp/cus-edit.el

    r3988 r4018  
    22;; 
    33;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 
    4 ;;   2005 Free Software Foundation, Inc. 
     4;;   2005, 2006 Free Software Foundation, Inc. 
    55;; 
    66;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 
     
    8989 
    9090;; You can see (and modify and save) this unevaluated value by selecting 
    91 ;; "Show initial Lisp expression" from the Lisp interface.  This will 
     91;; "Show Saved Lisp Expression" from the Lisp interface.  This will 
    9292;; give you the unevaluated saved value, if any, otherwise the 
    9393;; unevaluated standard value. 
     
    122122 
    123123;;    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 
    128129;;    `customize-option' non-interactively. 
    129130 
     
    458459  :link '(custom-manual "(emacs)Windows") 
    459460  :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-") 
    460468 
    461469;;; Utilities. 
     
    499507          val) 
    500508     (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: ") 
    503511                obarray 'custom-variable-p t nil nil default)) 
    504512     (list (if (equal val "") 
     
    612620customize." 
    613621  :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) 
    614   :group 'customize
     622  :group 'custom-buffer
    615623 
    616624(defcustom custom-guess-doc-alist 
     
    626634customize." 
    627635  :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) 
    628   :group 'customize
     636  :group 'custom-buffer
    629637 
    630638(defun custom-guess-type (symbol) 
     
    737745 
    738746(defun Custom-set () 
    739   "Set changes in all modified options." 
     747  "Set the current value of all edited settings in the buffer." 
    740748  (interactive) 
    741749  (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")))) 
    746759 
    747760(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. 
     762If a setting was edited and set before, this saves it. 
     763If a setting was merely edited before, this sets it then saves it." 
    749764  (interactive) 
    750765  (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")))) 
    757778 
    758779(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)) 
    762783  "Alist of actions for the `Reset' button. 
    763784The key is a string containing the name of the action, the value is a 
     
    768789  "Select item from reset menu." 
    769790  (let* ((completion-ignore-case t) 
    770          (answer (widget-choose "Reset to
     791         (answer (widget-choose "Reset settings
    771792                                custom-reset-menu 
    772793                                event))) 
     
    775796 
    776797(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." 
    778799  (interactive) 
    779800  (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")))) 
    785811 
    786812(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. 
     814This also shows the saved values in the buffer." 
    788815  (interactive) 
    789816  (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")))) 
    795827 
    796828(defun Custom-reset-standard (&rest ignore) 
    797829  "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, 
     830The immediate result is to restore them to their standard values. 
     831This operation eliminates any saved values for the group members, 
    800832making them as if they had never been customized at all." 
    801833  (interactive) 
    802834  (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")))) 
    815848 
    816849;;; The Customize Commands 
     
    933966  (funcall (or (get variable 'custom-set) 'set-default) variable value) 
    934967  (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)) 
    936969  (cond ((string= comment "") 
    937970         (put variable 'variable-comment nil) 
     
    9761009(defun customize-group (group) 
    9771010  "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)))) 
    9851020  (when (stringp group) 
    9861021    (if (string-equal "" group) 
     
    9991034(defun customize-group-other-window (group) 
    10001035  "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)))) 
    10081045  (when (stringp group) 
    10091046    (if (string-equal "" group) 
     
    10541091      (message "`%s' is an alias for `%s'" symbol basevar)))) 
    10551092 
    1056 (defvar customize-changed-options-previous-release "20.2
     1093(defvar customize-changed-options-previous-release "21.1
    10571094  "Version for `customize-changed-options' to refer back to by default.") 
     1095 
     1096;;;###autoload 
     1097(defalias 'customize-changed 'customize-changed-options) 
    10581098 
    10591099;;;###autoload 
    10601100(defun customize-changed-options (since-version) 
    1061   "Customize all user option variables changed in Emacs itself. 
     1101  "Customize all settings whose meanings have changed in Emacs itself. 
    10621102This 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." 
     1103customization groups, as well as older options and faces whose meanings 
     1104or default values have changed since the previous major Emacs release. 
     1105 
     1106With argument SINCE-VERSION (a string), customize all settings 
     1107that were added or redefined since that version." 
    10691108 
    10701109  (interactive "sCustomize options changed, since version (default all versions): ") 
     
    12111250;;;###autoload 
    12121251(defun customize-rogue () 
    1213   "Customize all user variable modified outside customize." 
     1252  "Customize all user variables modified outside customize." 
    12141253  (interactive) 
    12151254  (let ((found nil)) 
     
    12491288;;;###autoload 
    12501289(defun customize-apropos (regexp &optional all) 
    1251   "Customize all user options matching REGEXP. 
     1290  "Customize all loaded options, faces and groups matching REGEXP. 
    12521291If ALL is `options', include only options. 
    12531292If ALL is `faces', include only faces. 
    12541293If 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." 
     1294If ALL is t (interactively, with prefix arg), include variables 
     1295that are not customizable options, as well as faces and groups 
     1296\(but we recommend using `apropos-variable' instead)." 
    12571297  (interactive "sCustomize regexp: \nP") 
    12581298  (let ((found nil)) 
     
    12671307                  (when (and (not (memq all '(groups faces))) 
    12681308                             (boundp symbol) 
     1309                             (eq (indirect-variable symbol) symbol) 
    12691310                             (or (get symbol 'saved-value) 
    12701311                                 (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)))) 
    12741314                    (push (list symbol 'custom-variable) found))))) 
    12751315    (if (not found) 
     
    12811321;;;###autoload 
    12821322(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. 
     1324With prefix arg, include variables that are not customizable options 
     1325\(but we recommend using `apropos-variable' instead)." 
    12851326  (interactive "sCustomize regexp: \nP") 
    12861327  (customize-apropos regexp (or arg 'options))) 
     
    12881329;;;###autoload 
    12891330(defun customize-apropos-faces (regexp) 
    1290   "Customize all user faces matching REGEXP." 
     1331  "Customize all loaded faces matching REGEXP." 
    12911332  (interactive "sCustomize regexp: \n") 
    12921333  (customize-apropos regexp 'faces)) 
     
    12941335;;;###autoload 
    12951336(defun customize-apropos-groups (regexp) 
    1296   "Customize all user groups matching REGEXP." 
     1337  "Customize all loaded groups matching REGEXP." 
    12971338  (interactive "sCustomize regexp: \n") 
    12981339  (customize-apropos regexp 'groups)) 
     
    13901431  "Face used for buttons in customization buffers.") 
    13911432 
     1433(defvar custom-button-mouse nil 
     1434  "Mouse face used for buttons in customization buffers.") 
     1435 
    13921436(defvar custom-button-pressed nil 
    13931437  "Face used for pressed buttons in customization buffers.") 
     
    14041448         (setq custom-button 
    14051449               (if value 'custom-button 'custom-button-unraised)) 
     1450         (setq custom-button-mouse 
     1451               (if value 'custom-button-mouse 'highlight)) 
    14061452         (setq custom-button-pressed 
    14071453               (if value 
     
    14171463            (widget-insert description)) 
    14181464        (widget-insert (format ". 
    1419 %s show active fields; type RET or click mouse-1 
    1420 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 your init file. 
    1423 Invoke " 
     1465%s buttons; type RET or click mouse-1 to actuate one. 
     1466Editing a setting changes only the text in the buffer. 
     1467Use the setting's State button to set it or save changes in it. 
     1468Saving a change normally works by editing your Emacs init file. 
     1469See " 
    14241470                               (if custom-raised-buttons 
    1425                                    "`Raised' buttons" 
    1426                                  "Square brackets"))) 
    1427         (widget-create 'info-link 
     1471                                   "`Raised' text indicates" 
     1472                                 "Square brackets indicate"))) 
     1473        (widget-create 'custom-manual 
    14281474                       :tag "Custom file" 
    14291475                       "(emacs)Saving Customizations") 
    14301476        (widget-insert 
    1431          " for information on how to save in a different file. 
    1432 Invoke ") 
    1433         (widget-create 'info-link 
     1477         " for information on how to save in a different file.\n 
     1478See ") 
     1479        (widget-create 'custom-manual 
    14341480                       :tag "Help" 
    14351481                       :help-echo "Read the online help." 
    14361482                       "(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 \ 
     1485are not marked HIDDEN:\n ")) 
    14391486    (widget-insert " ")) 
    14401487  (widget-create 'push-button 
     
    14441491                 :action (lambda (widget &optional event) 
    14451492                           (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 "\ 
    14501505Make your editing in this buffer take effect for future Emacs sessions. 
    14511506This 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)))) 
    14541509  (if custom-reset-button-menu 
    14551510      (progn 
    14561511        (widget-insert " ") 
    14571512        (widget-create 'push-button 
    1458                        :tag "Reset
     1513                       :tag "Reset buffer
    14591514                       :help-echo "Show a menu with reset operations." 
    14601515                       :mouse-down-action (lambda (&rest junk) t) 
     
    14631518    (widget-insert "\n ") 
    14641519    (widget-create 'push-button 
    1465                    :tag "Reset
     1520                   :tag "Undo Edits
    14661521                   :help-echo "\ 
    14671522Reset all edited text in this buffer to reflect current values." 
     
    14711526                   :tag "Reset to Saved" 
    14721527                   :help-echo "\ 
    1473 Reset all values in this buffer to their saved settings." 
     1528Reset all settings in this buffer to their saved values." 
    14741529                   :action 'Custom-reset-saved) 
    14751530    (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 "\ 
     1535Un-customize all settings in this buffer and save them with standard values." 
     1536                     :action 'Custom-reset-standard))) 
    14881537  (widget-insert "   ") 
    14891538  (widget-create 'push-button 
     
    15471596    (pop-to-buffer (custom-get-fresh-buffer name))) 
    15481597  (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 
     1600on a button to invoke its action. 
     1601Invoke [+] 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 
    15531607  (if custom-browse-only-groups 
    15541608      (widget-insert "\ 
     
    15891643    (custom-toggle-parent widget))) 
    15901644 
    1591 (define-widget 'custom-browse-group-tag 'push-button 
     1645(define-widget 'custom-browse-group-tag 'custom-group-link 
    15921646  "Show parent in other window when activated." 
    15931647  :tag "Group" 
     
    15991653    (customize-group-other-window (widget-value parent)))) 
    16001654 
    1601 (define-widget 'custom-browse-variable-tag 'push-button 
     1655(define-widget 'custom-browse-variable-tag 'custom-group-link 
    16021656  "Show parent in other window when activated." 
    16031657  :tag "Option" 
     
    16091663    (customize-variable-other-window (widget-value parent)))) 
    16101664 
    1611 (define-widget 'custom-browse-face-tag 'push-button 
     1665(define-widget 'custom-browse-face-tag 'custom-group-link 
    16121666  "Show parent in other window when activated." 
    16131667  :tag "Face" 
     
    16651719  "Link to the manual entry for this customization option." 
    16661720  :help-echo "Read the manual entry for this option." 
     1721  :button-face 'custom-link 
     1722  :mouse-face 'highlight 
    16671723  :tag "Manual") 
    16681724 
     
    17241780;; backward-compatibility alias 
    17251781(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) 
    17261791 
    17271792(defface custom-saved '((t (:underline t))) 
     
    17531818SAVED and set." "\ 
    17541819something in this group has been set and saved.") 
     1820    (themed "o" custom-themed "\ 
     1821THEMED." "\ 
     1822visible group members are all at standard values.") 
    17551823    (rogue "@" custom-rogue "\ 
    1756 NO CUSTOMIZATION DATA; you should not see this." "\ 
     1824NO CUSTOMIZATION DATA; not intended to be customized." "\ 
    17571825something in this group is not prepared for customization.") 
    17581826    (standard " " nil "\ 
    17591827STANDARD." "\ 
    1760 visible group members are all at standard settings.")) 
     1828visible group members are all at standard values.")) 
    17611829  "Alist of customize option states. 
    17621830Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where 
     
    19261994(put 'custom-button-face 'face-alias 'custom-button) 
    19271995 
     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 
    19282006(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)) 
    19362008  "Face for custom buffer buttons if `custom-raised-buttons' is nil." 
    19372009  :version "22.1" 
     
    19402012(setq custom-button 
    19412013      (if custom-raised-buttons 'custom-button 'custom-button-unraised)) 
     2014 
     2015(setq custom-button-mouse 
     2016      (if custom-raised-buttons 'custom-button-mouse 'highlight)) 
    19422017 
    19432018(defface custom-button-pressed 
     
    19832058;; backward-compatibility alias 
    19842059(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) 
    19852066 
    19862067(define-widget 'custom 'default 
     
    21182199      (insert "See also ") 
    21192200      (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) 
    21212205              buttons) 
    21222206        (setq links (cdr links)) 
     
    21522236    (and (null (get name 'custom-links)) ;No links of its own. 
    21532237         (= (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)))) 
    21552243                (many (> (length links) 2))) 
    21562244           (when links 
    21572245             (insert "\nParent documentation: ") 
    21582246             (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) 
    21602251                     buttons) 
    21612252               (setq links (cdr links)) 
     
    21772268 
    21782269;; 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) 
    21802274                            (background light)) 
    2181                            (:background "gray85")
     2275                           :background "gray85"
    21822276                          (((class grayscale color) 
    21832277                            (background dark)) 
    2184                            (:background "dim gray")
     2278                           :background "dim gray"
    21852279                          (t 
    2186                            (:slant italic))) 
     2280                           :slant italic)) 
    21872281  "Face used for comments on variables or faces" 
    21882282  :version "21.1" 
     
    25072601                           'set 
    25082602                         'changed)) 
    2509                       ((progn (setq tmp (get symbol 'saved-value)) 
     2603                      ((progn (setq tmp (get symbol 'theme-value)) 
    25102604                              (setq temp (get symbol 'saved-variable-comment)) 
    25112605                              (or tmp temp)) 
    25122606                       (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))))) 
    25152612                             (error nil)) 
    2516                            'saved 
     2613                           (cond 
     2614                            ((eq (caar tmp) 'user) 'saved) 
     2615                            ((eq (caar tmp) 'changed) 'changed) 
     2616                            (t 'themed)) 
    25172617                         'changed)) 
    25182618                      ((setq tmp (get symbol 'standard-value)) 
     
    25302630 
    25312631(defvar custom-variable-menu 
    2532   '(("Set for Current Session" custom-variable-set 
     2632  `(("Set for Current Session" custom-variable-set 
    25332633     (lambda (widget) 
    25342634       (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 
    25392641     (lambda (widget) 
    25402642       (and (default-boundp (widget-value widget)) 
     
    25462648            (memq (widget-get widget :custom-state) 
    25472649                  '(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 
    25542657     (lambda (widget) 
    25552658       (get (widget-value widget) 'backup-value))) 
     
    25572660    ("Add Comment" custom-comment-show custom-comment-invisible-p) 
    25582661    ("---" ignore ignore) 
    2559     ("Don't show as Lisp expression" custom-variable-edit 
     2662    ("Show Current Value" custom-variable-edit 
    25602663     (lambda (widget) 
    25612664       (eq (widget-get widget :custom-form) 'lisp))) 
    2562     ("Show initial Lisp expression" custom-variable-edit-lisp 
     2665    ("Show Saved Lisp Expression" custom-variable-edit-lisp 
    25632666     (lambda (widget) 
    25642667       (eq (widget-get widget :custom-form) 'edit)))) 
     
    26212724             (custom-comment-hide comment-widget)) 
    26222725           (custom-variable-backup-value widget) 
     2726           (custom-push-theme 'theme-value symbol 'user 
     2727                              'set (custom-quote (widget-value child))) 
    26232728           (funcall set symbol (eval (setq val (widget-value child)))) 
    26242729           (put symbol 'customized-value (list val)) 
     
    26312736             (custom-comment-hide comment-widget)) 
    26322737           (custom-variable-backup-value widget) 
     2738           (custom-push-theme 'theme-value symbol 'user 
     2739                              'set (custom-quote (widget-value child))) 
    26332740           (funcall set symbol (setq val (widget-value child))) 
    26342741           (put symbol 'customized-value (list (custom-quote val))) 
     
    26602767           (put symbol 'saved-value (list (widget-value child))) 
    26612768           (custom-push-theme 'theme-value symbol 'user 
    2662                               'set (list (widget-value child))) 
     2769                              'set (custom-quote (widget-value child))) 
    26632770           (funcall set symbol (eval (widget-value child))) 
    26642771           (put symbol 'variable-comment comment) 
     
    26722779                (list (custom-quote (widget-value child)))) 
    26732780           (custom-push-theme 'theme-value symbol 'user 
    2674                               'set (list (custom-quote (widget-value 
    2675                                                   child)))) 
     2781                              'set (custom-quote (widget-value child))) 
    26762782           (funcall set symbol (widget-value child)) 
    26772783           (put symbol 'variable-comment comment) 
     
    26852791(defun custom-variable-reset-saved (widget) 
    26862792  "Restore the saved value for the variable being edited by WIDGET. 
     2793This also updates the buffer to show that value. 
    26872794The value that was current before this operation 
    26882795becomes the backup value, so you can get it again." 
     
    26942801           (put symbol 'variable-comment comment) 
    26952802           (custom-variable-backup-value widget) 
     2803           (custom-push-theme 'theme-value symbol 'user 'set (car-safe value)) 
    26962804           (condition-case nil 
    26972805               (funcall set symbol (eval (car value))) 
     
    27112819The value that was current before this operation 
    27122820becomes 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))) 
    27152822    (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) 
    27192824      (error "No standard setting known for %S" symbol)) 
    27202825    (put symbol 'variable-comment nil) 
    27212826    (put symbol 'customized-value nil) 
    27222827    (put symbol 'customized-variable-comment nil) 
     2828    (custom-push-theme 'theme-value symbol 'user 'reset) 
     2829    (custom-theme-recalc-variable symbol) 
    27232830    (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) 
    27242831      (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)) 
    27302832      (put symbol 'saved-variable-comment nil) 
    27312833      (custom-save-all)) 
     
    27592861        (progn 
    27602862          (custom-variable-backup-value widget) 
     2863          (custom-push-theme 'theme-value symbol 'user 'set value) 
    27612864          (condition-case nil 
    27622865              (funcall set symbol (car value)) 
     
    32013304 
    32023305(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)))) 
    32053312    ("Reset to Saved" custom-face-reset-saved 
    32063313     (lambda (widget) 
    32073314       (or (get (widget-value widget) 'saved-face) 
    32083315           (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))))) 
    32123320    ("---" ignore ignore) 
    32133321    ("Add Comment" custom-comment-show custom-comment-invisible-p) 
    32143322    ("---" 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 
    32163327     (lambda (widget) 
    32173328       (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 
    32223330     (lambda (widget) 
    32233331       (not (eq (widget-get widget :custom-form) 'lisp))))) 
     
    32653373                   (or tmp temp)) 
    32663374                 (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)) 
    32683381                   'changed)) 
    32693382                ((get symbol 'face-defface-spec) 
     
    33123425      ;; something harmless instead. 
    33133426      (face-spec-set symbol '((t :foreground unspecified)))) 
     3427    (custom-push-theme 'theme-face symbol 'user 'set value) 
    33143428    (put symbol 'customized-face-comment comment) 
    33153429    (put symbol 'face-comment comment) 
     
    33173431    (custom-redraw-magic widget))) 
    33183432 
    3319 (defun custom-face-save-command (widget) 
     3433(defun custom-face-save (widget) 
    33203434  "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'." 
    33263435  (let* ((symbol (widget-value widget)) 
    33273436         (child (car (widget-get widget :children))) 
     
    33333442      ;; Make the comment invisible by hand if it's empty 
    33343443      (custom-comment-hide comment-widget)) 
     3444    (custom-push-theme 'theme-face symbol 'user 'set value) 
    33353445    (if (face-spec-choose value) 
    33363446        (face-spec-set symbol value)