• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:custom +defs:variable

31 ;; See `custom.el'.
33 ;; No commands should have names starting with `custom-' because
45 ;; different means if the option symbol has the 'custom-get'
46 ;; property. Similarly, set-default (or the 'custom-set' property)
84 ;; variable that has one value when Emacs is running under a window
86 ;; when the variable is first initialized, this is only relevant for the
123 ;; There is no standard value. This means that the variable was
145 (defvar custom-versions-load-alist) ; from cus-load
156 (put 'custom-define-hook 'custom-type 'hook)
157 (put 'custom-define-hook 'standard-value '(nil))
158 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable)
164 :link '(custom-manual "(emacs)Top"))
182 :link '(custom-manual "(emacs)Emulation")
216 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
222 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
223 :link '(custom-manual "(ccmode)")
248 :link '(custom-manual "(gnus)")
303 :link '(custom-manual "(emacs)International")
329 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
352 (defgroup customize '((widgets custom-group))
354 :prefix "custom-"
357 (defgroup custom-faces nil
362 (defgroup custom-browse nil
364 :prefix "custom-"
367 (defgroup custom-buffer nil
369 :prefix "custom-"
372 (defgroup custom-menu nil
374 :prefix "custom-"
379 :link '(custom-manual "(emacs)Abbrevs")
389 :link '(custom-manual "(emacs)Undo")
426 :link '(custom-manual "(emacs)Minibuffer")
459 :link '(custom-manual "(emacs)Windows")
464 :link '(custom-manual "(emacs)Mac OS")
471 (defvar custom-mode-map
488 "Keymap for `custom-mode'.")
490 (defvar custom-mode-link-map
492 (set-keymap-parent map custom-mode-map)
497 "Local keymap for links in `custom-mode'.")
502 (defun custom-split-regexp-maybe (regexp)
517 (defun custom-variable-prompt ()
518 "Prompt for a custom variable, defaulting to the variable at point.
520 (let* ((v (variable-at-point))
521 (default (and (symbolp v) (custom-variable-p v) (symbol-name v)))
525 (if default (format "Customize variable (default %s): " default)
526 "Customize variable: ")
527 obarray 'custom-variable-p t nil nil default))
532 (defun custom-menu-filter (menu widget)
534 MENU should be in the same format as `custom-variable-menu'.
551 (defvar custom-prefix-list nil
552 "List of prefixes that should be ignored by `custom-unlispify'.")
554 (defcustom custom-unlispify-menu-entries t
556 :group 'custom-menu
559 (defcustom custom-unlispify-remove-prefixes nil
561 :group 'custom-menu
562 :group 'custom-buffer
565 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
567 (cond ((not custom-unlispify-menu-entries)
569 ((get symbol 'custom-tag)
571 (get symbol 'custom-tag)
572 (concat (get symbol 'custom-tag) "...")))
580 ;; (when (and (eq (get symbol 'custom-type) 'boolean)
584 (if custom-unlispify-remove-prefixes
585 (let ((prefixes custom-prefix-list)
601 (defcustom custom-unlispify-tag-names t
603 :group 'custom-buffer
606 (defun custom-unlispify-tag-name (symbol)
608 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
609 (custom-unlispify-menu-entry symbol t)))
611 (defun custom-prefix-add (symbol prefixes)
613 (cons (or (get symbol 'custom-prefix)
619 (defcustom custom-guess-name-alist
639 :group 'custom-buffer)
641 (defcustom custom-guess-doc-alist
646 should be a widget suitable for editing the value of a variable with
653 :group 'custom-buffer)
655 (defun custom-guess-type (symbol)
657 This is done by matching SYMBOL with `custom-guess-name-alist' and
658 if that fails, the doc string with `custom-guess-doc-alist'."
660 (names custom-guess-name-alist)
669 (let ((doc (documentation-property symbol 'variable-documentation))
670 (docs custom-guess-doc-alist))
683 (defcustom custom-browse-sort-alphabetically nil
684 "If non-nil, sort customization group alphabetically in `custom-browse'."
686 :group 'custom-browse)
688 (defcustom custom-browse-order-groups nil
695 :group 'custom-browse)
697 (defcustom custom-browse-only-groups nil
700 :group 'custom-browse)
703 (defcustom custom-buffer-sort-alphabetically nil
706 :group 'custom-buffer)
708 (defcustom custom-buffer-order-groups 'last
715 :group 'custom-buffer)
718 (defcustom custom-menu-sort-alphabetically nil
721 :group 'custom-menu)
723 (defcustom custom-menu-order-groups 'first
730 :group 'custom-menu)
734 (defun custom-sort-items (items sort-alphabetically order-groups)
736 ITEMS should be a `custom-group' property.
748 ((eq typea 'custom-group)
750 (if (eq typeb 'custom-group)
754 ((eq typeb 'custom-group)
763 (defvar custom-options nil
769 (let ((children custom-options))
772 '(custom-variable custom-face)))
775 (when (eq (widget-get child :custom-state) 'modified)
776 (widget-apply child :custom-set)))
785 (let ((children custom-options))
788 '(custom-variable custom-face)))
792 (when (memq (widget-get child :custom-state)
794 (widget-apply child :custom-save)))
796 (custom-save-all))
799 (defvar custom-reset-menu
808 (defun custom-reset (event)
812 custom-reset-menu
820 (let ((children custom-options))
823 '(custom-variable custom-face)))
826 (if (memq (widget-get widget :custom-state)
828 (widget-apply widget :custom-reset-current)))
836 (let ((children custom-options))
839 '(custom-variable custom-face)))
842 (if (memq (widget-get widget :custom-state)
844 (widget-apply widget :custom-reset-saved)))
854 (let ((children custom-options))
857 '(custom-variable custom-face)))
860 (and (if (widget-get widget :custom-standard-value)
861 (widget-apply widget :custom-standard-value)
863 (memq (widget-get widget :custom-state)
865 (widget-apply widget :custom-reset-standard)))
871 (defun custom-prompt-variable (prompt-var prompt-val &optional comment)
872 "Prompt for a variable and a value and return them as a list.
873 PROMPT-VAR is the prompt for the variable, and PROMPT-VAL is the
875 the name of the variable.
877 If the variable has a `variable-interactive' property, that is used as if
880 If the variable has a `custom-type' property, it must be a widget and the
885 (let* ((var (read-variable prompt-var))
886 (minibuffer-help-form '(describe-variable var))
888 (let ((prop (get var 'variable-interactive))
889 (type (get var 'custom-type))
894 ;; Use VAR's `variable-interactive' property
909 (read-string "Comment: " (get var 'variable-comment)))
913 (defun customize-set-value (variable value &optional comment)
916 If VARIABLE has a `variable-interactive' property, that is used as if
919 If VARIABLE has a `custom-type' property, it must be a widget and the
923 (interactive (custom-prompt-variable "Set variable: "
928 (put variable 'variable-comment nil))
930 (put variable 'variable-comment comment)))
931 (set variable value))
934 (defun customize-set-variable (variable value &optional comment)
938 If VARIABLE has a `custom-set' property, that is used for setting
941 If VARIABLE has a `variable-interactive' property, that is used as if
944 If VARIABLE has a `custom-type' property, it must be a widget and the
948 (interactive (custom-prompt-variable "Set variable: "
951 (custom-load-symbol variable)
952 (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
953 (funcall (or (get variable 'custom-set) 'set-default) variable value)
954 (put variable 'customized-value (list (custom-quote value)))
956 (put variable 'variable-comment nil)
957 (put variable 'customized-variable-comment nil))
959 (put variable 'variable-comment comment)
960 (put variable 'customized-variable-comment comment)))
964 (defun customize-save-variable (variable value &optional comment)
968 If VARIABLE has a `custom-set' property, that is used for setting
971 If VARIABLE has a `variable-interactive' property, that is used as if
974 If VARIABLE has a `custom-type' property, it must be a widget and the
978 (interactive (custom-prompt-variable "Set and save variable: "
981 (funcall (or (get variable 'custom-set) 'set-default) variable value)
982 (put variable 'saved-value (list (custom-quote value)))
983 (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
985 (put variable 'variable-comment nil)
986 (put variable 'saved-variable-comment nil))
988 (put variable 'variable-comment comment)
989 (put variable 'saved-variable-comment comment)))
990 (put variable 'customized-value nil)
991 (put variable 'customized-variable-comment nil)
992 (custom-save-all)
1012 (group (custom-group-of-mode major-mode)))
1020 'custom-group-of-mode
1022 (customize-group (custom-group-of-mode mode)))
1033 (or (and (get symbol 'custom-loads)
1034 (not (get symbol 'custom-autoload)))
1035 (get symbol 'custom-group)))
1042 (custom-unlispify-tag-name group))))
1045 (custom-buffer-create (list (list group 'custom-group))
1048 (custom-unlispify-tag-name group))))))
1058 (or (and (get symbol 'custom-loads)
1059 (not (get symbol 'custom-autoload)))
1060 (get symbol 'custom-group)))
1067 (custom-unlispify-tag-name group))))
1070 ;; Copied from `custom-buffer-create-other-window'.
1075 (custom-buffer-create-other-window
1076 (list (list group 'custom-group))
1079 (custom-unlispify-tag-name group))))))
1082 (defalias 'customize-variable 'customize-option)
1086 "Customize SYMBOL, which must be a user option variable."
1087 (interactive (custom-variable-prompt))
1089 (error "No variable specified"))
1090 (let ((basevar (indirect-variable symbol)))
1091 (custom-buffer-create (list (list basevar 'custom-variable))
1093 (custom-unlispify-tag-name basevar)))
1098 (defalias 'customize-variable-other-window 'customize-option-other-window)
1102 "Customize SYMBOL, which must be a user option variable.
1104 (interactive (custom-variable-prompt))
1106 (error "No variable specified"))
1107 (let ((basevar (indirect-variable symbol)))
1108 (custom-buffer-create-other-window
1109 (list (list basevar 'custom-variable))
1110 (format "*Customize Option: %s*" (custom-unlispify-tag-name basevar)))
1117 ;; Packages will update this variable, so make it available.
1178 ;; custom-load-symbol for this.
1179 (put 'custom-versions-load-alist 'custom-loads nil)
1180 (dolist (elt custom-versions-load-alist)
1183 (custom-add-load 'custom-versions-load-alist load))))
1184 (custom-load-symbol 'custom-versions-load-alist)
1185 (put 'custom-versions-load-alist 'custom-loads nil)
1190 (let* ((package-version (get symbol 'custom-package-version))
1195 (get symbol 'custom-version))))
1198 (if (or (get symbol 'custom-group)
1200 (push (list symbol 'custom-group) found))
1201 (if (custom-variable-p symbol)
1202 (push (list symbol 'custom-variable) found))
1203 (if (custom-facep symbol)
1204 (push (list symbol 'custom-face) found)))))))
1206 (custom-buffer-create (custom-sort-items found t 'first)
1274 (custom-buffer-create (custom-sort-items
1276 (list s 'custom-face))
1285 (custom-buffer-create (list (list face 'custom-face))
1287 (custom-unlispify-tag-name face)))))
1303 (custom-buffer-create-other-window
1304 (custom-sort-items
1306 (list s 'custom-face))
1314 (custom-buffer-create-other-window
1315 (list (list face 'custom-face))
1317 (custom-unlispify-tag-name face)))))
1329 (custom-facep symbol)
1330 (push (list symbol 'custom-face) found))
1332 (get symbol 'customized-variable-comment))
1334 (push (list symbol 'custom-variable) found))))
1337 (custom-buffer-create (custom-sort-items found t nil)
1354 (push (list symbol 'custom-variable) found)))))
1357 (custom-buffer-create (custom-sort-items found t nil)
1367 (custom-facep symbol)
1368 (push (list symbol 'custom-face) found))
1370 (get symbol 'saved-variable-comment))
1372 (push (list symbol 'custom-variable) found))))
1375 (custom-buffer-create (custom-sort-items found t nil)
1386 \(but we recommend using `apropos-variable' instead)."
1392 (get symbol 'custom-group))
1393 (push (list symbol 'custom-group) found))
1395 (custom-facep symbol))
1396 (push (list symbol 'custom-face) found))
1399 (eq (indirect-variable symbol) symbol)
1401 (custom-variable-p symbol)
1403 (get symbol 'variable-documentation))))
1404 (push (list symbol 'custom-variable) found)))))
1407 (custom-buffer-create
1408 (custom-sort-items found t custom-buffer-order-groups)
1415 \(but we recommend using `apropos-variable' instead)."
1433 (defcustom custom-buffer-style 'links
1441 :group 'custom-buffer)
1443 (defcustom custom-buffer-done-kill nil
1447 :group 'custom-buffer)
1449 (defcustom custom-buffer-indent 3
1452 :group 'custom-buffer)
1454 (defun custom-get-fresh-buffer (name)
1457 Beware: it's not quite like new. Good enough for custom, but maybe
1460 ;; but it's not needed for custom.
1480 (defun custom-buffer-create (options &optional name description)
1486 (pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*")))
1487 (custom-buffer-create-internal options description))
1490 (defun custom-buffer-create-other-window (options &optional name description)
1501 (pop-to-buffer (custom-get-fresh-buffer name))
1502 (custom-buffer-create-internal options description)))
1504 (defcustom custom-reset-button-menu nil
1508 :group 'custom-buffer)
1510 (defcustom custom-buffer-verbose-help t
1513 :group 'custom-buffer)
1516 "Exit current Custom buffer according to `custom-buffer-done-kill'."
1518 (quit-window custom-buffer-done-kill))
1520 (defvar custom-button nil
1523 (defvar custom-button-mouse nil
1526 (defvar custom-button-pressed nil
1529 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
1535 :group 'custom-buffer
1536 :set (lambda (variable value)
1537 (custom-set-default variable value)
1538 (setq custom-button
1539 (if value 'custom-button 'custom-button-unraised))
1540 (setq custom-button-mouse
1541 (if value 'custom-button-mouse 'highlight))
1542 (setq custom-button-pressed
1544 'custom-button-pressed
1545 'custom-button-pressed-unraised))))
1547 (defun custom-buffer-create-internal (options &optional description)
1548 (custom-mode)
1549 (if custom-buffer-verbose-help
1557 (if custom-raised-buttons
1568 (widget-create 'custom-manual
1574 (widget-create 'custom-manual
1588 (if (not custom-buffer-verbose-help)
1591 (widget-create 'custom-manual
1595 (when (or custom-file user-init-file)
1604 (if custom-reset-button-menu
1612 (custom-reset event))))
1626 (when (or custom-file user-init-file)
1637 (if custom-buffer-done-kill
1644 (setq custom-options
1649 :custom-state 'unknown
1650 :tag (custom-unlispify-tag-name
1661 :tag (custom-unlispify-tag-name
1673 (unless (eq custom-buffer-style 'tree)
1674 (mapc 'custom-magic-reset custom-options))
1691 (pop-to-buffer (custom-get-fresh-buffer name)))
1692 (custom-mode)
1697 (if custom-raised-buttons
1702 (if custom-browse-only-groups
1722 (let ((custom-buffer-style 'tree))
1723 (widget-create 'custom-group
1724 :custom-last t
1725 :custom-state 'unknown
1726 :tag (custom-unlispify-tag-name group)
1731 (define-widget 'custom-browse-visibility 'item
1734 :action 'custom-browse-visibility-action)
1736 (defun custom-browse-visibility-action (widget &rest ignore)
1737 (let ((custom-buffer-style 'tree))
1738 (custom-toggle-parent widget)))
1740 (define-widget 'custom-browse-group-tag 'custom-group-link
1744 :action 'custom-browse-group-tag-action)
1746 (defun custom-browse-group-tag-action (widget &rest ignore)
1750 (define-widget 'custom-browse-variable-tag 'custom-group-link
1754 :action 'custom-browse-variable-tag-action)
1756 (defun custom-browse-variable-tag-action (widget &rest ignore)
1758 (customize-variable-other-window (widget-value parent))))
1760 (define-widget 'custom-browse-face-tag 'custom-group-link
1764 :action 'custom-browse-face-tag-action)
1766 (defun custom-browse-face-tag-action (widget &rest ignore)
1770 (defconst custom-browse-alist '((" " "space")
1776 (defun custom-browse-insert-prefix (prefix)
1786 (name (nth 1 (assoc entry custom-browse-alist))))
1800 (widget-put (get 'item 'widget-type) :custom-show t)
1802 :custom-show (lambda (widget value)
1809 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
1811 ;;; The `custom-manual' Widget.
1813 (define-widget 'custom-manual 'info-link
1816 :keymap custom-mode-link-map
1818 :button-face 'custom-link
1823 ;;; The `custom-magic' Widget.
1825 (defgroup custom-magic-faces nil
1827 :group 'custom-faces
1828 :group 'custom-buffer)
1830 (defface custom-invalid '((((class color))
1835 :group 'custom-magic-faces)
1837 (put 'custom-invalid-face 'face-alias 'custom-invalid)
1839 (defface custom-rogue '((((class color))
1844 :group 'custom-magic-faces)
1846 (put 'custom-rogue-face 'face-alias 'custom-rogue)
1848 (defface custom-modified '((((min-colors 88) (class color))
1855 :group 'custom-magic-faces)
1857 (put 'custom-modified-face 'face-alias 'custom-modified)
1859 (defface custom-set '((((min-colors 88) (class color))
1866 :group 'custom-magic-faces)
1868 (put 'custom-set-face 'face-alias 'custom-set)
1870 (defface custom-changed '((((min-colors 88) (class color))
1877 :group 'custom-magic-faces)
1879 (put 'custom-changed-face 'face-alias 'custom-changed)
1881 (defface custom-themed '((((min-colors 88) (class color))
1888 :group 'custom-magic-faces)
1890 (defface custom-saved '((t (:underline t)))
1892 :group 'custom-magic-faces)
1894 (put 'custom-saved-face 'face-alias 'custom-saved)
1896 (defconst custom-magic-alist
1904 (invalid "x" custom-invalid "\
1906 (modified "*" custom-modified "\
1909 (set "+" custom-set "\
1912 (changed ":" custom-changed "\
1915 (saved "!" custom-saved "\
1918 (themed "o" custom-themed "\
1921 (rogue "@" custom-rogue "\
1967 (defcustom custom-magic-show 'long
1973 :group 'custom-buffer)
1975 (defcustom custom-magic-show-hidden '(option face)
1977 The value should be a list with the custom categories where the State
1981 :group 'custom-buffer)
1983 (defcustom custom-magic-show-button nil
1986 :group 'custom-buffer)
1988 (define-widget 'custom-magic 'default
1994 :value-create 'custom-magic-value-create
2000 :custom-state)
2003 (defun custom-magic-value-create (widget)
2006 (state (widget-get parent :custom-state))
2008 (entry (assq state custom-magic-alist))
2011 (category (widget-get parent :custom-category))
2015 (form (widget-get parent :custom-form))
2021 (when (and custom-magic-show
2023 (memq category custom-magic-show-hidden)))
2026 (not (and (eq custom-buffer-style 'links)
2027 (> (widget-get parent :custom-level) 1))))
2028 (insert-char ?\ (* custom-buffer-indent
2029 (widget-get parent :custom-level))))
2041 (if (eq custom-magic-show 'long)
2048 (put-text-property start (point) 'face 'custom-state))
2051 (not (and (eq custom-buffer-style 'links)
2052 (> (widget-get parent :custom-level) 1))))
2053 (insert-char ?\ (* custom-buffer-indent
2054 (widget-get parent :custom-level))))
2055 (when custom-magic-show-button
2056 (when custom-magic-show
2075 (defun custom-magic-reset (widget)
2076 "Redraw the :custom-magic property of WIDGET."
2077 (let ((magic (widget-get widget :custom-magic)))
2080 ;;; The `custom' Widget.
2082 (defface custom-button
2088 "Face for custom buffer buttons if `custom-raised-buttons' is non-nil."
2090 :group 'custom-faces)
2092 (put 'custom-button-face 'face-alias 'custom-button)
2094 (defface custom-button-mouse
2100 "Mouse face for custom buffer buttons if `custom-raised-buttons' is non-nil."
2102 :group 'custom-faces)
2104 (defface custom-button-unraised
2106 "Face for custom buffer buttons if `custom-raised-buttons' is nil."
2108 :group 'custom-faces)
2110 (setq custom-button
2111 (if custom-raised-buttons 'custom-button 'custom-button-unraised))
2113 (setq custom-button-mouse
2114 (if custom-raised-buttons 'custom-button-mouse 'highlight))
2116 (defface custom-button-pressed
2122 "Face for pressed custom buttons if `custom-raised-buttons' is non-nil."
2124 :group 'custom-faces)
2126 (put 'custom-button-pressed-face 'face-alias 'custom-button-pressed)
2128 (defface custom-button-pressed-unraised
2129 '((default :inherit custom-button-unraised)
2132 "Face for pressed custom buttons if `custom-raised-buttons' is nil."
2134 :group 'custom-faces)
2136 (setq custom-button-pressed
2137 (if custom-raised-buttons
2138 'custom-button-pressed
2139 'custom-button-pressed-unraised))
2141 (defface custom-documentation '((t nil))
2143 :group 'custom-faces)
2145 (put 'custom-documentation-face 'face-alias 'custom-documentation)
2147 (defface custom-state '((((class color)
2155 :group 'custom-faces)
2157 (put 'custom-state-face 'face-alias 'custom-state)
2159 (defface custom-link
2163 :group 'custom-faces)
2165 (define-widget 'custom 'default
2168 :convert-widget 'custom-convert-widget
2169 :notify 'custom-notify
2170 :custom-prefix ""
2171 :custom-level 1
2172 :custom-state 'hidden
2180 (defun custom-convert-widget (widget)
2186 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
2190 (defun custom-notify (widget &rest args)
2192 (let ((state (widget-get widget :custom-state)))
2195 (widget-put widget :custom-state 'modified))
2196 (custom-magic-reset widget)
2199 (defun custom-redraw (widget)
2208 (custom-redraw-magic widget))
2218 (defun custom-redraw-magic (widget)
2221 (let ((magic (widget-get widget :custom-magic)))
2225 (custom-group-state-update widget)))
2230 (defun custom-show (widget value)
2232 (let ((show (widget-get widget :custom-show)))
2240 (defun custom-load-widget (widget)
2242 (custom-load-symbol (widget-value widget)))
2244 (defun custom-unloaded-symbol-p (symbol)
2247 (loads (get symbol 'custom-loads))
2262 (defun custom-unloaded-widget-p (widget)
2264 (custom-unloaded-symbol-p (widget-value widget)))
2266 (defun custom-toggle-hide (widget)
2268 (custom-load-widget widget)
2269 (let ((state (widget-get widget :custom-state)))
2273 (widget-put widget :custom-state 'unknown))
2276 (widget-put widget :custom-state 'hidden)))
2277 (custom-redraw widget)
2280 (defun custom-toggle-parent (widget &rest ignore)
2282 (custom-toggle-hide (widget-get widget :parent)))
2284 (defun custom-add-see-also (widget &optional prefix)
2288 (links (get symbol 'custom-links))
2301 :button-face 'custom-link
2316 (defun custom-add-parent-links (widget &optional initial-string)
2327 (when (member (list name type) (get symbol 'custom-group))
2330 widget 'custom-group-link
2331 :tag (custom-unlispify-tag-name symbol)
2335 (and (null (get name 'custom-links)) ;No links of its own.
2339 'custom-group-link)
2341 (get (car parents) 'custom-links))))
2348 :button-face 'custom-link
2367 ;;; The `custom-comment' Widget.
2370 (defface custom-comment '((((type tty))
2383 :group 'custom-faces)
2385 (put 'custom-comment-face 'face-alias 'custom-comment)
2388 (defface custom-comment-tag
2397 :group 'custom-faces)
2399 (put 'custom-comment-tag-face 'face-alias 'custom-comment-tag)
2401 (define-widget 'custom-comment 'string
2405 :sample-face 'custom-comment-tag-face
2406 :value-face 'custom-comment-face
2408 :create 'custom-comment-create)
2410 (defun custom-comment-create (widget)
2420 (defun custom-comment-hide (widget)
2424 ;; the global custom one
2425 (defun custom-comment-show (widget)
2427 (custom-redraw widget)
2430 (defun custom-comment-invisible-p (widget)
2435 ;;; The `custom-variable' Widget.
2439 (defface custom-variable-tag
2442 (:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch))
2445 (:foreground "blue1" :weight bold :height 1.2 :inherit variable-pitch))
2448 (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch))
2450 "Face used for unpushable variable tags."
2451 :group 'custom-faces)
2453 (put 'custom-variable-tag-face 'face-alias 'custom-variable-tag)
2455 (defface custom-variable-button '((t (:underline t :weight bold)))
2456 "Face used for pushable variable tags."
2457 :group 'custom-faces)
2459 (put 'custom-variable-button-face 'face-alias 'custom-variable-button)
2461 (defcustom custom-variable-default-form 'edit
2462 "Default form of displaying variable values."
2465 :group 'custom-buffer
2468 (defun custom-variable-documentation (variable)
2472 (if (and (local-variable-if-set-p variable)
2473 (or (not (local-variable-p variable))
2475 (local-variable-if-set-p variable))))
2476 (concat (documentation-property variable 'variable-documentation)
2478 This variable automatically becomes buffer-local when set outside Custom.
2480 (documentation-property variable 'variable-documentation)))
2482 (define-widget 'custom-variable 'custom
2483 "Customize variable."
2485 :help-echo "Set or reset this variable."
2486 :documentation-property #'custom-variable-documentation
2487 :custom-category 'option
2488 :custom-state nil
2489 :custom-menu 'custom-variable-menu-create
2490 :custom-form nil ; defaults to value of `custom-variable-default-form'
2491 :value-create 'custom-variable-value-create
2492 :action 'custom-variable-action
2493 :custom-set 'custom-variable-set
2494 :custom-save 'custom-variable-save
2495 :custom-reset-current 'custom-redraw
2496 :custom-reset-saved 'custom-variable-reset-saved
2497 :custom-reset-standard 'custom-variable-reset-standard
2498 :custom-standard-value 'custom-variable-standard-value)
2500 (defun custom-variable-type (symbol)
2502 If SYMBOL has a `custom-type' property, use that.
2503 Otherwise, look up symbol in `custom-guess-type-alist'."
2504 (let* ((type (or (get symbol 'custom-type)
2506 (custom-guess-type symbol))
2508 (options (get symbol 'custom-options))
2516 (defun custom-variable-value-create (widget)
2517 "Here is where you edit the variable's value."
2518 (custom-load-widget widget)
2519 (unless (widget-get widget :custom-form)
2520 (widget-put widget :custom-form custom-variable-default-form))
2523 (form (widget-get widget :custom-form))
2524 (state (widget-get widget :custom-state))
2527 (type (custom-variable-type symbol))
2529 (get (or (get symbol 'custom-get) 'default-value))
2530 (prefix (widget-get widget :custom-prefix))
2531 (last (widget-get widget :custom-last))
2537 ((custom-show type value)
2547 (cond ((eq custom-buffer-style 'tree)
2550 widget 'custom-browse-variable-tag)
2559 :sample-face 'custom-variable-tag-face
2567 :action 'custom-toggle-parent
2577 (custom-quote (funcall get symbol)))
2579 (custom-quote (widget-get conv :value))))))
2586 :action 'custom-toggle-parent
2592 :button-face 'custom-variable-button-face
2609 :action 'custom-tag-action
2611 :mouse-down-action 'custom-tag-mouse-down-action
2612 :button-face 'custom-variable-button-face
2613 :sample-face 'custom-variable-tag-face
2622 :action 'custom-toggle-parent
2630 (unless (eq custom-buffer-style 'tree)
2635 widget 'custom-magic nil)))
2636 (widget-put widget :custom-magic magic)
2650 (let* ((comment (get symbol 'variable-comment))
2653 widget 'custom-comment
2661 (widget-put widget :custom-form form)
2665 (widget-put widget :custom-state state)
2666 (custom-variable-state-set widget))
2669 (when (eq (widget-get widget :custom-level) 1)
2670 (custom-add-parent-links widget))
2671 (custom-add-see-also widget)))))
2673 (defun custom-tag-action (widget &rest args)
2678 (defun custom-tag-mouse-down-action (widget &rest args)
2683 (defun custom-variable-state-set (widget)
2686 (get (or (get symbol 'custom-get) 'default-value))
2690 (comment (get symbol 'variable-comment))
2695 (get symbol 'customized-variable-comment))
2704 (setq temp (get symbol 'saved-variable-comment))
2710 (car (custom-variable-theme-value
2723 ;; custom, but it was set to the standard
2737 (widget-put widget :custom-state state)))
2739 (defun custom-variable-standard-value (widget)
2742 (defvar custom-variable-menu
2743 `(("Set for Current Session" custom-variable-set
2745 (eq (widget-get widget :custom-state) 'modified)))
2746 ,@(when (or custom-file user-init-file)
2747 '(("Save for Future Sessions" custom-variable-save
2749 (memq (widget-get widget :custom-state)
2751 ("Undo Edits" custom-redraw
2754 (memq (widget-get widget :custom-state) '(modified changed)))))
2755 ("Reset to Saved" custom-variable-reset-saved
2758 (get (widget-value widget) 'saved-variable-comment))
2759 (memq (widget-get widget :custom-state)
2761 ,@(when (or custom-file user-init-file)
2762 '(("Erase Customization" custom-variable-reset-standard
2765 (memq (widget-get widget :custom-state)
2767 ("Set to Backup Value" custom-variable-reset-backup
2771 ("Add Comment" custom-comment-show custom-comment-invisible-p)
2773 ("Show Current Value" custom-variable-edit
2775 (eq (widget-get widget :custom-form) 'lisp)))
2776 ("Show Saved Lisp Expression" custom-variable-edit-lisp
2778 (eq (widget-get widget :custom-form) 'edit))))
2779 "Alist of actions for the `custom-variable' widget.
2782 menu is selected, and FILTER is a predicate which takes a `custom-variable'
2786 (defun custom-variable-action (widget &optional event)
2787 "Show the menu for `custom-variable' WIDGET.
2789 (if (eq (widget-get widget :custom-state) 'hidden)
2790 (custom-toggle-hide widget)
2791 (unless (eq (widget-get widget :custom-state) 'modified)
2792 (custom-variable-state-set widget))
2793 (custom-redraw-magic widget)
2796 (custom-unlispify-tag-name
2798 (custom-menu-filter custom-variable-menu
2804 (defun custom-variable-edit (widget)
2806 (widget-put widget :custom-state 'unknown)
2807 (widget-put widget :custom-form 'edit)
2808 (custom-redraw widget))
2810 (defun custom-variable-edit-lisp (widget)
2812 (widget-put widget :custom-state 'unknown)
2813 (widget-put widget :custom-form 'lisp)
2814 (custom-redraw widget))
2816 (defun custom-variable-set (widget)
2817 "Set the current value for the variable being edited by WIDGET."
2818 (let* ((form (widget-get widget :custom-form))
2819 (state (widget-get widget :custom-state))
2822 (set (or (get symbol 'custom-set) 'set-default))
2827 (error "Cannot set hidden variable"))
2835 (custom-comment-hide comment-widget))
2836 (custom-variable-backup-value widget)
2837 (custom-push-theme 'theme-value symbol 'user
2838 'set (custom-quote (widget-value child)))
2841 (put symbol 'variable-comment comment)
2842 (put symbol 'customized-variable-comment comment))
2847 (custom-comment-hide comment-widget))
2848 (custom-variable-backup-value widget)
2849 (custom-push-theme 'theme-value symbol 'user
2850 'set (custom-quote (widget-value child)))
2852 (put symbol 'customized-value (list (custom-quote val)))
2853 (put symbol 'variable-comment comment)
2854 (put symbol 'customized-variable-comment comment)))
2855 (custom-variable-state-set widget)
2856 (custom-redraw-magic widget)))
2858 (defun custom-variable-save (widget)
2859 "Set and save the value for the variable being edited by WIDGET."
2860 (let* ((form (widget-get widget :custom-form))
2861 (state (widget-get widget :custom-state))
2864 (set (or (get symbol 'custom-set) 'set-default))
2869 (error "Cannot set hidden variable"))
2877 (custom-comment-hide comment-widget))
2879 (custom-push-theme 'theme-value symbol 'user
2880 'set (custom-quote (widget-value child)))
2882 (put symbol 'variable-comment comment)
2883 (put symbol 'saved-variable-comment comment))
2888 (custom-comment-hide comment-widget))
2890 (list (custom-quote (widget-value child))))
2891 (custom-push-theme 'theme-value symbol 'user
2892 'set (custom-quote (widget-value child)))
2894 (put symbol 'variable-comment comment)
2895 (put symbol 'saved-variable-comment comment)))
2897 (put symbol 'customized-variable-comment nil)
2898 (custom-save-all)
2899 (custom-variable-state-set widget)
2900 (custom-redraw-magic widget)))
2902 (defun custom-variable-reset-saved (widget)
2903 "Restore the saved value for the variable being edited by WIDGET.
2908 (set (or (get symbol 'custom-set) 'set-default))
2910 (comment (get symbol 'saved-variable-comment)))
2912 (put symbol 'variable-comment comment)
2913 (custom-variable-backup-value widget)
2914 (custom-push-theme 'theme-value symbol 'user 'set (car-safe value))
2921 (put symbol 'customized-variable-comment nil)
2922 (widget-put widget :custom-state 'unknown)
2924 (custom-redraw widget)))
2926 (defun custom-variable-reset-standard (widget)
2927 "Restore the standard setting for the variable being edited by WIDGET.
2928 This operation eliminates any saved setting for the variable,
2929 restoring it to the state of a variable that has never been customized.
2934 (custom-variable-backup-value widget)
2936 (put symbol 'variable-comment nil)
2938 (put symbol 'customized-variable-comment nil)
2939 (custom-push-theme 'theme-value symbol 'user 'reset)
2940 (custom-theme-recalc-variable symbol)
2941 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
2943 (put symbol 'saved-variable-comment nil)
2944 (custom-save-all))
2945 (widget-put widget :custom-state 'unknown)
2947 (custom-redraw widget)))
2949 (defun custom-variable-backup-value (widget)
2950 "Back up the current value for WIDGET's variable.
2953 (get (or (get symbol 'custom-get) 'default-value))
2954 (type (custom-variable-type symbol))
2961 (defun custom-variable-reset-backup (widget)
2962 "Restore the backup value for the variable being edited by WIDGET.
2967 (set (or (get symbol 'custom-set) 'set-default))
2973 (custom-variable-backup-value widget)
2974 (custom-push-theme 'theme-value symbol 'user 'set value)
2980 (put symbol 'variable-comment comment)
2981 (put symbol 'customized-variable-comment comment)
2982 (custom-variable-state-set widget)
2984 (custom-redraw widget)))
2986 ;;; The `custom-face-edit' Widget.
2988 (define-widget 'custom-face-edit 'checklist
2994 :value-to-internal 'custom-face-edit-fix-value
2997 (custom-face-edit-fix-value widget value)))
2998 :convert-widget 'custom-face-edit-convert-widget
3005 custom-face-attributes))
3007 (defun custom-face-edit-fix-value (widget value)
3032 (defun custom-face-edit-convert-widget (widget)
3038 :deactivate 'custom-face-edit-deactivate
3039 :activate 'custom-face-edit-activate
3040 :delete 'custom-face-edit-delete))
3044 (defun custom-face-edit-deactivate (widget)
3047 (let ((tag (custom-face-edit-attribute-tag widget))
3059 (defun custom-face-edit-activate (widget)
3073 (defun custom-face-edit-delete (widget)
3088 (defun custom-face-edit-attribute-tag (widget)
3094 (setq tag (custom-face-edit-attribute-tag (pop children))))
3097 ;;; The `custom-display' Widget.
3099 (define-widget 'custom-display 'menu-choice
3179 (custom-face-edit :inline t :format "%n%v"))))))
3181 ;;; The `custom-face' Widget.
3183 (defface custom-face-tag
3184 `((t (:weight bold :height 1.2 :inherit variable-pitch)))
3186 :group 'custom-faces)
3188 (put 'custom-face-tag-face 'face-alias 'custom-face-tag)
3190 (defcustom custom-face-default-form 'selected
3195 :group 'custom-buffer
3198 (define-widget 'custom-face 'custom
3200 :sample-face 'custom-face-tag-face
3203 :value-create 'custom-face-value-create
3204 :action 'custom-face-action
3205 :custom-category 'face
3206 :custom-form nil ; defaults to value of `custom-face-default-form'
3207 :custom-set 'custom-face-set
3208 :custom-save 'custom-face-save
3209 :custom-reset-current 'custom-redraw
3210 :custom-reset-saved 'custom-face-reset-saved
3211 :custom-reset-standard 'custom-face-reset-standard
3212 :custom-standard-value 'custom-face-standard-value
3213 :custom-menu 'custom-face-menu-create)
3215 (define-widget 'custom-face-all 'editable-list
3221 :args '((group :format "%v" custom-display custom-face-edit)))
3223 (defconst custom-face-all (widget-convert 'custom-face-all)
3224 "Converted version of the `custom-face-all' widget.")
3226 (define-widget 'custom-display-unselected 'item
3228 :match 'custom-display-unselected-match)
3230 (defun custom-display-unselected-match (widget value)
3234 (define-widget 'custom-face-selected 'group
3239 (custom-face-edit :tag " Default\n Attributes"))
3242 (group custom-display-unselected sexp))
3244 (custom-face-edit :tag " Overriding\n Attributes"))
3251 (group custom-display-unselected sexp))
3253 (custom-face-edit :tag "\n Attributes"))
3260 (defconst custom-face-selected (widget-convert 'custom-face-selected)
3261 "Converted version of the `custom-face-selected' widget.")
3263 (defun custom-filter-face-spec (spec filter-index &optional default-filter)
3266 `custom-face-attributes' at which the appropriate filter function can be
3283 (or (nth filter-index (assq attr custom-face-attributes))
3295 (defun custom-pre-filter-face-spec (spec)
3298 (custom-filter-face-spec spec 2))
3300 (defun custom-post-filter-face-spec (spec)
3302 (custom-filter-face-spec spec 3))
3304 (defun custom-face-value-create (widget)
3310 (state (widget-get widget :custom-state))
3312 (is-last (widget-get widget :custom-last))
3313 (prefix (widget-get widget :custom-prefix)))
3316 (cond ((eq custom-buffer-style 'tree)
3319 widget 'custom-browse-face-tag)
3327 (if (eq custom-buffer-style 'face)
3345 :action 'custom-toggle-parent
3351 widget 'custom-magic nil)))
3352 (widget-put widget :custom-magic magic)
3363 widget 'custom-comment
3370 (when (eq (widget-get widget :custom-level) 1)
3371 (custom-add-parent-links widget))
3372 (custom-add-see-also widget))
3378 (custom-load-widget widget)
3379 (unless (widget-get widget :custom-form)
3380 (widget-put widget :custom-form custom-face-default-form))
3386 (list (list t (custom-face-attributes-get
3388 (form (widget-get widget :custom-form))
3395 (setq spec (custom-pre-filter-face-spec spec))
3399 (widget-apply custom-face-selected
3402 'custom-face-selected)
3404 (widget-apply custom-face-all
3406 'custom-face-all)
3411 (custom-face-state-set widget)
3416 (defvar custom-face-menu
3417 `(("Set for Current Session" custom-face-set)
3418 ,@(when (or custom-file user-init-file)
3419 '(("Save for Future Sessions" custom-face-save)))
3420 ("Undo Edits" custom-redraw
3422 (memq (widget-get widget :custom-state) '(modified changed))))
3423 ("Reset to Saved" custom-face-reset-saved
3427 ,@(when (or custom-file user-init-file)
3428 '(("Erase Customization" custom-face-reset-standard
3432 ("Add Comment" custom-comment-show custom-comment-invisible-p)
3434 ("For Current Display" custom-face-edit-selected
3436 (not (eq (widget-get widget :custom-form) 'selected))))
3437 ("For All Kinds of Displays" custom-face-edit-all
3439 (not (eq (widget-get widget :custom-form) 'all))))
3440 ("Show Lisp Expression" custom-face-edit-lisp
3442 (not (eq (widget-get widget :custom-form) 'lisp)))))
3443 "Alist of actions for the `custom-face' widget.
3446 menu is selected, and FILTER is a predicate which takes a `custom-face'
3450 (defun custom-face-edit-selected (widget)
3452 (widget-put widget :custom-state 'unknown)
3453 (widget-put widget :custom-form 'selected)
3454 (custom-redraw widget))
3456 (defun custom-face-edit-all (widget)
3458 (widget-put widget :custom-state 'unknown)
3459 (widget-put widget :custom-form 'all)
3460 (custom-redraw widget))
3462 (defun custom-face-edit-lisp (widget)
3464 (widget-put widget :custom-state 'unknown)
3465 (widget-put widget :custom-form 'lisp)
3466 (custom-redraw widget))
3468 (defun custom-face-state-set (widget)
3504 (widget-put widget :custom-state state)))
3506 (defun custom-face-action (widget &optional event)
3507 "Show the menu for `custom-face' WIDGET.
3509 (if (eq (widget-get widget :custom-state) 'hidden)
3510 (custom-toggle-hide widget)
3514 (custom-unlispify-tag-name symbol))
3515 (custom-menu-filter custom-face-menu
3521 (defun custom-face-set (widget)
3525 (value (custom-post-filter-face-spec (widget-value child)))
3531 (custom-comment-hide comment-widget))
3533 (custom-push-theme 'theme-face symbol 'user 'set value)
3541 (custom-face-state-set widget)
3542 (custom-redraw-magic widget)))
3544 (defun custom-face-save (widget)
3548 (value (custom-post-filter-face-spec (widget-value child)))
3554 (custom-comment-hide comment-widget))
3555 (custom-push-theme 'theme-face symbol 'user 'set value)
3561 (unless (eq (widget-get widget :custom-state) 'standard)
3567 (custom-save-all)
3568 (custom-face-state-set widget)
3569 (custom-redraw-magic widget)))
3572 (define-obsolete-function-alias 'custom-face-save-command 'custom-face-save
3575 (defun custom-face-reset-saved (widget)
3586 (custom-push-theme 'theme-face symbol 'user 'set value)
3592 (custom-face-state-set widget)
3593 (custom-redraw-magic widget)))
3595 (defun custom-face-standard-value (widget)
3598 (defun custom-face-reset-standard (widget)
3610 (custom-push-theme 'theme-face symbol 'user 'reset)
3612 (custom-theme-recalc-face symbol)
3616 (custom-save-all))
3619 (custom-pre-filter-face-spec
3620 (list (list t (custom-face-attributes-get
3624 (custom-face-state-set widget)
3625 (custom-redraw-magic widget)))
3683 :convert-widget 'custom-hook-convert-widget
3686 (defun custom-hook-convert-widget (widget)
3702 ;;; The `custom-group-link' Widget.
3704 (define-widget 'custom-group-link 'link
3706 :button-face 'custom-link
3710 :keymap custom-mode-link-map
3712 :action 'custom-group-link-action)
3714 (defun custom-group-link-action (widget &rest ignore)
3717 ;;; The `custom-group' Widget.
3719 (defcustom custom-group-tag-faces nil
3724 and so forth. The remaining group tags are shown with `custom-group-tag'."
3726 :group 'custom-faces)
3728 (defface custom-group-tag-1
3731 (:foreground "pink" :weight bold :height 1.2 :inherit variable-pitch))
3734 (:foreground "red1" :weight bold :height 1.2 :inherit variable-pitch))
3737 (:foreground "red" :weight bold :height 1.2 :inherit variable-pitch))
3740 :group 'custom-faces)
3742 (put 'custom-group-tag-face-1 'face-alias 'custom-group-tag-1)
3744 (defface custom-group-tag
3756 :group 'custom-faces)
3758 (put 'custom-group-tag-face 'face-alias 'custom-group-tag)
3760 (define-widget 'custom-group 'custom
3763 :sample-face-get 'custom-group-sample-face-get
3766 :value-create 'custom-group-value-create
3767 :action 'custom-group-action
3768 :custom-category 'group
3769 :custom-set 'custom-group-set
3770 :custom-save 'custom-group-save
3771 :custom-reset-current 'custom-group-reset-current
3772 :custom-reset-saved 'custom-group-reset-saved
3773 :custom-reset-standard 'custom-group-reset-standard
3774 :custom-menu 'custom-group-menu-create)
3776 (defun custom-group-sample-face-get (widget)
3778 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces)
3779 'custom-group-tag))
3781 (define-widget 'custom-group-visibility 'visibility
3783 :create 'custom-group-visibility-create)
3785 (defun custom-group-visibility-create (widget)
3791 (defun custom-group-members (symbol groups-only)
3792 "Return SYMBOL's custom group members.
3795 (get symbol 'custom-group)
3797 (dolist (entry (get symbol 'custom-group))
3798 (when (eq (nth 1 entry) 'custom-group)
3802 (defun custom-group-value-create (widget)
3804 (unless (eq (widget-get widget :custom-state) 'hidden)
3805 (custom-load-widget widget))
3806 (let* ((state (widget-get widget :custom-state))
3807 (level (widget-get widget :custom-level))
3809 (prefix (widget-get widget :custom-prefix))
3813 (members (custom-group-members symbol
3814 (and (eq custom-buffer-style 'tree)
3815 custom-browse-only-groups))))
3816 (cond ((and (eq custom-buffer-style 'tree)
3818 (or members (custom-unloaded-widget-p widget)))
3819 (custom-browse-insert-prefix prefix)
3821 widget 'custom-browse-visibility
3828 widget 'custom-browse-group-tag)
3832 ((and (eq custom-buffer-style 'tree)
3834 (custom-browse-insert-prefix prefix)
3839 widget 'custom-browse-group-tag)
3843 ((eq custom-buffer-style 'tree)
3844 (custom-browse-insert-prefix prefix)
3847 (custom-browse-insert-prefix prefix)
3852 widget 'custom-browse-group-tag)
3857 widget 'custom-browse-visibility
3864 widget 'custom-browse-group-tag)
3869 (let* ((members (custom-sort-items members
3870 custom-browse-sort-alphabetically
3871 custom-browse-order-groups))
3872 (prefixes (widget-get widget :custom-prefixes))
3873 (custom-prefix-list (custom-prefix-add symbol prefixes))
3874 (extra-prefix (if (widget-get widget :custom-last)
3885 :tag (custom-unlispify-tag-name (nth 0 entry))
3886 :custom-prefixes custom-prefix-list
3887 :custom-level (1+ level)
3888 :custom-last (null members)
3890 :custom-prefix prefix)
3897 (unless (eq custom-buffer-style 'links)
3898 (insert-char ?\ (* custom-buffer-indent (1- level)))
3906 (if (eq custom-buffer-style 'links)
3908 widget 'custom-group-link
3913 widget 'custom-group-visibility
3915 :action 'custom-toggle-parent
3921 widget 'custom-magic nil)))
3922 (widget-put widget :custom-magic magic)
3927 (if (and (eq custom-buffer-style 'links) (> level 1))
3936 (if (custom-add-parent-links widget
3940 (insert-char ?\ (* custom-buffer-indent (1- level)))
3948 (unless (eq custom-buffer-style 'links)
3953 :action 'custom-toggle-parent
3961 (* custom-buffer-indent level)))
3965 widget 'custom-magic
3968 (widget-put widget :custom-magic magic)
3978 (insert-char ?\ custom-buffer-indent)
3979 (custom-add-parent-links widget)))
3980 (custom-add-see-also widget
3981 (make-string (* custom-buffer-indent level)
3985 (let* ((members (custom-sort-items members
3986 custom-buffer-sort-alphabetically
3987 custom-buffer-order-groups))
3988 (prefixes (widget-get widget :custom-prefixes))
3989 (custom-prefix-list (custom-prefix-add symbol prefixes))
4002 :tag (custom-unlispify-tag-name
4004 :custom-prefixes custom-prefix-list
4005 :custom-level (1+ level)
4011 (mapc 'custom-magic-reset children)
4014 (custom-group-state-update widget)
4018 (insert-char ?\ (* custom-buffer-indent (1- level)))
4020 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
4023 (defvar custom-group-menu
4024 `(("Set for Current Session" custom-group-set
4026 (eq (widget-get widget :custom-state) 'modified)))
4027 ,@(when (or custom-file user-init-file)
4028 '(("Save for Future Sessions" custom-group-save
4030 (memq (widget-get widget :custom-state) '(modified set))))))
4031 ("Undo Edits" custom-group-reset-current
4033 (memq (widget-get widget :custom-state) '(modified))))
4034 ("Reset to Saved" custom-group-reset-saved
4036 (memq (widget-get widget :custom-state) '(modified set))))
4037 ,@(when (or custom-file user-init-file)
4038 '(("Erase Customization" custom-group-reset-standard
4040 (memq (widget-get widget :custom-state) '(modified set saved)))))))
4041 "Alist of actions for the `custom-group' widget.
4044 menu is selected, and FILTER is a predicate which takes a `custom-group'
4048 (defun custom-group-action (widget &optional event)
4049 "Show the menu for `custom-group' WIDGET.
4051 (if (eq (widget-get widget :custom-state) 'hidden)
4052 (custom-toggle-hide widget)
4055 (custom-unlispify-tag-name
4057 (custom-menu-filter custom-group-menu
4063 (defun custom-group-set (widget)
4067 (when (eq (widget-get child :custom-state) 'modified)
4068 (widget-apply child :custom-set)))
4071 (defun custom-group-save (widget)
4075 (when (memq (widget-get child :custom-state) '(modified set))
4076 (widget-apply child :custom-save)))
4079 (defun custom-group-reset-current (widget)
4083 (when (eq (widget-get child :custom-state) 'modified)
4084 (widget-apply child :custom-reset-current)))
4087 (defun custom-group-reset-saved (widget)
4091 (when (memq (widget-get child :custom-state) '(modified set))
4092 (widget-apply child :custom-reset-saved)))
4095 (defun custom-group-reset-standard (widget)
4099 (when (memq (widget-get child :custom-state)
4101 (widget-apply child :custom-reset-standard)))
4104 (defun custom-group-state-update (widget)
4106 (unless (eq (widget-get widget :custom-state) 'hidden)
4109 (widget-get child :custom-state))
4111 (magics custom-magic-alist)
4120 (widget-put widget :custom-state found)))
4121 (custom-magic-reset widget))
4124 ;;; Reading and writing the custom file.
4127 (defcustom custom-file nil
4137 \(setq custom-file \"~/.emacs-custom.el\")
4138 \(load custom-file)
4143 When you change this variable outside Custom, look in the
4144 previous custom file \(usually your init file) for the
4145 forms `(custom-set-variables ...)' and `(custom-set-faces ...)',
4146 and copy them (whichever ones you find) to the new custom file.
4152 `custom-set-variables' and `custom-set-faces' forms already
4154 the old custom file. You should do that manually if that is what you
4158 and hence will not set `custom-file' to that file either."
4168 (defun custom-file ()
4171 (or custom-file
4187 (defun custom-save-all ()
4188 "Save all customizations in `custom-file'."
4189 (when (and (null custom-file) init-file-had-error)
4191 (let* ((filename (custom-file))
4196 (recentf-expand-file-name (custom-file)))
4205 (custom-save-variables)
4206 (custom-save-faces))
4220 (variable-comment
4221 (get symbol 'customized-variable-comment)))
4224 (custom-push-theme 'theme-face symbol 'user 'set value)
4228 (custom-push-theme 'theme-value symbol 'user 'set value)
4230 (when variable-comment
4231 (put symbol 'saved-variable-comment variable-comment)
4232 (put symbol 'customized-variable-comment nil))
4236 ;; We really should update all custom buffers here.
4237 (custom-save-all))
4240 ;; Editing the custom file contents in a buffer.
4242 (defun custom-save-delete (symbol)
4281 (defun custom-save-variables ()
4282 "Save all customized variables in `custom-file'."
4284 (custom-save-delete 'custom-set-variables)
4299 (princ "(custom-set-variables
4300 ;; custom-set-variables was added by Custom.
4307 (requests (get symbol 'custom-requests))
4308 (now (and (not (custom-variable-p symbol))
4312 (comment (get symbol 'saved-variable-comment)))
4318 ;; Is there anything customized about this variable?
4322 ;; Output an element for this variable.
4324 ;; SYMBOL is the variable name.
4326 ;; NOW if non-nil means always set the variable immediately
4330 ;; variable. Each element of it will be passed to `require'.
4355 (defun custom-save-faces ()
4356 "Save all customized faces in `custom-file'."
4358 (custom-save-delete 'custom-reset-faces)
4359 (custom-save-delete 'custom-set-faces)
4375 (princ "(custom-set-faces
4376 ;; custom-set-faces was added by Custom.
4384 (and (not (custom-facep symbol))
4415 (defcustom custom-menu-nesting 2
4416 "Maximum nesting in custom menus."
4418 :group 'custom-menu)
4420 (defun custom-face-menu-create (widget symbol)
4422 (vector (custom-unlispify-menu-entry symbol)
4426 (defun custom-variable-menu-create (widget symbol)
4427 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
4428 (let ((type (get symbol 'custom-type)))
4431 (if (and type (widget-get type :custom-menu))
4432 (widget-apply type :custom-menu symbol)
4433 (vector (custom-unlispify-menu-entry symbol)
4434 `(customize-variable ',symbol)
4437 ;; Add checkboxes to boolean variable entries.
4439 :custom-menu (lambda (widget symbol)
4440 (vector (custom-unlispify-menu-entry symbol)
4441 `(customize-variable ',symbol)
4445 (defun custom-group-menu-create (widget symbol)
4447 `( ,(custom-unlispify-menu-entry symbol t)
4449 (let* ((menu (custom-menu-create ',symbol)))
4453 (defun custom-menu-create (symbol)
4457 (item (vector (custom-unlispify-menu-entry symbol)
4460 (if (and (or (not (boundp 'custom-menu-nesting))
4461 (>= custom-menu-nesting 0))
4463 (custom-load-symbol symbol)
4464 (< (length (get symbol 'custom-group)) widget-menu-max-size)))
4465 (let ((custom-prefix-list (custom-prefix-add symbol
4466 custom-prefix-list))
4467 (members (custom-sort-items (get symbol 'custom-group)
4468 custom-menu-sort-alphabetically
4469 custom-menu-order-groups)))
4470 `(,(custom-unlispify-menu-entry symbol t)
4477 :custom-menu (nth 0 entry)))
4491 (let ((menu (custom-menu-create ',symbol)))
4510 custom-mode-map
4521 (defvar custom-field-keymap
4528 (widget-put (get 'editable-field 'widget-type) :keymap custom-field-keymap)
4541 (defcustom custom-mode-hook nil
4544 :group 'custom-buffer )
4546 (defun custom-state-buffer-message (widget)
4547 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified)
4550 (defun custom-mode ()
4558 \\<custom-field-keymap>\
4560 \\<custom-mode-map>\
4570 Entry to this mode calls the value of `custom-mode-hook'
4573 (setq major-mode 'custom-mode
4575 (use-local-map custom-mode-map)
4577 (make-local-variable 'custom-options)
4578 (make-local-variable 'custom-local-buffer)
4579 (make-local-variable 'widget-documentation-face)
4580 (setq widget-documentation-face 'custom-documentation)
4581 (make-local-variable 'widget-button-face)
4582 (setq widget-button-face custom-button)
4588 (set (make-local-variable 'widget-button-click-moves-point) t)
4590 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
4591 (set (make-local-variable 'widget-mouse-face) custom-button-mouse)
4595 (when custom-raised-buttons
4596 (set (make-local-variable 'widget-push-button-prefix) "")
4597 (set (make-local-variable 'widget-push-button-suffix) "")
4598 (set (make-local-variable 'widget-link-prefix) "")
4599 (set (make-local-variable 'widget-link-suffix) ""))
4600 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
4601 (run-mode-hooks 'custom-mode-hook))
4603 (put 'custom-mode 'mode-class 'special)
4611 "^Cannot set hidden variable"