Mercurial > emacs
annotate lisp/custom.el @ 58173:46e6d0e52da4
*** empty log message ***
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Fri, 12 Nov 2004 14:21:27 +0000 |
parents | e897db553e21 |
children | 24b54016dd51 0bdb5a16ae51 |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
36902
diff
changeset
|
1 ;;; custom.el --- tools for declaring and initializing options |
17334 | 2 ;; |
54161 | 3 ;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004 |
4 ;; Free Software Foundation, Inc. | |
17334 | 5 ;; |
6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> | |
26582
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
7 ;; Maintainer: FSF |
17334 | 8 ;; Keywords: help, faces |
9 | |
17520 | 10 ;; This file is part of GNU Emacs. |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
17334 | 27 ;;; Commentary: |
28 ;; | |
48238
b6f8e90bc592
Fix typos in Commentary section.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47822
diff
changeset
|
29 ;; This file only contains the code needed to declare and initialize |
17334 | 30 ;; user options. The code to customize options is autoloaded from |
25683 | 31 ;; `cus-edit.el' and is documented in the Emacs Lisp Reference manual. |
17334 | 32 |
48238
b6f8e90bc592
Fix typos in Commentary section.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47822
diff
changeset
|
33 ;; The code implementing face declarations is in `cus-face.el'. |
17334 | 34 |
35 ;;; Code: | |
36 | |
37 (require 'widget) | |
38 | |
17415 | 39 (defvar custom-define-hook nil |
40 ;; Customize information for this option is in `cus-edit.el'. | |
41 "Hook called after defining each customize option.") | |
42 | |
47570
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
43 (defvar custom-dont-initialize nil |
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
44 "Non-nil means `defcustom' should not initialize the variable. |
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
45 That is used for the sake of `custom-make-dependencies'. |
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
46 Users should not set it.") |
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
47 |
41224
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
48 (defvar custom-current-group-alist nil |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
49 "Alist of (FILE . GROUP) indicating the current group to use for FILE.") |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
50 |
17334 | 51 ;;; The `defcustom' Macro. |
52 | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
53 (defun custom-initialize-default (symbol value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
54 "Initialize SYMBOL with VALUE. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
55 This will do nothing if symbol already has a default binding. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
56 Otherwise, if symbol has a `saved-value' property, it will evaluate |
55518
10cd0e6bfb73
(custom-initialize-default, defcustom): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
54161
diff
changeset
|
57 the car of that and use it as the default binding for symbol. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
58 Otherwise, VALUE will be evaluated and used as the default binding for |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
59 symbol." |
17415 | 60 (unless (default-boundp symbol) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17949
diff
changeset
|
61 ;; Use the saved value if it exists, otherwise the standard setting. |
17334 | 62 (set-default symbol (if (get symbol 'saved-value) |
63 (eval (car (get symbol 'saved-value))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
64 (eval value))))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
65 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
66 (defun custom-initialize-set (symbol value) |
19535
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
67 "Initialize SYMBOL based on VALUE. |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
68 If the symbol doesn't have a default binding already, |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
69 then set it using its `:set' function (or `set-default' if it has none). |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
70 The value is either the value in the symbol's `saved-value' property, |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
71 if any, or VALUE." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
72 (unless (default-boundp symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
73 (funcall (or (get symbol 'custom-set) 'set-default) |
25683 | 74 symbol |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
75 (if (get symbol 'saved-value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
76 (eval (car (get symbol 'saved-value))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
77 (eval value))))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
78 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
79 (defun custom-initialize-reset (symbol value) |
19535
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
80 "Initialize SYMBOL based on VALUE. |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
81 Set the symbol, using its `:set' function (or `set-default' if it has none). |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
82 The value is either the symbol's current value |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
83 \(as obtained using the `:get' function), if any, |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
84 or the value in the symbol's `saved-value' property if any, |
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
85 or (last of all) VALUE." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
86 (funcall (or (get symbol 'custom-set) 'set-default) |
25683 | 87 symbol |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
88 (cond ((default-boundp symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
89 (funcall (or (get symbol 'custom-get) 'default-value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
90 symbol)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
91 ((get symbol 'saved-value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
92 (eval (car (get symbol 'saved-value)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
93 (t |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
94 (eval value))))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
95 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
96 (defun custom-initialize-changed (symbol value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
97 "Initialize SYMBOL with VALUE. |
36269
9a470a7db563
(custom-initialize-changed, defcustom): Doc fix.
Dave Love <fx@gnu.org>
parents:
33027
diff
changeset
|
98 Like `custom-initialize-reset', but only use the `:set' function if |
19535
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
99 not using the standard setting. |
36269
9a470a7db563
(custom-initialize-changed, defcustom): Doc fix.
Dave Love <fx@gnu.org>
parents:
33027
diff
changeset
|
100 For the standard setting, use `set-default'." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
101 (cond ((default-boundp symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
102 (funcall (or (get symbol 'custom-set) 'set-default) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
103 symbol |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
104 (funcall (or (get symbol 'custom-get) 'default-value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
105 symbol))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
106 ((get symbol 'saved-value) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
107 (funcall (or (get symbol 'custom-set) 'set-default) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
108 symbol |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
109 (eval (car (get symbol 'saved-value))))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
110 (t |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
111 (set-default symbol (eval value))))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
112 |
19516
6591f294b265
(custom-declare-variable): Rename 2nd arg to DEFAULT.
Richard M. Stallman <rms@gnu.org>
parents:
18882
diff
changeset
|
113 (defun custom-declare-variable (symbol default doc &rest args) |
6591f294b265
(custom-declare-variable): Rename 2nd arg to DEFAULT.
Richard M. Stallman <rms@gnu.org>
parents:
18882
diff
changeset
|
114 "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments. |
6591f294b265
(custom-declare-variable): Rename 2nd arg to DEFAULT.
Richard M. Stallman <rms@gnu.org>
parents:
18882
diff
changeset
|
115 DEFAULT should be an expression to evaluate to compute the default value, |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
116 not the default value itself. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
117 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
118 DEFAULT is stored as SYMBOL's value in the standard theme. See |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
119 `custom-known-themes' for a list of known themes. For backwards |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
120 compatibility, DEFAULT is also stored in SYMBOL's property |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
121 `standard-value'. At the same time, SYMBOL's property `force-value' is |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
122 set to nil, as the value is no longer rogue." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
123 ;; Remember the standard setting. The value should be in the standard |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
124 ;; theme, not in this property. However, his would require changeing |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
125 ;; the C source of defvar and others as well... |
19516
6591f294b265
(custom-declare-variable): Rename 2nd arg to DEFAULT.
Richard M. Stallman <rms@gnu.org>
parents:
18882
diff
changeset
|
126 (put symbol 'standard-value (list default)) |
17415 | 127 ;; Maybe this option was rogue in an earlier version. It no longer is. |
128 (when (get symbol 'force-value) | |
129 (put symbol 'force-value nil)) | |
17334 | 130 (when doc |
131 (put symbol 'variable-documentation doc)) | |
19535
e9d8fcec9843
(custom-declare-variable): Use custom-initialize-reset
Richard M. Stallman <rms@gnu.org>
parents:
19516
diff
changeset
|
132 (let ((initialize 'custom-initialize-reset) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
133 (requests nil)) |
41224
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
134 (unless (memq :group args) |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
135 (custom-add-to-group (custom-current-group) symbol 'custom-variable)) |
25683 | 136 (while args |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
137 (let ((arg (car args))) |
17334 | 138 (setq args (cdr args)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
139 (unless (symbolp arg) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
140 (error "Junk in args %S" args)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
141 (let ((keyword arg) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
142 (value (car args))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
143 (unless args |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
144 (error "Keyword %s is missing an argument" keyword)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
145 (setq args (cdr args)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
146 (cond ((eq keyword :initialize) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
147 (setq initialize value)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
148 ((eq keyword :set) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
149 (put symbol 'custom-set value)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
150 ((eq keyword :get) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
151 (put symbol 'custom-get value)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
152 ((eq keyword :require) |
48476
29e63846608d
(custom-declare-variable): Use push.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48334
diff
changeset
|
153 (push value requests)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
154 ((eq keyword :type) |
26928
755f54893c1f
(custom-declare-variable): Purecopy value.
Dave Love <fx@gnu.org>
parents:
26831
diff
changeset
|
155 (put symbol 'custom-type (purecopy value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
156 ((eq keyword :options) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
157 (if (get symbol 'custom-options) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
158 ;; Slow safe code to avoid duplicates. |
32225
15a7324321bb
(custom-declare-variable, custom-set-variables): Use mapc.
Dave Love <fx@gnu.org>
parents:
31362
diff
changeset
|
159 (mapc (lambda (option) |
15a7324321bb
(custom-declare-variable, custom-set-variables): Use mapc.
Dave Love <fx@gnu.org>
parents:
31362
diff
changeset
|
160 (custom-add-option symbol option)) |
48476
29e63846608d
(custom-declare-variable): Use push.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48334
diff
changeset
|
161 value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
162 ;; Fast code for the common case. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
163 (put symbol 'custom-options (copy-sequence value)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
164 (t |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
165 (custom-handle-keyword symbol keyword value |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
166 'custom-variable)))))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
167 (put symbol 'custom-requests requests) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
168 ;; Do the actual initialization. |
47570
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
169 (unless custom-dont-initialize |
b65cc673fb00
(custom-dont-initialize): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
45366
diff
changeset
|
170 (funcall initialize symbol default))) |
48476
29e63846608d
(custom-declare-variable): Use push.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48334
diff
changeset
|
171 (push (cons 'defvar symbol) current-load-list) |
17334 | 172 (run-hooks 'custom-define-hook) |
173 symbol) | |
174 | |
175 (defmacro defcustom (symbol value doc &rest args) | |
176 "Declare SYMBOL as a customizable variable that defaults to VALUE. | |
177 DOC is the variable documentation. | |
178 | |
55518
10cd0e6bfb73
(custom-initialize-default, defcustom): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
54161
diff
changeset
|
179 Neither SYMBOL nor VALUE need to be quoted. |
17334 | 180 If SYMBOL is not already bound, initialize it to VALUE. |
181 The remaining arguments should have the form | |
182 | |
25683 | 183 [KEYWORD VALUE]... |
17334 | 184 |
22141 | 185 The following keywords are meaningful: |
17334 | 186 |
47677 | 187 :type VALUE should be a widget type for editing the symbol's value. |
17334 | 188 :options VALUE should be a list of valid members of the widget type. |
25683 | 189 :group VALUE should be a customization group. |
17334 | 190 Add SYMBOL to that group. |
42508
37d771fc6685
(defcustom): Fix syntax of previous change.
Richard M. Stallman <rms@gnu.org>
parents:
42503
diff
changeset
|
191 :link LINK-DATA |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
192 Include an external link after the documentation string for this |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
193 item. This is a sentence containing an active field which |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
194 references some other documentation. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
195 |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
196 There are three alternatives you can use for LINK-DATA: |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
197 |
42508
37d771fc6685
(defcustom): Fix syntax of previous change.
Richard M. Stallman <rms@gnu.org>
parents:
42503
diff
changeset
|
198 (custom-manual INFO-NODE) |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
199 Link to an Info node; INFO-NODE is a string which specifies |
42508
37d771fc6685
(defcustom): Fix syntax of previous change.
Richard M. Stallman <rms@gnu.org>
parents:
42503
diff
changeset
|
200 the node name, as in \"(emacs)Top\". The link appears as |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
201 `[manual]' in the customization buffer. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
202 |
42508
37d771fc6685
(defcustom): Fix syntax of previous change.
Richard M. Stallman <rms@gnu.org>
parents:
42503
diff
changeset
|
203 (info-link INFO-NODE) |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
204 Like `custom-manual' except that the link appears in the |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
205 customization buffer with the Info node name. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
206 |
42508
37d771fc6685
(defcustom): Fix syntax of previous change.
Richard M. Stallman <rms@gnu.org>
parents:
42503
diff
changeset
|
207 (url-link URL) |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
208 Link to a web page; URL is a string which specifies the URL. |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
209 The link appears in the customization buffer as URL. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
210 |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
211 You can specify the text to use in the customization buffer by |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
212 adding `:tag NAME' after the first element of the LINK-DATA; for |
42508
37d771fc6685
(defcustom): Fix syntax of previous change.
Richard M. Stallman <rms@gnu.org>
parents:
42503
diff
changeset
|
213 example, (info-link :tag \"foo\" \"(emacs)Top\") makes a link to the |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
214 Emacs manual which appears in the buffer as `foo'. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
215 |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
216 An item can have more than one external link; however, most items |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
217 have none at all. |
22141 | 218 :initialize |
219 VALUE should be a function used to initialize the | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
220 variable. It takes two arguments, the symbol and value |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
221 given in the `defcustom' call. The default is |
41821 | 222 `custom-initialize-reset'. |
25683 | 223 :set VALUE should be a function to set the value of the symbol. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
224 It takes two arguments, the symbol to set and the value to |
22606
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
225 give it. The default choice of function is `custom-set-default'. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
226 :get VALUE should be a function to extract the value of symbol. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
227 The function takes one argument, a symbol, and should return |
22141 | 228 the current value for that symbol. The default choice of function |
25683 | 229 is `custom-default-value'. |
22141 | 230 :require |
231 VALUE should be a feature symbol. If you save a value | |
232 for this option, then when your `.emacs' file loads the value, | |
233 it does (require VALUE) first. | |
29761 | 234 :version |
235 VALUE should be a string specifying that the variable was | |
236 first introduced, or its default value was changed, in Emacs | |
237 version VERSION. | |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
238 :tag LABEL |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
239 Use LABEL, a string, instead of the item's name, to label the item |
42556 | 240 in customization menus and buffers. |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
241 :load FILE |
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
242 Load file FILE (a string) before displaying this customization |
47822
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
243 item. Loading is done with `load', and only if the file is |
42503
e95910976840
(defcustom): Documented :tag, :link and :load.
Eli Zaretskii <eliz@gnu.org>
parents:
41821
diff
changeset
|
244 not already loaded. |
48821
d886606b4f3a
(defcustom, custom-set-variables): Doc fix.
Dave Love <fx@gnu.org>
parents:
48476
diff
changeset
|
245 :set-after VARIABLES |
d886606b4f3a
(defcustom, custom-set-variables): Doc fix.
Dave Love <fx@gnu.org>
parents:
48476
diff
changeset
|
246 Specifies that SYMBOL should be set after the list of variables |
d886606b4f3a
(defcustom, custom-set-variables): Doc fix.
Dave Love <fx@gnu.org>
parents:
48476
diff
changeset
|
247 VARIABLES when both have been customized. |
17334 | 248 |
56558 | 249 If SYMBOL has a local binding, then this form affects the local |
250 binding. This is normally not what you want. Thus, if you need | |
251 to load a file defining variables with this form, or with | |
252 `defvar' or `defconst', you should always load that file | |
253 _outside_ any bindings for these variables. \(`defvar' and | |
254 `defconst' behave similarly in this respect.) | |
255 | |
17442 | 256 Read the section about customization in the Emacs Lisp manual for more |
17334 | 257 information." |
21703
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
258 ;; It is better not to use backquote in this file, |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
259 ;; because that makes a bootstrapping problem |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
260 ;; if you need to recompile all the Lisp files using interpreted code. |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
261 (nconc (list 'custom-declare-variable |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
262 (list 'quote symbol) |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
263 (list 'quote value) |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
264 doc) |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
265 args)) |
17334 | 266 |
267 ;;; The `defface' Macro. | |
268 | |
269 (defmacro defface (face spec doc &rest args) | |
270 "Declare FACE as a customizable face that defaults to SPEC. | |
271 FACE does not need to be quoted. | |
272 | |
273 Third argument DOC is the face documentation. | |
274 | |
53040 | 275 If FACE has been set with `custom-set-faces', set the face attributes |
17334 | 276 as specified by that function, otherwise set the face attributes |
277 according to SPEC. | |
278 | |
279 The remaining arguments should have the form | |
280 | |
281 [KEYWORD VALUE]... | |
282 | |
17949 | 283 The following KEYWORDs are defined: |
17334 | 284 |
285 :group VALUE should be a customization group. | |
286 Add FACE to that group. | |
287 | |
288 SPEC should be an alist of the form ((DISPLAY ATTS)...). | |
289 | |
17949 | 290 The first element of SPEC where the DISPLAY matches the frame |
291 is the one that takes effect in that frame. The ATTRs in this | |
292 element take effect; the other elements are ignored, on that frame. | |
17334 | 293 |
17949 | 294 ATTS is a list of face attributes followed by their values: |
295 (ATTR VALUE ATTR VALUE...) | |
24986
cf6d86af7374
(defface): Extend documentation to include new
Gerd Moellmann <gerd@gnu.org>
parents:
24872
diff
changeset
|
296 |
cf6d86af7374
(defface): Extend documentation to include new
Gerd Moellmann <gerd@gnu.org>
parents:
24872
diff
changeset
|
297 The possible attributes are `:family', `:width', `:height', `:weight', |
cf6d86af7374
(defface): Extend documentation to include new
Gerd Moellmann <gerd@gnu.org>
parents:
24872
diff
changeset
|
298 `:slant', `:underline', `:overline', `:strike-through', `:box', |
39981
c576f3427825
(defface): Mention `:inherit' in doc-string.
Miles Bader <miles@gnu.org>
parents:
38857
diff
changeset
|
299 `:foreground', `:background', `:stipple', `:inverse-video', and `:inherit'. |
17334 | 300 |
17949 | 301 DISPLAY can either be the symbol t, which will match all frames, or an |
302 alist of the form \((REQ ITEM...)...). For the DISPLAY to match a | |
303 FRAME, the REQ property of the frame must match one of the ITEM. The | |
304 following REQ are defined: | |
17334 | 305 |
306 `type' (the value of `window-system') | |
25888
7144668076c7
(defface): Extend documentation for new values of `type'.
Gerd Moellmann <gerd@gnu.org>
parents:
25683
diff
changeset
|
307 Under X, in addition to the values `window-system' can take, |
55545
70c4138d3b8d
* custom.el (defface): Document that type can have value gtk.
Jan Djärv <jan.h.d@swipnet.se>
parents:
55518
diff
changeset
|
308 `motif', `lucid', `gtk' and `x-toolkit' are allowed, and match when |
70c4138d3b8d
* custom.el (defface): Document that type can have value gtk.
Jan Djärv <jan.h.d@swipnet.se>
parents:
55518
diff
changeset
|
309 the Motif toolkit, Lucid toolkit, GTK toolkit or any X toolkit is in use. |
17334 | 310 |
311 `class' (the frame's color support) | |
312 Should be one of `color', `grayscale', or `mono'. | |
313 | |
314 `background' (what color is used for the background text) | |
315 Should be one of `light' or `dark'. | |
316 | |
54152
42286a8d371c
(defface): Add documentation for `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
53371
diff
changeset
|
317 `min-colors' (the minimum number of colors the frame should support) |
42286a8d371c
(defface): Add documentation for `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
53371
diff
changeset
|
318 Should be an integer, it is compared with the result of |
42286a8d371c
(defface): Add documentation for `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
53371
diff
changeset
|
319 `display-color-cells'. |
42286a8d371c
(defface): Add documentation for `min-colors'.
Eli Zaretskii <eliz@gnu.org>
parents:
53371
diff
changeset
|
320 |
55945
4ecb534c2d20
(defface): Add `supports' to docstring.
Juri Linkov <juri@jurta.org>
parents:
55545
diff
changeset
|
321 `supports' (only match frames that support the specified face attributes) |
4ecb534c2d20
(defface): Add `supports' to docstring.
Juri Linkov <juri@jurta.org>
parents:
55545
diff
changeset
|
322 Should be a list of face attributes. See the documentation for |
4ecb534c2d20
(defface): Add `supports' to docstring.
Juri Linkov <juri@jurta.org>
parents:
55545
diff
changeset
|
323 the function `display-supports-face-attributes-p' for more |
4ecb534c2d20
(defface): Add `supports' to docstring.
Juri Linkov <juri@jurta.org>
parents:
55545
diff
changeset
|
324 information on exactly how testing is done. |
4ecb534c2d20
(defface): Add `supports' to docstring.
Juri Linkov <juri@jurta.org>
parents:
55545
diff
changeset
|
325 |
17442 | 326 Read the section about customization in the Emacs Lisp manual for more |
17334 | 327 information." |
21703
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
328 ;; It is better not to use backquote in this file, |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
329 ;; because that makes a bootstrapping problem |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
330 ;; if you need to recompile all the Lisp files using interpreted code. |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
331 (nconc (list 'custom-declare-face (list 'quote face) spec doc) args)) |
17334 | 332 |
333 ;;; The `defgroup' Macro. | |
334 | |
41224
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
335 (defun custom-current-group () |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
336 (cdr (assoc load-file-name custom-current-group-alist))) |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
337 |
17334 | 338 (defun custom-declare-group (symbol members doc &rest args) |
339 "Like `defgroup', but SYMBOL is evaluated as a normal argument." | |
25683 | 340 (while members |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
341 (apply 'custom-add-to-group symbol (car members)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17529
diff
changeset
|
342 (setq members (cdr members))) |
17334 | 343 (when doc |
26582
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
344 ;; This text doesn't get into DOC. |
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
345 (put symbol 'group-documentation (purecopy doc))) |
25683 | 346 (while args |
17334 | 347 (let ((arg (car args))) |
348 (setq args (cdr args)) | |
349 (unless (symbolp arg) | |
350 (error "Junk in args %S" args)) | |
351 (let ((keyword arg) | |
352 (value (car args))) | |
353 (unless args | |
354 (error "Keyword %s is missing an argument" keyword)) | |
355 (setq args (cdr args)) | |
356 (cond ((eq keyword :prefix) | |
357 (put symbol 'custom-prefix value)) | |
358 (t | |
359 (custom-handle-keyword symbol keyword value | |
360 'custom-group)))))) | |
41224
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
361 ;; Record the group on the `current' list. |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
362 (let ((elt (assoc load-file-name custom-current-group-alist))) |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
363 (if elt (setcdr elt symbol) |
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
364 (push (cons load-file-name symbol) custom-current-group-alist))) |
17334 | 365 (run-hooks 'custom-define-hook) |
366 symbol) | |
367 | |
368 (defmacro defgroup (symbol members doc &rest args) | |
369 "Declare SYMBOL as a customization group containing MEMBERS. | |
370 SYMBOL does not need to be quoted. | |
371 | |
372 Third arg DOC is the group documentation. | |
373 | |
374 MEMBERS should be an alist of the form ((NAME WIDGET)...) where | |
20599 | 375 NAME is a symbol and WIDGET is a widget for editing that symbol. |
376 Useful widgets are `custom-variable' for editing variables, | |
17334 | 377 `custom-face' for edit faces, and `custom-group' for editing groups. |
378 | |
379 The remaining arguments should have the form | |
380 | |
25683 | 381 [KEYWORD VALUE]... |
17334 | 382 |
29761 | 383 The following KEYWORDs are defined: |
17334 | 384 |
29761 | 385 :group VALUE should be a customization group. |
386 Add SYMBOL to that group. | |
387 | |
388 :version VALUE should be a string specifying that the group was introduced | |
389 in Emacs version VERSION. | |
17334 | 390 |
17442 | 391 Read the section about customization in the Emacs Lisp manual for more |
17334 | 392 information." |
21703
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
393 ;; It is better not to use backquote in this file, |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
394 ;; because that makes a bootstrapping problem |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
395 ;; if you need to recompile all the Lisp files using interpreted code. |
aea35bf72489
(defcustom, defgroup, defface): Don't use backquote.
Richard M. Stallman <rms@gnu.org>
parents:
20599
diff
changeset
|
396 (nconc (list 'custom-declare-group (list 'quote symbol) members doc) args)) |
17334 | 397 |
398 (defun custom-add-to-group (group option widget) | |
399 "To existing GROUP add a new OPTION of type WIDGET. | |
33025
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
parents:
32225
diff
changeset
|
400 If there already is an entry for OPTION and WIDGET, nothing is done." |
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
parents:
32225
diff
changeset
|
401 (let ((members (get group 'custom-group)) |
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
parents:
32225
diff
changeset
|
402 (entry (list option widget))) |
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
parents:
32225
diff
changeset
|
403 (unless (member entry members) |
9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
Miles Bader <miles@gnu.org>
parents:
32225
diff
changeset
|
404 (put group 'custom-group (nconc members (list entry)))))) |
17334 | 405 |
47822
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
406 (defun custom-group-of-mode (mode) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
407 "Return the custom group corresponding to the major or minor MODE. |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
408 If no such group is found, return nil." |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
409 (or (get mode 'custom-mode-group) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
410 (if (or (get mode 'custom-group) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
411 (and (string-match "-mode\\'" (symbol-name mode)) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
412 (get (setq mode (intern (substring (symbol-name mode) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
413 0 (match-beginning 0)))) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
414 'custom-group))) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
415 mode))) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
416 |
17334 | 417 ;;; Properties. |
418 | |
419 (defun custom-handle-all-keywords (symbol args type) | |
420 "For customization option SYMBOL, handle keyword arguments ARGS. | |
421 Third argument TYPE is the custom option type." | |
41224
fc0e6d3f905d
(custom-current-group-alist): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39981
diff
changeset
|
422 (unless (memq :group args) |
48272
8555178ad8a0
(custom-handle-all-keywords): Fix arg passed to custom-add-to-group.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48238
diff
changeset
|
423 (custom-add-to-group (custom-current-group) symbol type)) |
25683 | 424 (while args |
17334 | 425 (let ((arg (car args))) |
426 (setq args (cdr args)) | |
427 (unless (symbolp arg) | |
428 (error "Junk in args %S" args)) | |
429 (let ((keyword arg) | |
430 (value (car args))) | |
431 (unless args | |
432 (error "Keyword %s is missing an argument" keyword)) | |
433 (setq args (cdr args)) | |
25683 | 434 (custom-handle-keyword symbol keyword value type))))) |
17334 | 435 |
436 (defun custom-handle-keyword (symbol keyword value type) | |
437 "For customization option SYMBOL, handle KEYWORD with VALUE. | |
438 Fourth argument TYPE is the custom option type." | |
26582
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
439 (if purify-flag |
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
440 (setq value (purecopy value))) |
17334 | 441 (cond ((eq keyword :group) |
442 (custom-add-to-group value symbol type)) | |
20445
20ff88ac8cc2
(custom-add-version): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19535
diff
changeset
|
443 ((eq keyword :version) |
20ff88ac8cc2
(custom-add-version): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19535
diff
changeset
|
444 (custom-add-version symbol value)) |
17334 | 445 ((eq keyword :link) |
446 (custom-add-link symbol value)) | |
447 ((eq keyword :load) | |
448 (custom-add-load symbol value)) | |
449 ((eq keyword :tag) | |
450 (put symbol 'custom-tag value)) | |
26831
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
451 ((eq keyword :set-after) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
452 (custom-add-dependencies symbol value)) |
17334 | 453 (t |
24872
9db8a7ed814e
(custom-handle-keyword): Fix error message.
Karl Heuer <kwzh@gnu.org>
parents:
24438
diff
changeset
|
454 (error "Unknown keyword %s" keyword)))) |
17334 | 455 |
26831
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
456 (defun custom-add-dependencies (symbol value) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
457 "To the custom option SYMBOL, add dependencies specified by VALUE. |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
458 VALUE should be a list of symbols. For each symbol in that list, |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
459 this specifies that SYMBOL should be set after the specified symbol, if |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
460 both appear in constructs like `custom-set-variables'." |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
461 (unless (listp value) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
462 (error "Invalid custom dependency `%s'" value)) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
463 (let* ((deps (get symbol 'custom-dependencies)) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
464 (new-deps deps)) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
465 (while value |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
466 (let ((dep (car value))) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
467 (unless (symbolp dep) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
468 (error "Invalid custom dependency `%s'" dep)) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
469 (unless (memq dep new-deps) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
470 (setq new-deps (cons dep new-deps))) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
471 (setq value (cdr value)))) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
472 (unless (eq deps new-deps) |
ddaafb816c3e
(custom-handle-keyword): Add :set-after.
Gerd Moellmann <gerd@gnu.org>
parents:
26582
diff
changeset
|
473 (put symbol 'custom-dependencies new-deps)))) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
474 |
17334 | 475 (defun custom-add-option (symbol option) |
476 "To the variable SYMBOL add OPTION. | |
477 | |
478 If SYMBOL is a hook variable, OPTION should be a hook member. | |
479 For other types variables, the effect is undefined." | |
480 (let ((options (get symbol 'custom-options))) | |
481 (unless (member option options) | |
482 (put symbol 'custom-options (cons option options))))) | |
483 | |
484 (defun custom-add-link (symbol widget) | |
485 "To the custom option SYMBOL add the link WIDGET." | |
486 (let ((links (get symbol 'custom-links))) | |
487 (unless (member widget links) | |
26582
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
488 (put symbol 'custom-links (cons (purecopy widget) links))))) |
17334 | 489 |
20445
20ff88ac8cc2
(custom-add-version): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19535
diff
changeset
|
490 (defun custom-add-version (symbol version) |
20ff88ac8cc2
(custom-add-version): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19535
diff
changeset
|
491 "To the custom option SYMBOL add the version VERSION." |
26582
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
492 (put symbol 'custom-version (purecopy version))) |
20445
20ff88ac8cc2
(custom-add-version): New function.
Karl Heuer <kwzh@gnu.org>
parents:
19535
diff
changeset
|
493 |
17334 | 494 (defun custom-add-load (symbol load) |
495 "To the custom option SYMBOL add the dependency LOAD. | |
496 LOAD should be either a library file name, or a feature name." | |
497 (let ((loads (get symbol 'custom-loads))) | |
498 (unless (member load loads) | |
26582
fbd1f4d3000d
(custom-declare-group): Purecopy DOC.
Dave Love <fx@gnu.org>
parents:
25888
diff
changeset
|
499 (put symbol 'custom-loads (cons (purecopy load) loads))))) |
17334 | 500 |
49099
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
501 (defun custom-autoload (symbol load) |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
502 "Mark SYMBOL as autoloaded custom variable and add dependency LOAD." |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
503 (put symbol 'custom-autoload t) |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
504 (custom-add-load symbol load)) |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
505 |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
506 ;; This test is also in the C code of `user-variable-p'. |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
507 (defun custom-variable-p (variable) |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
508 "Return non-nil if VARIABLE is a custom variable." |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
509 (or (get variable 'standard-value) |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
510 (get variable 'custom-autoload))) |
04672e32e3b0
(custom-autoload, custom-variable-p): New functions.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48951
diff
changeset
|
511 |
44911
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
512 ;;; Loading files needed to customize a symbol. |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
513 ;;; This is in custom.el because menu-bar.el needs it for toggle cmds. |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
514 |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
515 (defvar custom-load-recursion nil |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
516 "Hack to avoid recursive dependencies.") |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
517 |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
518 (defun custom-load-symbol (symbol) |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
519 "Load all dependencies for SYMBOL." |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
520 (unless custom-load-recursion |
47822
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
521 (let ((custom-load-recursion t)) |
52207
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
522 ;; Load these files if not already done, |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
523 ;; to make sure we know all the dependencies of SYMBOL. |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
524 (condition-case nil |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
525 (require 'cus-load) |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
526 (error nil)) |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
527 (condition-case nil |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
528 (require 'cus-start) |
c26f56efcd5d
(custom-load-symbol): Load cus-load and cus-start first.
Richard M. Stallman <rms@gnu.org>
parents:
50123
diff
changeset
|
529 (error nil)) |
47822
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
530 (dolist (load (get symbol 'custom-loads)) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
531 (cond ((symbolp load) (condition-case nil (require load) (error nil))) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
532 ;; This is subsumed by the test below, but it's much faster. |
44911
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
533 ((assoc load load-history)) |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
534 ;; This was just (assoc (locate-library load) load-history) |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
535 ;; but has been optimized not to load locate-library |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
536 ;; if not necessary. |
47822
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
537 ((let ((regexp (concat "\\(\\`\\|/\\)" (regexp-quote load) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
538 "\\(\\'\\|\\.\\)")) |
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
539 (found nil)) |
44911
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
540 (dolist (loaded load-history) |
45366
c9338efa3fd9
(custom-load-symbol): Verify that LOADED is a string.
Richard M. Stallman <rms@gnu.org>
parents:
44911
diff
changeset
|
541 (and (stringp (car loaded)) |
c9338efa3fd9
(custom-load-symbol): Verify that LOADED is a string.
Richard M. Stallman <rms@gnu.org>
parents:
44911
diff
changeset
|
542 (string-match regexp (car loaded)) |
44911
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
543 (setq found t))) |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
544 found)) |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
545 ;; Without this, we would load cus-edit recursively. |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
546 ;; We are still loading it when we call this, |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
547 ;; and it is not in load-history yet. |
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
548 ((equal load "cus-edit")) |
47822
46f8bf0fc7b4
(custom-group-of-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47677
diff
changeset
|
549 (t (condition-case nil (load load) (error nil)))))))) |
44911
0edc2b27187b
(custom-load-symbol): Moved from cus-edit.el.
Richard M. Stallman <rms@gnu.org>
parents:
44683
diff
changeset
|
550 |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
551 (defvar custom-known-themes '(user standard) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
552 "Themes that have been define with `deftheme'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
553 The default value is the list (user standard). The theme `standard' |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
554 contains the Emacs standard settings from the original Lisp files. The |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
555 theme `user' contains all the the settings the user customized and saved. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
556 Additional themes declared with the `deftheme' macro will be added to |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
557 the front of this list.") |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
558 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
559 (defun custom-declare-theme (theme feature &optional doc &rest args) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
560 "Like `deftheme', but THEME is evaluated as a normal argument. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
561 FEATURE is the feature this theme provides. This symbol is created |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
562 from THEME by `custom-make-theme-feature'." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
563 (add-to-list 'custom-known-themes theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
564 (put theme 'theme-feature feature) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
565 (when doc |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
566 (put theme 'theme-documentation doc)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
567 (while args |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
568 (let ((arg (car args))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
569 (setq args (cdr args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
570 (unless (symbolp arg) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
571 (error "Junk in args %S" args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
572 (let ((keyword arg) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
573 (value (car args))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
574 (unless args |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
575 (error "Keyword %s is missing an argument" keyword)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
576 (setq args (cdr args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
577 (cond ((eq keyword :short-description) |
53371
89c5aff0d5d7
(custom-declare-theme): Use `value' when putting properties on `theme'.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53040
diff
changeset
|
578 (put theme 'theme-short-description value)) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
579 ((eq keyword :immediate) |
53371
89c5aff0d5d7
(custom-declare-theme): Use `value' when putting properties on `theme'.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53040
diff
changeset
|
580 (put theme 'theme-immediate value)) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
581 ((eq keyword :variable-set-string) |
53371
89c5aff0d5d7
(custom-declare-theme): Use `value' when putting properties on `theme'.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53040
diff
changeset
|
582 (put theme 'theme-variable-set-string value)) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
583 ((eq keyword :variable-reset-string) |
53371
89c5aff0d5d7
(custom-declare-theme): Use `value' when putting properties on `theme'.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53040
diff
changeset
|
584 (put theme 'theme-variable-reset-string value)) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
585 ((eq keyword :face-set-string) |
53371
89c5aff0d5d7
(custom-declare-theme): Use `value' when putting properties on `theme'.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53040
diff
changeset
|
586 (put theme 'theme-face-set-string value)) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
587 ((eq keyword :face-reset-string) |
53371
89c5aff0d5d7
(custom-declare-theme): Use `value' when putting properties on `theme'.
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53040
diff
changeset
|
588 (put theme 'theme-face-reset-string value))))))) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
589 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
590 (defmacro deftheme (theme &optional doc &rest args) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
591 "Declare custom theme THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
592 The optional argument DOC is a doc string describing the theme. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
593 The remaining arguments should have the form |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
594 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
595 [KEYWORD VALUE]... |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
596 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
597 The following KEYWORD's are defined: |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
598 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
599 :short-description |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
600 VALUE is a short (one line) description of the theme. If not |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
601 given, DOC is used. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
602 :immediate |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
603 If VALUE is non-nil, variables specified in this theme are set |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
604 immediately when loading the theme. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
605 :variable-set-string |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
606 VALUE is a string used to indicate that a variable takes its |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
607 setting from this theme. It is passed to FORMAT with the name |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
608 of the theme as an additional argument. If not given, a |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
609 generic description is used. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
610 :variable-reset-string |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
611 VALUE is a string used in the case a variable has been forced |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
612 to its value in this theme. It is passed to FORMAT with the |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
613 name of the theme as an additional argument. If not given, a |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
614 generic description is used. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
615 :face-set-string |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
616 VALUE is a string used to indicate that a face takes its |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
617 setting from this theme. It is passed to FORMAT with the name |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
618 of the theme as an additional argument. If not given, a |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
619 generic description is used. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
620 :face-reset-string |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
621 VALUE is a string used in the case a face has been forced to |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
622 its value in this theme. It is passed to FORMAT with the name |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
623 of the theme as an additional argument. If not given, a |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
624 generic description is used. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
625 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
626 Any theme `foo' should be defined in a file called `foo-theme.el'; |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
627 see `custom-make-theme-feature' for more information." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
628 (let ((feature (custom-make-theme-feature theme))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
629 ;; It is better not to use backquote in this file, |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
630 ;; because that makes a bootstrapping problem |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
631 ;; if you need to recompile all the Lisp files using interpreted code. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
632 (nconc (list 'custom-declare-theme |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
633 (list 'quote theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
634 (list 'quote feature) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
635 doc) args))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
636 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
637 (defun custom-make-theme-feature (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
638 "Given a symbol THEME, create a new symbol by appending \"-theme\". |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
639 Store this symbol in the `theme-feature' property of THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
640 Calling `provide-theme' to provide THEME actually puts `THEME-theme' |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
641 into `features'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
642 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
643 This allows for a file-name convention for autoloading themes: |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
644 Every theme X has a property `provide-theme' whose value is \"X-theme\". |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
645 \(require-theme X) then attempts to load the file `X-theme.el'." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
646 (intern (concat (symbol-name theme) "-theme"))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
647 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
648 (defsubst custom-theme-p (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
649 "Non-nil when THEME has been defined." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
650 (memq theme custom-known-themes)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
651 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
652 (defsubst custom-check-theme (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
653 "Check whether THEME is valid, and signal an error if it is not." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
654 (unless (custom-theme-p theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
655 (error "Unknown theme `%s'" theme))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
656 |
17334 | 657 ;;; Initializing. |
658 | |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
659 (defun custom-push-theme (prop symbol theme mode value) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
660 "Add (THEME MODE VALUE) to the list in property PROP of SYMBOL. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
661 If the first element in that list is already (THEME ...), |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
662 discard it first. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
663 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
664 MODE can be either the symbol `set' or the symbol `reset'. If it is the |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
665 symbol `set', then VALUE is the value to use. If it is the symbol |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
666 `reset', then VALUE is the mode to query instead. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
667 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
668 In the following example for the variable `goto-address-url-face', the |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
669 theme `subtle-hacker' uses the same value for the variable as the theme |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
670 `gnome2': |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
671 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
672 \((standard set bold) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
673 \(gnome2 set info-xref) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
674 \(jonadab set underline) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
675 \(subtle-hacker reset gnome2)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
676 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
677 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
678 If a value has been stored for themes A B and C, and a new value |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
679 is to be stored for theme C, then the old value of C is discarded. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
680 If a new value is to be stored for theme B, however, the old value |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
681 of B is not discarded because B is not the car of the list. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
682 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
683 For variables, list property PROP is `theme-value'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
684 For faces, list property PROP is `theme-face'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
685 This is used in `custom-do-theme-reset', for example. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
686 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
687 The list looks the same in any case; the examples shows a possible |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
688 value of the `theme-face' property for the face `region': |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
689 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
690 \((gnome2 set ((t (:foreground \"cyan\" :background \"dark cyan\")))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
691 \(standard set ((((class color) (background dark)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
692 \(:background \"blue\")) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
693 \(t (:background \"gray\"))))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
694 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
695 This records values for the `standard' and the `gnome2' themes. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
696 The user has not customized the face; had he done that, |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
697 the list would contain an entry for the `user' theme, too. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
698 See `custom-known-themes' for a list of known themes." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
699 (let ((old (get symbol prop))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
700 (if (eq (car-safe (car-safe old)) theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
701 (setq old (cdr old))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
702 (put symbol prop (cons (list theme mode value) old)))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
703 |
22606
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
704 (defvar custom-local-buffer nil |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
705 "Non-nil, in a Customization buffer, means customize a specific buffer. |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
706 If this variable is non-nil, it should be a buffer, |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
707 and it means customize the local bindings of that buffer. |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
708 This variable is a permanent local, and it normally has a local binding |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
709 in every Customization buffer.") |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
710 (put 'custom-local-buffer 'permanent-local t) |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
711 |
17334 | 712 (defun custom-set-variables (&rest args) |
25683 | 713 "Initialize variables according to user preferences. |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
714 The settings are registered as theme `user'. |
48821
d886606b4f3a
(defcustom, custom-set-variables): Doc fix.
Dave Love <fx@gnu.org>
parents:
48476
diff
changeset
|
715 The arguments should each be a list of the form: |
17334 | 716 |
25683 | 717 (SYMBOL VALUE [NOW [REQUEST [COMMENT]]]) |
17334 | 718 |
719 The unevaluated VALUE is stored as the saved value for SYMBOL. | |
720 If NOW is present and non-nil, VALUE is also evaluated and bound as | |
25683 | 721 the default value for the SYMBOL. |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
722 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
723 REQUEST is a list of features we must 'require for SYMBOL. |
25683 | 724 COMMENT is a comment string about SYMBOL." |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
725 (apply 'custom-theme-set-variables 'user args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
726 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
727 (defun custom-theme-set-variables (theme &rest args) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
728 "Initialize variables according to settings specified by args. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
729 Records the settings as belonging to THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
730 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
731 The arguments should be a list where each entry has the form: |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
732 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
733 (SYMBOL VALUE [NOW [REQUEST [COMMENT]]]) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
734 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
735 The unevaluated VALUE is stored as the saved value for SYMBOL. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
736 If NOW is present and non-nil, VALUE is also evaluated and bound as |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
737 the default value for the SYMBOL. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
738 REQUEST is a list of features we must 'require for SYMBOL. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
739 COMMENT is a comment string about SYMBOL. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
740 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
741 Several properties of THEME and SYMBOL are used in the process: |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
742 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
743 If THEME property `theme-immediate' is non-nil, this is equivalent of |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
744 providing the NOW argument to all symbols in the argument list: SYMBOL |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
745 is bound to the evaluated VALUE. The only difference is SYMBOL property |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
746 `force-value': if NOW is non-nil, SYMBOL's property `force-value' is set to |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
747 the symbol `rogue', else if THEME's property `theme-immediate' is non-nil, |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
748 FACE's property `force-face' is set to the symbol `immediate'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
749 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
750 VALUE itself is saved unevaluated as SYMBOL property `saved-value' and |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
751 in SYMBOL's list property `theme-value' \(using `custom-push-theme')." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
752 (custom-check-theme theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
753 (let ((immediate (get theme 'theme-immediate))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
754 (setq args |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
755 (sort args |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
756 (lambda (a1 a2) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
757 (let* ((sym1 (car a1)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
758 (sym2 (car a2)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
759 (1-then-2 (memq sym1 (get sym2 'custom-dependencies))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
760 (2-then-1 (memq sym2 (get sym1 'custom-dependencies)))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
761 (cond ((and 1-then-2 2-then-1) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
762 (error "Circular custom dependency between `%s' and `%s'" |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
763 sym1 sym2)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
764 (2-then-1 nil) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
765 ;; Put symbols with :require last. The macro |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
766 ;; define-minor-mode generates a defcustom |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
767 ;; with a :require and a :set, where the |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
768 ;; setter function calls the mode function. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
769 ;; Putting symbols with :require last ensures |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
770 ;; that the mode function will see other |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
771 ;; customized values rather than default |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
772 ;; values. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
773 (t (nth 3 a2))))))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
774 (while args |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
775 (let ((entry (car args))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
776 (if (listp entry) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
777 (let* ((symbol (nth 0 entry)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
778 (value (nth 1 entry)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
779 (now (nth 2 entry)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
780 (requests (nth 3 entry)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
781 (comment (nth 4 entry)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
782 set) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
783 (when requests |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
784 (put symbol 'custom-requests requests) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
785 (mapc 'require requests)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
786 (setq set (or (get symbol 'custom-set) 'custom-set-default)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
787 (put symbol 'saved-value (list value)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
788 (put symbol 'saved-variable-comment comment) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
789 (custom-push-theme 'theme-value symbol theme 'set value) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
790 ;; Allow for errors in the case where the setter has |
31362
652b5c65769a
(custom-set-variables): Print message about errors in
Dave Love <fx@gnu.org>
parents:
29761
diff
changeset
|
791 ;; changed between versions, say, but let the user know. |
652b5c65769a
(custom-set-variables): Print message about errors in
Dave Love <fx@gnu.org>
parents:
29761
diff
changeset
|
792 (condition-case data |
24438
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
793 (cond (now |
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
794 ;; Rogue variable, set it now. |
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
795 (put symbol 'force-value t) |
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
796 (funcall set symbol (eval value))) |
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
797 ((default-boundp symbol) |
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
798 ;; Something already set this, overwrite it. |
4a78f6354310
(custom-set-variables): Protect against setter errors.
Dave Love <fx@gnu.org>
parents:
23354
diff
changeset
|
799 (funcall set symbol (eval value)))) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
800 (error |
31362
652b5c65769a
(custom-set-variables): Print message about errors in
Dave Love <fx@gnu.org>
parents:
29761
diff
changeset
|
801 (message "Error setting %s: %s" symbol data))) |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
802 (setq args (cdr args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
803 (and (or now (default-boundp symbol)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
804 (put symbol 'variable-comment comment))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
805 ;; Old format, a plist of SYMBOL VALUE pairs. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
806 (message "Warning: old format `custom-set-variables'") |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
807 (ding) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
808 (sit-for 2) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
809 (let ((symbol (nth 0 args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
810 (value (nth 1 args))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
811 (put symbol 'saved-value (list value)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
812 (custom-push-theme 'theme-value symbol theme 'set value)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
813 (setq args (cdr (cdr args)))))))) |
17334 | 814 |
22606
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
815 (defun custom-set-default (variable value) |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
816 "Default :set function for a customizable variable. |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
817 Normally, this sets the default value of VARIABLE to VALUE, |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
818 but if `custom-local-buffer' is non-nil, |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
819 this sets the local binding in that buffer instead." |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
820 (if custom-local-buffer |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
821 (with-current-buffer custom-local-buffer |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
822 (set variable value)) |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
823 (set-default variable value))) |
36171df7d571
(custom-set-default): New function.
Richard M. Stallman <rms@gnu.org>
parents:
22499
diff
changeset
|
824 |
50123
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
825 (defun custom-set-minor-mode (variable value) |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
826 ":set function for minor mode variables. |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
827 Normally, this sets the default value of VARIABLE to nil if VALUE |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
828 is nil and to t otherwise, |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
829 but if `custom-local-buffer' is non-nil, |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
830 this sets the local binding in that buffer instead." |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
831 (if custom-local-buffer |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
832 (with-current-buffer custom-local-buffer |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
833 (funcall variable (or value 0))) |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
834 (funcall variable (or value 0)))) |
7c924263658d
(custom-set-minor-mode): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49588
diff
changeset
|
835 |
44683
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
836 (defun custom-quote (sexp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
837 "Quote SEXP iff it is not self quoting." |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
838 (if (or (memq sexp '(t nil)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
839 (keywordp sexp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
840 (and (listp sexp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
841 (memq (car sexp) '(lambda))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
842 (stringp sexp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
843 (numberp sexp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
844 (vectorp sexp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
845 ;;; (and (fboundp 'characterp) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
846 ;;; (characterp sexp)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
847 ) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
848 sexp |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
849 (list 'quote sexp))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
850 |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
851 (defun customize-mark-to-save (symbol) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
852 "Mark SYMBOL for later saving. |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
853 |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
854 If the default value of SYMBOL is different from the standard value, |
44683
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
855 set the `saved-value' property to a list whose car evaluates to the |
49522
4dd5da1ea3dc
* font-lock.el (lisp-font-lock-keywords-1): Match `deftheme'.
John Paul Wallington <jpw@pobox.com>
parents:
49099
diff
changeset
|
856 default value. Otherwise, set it to nil. |
44683
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
857 |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
858 To actually save the value, call `custom-save-all'. |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
859 |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
860 Return non-nil iff the `saved-value' property actually changed." |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
861 (let* ((get (or (get symbol 'custom-get) 'default-value)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
862 (value (funcall get symbol)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
863 (saved (get symbol 'saved-value)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
864 (standard (get symbol 'standard-value)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
865 (comment (get symbol 'customized-variable-comment))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
866 ;; Save default value iff different from standard value. |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
867 (if (or (null standard) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
868 (not (equal value (condition-case nil |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
869 (eval (car standard)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
870 (error nil))))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
871 (put symbol 'saved-value (list (custom-quote value))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
872 (put symbol 'saved-value nil)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
873 ;; Clear customized information (set, but not saved). |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
874 (put symbol 'customized-value nil) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
875 ;; Save any comment that might have been set. |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
876 (when comment |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
877 (put symbol 'saved-variable-comment comment)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
878 (not (equal saved (get symbol 'saved-value))))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
879 |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
880 (defun customize-mark-as-set (symbol) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
881 "Mark current value of SYMBOL as being set from customize. |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
882 |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
883 If the default value of SYMBOL is different from the saved value if any, |
44683
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
884 or else if it is different from the standard value, set the |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
885 `customized-value' property to a list whose car evaluates to the |
49522
4dd5da1ea3dc
* font-lock.el (lisp-font-lock-keywords-1): Match `deftheme'.
John Paul Wallington <jpw@pobox.com>
parents:
49099
diff
changeset
|
886 default value. Otherwise, set it to nil. |
44683
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
887 |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
888 Return non-nil iff the `customized-value' property actually changed." |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
889 (let* ((get (or (get symbol 'custom-get) 'default-value)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
890 (value (funcall get symbol)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
891 (customized (get symbol 'customized-value)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
892 (old (or (get symbol 'saved-value) (get symbol 'standard-value)))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
893 ;; Mark default value as set iff different from old value. |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
894 (if (or (null old) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49522
diff
changeset
|
895 (not (equal value (condition-case nil |
44683
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
896 (eval (car old)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
897 (error nil))))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
898 (put symbol 'customized-value (list (custom-quote value))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
899 (put symbol 'customized-value nil)) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
900 ;; Changed? |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
901 (not (equal customized (get symbol 'customized-value))))) |
17031c88f781
(customize-mark-to-save, customize-mark-as-set)
Miles Bader <miles@gnu.org>
parents:
42556
diff
changeset
|
902 |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
903 ;;; Theme Manipulation |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
904 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
905 (defvar custom-loaded-themes nil |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
906 "Themes in the order they are loaded.") |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
907 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
908 (defun custom-theme-loaded-p (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
909 "Return non-nil when THEME has been loaded." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
910 (memq theme custom-loaded-themes)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
911 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
912 (defun provide-theme (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
913 "Indicate that this file provides THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
914 Add THEME to `custom-loaded-themes' and `provide' whatever |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
915 is stored in THEME's property `theme-feature'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
916 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
917 Usually the theme-feature property contains a symbol created |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
918 by `custom-make-theme-feature'." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
919 (custom-check-theme theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
920 (provide (get theme 'theme-feature)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
921 (setq custom-loaded-themes (nconc (list theme) custom-loaded-themes))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
922 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
923 (defun require-theme (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
924 "Try to load a theme by requiring its feature. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
925 THEME's feature is stored in THEME's `theme-feature' property. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
926 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
927 Usually the `theme-feature' property contains a symbol created |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
928 by `custom-make-theme-feature'." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
929 ;; Note we do no check for validity of the theme here. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
930 ;; This allows to pull in themes by a file-name convention |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
931 (require (or (get theme 'theme-feature) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
932 (custom-make-theme-feature theme)))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
933 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
934 (defun custom-remove-theme (spec-alist theme) |
49522
4dd5da1ea3dc
* font-lock.el (lisp-font-lock-keywords-1): Match `deftheme'.
John Paul Wallington <jpw@pobox.com>
parents:
49099
diff
changeset
|
935 "Delete all elements from SPEC-ALIST whose car is THEME." |
48951
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
936 (let ((elt (assoc theme spec-alist))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
937 (while elt |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
938 (setq spec-alist (delete elt spec-alist) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
939 elt (assoc theme spec-alist)))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
940 spec-alist) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
941 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
942 (defun custom-do-theme-reset (theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
943 "Undo all settings defined by THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
944 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
945 A variable remains unchanged if its property `theme-value' does not |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
946 contain a value for THEME. A face remains unchanged if its property |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
947 `theme-face' does not contain a value for THEME. In either case, all |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
948 settings for THEME are removed from the property and the variable or |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
949 face is set to the `user' theme. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
950 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
951 See `custom-known-themes' for a list of known themes." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
952 (let (spec-list) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
953 (mapatoms (lambda (symbol) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
954 ;; This works even if symbol is both a variable and a |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
955 ;; face. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
956 (setq spec-list (get symbol 'theme-value)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
957 (when spec-list |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
958 (put symbol 'theme-value (custom-remove-theme spec-list theme)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
959 (custom-theme-reset-internal symbol 'user)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
960 (setq spec-list (get symbol 'theme-face)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
961 (when spec-list |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
962 (put symbol 'theme-face (custom-remove-theme spec-list theme)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
963 (custom-theme-reset-internal-face symbol 'user)))))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
964 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
965 (defun custom-theme-load-themes (by-theme &rest body) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
966 "Load the themes specified by BODY. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
967 Record them as required by theme BY-THEME. BODY is a sequence of either |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
968 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
969 THEME |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
970 BY-THEME requires THEME |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
971 \(reset THEME) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
972 Undo all the settings made by THEME |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
973 \(hidden THEME) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
974 Require THEME but hide it from the user |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
975 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
976 All the themes loaded for BY-THEME are recorded in BY-THEME's property |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
977 `theme-loads-themes'. Any theme loaded with the hidden predicate will |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
978 be given the property `theme-hidden' unless it has been loaded before. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
979 Whether a theme has been loaded before is determined by the function |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
980 `custom-theme-loaded-p'." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
981 (custom-check-theme by-theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
982 (let ((theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
983 (themes-loaded (get by-theme 'theme-loads-themes))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
984 (while theme |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
985 (setq theme (car body) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
986 body (cdr body)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
987 (cond ((and (consp theme) (eq (car theme) 'reset)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
988 (custom-do-theme-reset (cadr theme))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
989 ((and (consp theme) (eq (car theme) 'hidden)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
990 (require-theme (cadr theme)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
991 (unless (custom-theme-loaded-p (cadr theme)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
992 (put (cadr theme) 'theme-hidden t))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
993 (t |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
994 (require-theme theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
995 (put theme 'theme-hidden nil))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
996 (setq themes-loaded (nconc (list theme) themes-loaded))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
997 (put by-theme 'theme-loads-themes themes-loaded))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
998 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
999 (defun custom-load-themes (&rest body) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1000 "Load themes for the USER theme as specified by BODY. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1001 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1002 See `custom-theme-load-themes' for more information on BODY." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1003 (apply 'custom-theme-load-themes 'user body)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1004 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1005 ; (defsubst copy-upto-last (elt list) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1006 ; "Copy all the elements of the list upto the last occurence of elt" |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1007 ; ;; Is it faster to do more work in C than to do less in elisp? |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1008 ; (nreverse (cdr (member elt (reverse list))))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1009 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1010 (defun custom-theme-value (theme theme-spec-list) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1011 "Determine the value for THEME defined by THEME-SPEC-LIST. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1012 Returns a list with the original value if found; nil otherwise. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1013 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1014 THEME-SPEC-LIST is an alist with themes as its key. As new themes are |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1015 installed, these are added to the front of THEME-SPEC-LIST. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1016 Each element has the form |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1017 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1018 \(THEME MODE VALUE) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1019 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1020 MODE is either the symbol `set' or the symbol `reset'. See |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1021 `custom-push-theme' for more information on the format of |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1022 THEME-SPEC-LIST." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1023 ;; Note we do _NOT_ signal an error if the theme is unknown |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1024 ;; it might have gone away without the user knowing. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1025 (let ((value (cdr (assoc theme theme-spec-list)))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1026 (if value |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1027 (if (eq (car value) 'set) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1028 (cdr value) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1029 (custom-theme-value (cadr value) theme-spec-list))))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1030 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1031 (defun custom-theme-variable-value (variable theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1032 "Return (list value) indicating value of VARIABLE in THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1033 If THEME does not define a value for VARIABLE, return nil. The value |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1034 definitions per theme are stored in VARIABLE's property `theme-value'. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1035 The actual work is done by function `custom-theme-value', which see. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1036 See `custom-push-theme' for more information on how these definitions |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1037 are stored." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1038 (custom-theme-value theme (get variable 'theme-value))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1039 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1040 (defun custom-theme-reset-internal (symbol to-theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1041 "Reset SYMBOL to the value defined by TO-THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1042 If SYMBOL is not defined in TO-THEME, reset SYMBOL to the standard |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1043 value. See `custom-theme-variable-value'. The standard value is |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1044 stored in SYMBOL's property `standard-value'." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1045 (let ((value (custom-theme-variable-value symbol to-theme)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1046 was-in-theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1047 (setq was-in-theme value) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1048 (setq value (or value (get symbol 'standard-value))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1049 (when value |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1050 (put symbol 'saved-value was-in-theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1051 (if (or (get 'force-value symbol) (default-boundp symbol)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1052 (funcall (or (get symbol 'custom-set) 'set-default) symbol |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1053 (eval (car value))))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1054 value)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1055 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1056 (defun custom-theme-reset-variables (theme &rest args) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1057 "Reset the value of the variables to values previously defined. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1058 Associate this setting with THEME. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1059 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1060 ARGS is a list of lists of the form |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1061 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1062 (VARIABLE TO-THEME) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1063 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1064 This means reset VARIABLE to its value in TO-THEME." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1065 (custom-check-theme theme) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1066 (mapcar '(lambda (arg) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1067 (apply 'custom-theme-reset-internal arg) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1068 (custom-push-theme 'theme-value (car arg) theme 'reset (cadr arg))) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1069 args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1070 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1071 (defun custom-reset-variables (&rest args) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1072 "Reset the value of the variables to values previously saved. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1073 This is the setting associated the `user' theme. |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1074 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1075 ARGS is a list of lists of the form |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1076 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1077 (VARIABLE TO-THEME) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1078 |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1079 This means reset VARIABLE to its value in TO-THEME." |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1080 (apply 'custom-theme-reset-variables 'user args)) |
d77bc55dd27b
(custom-known-themes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
48821
diff
changeset
|
1081 |
17334 | 1082 ;;; The End. |
1083 | |
18882
539611251037
(custom-declare-variable-list): Process already-declared
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
1084 ;; Process the defcustoms for variables loaded before this file. |
539611251037
(custom-declare-variable-list): Process already-declared
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
1085 (while custom-declare-variable-list |
539611251037
(custom-declare-variable-list): Process already-declared
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
1086 (apply 'custom-declare-variable (car custom-declare-variable-list)) |
539611251037
(custom-declare-variable-list): Process already-declared
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
1087 (setq custom-declare-variable-list (cdr custom-declare-variable-list))) |
539611251037
(custom-declare-variable-list): Process already-declared
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
1088 |
17334 | 1089 (provide 'custom) |
1090 | |
52401 | 1091 ;;; arch-tag: 041b6116-aabe-4f9a-902d-74092bc3dab2 |
25683 | 1092 ;;; custom.el ends here |