annotate lisp/cus-edit.el @ 97541:33164d8e9921

Uncomment 'put backspace ascii-character...' and friends, they are needed for tramp.
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Mon, 18 Aug 2008 15:04:37 +0000
parents cc5f94eeb1d8
children 57c9b0f7df3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37911
diff changeset
1 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2 ;;
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64494
diff changeset
3 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
87597
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
5 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
7 ;; Maintainer: FSF
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
8 ;; Keywords: help, faces
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
9
17521
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
10 ;; This file is part of GNU Emacs.
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
11
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94463
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
17521
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94463
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94463
diff changeset
15 ;; (at your option) any later version.
17521
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
16
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
20 ;; GNU General Public License for more details.
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
21
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94463
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17521
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
24
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
25 ;;; Commentary:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
26 ;;
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
27 ;; This file implements the code to create and edit customize buffers.
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
28 ;;
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
29 ;; See `custom.el'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
30
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
31 ;; No commands should have names starting with `custom-' because
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
32 ;; that interferes with completion. Use `customize-' for commands
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
33 ;; that the user will run with M-x, and `Custom-' for interactive commands.
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
34
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
35 ;; The identity of a customize option is represented by a Lisp symbol.
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
36 ;; The following values are associated with an option.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
37
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
38 ;; 0. The current value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
39
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
40 ;; This is the value of the option as seen by "the rest of Emacs".
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
41
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
42 ;; Usually extracted by 'default-value', but can be extracted with
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
43 ;; different means if the option symbol has the 'custom-get'
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
44 ;; property. Similarly, set-default (or the 'custom-set' property)
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
45 ;; can set it.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
46
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
47 ;; 1. The widget value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
48
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
49 ;; This is the value shown in the widget in a customize buffer.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
50
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
51 ;; 2. The customized value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
52
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
53 ;; This is the last value given to the option through customize.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
54
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
55 ;; It is stored in the 'customized-value' property of the option, in a
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
56 ;; cons-cell whose car evaluates to the customized value.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
57
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
58 ;; 3. The saved value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
59
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
60 ;; This is last value saved from customize.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
61
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
62 ;; It is stored in the 'saved-value' property of the option, in a
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
63 ;; cons-cell whose car evaluates to the saved value.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
64
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
65 ;; 4. The standard value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
66
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
67 ;; This is the value given in the 'defcustom' declaration.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
68
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
69 ;; It is stored in the 'standard-value' property of the option, in a
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
70 ;; cons-cell whose car evaluates to the standard value.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
71
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
72 ;; 5. The "think" value.
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
73
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
74 ;; This is what customize thinks the current value should be.
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
75
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
76 ;; This is the customized value, if any such value exists, otherwise
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
77 ;; the saved value, if that exists, and as a last resort the standard
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
78 ;; value.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
79
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
80 ;; The reason for storing values unevaluated: This is so you can have
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
81 ;; values that depend on the environment. For example, you can have a
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
82 ;; variable that has one value when Emacs is running under a window
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
83 ;; system, and another value on a tty. Since the evaluation is only done
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
84 ;; when the variable is first initialized, this is only relevant for the
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
85 ;; saved (and standard) values, but affect others values for
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
86 ;; compatibility.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
87
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
88 ;; You can see (and modify and save) this unevaluated value by selecting
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
89 ;; "Show Saved Lisp Expression" from the Lisp interface. This will
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
90 ;; give you the unevaluated saved value, if any, otherwise the
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
91 ;; unevaluated standard value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
92
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
93 ;; The possible states for a customize widget are:
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
94
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
95 ;; 0. unknown
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
96
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
97 ;; The state has not been determined yet.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
98
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
99 ;; 1. modified
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
100
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
101 ;; The widget value is different from the current value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
102
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
103 ;; 2. changed
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
104
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
105 ;; The current value is different from the "think" value.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
106
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
107 ;; 3. set
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
108
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
109 ;; The "think" value is the customized value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
110
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
111 ;; 4. saved
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
112
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
113 ;; The "think" value is the saved value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
114
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
115 ;; 5. standard
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
116
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
117 ;; The "think" value is the standard value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
118
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
119 ;; 6. rogue
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
120
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
121 ;; There is no standard value. This means that the variable was
67600
d14352717f67 Introductory comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67549
diff changeset
122 ;; not defined with defcustom, nor handled in cus-start.el. Most
d14352717f67 Introductory comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67549
diff changeset
123 ;; standard interactive Custom commands do not let you create a
d14352717f67 Introductory comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67549
diff changeset
124 ;; Custom buffer containing such variables. However, such Custom
d14352717f67 Introductory comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67549
diff changeset
125 ;; buffers can be created, for instance, by calling
d14352717f67 Introductory comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67549
diff changeset
126 ;; `customize-apropos' with a prefix arg or by calling
60296
7090a1e062e2 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60295
diff changeset
127 ;; `customize-option' non-interactively.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
128
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
129 ;; 7. hidden
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
130
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
131 ;; There is no widget value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
132
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
133 ;; 8. mismatch
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
134
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
135 ;; The widget value is not valid member of the :type specified for the
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
136 ;; option.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
137
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
138 ;;; Code:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
139
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
140 (require 'cus-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
141 (require 'wid-edit)
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
142
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
143 (defvar custom-versions-load-alist) ; from cus-load
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
144 (defvar recentf-exclude) ; from recentf.el
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
145
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
146 (condition-case nil
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
147 (require 'cus-load)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
148 (error nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
149
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
150 (condition-case nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
151 (require 'cus-start)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
152 (error nil))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
153
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
154 (put 'custom-define-hook 'custom-type 'hook)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
155 (put 'custom-define-hook 'standard-value '(nil))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
156 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
157
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
158 ;;; Customization Groups.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
159
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
160 (defgroup emacs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
161 "Customization of the One True Editor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
162 :link '(custom-manual "(emacs)Top"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
163
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
164 ;; Most of these groups are stolen from `finder.el',
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
165 (defgroup editing nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
166 "Basic text editing facilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
167 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
168
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
169 (defgroup abbrev nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
170 "Abbreviation handling, typing shortcuts, macros."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
171 :tag "Abbreviations"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
172 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
173
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
174 (defgroup matching nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
175 "Various sorts of searching and matching."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
176 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
177
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
178 (defgroup emulations nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
179 "Emulations of other editors."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
180 :link '(custom-manual "(emacs)Emulation")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
181 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
182
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
183 (defgroup mouse nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
184 "Mouse support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
185 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
186
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
187 (defgroup outlines nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
188 "Support for hierarchical outlining."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
189 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
190
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
191 (defgroup external nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
192 "Interfacing to external utilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
193 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
194
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
195 (defgroup processes nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
196 "Process, subshell, compilation, and job control support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
197 :group 'external
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
198 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
199
22068
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
200 (defgroup convenience nil
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
201 "Convenience features for faster editing."
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
202 :group 'emacs)
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
203
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
204 (defgroup programming nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
205 "Support for programming in other languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
206 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
207
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
208 (defgroup languages nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
209 "Specialized modes for editing programming languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
210 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
211
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
212 (defgroup lisp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
213 "Lisp support, including Emacs Lisp."
66957
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
214 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
215 :group 'languages
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
216 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
217
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
218 (defgroup c nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
219 "Support for the C language and related languages."
66957
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
220 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
221 :link '(custom-manual "(ccmode)")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
222 :group 'languages)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
223
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
224 (defgroup tools nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
225 "Programming tools."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
226 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
227
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
228 (defgroup oop nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
229 "Support for object-oriented programming."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
230 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
231
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
232 (defgroup applications nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
233 "Applications written in Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
234 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
235
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
236 (defgroup calendar nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
237 "Calendar and time management support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
238 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
239
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
240 (defgroup mail nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
241 "Modes for electronic-mail handling."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
242 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
243
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
244 (defgroup news nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
245 "Support for netnews reading and posting."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
246 :link '(custom-manual "(gnus)")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
247 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
248
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
249 (defgroup games nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
250 "Games, jokes and amusements."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
251 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
252
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
253 (defgroup development nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
254 "Support for further development of Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
255 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
256
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
257 (defgroup docs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
258 "Support for Emacs documentation."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
259 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
260
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
261 (defgroup extensions nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
262 "Emacs Lisp language extensions."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
263 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
264
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
265 (defgroup internal nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
266 "Code for Emacs internals, build process, defaults."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
267 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
268
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
269 (defgroup maint nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
270 "Maintenance aids for the Emacs development group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
271 :tag "Maintenance"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
272 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
273
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
274 (defgroup environment nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
275 "Fitting Emacs with its environment."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
276 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
277
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
278 (defgroup comm nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
279 "Communications, networking, remote access to files."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
280 :tag "Communication"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
281 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
282
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
283 (defgroup hardware nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
284 "Support for interfacing with exotic hardware."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
285 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
286
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
287 (defgroup terminals nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
288 "Support for terminal types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
289 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
290
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
291 (defgroup unix nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
292 "Front-ends/assistants for, or emulators of, UNIX features."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
293 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
294
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
295 (defgroup i18n nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
296 "Internationalization and alternate character-set support."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
297 :link '(custom-manual "(emacs)International")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
298 :group 'environment
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
299 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
300
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
301 (defgroup x nil
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
302 "The X Window system."
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
303 :group 'environment)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
304
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
305 (defgroup frames nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
306 "Support for Emacs frames and window systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
307 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
308
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
309 (defgroup data nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
310 "Support editing files of data."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
311 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
312
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
313 (defgroup files nil
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
314 "Support editing files."
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
315 :group 'emacs)
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
316
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
317 (defgroup wp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
318 "Word processing."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
319 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
320
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
321 (defgroup tex nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
322 "Code related to the TeX formatter."
66957
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
323 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
324 :group 'wp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
325
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
326 (defgroup faces nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
327 "Support for multiple fonts."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
328 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
329
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
330 (defgroup hypermedia nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
331 "Support for links between text or other media types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
332 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
333
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
334 (defgroup help nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
335 "Support for on-line help systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
336 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
337
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
338 (defgroup multimedia nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
339 "Non-textual support, specifically images and sound."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
340 :group 'emacs)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
341
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
342 (defgroup local nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
343 "Code local to your site."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
344 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
345
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
346 (defgroup customize '((widgets custom-group))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
347 "Customization of the Customization support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
348 :prefix "custom-"
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
349 :group 'help)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
350
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
351 (defgroup custom-faces nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
352 "Faces used by customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
353 :group 'customize
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
354 :group 'faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
355
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
356 (defgroup custom-browse nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
357 "Control customize browser."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
358 :prefix "custom-"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
359 :group 'customize)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
360
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
361 (defgroup custom-buffer nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
362 "Control customize buffers."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
363 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
364 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
365
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
366 (defgroup custom-menu nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
367 "Control customize menus."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
368 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
369 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
370
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
371 (defgroup alloc nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
372 "Storage allocation and gc for GNU Emacs Lisp interpreter."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
373 :tag "Storage Allocation"
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
374 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
375
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
376 (defgroup undo nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
377 "Undoing changes in buffers."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
378 :link '(custom-manual "(emacs)Undo")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
379 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
380
72877
bbdd54e72794 (mode-line): Renamed from modeline. All uses changed.
Richard M. Stallman <rms@gnu.org>
parents: 72715
diff changeset
381 (defgroup mode-line nil
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
382 "Content of the modeline."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
383 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
384
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
385 (defgroup editing-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
386 "Most basic editing facilities."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
387 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
388
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
389 (defgroup display nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
390 "How characters are displayed in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
391 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
392
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
393 (defgroup execute nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
394 "Executing external commands."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
395 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
396
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
397 (defgroup installation nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
398 "The Emacs installation."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
399 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
400
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
401 (defgroup dired nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
402 "Directory editing."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
403 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
404
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
405 (defgroup limits nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
406 "Internal Emacs limits."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
407 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
408
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
409 (defgroup debug nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
410 "Debugging Emacs itself."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
411 :group 'development)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
412
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
413 (defgroup keyboard nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
414 "Input from the keyboard."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
415 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
416
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
417 (defgroup mouse nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
418 "Input from the mouse."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
419 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
420
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
421 (defgroup menu nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
422 "Input from the menus."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
423 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
424
61475
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
425 (defgroup dnd nil
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
426 "Handling data from drag and drop."
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
427 :group 'environment)
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
428
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
429 (defgroup auto-save nil
77171
6540b56c4b3d (minibuffer, auto-save): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 76338
diff changeset
430 "Preventing accidental loss of data."
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
431 :group 'files)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
432
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
433 (defgroup processes-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
434 "Basic stuff dealing with processes."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
435 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
436
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
437 (defgroup mule nil
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
438 "MULE Emacs internationalization."
18053
941f5d1a241e (cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents: 18033
diff changeset
439 :group 'i18n)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
440
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
441 (defgroup windows nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
442 "Windows within a frame."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
443 :link '(custom-manual "(emacs)Windows")
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
444 :group 'environment)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
445
73795
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
446 ;;; Custom mode keymaps
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
447
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
448 (defvar custom-mode-map
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
449 ;; This keymap should be dense, but a dense keymap would prevent inheriting
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
450 ;; "\r" bindings from the parent map.
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
451 ;; Actually, this misfeature of dense keymaps was fixed on 2001-11-26.
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
452 (let ((map (make-keymap)))
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
453 (set-keymap-parent map widget-keymap)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
454 (define-key map [remap self-insert-command] 'Custom-no-edit)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
455 (define-key map "\^m" 'Custom-newline)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
456 (define-key map " " 'scroll-up)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
457 (define-key map "\177" 'scroll-down)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
458 (define-key map "\C-c\C-c" 'Custom-set)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
459 (define-key map "\C-x\C-s" 'Custom-save)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
460 (define-key map "q" 'Custom-buffer-done)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
461 (define-key map "u" 'Custom-goto-parent)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
462 (define-key map "n" 'widget-forward)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
463 (define-key map "p" 'widget-backward)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
464 map)
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
465 "Keymap for `Custom-mode'.")
73795
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
466
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
467 (defvar custom-mode-link-map
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
468 (let ((map (make-keymap)))
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
469 (set-keymap-parent map custom-mode-map)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
470 (define-key map [down-mouse-2] nil)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
471 (define-key map [down-mouse-1] 'mouse-drag-region)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
472 (define-key map [mouse-2] 'widget-move-and-invoke)
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
473 map)
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
474 "Local keymap for links in `Custom-mode'.")
73795
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
475
86232
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
476 (defvar custom-field-keymap
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
477 (let ((map (copy-keymap widget-field-keymap)))
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
478 (define-key map "\C-c\C-c" 'Custom-set)
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
479 (define-key map "\C-x\C-s" 'Custom-save)
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
480 map)
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
481 "Keymap used inside editable fields in customization buffers.")
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
482
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
483 (widget-put (get 'editable-field 'widget-type) :keymap custom-field-keymap)
73795
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
484
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
485 ;;; Utilities.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
486
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
487 (defun custom-split-regexp-maybe (regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
488 "If REGEXP is a string, split it to a list at `\\|'.
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
489 You can get the original back from the result with:
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
490 (mapconcat 'identity result \"\\|\")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
491
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
492 IF REGEXP is not a string, return it unchanged."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
493 (if (stringp regexp)
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
494 (split-string regexp "\\\\|")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
495 regexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
496
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
497 (defun custom-variable-prompt ()
49104
b74a6560ecbb (custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49013
diff changeset
498 "Prompt for a custom variable, defaulting to the variable at point.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
499 Return a list suitable for use in `interactive'."
66957
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
500 (let* ((v (variable-at-point))
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
501 (default (and (symbolp v) (custom-variable-p v) (symbol-name v)))
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
502 (enable-recursive-minibuffers t)
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
503 val)
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
504 (setq val (completing-read
67744
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
505 (if default (format "Customize variable (default %s): " default)
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
506 "Customize variable: ")
66957
38c5bc4332b9 (lisp, c, tex): Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 66941
diff changeset
507 obarray 'custom-variable-p t nil nil default))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
508 (list (if (equal val "")
18085
3da4eaba1fe8 (custom-variable-prompt): Handle variable-at-point returning 0.
Richard M. Stallman <rms@gnu.org>
parents: 18067
diff changeset
509 (if (symbolp v) v nil)
3da4eaba1fe8 (custom-variable-prompt): Handle variable-at-point returning 0.
Richard M. Stallman <rms@gnu.org>
parents: 18067
diff changeset
510 (intern val)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
511
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
512 (defun custom-menu-filter (menu widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
513 "Convert MENU to the form used by `widget-choose'.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
514 MENU should be in the same format as `custom-variable-menu'.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
515 WIDGET is the widget to apply the filter entries of MENU on."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
516 (let ((result nil)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
517 current name action filter)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
518 (while menu
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
519 (setq current (car menu)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
520 name (nth 0 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
521 action (nth 1 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
522 filter (nth 2 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
523 menu (cdr menu))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
524 (if (or (null filter) (funcall filter widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
525 (push (cons name action) result)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
526 (push name result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
527 (nreverse result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
528
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
529 ;;; Unlispify.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
530
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
531 (defvar custom-prefix-list nil
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
532 "List of prefixes that should be ignored by `custom-unlispify'.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
533
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
534 (defcustom custom-unlispify-menu-entries t
73643
b99336492688 (custom-unlispify-menu-entries, custom-unlispify-tag-names,
Juanma Barranquero <lekktu@gmail.com>
parents: 73194
diff changeset
535 "Display menu entries as words instead of symbols if non-nil."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
536 :group 'custom-menu
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
537 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
538
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
539 (defcustom custom-unlispify-remove-prefixes nil
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
540 "Non-nil means remove group prefixes from option names in buffer."
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
541 :group 'custom-menu
43508
c092c3c65251 2002-02-24 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43246
diff changeset
542 :group 'custom-buffer
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
543 :type 'boolean)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
544
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
545 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
546 "Convert SYMBOL into a menu entry."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
547 (cond ((not custom-unlispify-menu-entries)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
548 (symbol-name symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
549 ((get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
550 (if no-suffix
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
551 (get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
552 (concat (get symbol 'custom-tag) "...")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
553 (t
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
554 (with-current-buffer (get-buffer-create " *Custom-Work*")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
555 (erase-buffer)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
556 (princ symbol (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
557 (goto-char (point-min))
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
558 ;; FIXME: Boolean variables are not predicates, so they shouldn't
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
559 ;; end with `-p'. -stef
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
560 ;; (when (and (eq (get symbol 'custom-type) 'boolean)
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
561 ;; (re-search-forward "-p\\'" nil t))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
562 ;; (replace-match "" t t)
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
563 ;; (goto-char (point-min)))
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
564 (if custom-unlispify-remove-prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
565 (let ((prefixes custom-prefix-list)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
566 prefix)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
567 (while prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
568 (setq prefix (car prefixes))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
569 (if (search-forward prefix (+ (point) (length prefix)) t)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
570 (progn
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
571 (setq prefixes nil)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
572 (delete-region (point-min) (point)))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
573 (setq prefixes (cdr prefixes))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
574 (subst-char-in-region (point-min) (point-max) ?- ?\ t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
575 (capitalize-region (point-min) (point-max))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
576 (unless no-suffix
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
577 (goto-char (point-max))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
578 (insert "..."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
579 (buffer-string)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
580
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
581 (defcustom custom-unlispify-tag-names t
73643
b99336492688 (custom-unlispify-menu-entries, custom-unlispify-tag-names,
Juanma Barranquero <lekktu@gmail.com>
parents: 73194
diff changeset
582 "Display tag names as words instead of symbols if non-nil."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
583 :group 'custom-buffer
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
584 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
585
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
586 (defun custom-unlispify-tag-name (symbol)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
587 "Convert SYMBOL into a menu entry."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
588 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
589 (custom-unlispify-menu-entry symbol t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
590
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
591 (defun custom-prefix-add (symbol prefixes)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
592 "Add SYMBOL to list of ignored PREFIXES."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
593 (cons (or (get symbol 'custom-prefix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
594 (concat (symbol-name symbol) "-"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
595 prefixes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
596
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
597 ;;; Guess.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
598
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
599 (defcustom custom-guess-name-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
600 '(("-p\\'" boolean)
71368
7c41e181974c (custom-guess-name-alist): Recognize `-flag'.
Richard M. Stallman <rms@gnu.org>
parents: 70179
diff changeset
601 ("-flag\\'" boolean)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
602 ("-hook\\'" hook)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
603 ("-face\\'" face)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
604 ("-file\\'" file)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
605 ("-function\\'" function)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
606 ("-functions\\'" (repeat function))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
607 ("-list\\'" (repeat sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
608 ("-alist\\'" (repeat (cons sexp sexp))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
609 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
610
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
611 MATCH should be a regexp matching the name of a symbol, and TYPE should
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
612 be a widget suitable for editing the value of that symbol. The TYPE
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
613 of the first entry where MATCH matches the name of the symbol will be
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
614 used.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
615
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
616 This is used for guessing the type of variables not declared with
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
617 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
618 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
67983
eea3a49a9d6c * cus-edit.el (custom-guess-name-alist, custom-guess-doc-alist):
Chong Yidong <cyd@stupidchicken.com>
parents: 67977
diff changeset
619 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
620
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
621 (defcustom custom-guess-doc-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
622 '(("\\`\\*?Non-nil " boolean))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
623 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
624
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
625 MATCH should be a regexp matching a documentation string, and TYPE
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
626 should be a widget suitable for editing the value of a variable with
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
627 that documentation string. The TYPE of the first entry where MATCH
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
628 matches the name of the symbol will be used.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
629
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
630 This is used for guessing the type of variables not declared with
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
631 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
632 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
67983
eea3a49a9d6c * cus-edit.el (custom-guess-name-alist, custom-guess-doc-alist):
Chong Yidong <cyd@stupidchicken.com>
parents: 67977
diff changeset
633 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
634
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
635 (defun custom-guess-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
636 "Guess a widget suitable for editing the value of SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
637 This is done by matching SYMBOL with `custom-guess-name-alist' and
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
638 if that fails, the doc string with `custom-guess-doc-alist'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
639 (let ((name (symbol-name symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
640 (names custom-guess-name-alist)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
641 current found)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
642 (while names
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
643 (setq current (car names)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
644 names (cdr names))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
645 (when (string-match (nth 0 current) name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
646 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
647 names nil)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
648 (unless found
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
649 (let ((doc (documentation-property symbol 'variable-documentation))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
650 (docs custom-guess-doc-alist))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
651 (when doc
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
652 (while docs
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
653 (setq current (car docs)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
654 docs (cdr docs))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
655 (when (string-match (nth 0 current) doc)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
656 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
657 docs nil))))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
658 found))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
659
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
660 ;;; Sorting.
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
661
74921
2472ac8d27d2 (custom-browse-sort-alphabetically, custom-buffer-sort-alphabetically)
Richard M. Stallman <rms@gnu.org>
parents: 73942
diff changeset
662 ;;;###autoload
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
663 (defcustom custom-browse-sort-alphabetically nil
74921
2472ac8d27d2 (custom-browse-sort-alphabetically, custom-buffer-sort-alphabetically)
Richard M. Stallman <rms@gnu.org>
parents: 73942
diff changeset
664 "If non-nil, sort customization group alphabetically in `custom-browse'."
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
665 :type 'boolean
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
666 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
667
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
668 (defcustom custom-browse-order-groups nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
669 "If non-nil, order group members within each customization group.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
670 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
671 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
672 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
673 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
674 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
675 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
676
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
677 (defcustom custom-browse-only-groups nil
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
678 "If non-nil, show group members only within each customization group."
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
679 :type 'boolean
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
680 :group 'custom-browse)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
681
74921
2472ac8d27d2 (custom-browse-sort-alphabetically, custom-buffer-sort-alphabetically)
Richard M. Stallman <rms@gnu.org>
parents: 73942
diff changeset
682 ;;;###autoload
65736
d87f6cfbe849 (custom-buffer-sort-alphabetically): Default to nil.
Juri Linkov <juri@jurta.org>
parents: 65680
diff changeset
683 (defcustom custom-buffer-sort-alphabetically nil
74921
2472ac8d27d2 (custom-browse-sort-alphabetically, custom-buffer-sort-alphabetically)
Richard M. Stallman <rms@gnu.org>
parents: 73942
diff changeset
684 "If non-nil, sort each customization group alphabetically in Custom buffer."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
685 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
686 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
687
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
688 (defcustom custom-buffer-order-groups 'last
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
689 "If non-nil, order group members within each customization group.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
690 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
691 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
692 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
693 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
694 (const :tag "none" nil))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
695 :group 'custom-buffer)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
696
74921
2472ac8d27d2 (custom-browse-sort-alphabetically, custom-buffer-sort-alphabetically)
Richard M. Stallman <rms@gnu.org>
parents: 73942
diff changeset
697 ;;;###autoload
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
698 (defcustom custom-menu-sort-alphabetically nil
74921
2472ac8d27d2 (custom-browse-sort-alphabetically, custom-buffer-sort-alphabetically)
Richard M. Stallman <rms@gnu.org>
parents: 73942
diff changeset
699 "If non-nil, sort each customization group alphabetically in menus."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
700 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
701 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
702
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
703 (defcustom custom-menu-order-groups 'first
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
704 "If non-nil, order group members within each customization group.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
705 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
706 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
707 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
708 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
709 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
710 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
711
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
712 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
713
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
714 (defun custom-sort-items (items sort-alphabetically order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
715 "Return a sorted copy of ITEMS.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
716 ITEMS should be a `custom-group' property.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
717 If SORT-ALPHABETICALLY non-nil, sort alphabetically.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
718 If ORDER-GROUPS is `first' order groups before non-groups, if `last' order
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
719 groups after non-groups, if nil do not order groups at all."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
720 (sort (copy-sequence items)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
721 (lambda (a b)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
722 (let ((typea (nth 1 a)) (typeb (nth 1 b))
28568
cfff869d8a3d (custom-sort-items): Avoid symbol-name with new
Dave Love <fx@gnu.org>
parents: 28310
diff changeset
723 (namea (nth 0 a)) (nameb (nth 0 b)))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
724 (cond ((not order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
725 ;; Since we don't care about A and B order, maybe sort.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
726 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
727 (string-lessp namea nameb)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
728 ((eq typea 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
729 ;; If B is also a group, maybe sort. Otherwise, order A and B.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
730 (if (eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
731 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
732 (string-lessp namea nameb))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
733 (eq order-groups 'first)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
734 ((eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
735 ;; Since A cannot be a group, order A and B.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
736 (eq order-groups 'last))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
737 (sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
738 ;; Since A and B cannot be groups, sort.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
739 (string-lessp namea nameb)))))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
740
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
741 ;;; Custom Mode Commands.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
742
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
743 ;; This variable is used by `custom-tool-bar-map', or directly by
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
744 ;; `custom-buffer-create-internal' if the toolbar is not present and
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
745 ;; `custom-buffer-verbose-help' is non-nil.
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
746
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
747 (defvar custom-commands
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
748 '(("Set for current session" Custom-set t
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
749 "Apply all settings in this buffer to the current session"
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
750 "index")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
751 ("Save for future sessions" Custom-save
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
752 (or custom-file user-init-file)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
753 "Apply all settings in this buffer and save them for future Emacs sessions."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
754 "save")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
755 ("Undo edits" Custom-reset-current t
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
756 "Restore all settings in this buffer to reflect their current values."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
757 "refresh")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
758 ("Reset to saved" Custom-reset-saved t
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
759 "Restore all settings in this buffer to their saved values (if any)."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
760 "undo")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
761 ("Erase customizations" Custom-reset-standard
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
762 (or custom-file user-init-file)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
763 "Un-customize all settings in this buffer and save them with standard values."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
764 "delete")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
765 ("Help for Customize" Custom-help t
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
766 "Get help for using Customize."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
767 "help")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
768 ("Exit" Custom-buffer-done t "Exit Customize." "exit")))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
769
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
770 (defun Custom-help ()
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
771 "Read the node on Easy Customization in the Emacs manual."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
772 (interactive)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
773 (info "(emacs)Easy Customization"))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
774
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
775 (defvar custom-reset-menu
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
776 '(("Undo Edits" . Custom-reset-current)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
777 ("Reset to Saved" . Custom-reset-saved)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
778 ("Erase Customizations (use standard values)" . Custom-reset-standard))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
779 "Alist of actions for the `Reset' button.
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
780 The key is a string containing the name of the action, the value is a
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
781 Lisp function taking the widget as an element which will be called
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
782 when the action is chosen.")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
783
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
784 (defvar custom-options nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
785 "Customization widgets in the current buffer.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
786
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
787 (defun custom-command-apply (fun query &optional strong-query)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
788 "Call function FUN on all widgets in `custom-options'.
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
789 If there is more than one widget, ask user for confirmation using
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
790 the query string QUERY, using `y-or-n-p' if STRONG-QUERY is nil,
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
791 and `yes-or-no-p' otherwise."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
792 (if (or (and (= 1 (length custom-options))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
793 (memq (widget-type (car custom-options))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
794 '(custom-variable custom-face)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
795 (funcall (if strong-query 'yes-or-no-p 'y-or-n-p) query))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
796 (progn (mapc fun custom-options) t)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
797 (message "Aborted")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
798 nil))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
799
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
800 (defun Custom-set (&rest ignore)
68086
742bf2516c24 (Custom-set, Custom-save): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 68028
diff changeset
801 "Set the current value of all edited settings in the buffer."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
802 (interactive)
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
803 (custom-command-apply
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
804 (lambda (child)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
805 (when (eq (widget-get child :custom-state) 'modified)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
806 (widget-apply child :custom-set)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
807 "Set all values according to this buffer? "))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
808
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
809 (defun Custom-save (&rest ignore)
68086
742bf2516c24 (Custom-set, Custom-save): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 68028
diff changeset
810 "Set all edited settings, then save all settings that have been set.
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
811 If a setting was edited and set before, this saves it. If a
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
812 setting was merely edited before, this sets it then saves it."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
813 (interactive)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
814 (when (custom-command-apply
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
815 (lambda (child)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
816 (when (memq (widget-get child :custom-state)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
817 '(modified set changed rogue))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
818 (widget-apply child :custom-mark-to-save)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
819 "Save all settings in this buffer? " t)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
820 ;; Save changes to buffer and redraw.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
821 (custom-save-all)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
822 (dolist (child custom-options)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
823 (widget-apply child :custom-state-set-and-redraw))))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
824
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
825 (defun custom-reset (widget &optional event)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
826 "Select item from reset menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
827 (let* ((completion-ignore-case t)
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
828 (answer (widget-choose "Reset settings"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
829 custom-reset-menu
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
830 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
831 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
832 (funcall answer))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
833
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
834 (defun Custom-reset-current (&rest ignore)
68086
742bf2516c24 (Custom-set, Custom-save): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 68028
diff changeset
835 "Reset all edited settings in the buffer to show their current values."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
836 (interactive)
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
837 (custom-command-apply
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
838 (lambda (widget)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
839 (if (memq (widget-get widget :custom-state) '(modified changed))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
840 (widget-apply widget :custom-reset-current)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
841 "Reset all settings' buffer text to show current values? "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
842
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
843 (defun Custom-reset-saved (&rest ignore)
68086
742bf2516c24 (Custom-set, Custom-save): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 68028
diff changeset
844 "Reset all edited or set settings in the buffer to their saved value.
742bf2516c24 (Custom-set, Custom-save): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 68028
diff changeset
845 This also shows the saved values in the buffer."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
846 (interactive)
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
847 (custom-command-apply
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
848 (lambda (widget)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
849 (if (memq (widget-get widget :custom-state) '(modified set changed rogue))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
850 (widget-apply widget :custom-reset-saved)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
851 "Reset all settings (current values and buffer text) to saved values? "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
852
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
853 ;; The next two variables are bound to '(t) by `Custom-reset-standard'
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
854 ;; and `custom-group-reset-standard'. If these variables are nil, both
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
855 ;; `custom-variable-reset-standard' and `custom-face-reset-standard'
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
856 ;; save, reset and redraw the handled widget immediately. Otherwise,
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
857 ;; they add the widget to the corresponding list and leave it to
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
858 ;; `custom-reset-standard-save-and-update' to save, reset and redraw it.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
859 (defvar custom-reset-standard-variables-list nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
860 (defvar custom-reset-standard-faces-list nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
861
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
862 ;; The next function was excerpted from `custom-variable-reset-standard'
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
863 ;; and `custom-face-reset-standard' and is used to avoid calling
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
864 ;; `custom-save-all' repeatedly (and thus saving settings to file one by
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
865 ;; one) when erasing all customizations.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
866 (defun custom-reset-standard-save-and-update ()
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
867 "Save settings and redraw after erasing customizations."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
868 (when (or (and custom-reset-standard-variables-list
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
869 (not (eq custom-reset-standard-variables-list '(t))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
870 (and custom-reset-standard-faces-list
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
871 (not (eq custom-reset-standard-faces-list '(t)))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
872 ;; Save settings to file.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
873 (custom-save-all)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
874 ;; Set state of and redraw variables.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
875 (dolist (widget custom-reset-standard-variables-list)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
876 (unless (eq widget t)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
877 (widget-put widget :custom-state 'unknown)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
878 (custom-redraw widget)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
879 ;; Set state of and redraw faces.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
880 (dolist (widget custom-reset-standard-faces-list)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
881 (unless (eq widget t)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
882 (let* ((symbol (widget-value widget))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
883 (child (car (widget-get widget :children)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
884 (value (get symbol 'face-defface-spec))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
885 (comment-widget (widget-get widget :comment-widget)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
886 (put symbol 'face-comment nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
887 (widget-value-set child
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
888 (custom-pre-filter-face-spec
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
889 (list (list t (custom-face-attributes-get
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
890 symbol nil)))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
891 ;; This call manages the comment visibility
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
892 (widget-value-set comment-widget "")
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
893 (custom-face-state-set widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
894 (custom-redraw-magic widget))))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
895
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
896 (defun Custom-reset-standard (&rest ignore)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
897 "Erase all customizations (either current or saved) in current buffer.
67749
1607dd4159f5 (custom-reset-menu, custom-magic-alist, Custom-mode-menu):
Richard M. Stallman <rms@gnu.org>
parents: 67747
diff changeset
898 The immediate result is to restore them to their standard values.
1607dd4159f5 (custom-reset-menu, custom-magic-alist, Custom-mode-menu):
Richard M. Stallman <rms@gnu.org>
parents: 67747
diff changeset
899 This operation eliminates any saved values for the group members,
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
900 making them as if they had never been customized at all."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
901 (interactive)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
902 ;; Bind these temporarily.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
903 (let ((custom-reset-standard-variables-list '(t))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
904 (custom-reset-standard-faces-list '(t)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
905 (custom-command-apply
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
906 (lambda (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
907 (and (or (null (widget-get widget :custom-standard-value))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
908 (widget-apply widget :custom-standard-value))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
909 (memq (widget-get widget :custom-state)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
910 '(modified set changed saved rogue))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
911 (widget-apply widget :custom-mark-to-reset-standard)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
912 "Erase all customizations for settings in this buffer? " t)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
913 (custom-reset-standard-save-and-update)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
914
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
915 ;;; The Customize Commands
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
916
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
917 (defun custom-prompt-variable (prompt-var prompt-val &optional comment)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
918 "Prompt for a variable and a value and return them as a list.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
919 PROMPT-VAR is the prompt for the variable, and PROMPT-VAL is the
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
920 prompt for the value. The %s escape in PROMPT-VAL is replaced with
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
921 the name of the variable.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
922
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
923 If the variable has a `variable-interactive' property, that is used as if
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
924 it were the arg to `interactive' (which see) to interactively read the value.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
925
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
926 If the variable has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
927 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
928
73643
b99336492688 (custom-unlispify-menu-entries, custom-unlispify-tag-names,
Juanma Barranquero <lekktu@gmail.com>
parents: 73194
diff changeset
929 If optional COMMENT argument is non-nil, also prompt for a comment and return
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
930 it as the third element in the list."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
931 (let* ((var (read-variable prompt-var))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
932 (minibuffer-help-form '(describe-variable var))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
933 (val
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
934 (let ((prop (get var 'variable-interactive))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
935 (type (get var 'custom-type))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
936 (prompt (format prompt-val var)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
937 (unless (listp type)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
938 (setq type (list type)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
939 (cond (prop
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
940 ;; Use VAR's `variable-interactive' property
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
941 ;; as an interactive spec for prompting.
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
942 (call-interactively `(lambda (arg)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
943 (interactive ,prop)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
944 arg)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
945 (type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
946 (widget-prompt-value type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
947 prompt
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
948 (if (boundp var)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
949 (symbol-value var))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
950 (not (boundp var))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
951 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
952 (eval-minibuffer prompt))))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
953 (if comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
954 (list var val
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
955 (read-string "Comment: " (get var 'variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
956 (list var val))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
957
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
958 ;;;###autoload
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
959 (defun customize-set-value (variable value &optional comment)
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
960 "Set VARIABLE to VALUE, and return VALUE. VALUE is a Lisp object.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
961
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
962 If VARIABLE has a `variable-interactive' property, that is used as if
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
963 it were the arg to `interactive' (which see) to interactively read the value.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
964
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
965 If VARIABLE has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
966 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
967
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
968 If given a prefix (or a COMMENT argument), also prompt for a comment."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
969 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
970 "Set %s to value: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
971 current-prefix-arg))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
972
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
973 (cond ((string= comment "")
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
974 (put variable 'variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
975 (comment
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
976 (put variable 'variable-comment comment)))
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
977 (set variable value))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
978
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
979 ;;;###autoload
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
980 (defun customize-set-variable (variable value &optional comment)
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
981 "Set the default for VARIABLE to VALUE, and return VALUE.
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
982 VALUE is a Lisp object.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
983
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
984 If VARIABLE has a `custom-set' property, that is used for setting
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
985 VARIABLE, otherwise `set-default' is used.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
986
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
987 If VARIABLE has a `variable-interactive' property, that is used as if
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
988 it were the arg to `interactive' (which see) to interactively read the value.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
989
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
990 If VARIABLE has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
991 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
992
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
993 If given a prefix (or a COMMENT argument), also prompt for a comment."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
994 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
995 "Set customized value for %s to: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
996 current-prefix-arg))
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
997 (custom-load-symbol variable)
69007
b9e2a1b4b54a * cus-edit.el (customize-set-variable): Push setting to `user' theme.
Chong Yidong <cyd@stupidchicken.com>
parents: 69004
diff changeset
998 (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
999 (funcall (or (get variable 'custom-set) 'set-default) variable value)
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1000 (put variable 'customized-value (list (custom-quote value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1001 (cond ((string= comment "")
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1002 (put variable 'variable-comment nil)
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1003 (put variable 'customized-variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1004 (comment
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1005 (put variable 'variable-comment comment)
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
1006 (put variable 'customized-variable-comment comment)))
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
1007 value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1008
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1009 ;;;###autoload
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1010 (defun customize-save-variable (variable value &optional comment)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1011 "Set the default for VARIABLE to VALUE, and save it for future sessions.
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
1012 Return VALUE.
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
1013
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1014 If VARIABLE has a `custom-set' property, that is used for setting
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1015 VARIABLE, otherwise `set-default' is used.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1016
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1017 If VARIABLE has a `variable-interactive' property, that is used as if
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1018 it were the arg to `interactive' (which see) to interactively read the value.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1019
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1020 If VARIABLE has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1021 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1022
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1023 If given a prefix (or a COMMENT argument), also prompt for a comment."
43063
9f236506400a Fix typo in prompt.
Pavel Janík <Pavel@Janik.cz>
parents: 42930
diff changeset
1024 (interactive (custom-prompt-variable "Set and save variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1025 "Set and save value for %s as: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1026 current-prefix-arg))
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1027 (funcall (or (get variable 'custom-set) 'set-default) variable value)
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1028 (put variable 'saved-value (list (custom-quote value)))
67797
7bdbb812b2f9 * custom.el (custom-push-theme): Fix docstring.
Chong Yidong <cyd@stupidchicken.com>
parents: 67793
diff changeset
1029 (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1030 (cond ((string= comment "")
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1031 (put variable 'variable-comment nil)
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1032 (put variable 'saved-variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1033 (comment
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1034 (put variable 'variable-comment comment)
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
1035 (put variable 'saved-variable-comment comment)))
76338
12695d523f37 (customize-save-variable): Clear customized-value property (saved
Chong Yidong <cyd@stupidchicken.com>
parents: 76100
diff changeset
1036 (put variable 'customized-value nil)
12695d523f37 (customize-save-variable): Clear customized-value property (saved
Chong Yidong <cyd@stupidchicken.com>
parents: 76100
diff changeset
1037 (put variable 'customized-variable-comment nil)
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
1038 (custom-save-all)
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
1039 value)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1040
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1041 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1042 (defun customize ()
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1043 "Select a customization buffer which you can use to set user options.
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1044 User options are structured into \"groups\".
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1045 Initially the top-level group `Emacs' and its immediate subgroups
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1046 are shown; the contents of those subgroups are initially hidden."
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1047 (interactive)
17703
cd6ad557fb57 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17702
diff changeset
1048 (customize-group 'emacs))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1049
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1050 ;;;###autoload
47823
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1051 (defun customize-mode (mode)
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1052 "Customize options related to the current major mode.
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1053 If a prefix \\[universal-argument] was given (or if the current major mode has no known group),
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1054 then prompt for the MODE to customize."
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1055 (interactive
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1056 (list
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1057 (let ((completion-regexp-list '("-mode\\'"))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1058 (group (custom-group-of-mode major-mode)))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1059 (if (and group (not current-prefix-arg))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1060 major-mode
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1061 (intern
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1062 (completing-read (if group
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1063 (format "Major mode (default %s): " major-mode)
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1064 "Major mode: ")
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1065 obarray
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1066 'custom-group-of-mode
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1067 t nil nil (if group (symbol-name major-mode))))))))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1068 (customize-group (custom-group-of-mode mode)))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1069
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1070 (defun customize-read-group ()
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1071 (let ((completion-ignore-case t))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1072 (completing-read "Customize group (default emacs): "
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1073 obarray
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1074 (lambda (symbol)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1075 (or (and (get symbol 'custom-loads)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1076 (not (get symbol 'custom-autoload)))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1077 (get symbol 'custom-group)))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1078 t)))
47823
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1079
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
1080 ;;;###autoload
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1081 (defun customize-group (&optional group)
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1082 "Customize GROUP, which must be a customization group."
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1083 (interactive (list (customize-read-group)))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1084 (when (stringp group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1085 (if (string-equal "" group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1086 (setq group 'emacs)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1087 (setq group (intern group))))
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
1088 (let ((name (format "*Customize Group: %s*"
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
1089 (custom-unlispify-tag-name group))))
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
1090 (if (get-buffer name)
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1091 (pop-to-buffer name)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1092 (custom-buffer-create
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1093 (list (list group 'custom-group))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1094 name
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1095 (concat " for group "
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1096 (custom-unlispify-tag-name group))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1097
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1098 ;;;###autoload
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1099 (defun customize-group-other-window (&optional group)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1100 "Customize GROUP, which must be a customization group, in another window."
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1101 (interactive (list (customize-read-group)))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1102 (let ((pop-up-windows t)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1103 (same-window-buffer-names nil)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1104 (same-window-regexps nil))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1105 (customize-group group)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1106
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1107 ;;;###autoload
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1108 (defalias 'customize-variable 'customize-option)
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1109
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1110 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1111 (defun customize-option (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1112 "Customize SYMBOL, which must be a user option variable."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1113 (interactive (custom-variable-prompt))
71390
927d95604b99 (customize-option, customize-option-other-window): Error if SYMBOL is nil.
Richard M. Stallman <rms@gnu.org>
parents: 71368
diff changeset
1114 (unless symbol
927d95604b99 (customize-option, customize-option-other-window): Error if SYMBOL is nil.
Richard M. Stallman <rms@gnu.org>
parents: 71368
diff changeset
1115 (error "No variable specified"))
64151
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1116 (let ((basevar (indirect-variable symbol)))
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1117 (custom-buffer-create (list (list basevar 'custom-variable))
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1118 (format "*Customize Option: %s*"
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1119 (custom-unlispify-tag-name basevar)))
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1120 (unless (eq symbol basevar)
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1121 (message "`%s' is an alias for `%s'" symbol basevar))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1122
48975
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1123 ;;;###autoload
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1124 (defalias 'customize-variable-other-window 'customize-option-other-window)
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1125
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1126 ;;;###autoload
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1127 (defun customize-option-other-window (symbol)
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1128 "Customize SYMBOL, which must be a user option variable.
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1129 Show the buffer in another window, but don't select it."
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1130 (interactive (custom-variable-prompt))
71390
927d95604b99 (customize-option, customize-option-other-window): Error if SYMBOL is nil.
Richard M. Stallman <rms@gnu.org>
parents: 71368
diff changeset
1131 (unless symbol
927d95604b99 (customize-option, customize-option-other-window): Error if SYMBOL is nil.
Richard M. Stallman <rms@gnu.org>
parents: 71368
diff changeset
1132 (error "No variable specified"))
64151
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1133 (let ((basevar (indirect-variable symbol)))
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1134 (custom-buffer-create-other-window
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1135 (list (list basevar 'custom-variable))
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1136 (format "*Customize Option: %s*" (custom-unlispify-tag-name basevar)))
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1137 (unless (eq symbol basevar)
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1138 (message "`%s' is an alias for `%s'" symbol basevar))))
48975
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1139
67747
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1140 (defvar customize-changed-options-previous-release "21.1"
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1141 "Version for `customize-changed-options' to refer back to by default.")
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1142
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1143 ;; Packages will update this variable, so make it available.
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1144 ;;;###autoload
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1145 (defvar customize-package-emacs-version-alist nil
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1146 "Alist mapping versions of a package to Emacs versions.
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1147 We use this for packages that have their own names, but are released
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1148 as part of Emacs itself.
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1150 Each elements looks like this:
70021
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1151
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1152 (PACKAGE (PVERSION . EVERSION)...)
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1153
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1154 Here PACKAGE is the name of a package, as a symbol. After
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1155 PACKAGE come one or more elements, each associating a
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1156 package version PVERSION with the first Emacs version
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1157 EVERSION in which it (or a subsequent version of PACKAGE)
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1158 was first released. Both PVERSION and EVERSION are strings.
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1159 PVERSION should be a string that this package used in
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1160 the :package-version keyword for `defcustom', `defgroup',
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1161 and `defface'.
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1162
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1163 For example, the MH-E package updates this alist as follows:
70021
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1164
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1165 (add-to-list 'customize-package-emacs-version-alist
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1166 '(MH-E (\"6.0\" . \"22.1\") (\"6.1\" . \"22.1\")
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1167 (\"7.0\" . \"22.1\") (\"7.1\" . \"22.1\")
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1168 (\"7.2\" . \"22.1\") (\"7.3\" . \"22.1\")
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1169 (\"7.4\" . \"22.1\") (\"8.0\" . \"22.1\")))
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1170
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1171 The value of PACKAGE needs to be unique and it needs to match the
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1172 PACKAGE value appearing in the :package-version keyword. Since
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1173 the user might see the value in a error message, a good choice is
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1174 the official name of the package, such as MH-E or Gnus.")
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1175
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1176 ;;;###autoload
67747
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1177 (defalias 'customize-changed 'customize-changed-options)
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1178
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1179 ;;;###autoload
79190
afa7fa1e71f4 (customize-changed-options): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 79040
diff changeset
1180 (defun customize-changed-options (&optional since-version)
67747
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1181 "Customize all settings whose meanings have changed in Emacs itself.
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1182 This includes new user option variables and faces, and new
67747
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1183 customization groups, as well as older options and faces whose meanings
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1184 or default values have changed since the previous major Emacs release.
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1185
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1186 With argument SINCE-VERSION (a string), customize all settings
3b325979ccee (customize-changed-options-previous-release): Prev release is 21.1.
Richard M. Stallman <rms@gnu.org>
parents: 67745
diff changeset
1187 that were added or redefined since that version."
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1188
69540
a22167168ac4 (customize-changed-options): Mention explicit version number as
Luc Teirlinck <teirllm@auburn.edu>
parents: 69268
diff changeset
1189 (interactive
a22167168ac4 (customize-changed-options): Mention explicit version number as
Luc Teirlinck <teirllm@auburn.edu>
parents: 69268
diff changeset
1190 (list
a22167168ac4 (customize-changed-options): Mention explicit version number as
Luc Teirlinck <teirllm@auburn.edu>
parents: 69268
diff changeset
1191 (read-from-minibuffer
a22167168ac4 (customize-changed-options): Mention explicit version number as
Luc Teirlinck <teirllm@auburn.edu>
parents: 69268
diff changeset
1192 (format "Customize options changed, since version (default %s): "
a22167168ac4 (customize-changed-options): Mention explicit version number as
Luc Teirlinck <teirllm@auburn.edu>
parents: 69268
diff changeset
1193 customize-changed-options-previous-release))))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1194 (if (equal since-version "")
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1195 (setq since-version nil)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1196 (unless (condition-case nil
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1197 (numberp (read since-version))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1198 (error nil))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1199 (signal 'wrong-type-argument (list 'numberp since-version))))
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1200 (unless since-version
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1201 (setq since-version customize-changed-options-previous-release))
49218
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1202
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1203 ;; Load the information for versions since since-version. We use
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1204 ;; custom-load-symbol for this.
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1205 (put 'custom-versions-load-alist 'custom-loads nil)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1206 (dolist (elt custom-versions-load-alist)
49300
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
1207 (if (customize-version-lessp since-version (car elt))
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
1208 (dolist (load (cdr elt))
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
1209 (custom-add-load 'custom-versions-load-alist load))))
49218
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1210 (custom-load-symbol 'custom-versions-load-alist)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1211 (put 'custom-versions-load-alist 'custom-loads nil)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1212
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1213 (let (found)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1214 (mapatoms
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1215 (lambda (symbol)
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1216 (let* ((package-version (get symbol 'custom-package-version))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1217 (version
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1218 (or (and package-version
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1219 (customize-package-emacs-version symbol
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1220 package-version))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1221 (get symbol 'custom-version))))
49218
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1222 (if version
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1223 (when (customize-version-lessp since-version version)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1224 (if (or (get symbol 'custom-group)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1225 (get symbol 'group-documentation))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1226 (push (list symbol 'custom-group) found))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1227 (if (custom-variable-p symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1228 (push (list symbol 'custom-variable) found))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1229 (if (custom-facep symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1230 (push (list symbol 'custom-face) found)))))))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1231 (if found
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1232 (custom-buffer-create (custom-sort-items found t 'first)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1233 "*Customize Changed Options*")
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1234 (error "No user option defaults have been changed since Emacs %s"
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1235 since-version))))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1236
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1237 (defun customize-package-emacs-version (symbol package-version)
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1238 "Return the Emacs version in which SYMBOL's meaning last changed.
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1239 PACKAGE-VERSION has the form (PACKAGE . VERSION). We use
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1240 `customize-package-emacs-version-alist' to find the version of
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1241 Emacs that is associated with version VERSION of PACKAGE."
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1242 (let (package-versions emacs-version)
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1243 ;; Use message instead of error since we want user to be able to
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1244 ;; see the rest of the symbols even if a package author has
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1245 ;; botched things up.
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1246 (cond ((not (listp package-version))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1247 (message "Invalid package-version value for %s" symbol))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1248 ((setq package-versions (assq (car package-version)
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1249 customize-package-emacs-version-alist))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1250 (setq emacs-version
70021
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1251 (cdr (assoc (cdr package-version) package-versions)))
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1252 (unless emacs-version
70021
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1253 (message "%s version %s not found in %s" symbol
8991a6461375 * cus-edit.el (customize-package-emacs-version-alist): Update
Bill Wohler <wohler@newt.com>
parents: 69922
diff changeset
1254 (cdr package-version)
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1255 "customize-package-emacs-version-alist")))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1256 (t
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1257 (message "Package %s version %s lists no corresponding Emacs version"
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1258 (car package-version)
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
1259 (cdr package-version))))
69922
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1260 emacs-version))
dc1f0ab7e276 * custom.el (defcustom, custom-handle-keyword): Add :package-version
Bill Wohler <wohler@newt.com>
parents: 69624
diff changeset
1261
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1262 (defun customize-version-lessp (version1 version2)
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1263 ;; Why are the versions strings, and given that they are, why aren't
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1264 ;; they converted to numbers and compared as such here? -- fx
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1265
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1266 ;; In case someone made a mistake and left out the quotes
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1267 ;; in the :version value.
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1268 (if (numberp version2)
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1269 (setq version2 (prin1-to-string version2)))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1270 (let (major1 major2 minor1 minor2)
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1271 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1272 (setq major1 (read (or (match-string 1 version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1273 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1274 (setq minor1 (read (or (match-string 3 version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1275 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1276 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1277 (setq major2 (read (or (match-string 1 version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1278 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1279 (setq minor2 (read (or (match-string 3 version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1280 "0")))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1281 (or (< major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1282 (and (= major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1283 (< minor1 minor2)))))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
1284
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1285 ;;;###autoload
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1286 (defun customize-face (&optional face)
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
1287 "Customize FACE, which should be a face name or nil.
63661
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1288 If FACE is nil, customize all faces. If FACE is actually a
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1289 face-alias, customize the face it is aliased to.
44841
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1290
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1291 Interactively, when point is on text which has a face specified,
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
1292 suggest to customize that face, if it's customizable."
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1293 (interactive (list (read-face-name "Customize face" "all faces" t)))
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1294 (if (member face '(nil ""))
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1295 (setq face (face-list)))
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1296 (if (and (listp face) (null (cdr face)))
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1297 (setq face (car face)))
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1298 (if (listp face)
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1299 (custom-buffer-create
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1300 (custom-sort-items
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1301 (mapcar (lambda (s) (list s 'custom-face)) face)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1302 t nil)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1303 "*Customize Faces*")
63661
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1304 ;; If FACE is actually an alias, customize the face it is aliased to.
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1305 (if (get face 'face-alias)
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1306 (setq face (get face 'face-alias)))
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1307 (unless (facep face)
49013
4a3d5b9c79b9 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48997
diff changeset
1308 (error "Invalid face %S" face))
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1309 (custom-buffer-create
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1310 (list (list face 'custom-face))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1311 (format "*Customize Face: %s*"
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1312 (custom-unlispify-tag-name face)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1313
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1314 ;;;###autoload
44891
5d2dc0b4fd2f Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 44888
diff changeset
1315 (defun customize-face-other-window (&optional face)
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
1316 "Show customization buffer for face FACE in other window.
63661
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1317 If FACE is actually a face-alias, customize the face it is aliased to.
44841
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1318
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1319 Interactively, when point is on text which has a face specified,
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
1320 suggest to customize that face, if it's customizable."
82193
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1321 (interactive (list (read-face-name "Customize face" "all faces" t)))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1322 (let ((pop-up-windows t)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1323 (same-window-buffer-names nil)
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1324 (same-window-regexps nil))
6037be8575c3 (customize-read-group): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1325 (customize-face face)))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1326
75046
b644db4759fa (customize-unsaved): Renamed from customize-customized.
Richard M. Stallman <rms@gnu.org>
parents: 74921
diff changeset
1327 (defalias 'customize-customized 'customize-unsaved)
b644db4759fa (customize-unsaved): Renamed from customize-customized.
Richard M. Stallman <rms@gnu.org>
parents: 74921
diff changeset
1328
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1329 ;;;###autoload
75046
b644db4759fa (customize-unsaved): Renamed from customize-customized.
Richard M. Stallman <rms@gnu.org>
parents: 74921
diff changeset
1330 (defun customize-unsaved ()
b644db4759fa (customize-unsaved): Renamed from customize-customized.
Richard M. Stallman <rms@gnu.org>
parents: 74921
diff changeset
1331 "Customize all user options set in this session but not saved."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1332 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1333 (let ((found nil))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1334 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1335 (and (or (get symbol 'customized-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1336 (get symbol 'customized-face-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1337 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1338 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1339 (and (or (get symbol 'customized-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1340 (get symbol 'customized-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1341 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1342 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1343 (if (not found)
75046
b644db4759fa (customize-unsaved): Renamed from customize-customized.
Richard M. Stallman <rms@gnu.org>
parents: 74921
diff changeset
1344 (error "No user options are set but unsaved")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1345 (custom-buffer-create (custom-sort-items found t nil)
75046
b644db4759fa (customize-unsaved): Renamed from customize-customized.
Richard M. Stallman <rms@gnu.org>
parents: 74921
diff changeset
1346 "*Customize Unsaved*"))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1347
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1348 ;;;###autoload
50077
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1349 (defun customize-rogue ()
68232
4580b1bedd8a (customize-rogue): Minor doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 68194
diff changeset
1350 "Customize all user variables modified outside customize."
50077
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1351 (interactive)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1352 (let ((found nil))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1353 (mapatoms (lambda (symbol)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1354 (let ((cval (or (get symbol 'customized-value)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1355 (get symbol 'saved-value)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1356 (get symbol 'standard-value))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1357 (when (and cval ;Declared with defcustom.
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1358 (default-boundp symbol) ;Has a value.
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
1359 (not (equal (eval (car cval))
50077
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1360 ;; Which does not match customize.
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1361 (default-value symbol))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1362 (push (list symbol 'custom-variable) found)))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1363 (if (not found)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1364 (error "No rogue user options")
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1365 (custom-buffer-create (custom-sort-items found t nil)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1366 "*Customize Rogue*"))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1367 ;;;###autoload
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1368 (defun customize-saved ()
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1369 "Customize all already saved user options."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1370 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1371 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1372 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1373 (and (or (get symbol 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1374 (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1375 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1376 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1377 (and (or (get symbol 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1378 (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1379 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1380 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1381 (if (not found )
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1382 (error "No saved user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1383 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1384 "*Customize Saved*"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1385
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1386 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1387 (defun customize-apropos (regexp &optional all)
67549
9732906a9ef7 (customize-apropos, customize-apropos-options)
Luc Teirlinck <teirllm@auburn.edu>
parents: 67510
diff changeset
1388 "Customize all loaded options, faces and groups matching REGEXP.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1389 If ALL is `options', include only options.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1390 If ALL is `faces', include only faces.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1391 If ALL is `groups', include only groups.
67510
984ab2cd1b98 (customize-apropos): Avoid listing an option more than once under
Luc Teirlinck <teirllm@auburn.edu>
parents: 67413
diff changeset
1392 If ALL is t (interactively, with prefix arg), include variables
67677
acbc5122c634 (customize-apropos, customize-apropos-options): Docstring changes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67660
diff changeset
1393 that are not customizable options, as well as faces and groups
acbc5122c634 (customize-apropos, customize-apropos-options): Docstring changes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67660
diff changeset
1394 \(but we recommend using `apropos-variable' instead)."
78394
ec3c22479e73 (customize-apropos, customize-apropos-options)
Richard M. Stallman <rms@gnu.org>
parents: 78377
diff changeset
1395 (interactive "sCustomize (regexp): \nP")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1396 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1397 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1398 (when (string-match regexp (symbol-name symbol))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1399 (when (and (not (memq all '(faces options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1400 (get symbol 'custom-group))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1401 (push (list symbol 'custom-group) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1402 (when (and (not (memq all '(options groups)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1403 (custom-facep symbol))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1404 (push (list symbol 'custom-face) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1405 (when (and (not (memq all '(groups faces)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1406 (boundp symbol)
67510
984ab2cd1b98 (customize-apropos): Avoid listing an option more than once under
Luc Teirlinck <teirllm@auburn.edu>
parents: 67413
diff changeset
1407 (eq (indirect-variable symbol) symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1408 (or (get symbol 'saved-value)
49104
b74a6560ecbb (custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49013
diff changeset
1409 (custom-variable-p symbol)
67510
984ab2cd1b98 (customize-apropos): Avoid listing an option more than once under
Luc Teirlinck <teirllm@auburn.edu>
parents: 67413
diff changeset
1410 (and (not (memq all '(nil options)))
984ab2cd1b98 (customize-apropos): Avoid listing an option more than once under
Luc Teirlinck <teirllm@auburn.edu>
parents: 67413
diff changeset
1411 (get symbol 'variable-documentation))))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1412 (push (list symbol 'custom-variable) found)))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1413 (if (not found)
82244
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1414 (error "No %s matching %s"
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1415 (if (eq all t)
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1416 "items"
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1417 (format "customizable %s"
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1418 (if (memq all '(options faces groups))
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1419 (symbol-name all)
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1420 "items")))
9928f84fd32b (customize-apropos): Make the error message indicate what kind of
Glenn Morris <rgm@gnu.org>
parents: 82225
diff changeset
1421 regexp)
71438
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
1422 (custom-buffer-create
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
1423 (custom-sort-items found t custom-buffer-order-groups)
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
1424 "*Customize Apropos*"))))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1425
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1426 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1427 (defun customize-apropos-options (regexp &optional arg)
67549
9732906a9ef7 (customize-apropos, customize-apropos-options)
Luc Teirlinck <teirllm@auburn.edu>
parents: 67510
diff changeset
1428 "Customize all loaded customizable options matching REGEXP.
67677
acbc5122c634 (customize-apropos, customize-apropos-options): Docstring changes.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67660
diff changeset
1429 With prefix arg, include variables that are not customizable options
79655
4feb30a8db36 (custom-add-parent-links): Fill the "Parent documentation" text.
Richard M. Stallman <rms@gnu.org>
parents: 79190
diff changeset
1430 \(but it is better to use `apropos-variable' if you want to find those)."
78394
ec3c22479e73 (customize-apropos, customize-apropos-options)
Richard M. Stallman <rms@gnu.org>
parents: 78377
diff changeset
1431 (interactive "sCustomize options (regexp): \nP")
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1432 (customize-apropos regexp (or arg 'options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1433
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1434 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1435 (defun customize-apropos-faces (regexp)
67549
9732906a9ef7 (customize-apropos, customize-apropos-options)
Luc Teirlinck <teirllm@auburn.edu>
parents: 67510
diff changeset
1436 "Customize all loaded faces matching REGEXP."
78394
ec3c22479e73 (customize-apropos, customize-apropos-options)
Richard M. Stallman <rms@gnu.org>
parents: 78377
diff changeset
1437 (interactive "sCustomize faces (regexp): \n")
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1438 (customize-apropos regexp 'faces))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1439
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1440 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1441 (defun customize-apropos-groups (regexp)
67549
9732906a9ef7 (customize-apropos, customize-apropos-options)
Luc Teirlinck <teirllm@auburn.edu>
parents: 67510
diff changeset
1442 "Customize all loaded groups matching REGEXP."
78394
ec3c22479e73 (customize-apropos, customize-apropos-options)
Richard M. Stallman <rms@gnu.org>
parents: 78377
diff changeset
1443 (interactive "sCustomize groups (regexp): \n")
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1444 (customize-apropos regexp 'groups))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1445
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1446 ;;; Buffer.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1447
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1448 (defcustom custom-buffer-style 'links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1449 "Control the presentation style for customization buffers.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1450 The value should be a symbol, one of:
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1451
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1452 brackets: groups nest within each other with big horizontal brackets.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1453 links: groups have links to subgroups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1454 :type '(radio (const brackets)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1455 (const links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1456 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1457
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1458 (defcustom custom-buffer-done-kill nil
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1459 "*Non-nil means exiting a Custom buffer should kill it."
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1460 :type 'boolean
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59795
diff changeset
1461 :version "22.1"
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1462 :group 'custom-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1463
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1464 (defcustom custom-buffer-indent 3
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1465 "Number of spaces to indent nested groups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1466 :type 'integer
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1467 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1468
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1469 (defun custom-get-fresh-buffer (name)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1470 "Get a fresh new buffer with name NAME.
51381
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1471 If the buffer already exist, clean it up to be like new.
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1472 Beware: it's not quite like new. Good enough for custom, but maybe
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1473 not for everybody."
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1474 ;; To be more complete, we should also kill all permanent-local variables,
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1475 ;; but it's not needed for custom.
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1476 (let ((buf (get-buffer name)))
51429
b107764e9a67 (custom-get-fresh-buffer): Test for nonexistence buffer.
Lute Kamstra <lute@gnu.org>
parents: 51381
diff changeset
1477 (when (and buf (buffer-local-value 'buffer-file-name buf))
51381
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1478 ;; This will check if the file is not saved.
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1479 (kill-buffer buf)
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1480 (setq buf nil))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1481 (if (null buf)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1482 (get-buffer-create name)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1483 (with-current-buffer buf
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1484 (kill-all-local-variables)
51381
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1485 (run-hooks 'kill-buffer-hook)
51561
bed114065e35 (custom-get-fresh-buffer): Kill overlays before erasing the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51429
diff changeset
1486 ;; Delete overlays before erasing the buffer so the overlay hooks
bed114065e35 (custom-get-fresh-buffer): Kill overlays before erasing the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51429
diff changeset
1487 ;; don't get run spuriously when we erase the buffer.
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1488 (let ((ols (overlay-lists)))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1489 (dolist (ol (nconc (car ols) (cdr ols)))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1490 (delete-overlay ol)))
51561
bed114065e35 (custom-get-fresh-buffer): Kill overlays before erasing the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51429
diff changeset
1491 (erase-buffer)
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1492 buf))))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1493
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1494 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1495 (defun custom-buffer-create (options &optional name description)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1496 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1497 Optional NAME is the name of the buffer.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1498 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1499 SYMBOL is a customization option, and WIDGET is a widget for editing
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1500 that option."
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1501 (pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*")))
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1502 (custom-buffer-create-internal options description))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1503
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1504 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1505 (defun custom-buffer-create-other-window (options &optional name description)
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1506 "Create a buffer containing OPTIONS, and display it in another window.
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1507 The result includes selecting that window.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1508 Optional NAME is the name of the buffer.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1509 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1510 SYMBOL is a customization option, and WIDGET is a widget for editing
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1511 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1512 (unless name (setq name "*Customization*"))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1513 (let ((pop-up-windows t)
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1514 (same-window-buffer-names nil)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1515 (same-window-regexps nil))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1516 (pop-to-buffer (custom-get-fresh-buffer name))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1517 (custom-buffer-create-internal options description)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1518
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1519 (defcustom custom-reset-button-menu nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1520 "If non-nil, only show a single reset button in customize buffers.
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1521 This button will have a menu with all three reset operations."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1522 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1523 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1524
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1525 (defcustom custom-buffer-verbose-help t
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1526 "If non-nil, include explanatory text in the customization buffer."
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1527 :type 'boolean
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1528 :group 'custom-buffer)
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1529
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1530 (defun Custom-buffer-done (&rest ignore)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1531 "Exit current Custom buffer according to `custom-buffer-done-kill'."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1532 (interactive)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1533 (quit-window custom-buffer-done-kill))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1534
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1535 (defvar custom-button nil
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1536 "Face used for buttons in customization buffers.")
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1537
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
1538 (defvar custom-button-mouse nil
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
1539 "Mouse face used for buttons in customization buffers.")
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
1540
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1541 (defvar custom-button-pressed nil
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1542 "Face used for pressed buttons in customization buffers.")
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1543
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1544 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1545 '(("unspecified" . unspecified))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1546 "If non-nil, indicate active buttons in a `raised-button' style.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1547 Otherwise use brackets."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1548 :type 'boolean
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1549 :version "21.1"
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1550 :group 'custom-buffer
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1551 :set (lambda (variable value)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1552 (custom-set-default variable value)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1553 (setq custom-button
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1554 (if value 'custom-button 'custom-button-unraised))
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
1555 (setq custom-button-mouse
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
1556 (if value 'custom-button-mouse 'highlight))
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1557 (setq custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1558 (if value
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1559 'custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1560 'custom-button-pressed-unraised))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1561
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1562 (defun custom-buffer-create-internal (options &optional description)
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
1563 (Custom-mode)
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1564 (let ((init-file (or custom-file user-init-file)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1565 ;; Insert verbose help at the top of the custom buffer.
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1566 (when custom-buffer-verbose-help
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1567 (widget-insert "Editing a setting changes only the text in this buffer."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1568 (if init-file
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1569 "
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
1570 To apply your changes, use the Save or Set buttons.
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1571 Saving a change normally works by editing your init file."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1572 "
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1573 Currently, these settings cannot be saved for future Emacs sessions,
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1574 possibly because you started Emacs with `-q'.")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1575 "\nFor details, see ")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1576 (widget-create 'custom-manual
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1577 :tag "Saving Customizations"
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1578 "(emacs)Saving Customizations")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1579 (widget-insert " in the ")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1580 (widget-create 'custom-manual
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1581 :tag "Emacs manual"
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1582 :help-echo "Read the Emacs manual."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1583 "(emacs)Top")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1584 (widget-insert "."))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1585 ;; Insert custom command buttons if the toolbar is not in use.
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1586
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1587 (widget-insert "\n")
83897
0433e66465f6 (custom-buffer-create-internal): Check tool-bar-mode is bound.
Glenn Morris <rgm@gnu.org>
parents: 82251
diff changeset
1588 ;; tool-bar is not dumped in builds without x.
0433e66465f6 (custom-buffer-create-internal): Check tool-bar-mode is bound.
Glenn Morris <rgm@gnu.org>
parents: 82251
diff changeset
1589 (when (not (and (bound-and-true-p tool-bar-mode) (display-graphic-p)))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1590 (if custom-buffer-verbose-help
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1591 (widget-insert "\n
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1592 Operate on all settings in this buffer that are not marked HIDDEN:\n"))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1593 (let ((button (lambda (tag action active help icon)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1594 (widget-insert " ")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1595 (if (eval active)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1596 (widget-create 'push-button :tag tag
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1597 :help-echo help :action action))))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1598 (commands custom-commands))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1599 (apply button (pop commands)) ; Set for current session
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1600 (apply button (pop commands)) ; Save for future sessions
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1601 (if custom-reset-button-menu
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1602 (progn
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1603 (widget-insert " ")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1604 (widget-create 'push-button
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1605 :tag "Reset buffer"
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1606 :help-echo "Show a menu with reset operations."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1607 :mouse-down-action 'ignore
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1608 :action 'custom-reset))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1609 (widget-insert "\n")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1610 (apply button (pop commands)) ; Undo edits
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1611 (apply button (pop commands)) ; Reset to saved
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1612 (apply button (pop commands)) ; Erase customization
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1613 (widget-insert " ")
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1614 (pop commands) ; Help (omitted)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1615 (apply button (pop commands))))) ; Exit
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1616 (widget-insert "\n\n"))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1617
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
1618 ;; Now populate the custom buffer.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1619 (message "Creating customization items...")
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1620 (buffer-disable-undo)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1621 (setq custom-options
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1622 (if (= (length options) 1)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1623 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1624 (widget-create (nth 1 entry)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1625 :documentation-shown t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1626 :custom-state 'unknown
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1627 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1628 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1629 :value (nth 0 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1630 options)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1631 (let ((count 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1632 (length (length options)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1633 (mapcar (lambda (entry)
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1634 (prog2
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1635 (message "Creating customization items ...%2d%%"
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1636 (/ (* 100.0 count) length))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1637 (widget-create (nth 1 entry)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1638 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1639 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1640 :value (nth 0 entry))
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1641 (setq count (1+ count))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1642 (unless (eq (preceding-char) ?\n)
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1643 (widget-insert "\n"))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1644 (widget-insert "\n")))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1645 options))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1646 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1647 (widget-insert "\n"))
39153
001cb5cd0de9 (custom-buffer-create-internal): Remove "100%" from
Eli Zaretskii <eliz@gnu.org>
parents: 38436
diff changeset
1648 (message "Creating customization items ...done")
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1649 (message "Resetting customization items...")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1650 (unless (eq custom-buffer-style 'tree)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1651 (mapc 'custom-magic-reset custom-options))
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1652 (message "Resetting customization items...done")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1653 (message "Creating customization setup...")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1654 (widget-setup)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1655 (buffer-enable-undo)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1656 (goto-char (point-min))
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1657 (message "Creating customization setup...done"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1658
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1659 ;;; The Tree Browser.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1660
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1661 ;;;###autoload
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1662 (defun customize-browse (&optional group)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1663 "Create a tree browser for the customize hierarchy."
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
1664 (interactive)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1665 (unless group
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1666 (setq group 'emacs))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1667 (let ((name "*Customize Browser*"))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1668 (pop-to-buffer (custom-get-fresh-buffer name)))
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
1669 (Custom-mode)
67745
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1670 (widget-insert (format "\
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1671 %s buttons; type RET or click mouse-1
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1672 on a button to invoke its action.
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1673 Invoke [+] to expand a group, and [-] to collapse an expanded group.\n"
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1674 (if custom-raised-buttons
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1675 "`Raised' text indicates"
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1676 "Square brackets indicate")))
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1677
1c2cd41aeda7 (customize-browse): Reword the top-of-buffer help intro.
Richard M. Stallman <rms@gnu.org>
parents: 67744
diff changeset
1678
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1679 (if custom-browse-only-groups
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1680 (widget-insert "\
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1681 Invoke the [Group] button below to edit that item in another window.\n\n")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1682 (widget-insert "Invoke the ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1683 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1684 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1685 :tag "[Group]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1686 :tag-glyph "folder")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1687 (widget-insert ", ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1688 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1689 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1690 :tag "[Face]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1691 :tag-glyph "face")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1692 (widget-insert ", and ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1693 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1694 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1695 :tag "[Option]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1696 :tag-glyph "option")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1697 (widget-insert " buttons below to edit that
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1698 item in another window.\n\n"))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1699 (let ((custom-buffer-style 'tree))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1700 (widget-create 'custom-group
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1701 :custom-last t
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1702 :custom-state 'unknown
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1703 :tag (custom-unlispify-tag-name group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1704 :value group))
48997
eb9dca992edf (customize-browse): Call `widget-setup'.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48975
diff changeset
1705 (widget-setup)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1706 (goto-char (point-min)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1707
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1708 (define-widget 'custom-browse-visibility 'item
20600
323f33e3e92c (custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 20562
diff changeset
1709 "Control visibility of items in the customize tree browser."
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1710 :format "%[[%t]%]"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1711 :action 'custom-browse-visibility-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1712
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1713 (defun custom-browse-visibility-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1714 (let ((custom-buffer-style 'tree))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1715 (custom-toggle-parent widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1716
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
1717 (define-widget 'custom-browse-group-tag 'custom-group-link
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1718 "Show parent in other window when activated."
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1719 :tag "Group"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1720 :tag-glyph "folder"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1721 :action 'custom-browse-group-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1722
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1723 (defun custom-browse-group-tag-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1724 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1725 (customize-group-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1726
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
1727 (define-widget 'custom-browse-variable-tag 'custom-group-link
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1728 "Show parent in other window when activated."
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1729 :tag "Option"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1730 :tag-glyph "option"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1731 :action 'custom-browse-variable-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1732
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1733 (defun custom-browse-variable-tag-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1734 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1735 (customize-variable-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1736
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
1737 (define-widget 'custom-browse-face-tag 'custom-group-link
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1738 "Show parent in other window when activated."
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1739 :tag "Face"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1740 :tag-glyph "face"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1741 :action 'custom-browse-face-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1742
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1743 (defun custom-browse-face-tag-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1744 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1745 (customize-face-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1746
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1747 (defconst custom-browse-alist '((" " "space")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1748 (" | " "vertical")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1749 ("-\\ " "top")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1750 (" |-" "middle")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1751 (" `-" "bottom")))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1752
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1753 (defun custom-browse-insert-prefix (prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1754 "Insert PREFIX. On XEmacs convert it to line graphics."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1755 ;; Fixme: do graphics.
85724
c717580e7817 * cus-edit.el (custom-browse-insert-prefix):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85710
diff changeset
1756 (if nil ; (featurep 'xemacs)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1757 (progn
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1758 (insert "*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1759 (while (not (string-equal prefix ""))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1760 (let ((entry (substring prefix 0 3)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1761 (setq prefix (substring prefix 3))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1762 (let ((overlay (make-overlay (1- (point)) (point) nil t nil))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1763 (name (nth 1 (assoc entry custom-browse-alist))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1764 (overlay-put overlay 'end-glyph (widget-glyph-find name entry))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1765 (overlay-put overlay 'start-open t)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1766 (overlay-put overlay 'end-open t)))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1767 (insert prefix)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1768
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1769 ;;; Modification of Basic Widgets.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1770 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1771 ;; We add extra properties to the basic widgets needed here. This is
94463
33cbbd41a93f Fix comment typo.
Glenn Morris <rgm@gnu.org>
parents: 93937
diff changeset
1772 ;; fine, as long as we are careful to stay within our own namespace.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1773 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1774 ;; We want simple widgets to be displayed by default, but complex
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1775 ;; widgets to be hidden.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1776
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1777 (widget-put (get 'item 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1778 (widget-put (get 'editable-field 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1779 :custom-show (lambda (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1780 (let ((pp (pp-to-string value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1781 (cond ((string-match "\n" pp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1782 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1783 ((> (length pp) 40)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1784 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1785 (t t)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1786 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1787
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1788 ;;; The `custom-manual' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1789
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1790 (define-widget 'custom-manual 'info-link
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1791 "Link to the manual entry for this customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1792 :help-echo "Read the manual entry for this option."
73795
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
1793 :keymap custom-mode-link-map
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
1794 :follow-link 'mouse-face
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
1795 :button-face 'custom-link
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
1796 :mouse-face 'highlight
68892
93b583aac002 * wid-edit.el (widget-button-click): Use :pressed-face property
Chong Yidong <cyd@stupidchicken.com>
parents: 68406
diff changeset
1797 :pressed-face 'highlight
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1798 :tag "Manual")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1799
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1800 ;;; The `custom-magic' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1801
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1802 (defgroup custom-magic-faces nil
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1803 "Faces used by the magic button."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1804 :group 'custom-faces
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1805 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1806
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1807 (defface custom-invalid '((((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1808 (:foreground "yellow1" :background "red1"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1809 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1810 (:weight bold :slant italic :underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1811 "Face used when the customize item is invalid."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1812 :group 'custom-magic-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1813 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1814 (put 'custom-invalid-face 'face-alias 'custom-invalid)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1815
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1816 (defface custom-rogue '((((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1817 (:foreground "pink" :background "black"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1818 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1819 (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1820 "Face used when the customize item is not defined for customization."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1821 :group 'custom-magic-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1822 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1823 (put 'custom-rogue-face 'face-alias 'custom-rogue)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1824
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1825 (defface custom-modified '((((min-colors 88) (class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1826 (:foreground "white" :background "blue1"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1827 (((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1828 (:foreground "white" :background "blue"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1829 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1830 (:slant italic :bold)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1831 "Face used when the customize item has been modified."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1832 :group 'custom-magic-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1833 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1834 (put 'custom-modified-face 'face-alias 'custom-modified)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1835
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1836 (defface custom-set '((((min-colors 88) (class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1837 (:foreground "blue1" :background "white"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1838 (((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1839 (:foreground "blue" :background "white"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1840 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1841 (:slant italic)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1842 "Face used when the customize item has been set."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1843 :group 'custom-magic-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1844 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1845 (put 'custom-set-face 'face-alias 'custom-set)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1846
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1847 (defface custom-changed '((((min-colors 88) (class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1848 (:foreground "white" :background "blue1"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1849 (((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1850 (:foreground "white" :background "blue"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1851 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1852 (:slant italic)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1853 "Face used when the customize item has been changed."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1854 :group 'custom-magic-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1855 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1856 (put 'custom-changed-face 'face-alias 'custom-changed)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1857
67783
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1858 (defface custom-themed '((((min-colors 88) (class color))
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1859 (:foreground "white" :background "blue1"))
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1860 (((class color))
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1861 (:foreground "white" :background "blue"))
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1862 (t
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1863 (:slant italic)))
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1864 "Face used when the customize item has been set by a theme."
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1865 :group 'custom-magic-faces)
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1866
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1867 (defface custom-saved '((t (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1868 "Face used when the customize item has been saved."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1869 :group 'custom-magic-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1870 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1871 (put 'custom-saved-face 'face-alias 'custom-saved)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1872
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1873 (defconst custom-magic-alist
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1874 '((nil "#" underline "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1875 UNINITIALIZED, you should not see this.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1876 (unknown "?" italic "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1877 UNKNOWN, you should not see this.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1878 (hidden "-" default "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1879 HIDDEN, invoke \"Show\" in the previous line to show." "\
18362
4655515f51cc (custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents: 18360
diff changeset
1880 group now hidden, invoke \"Show\", above, to show contents.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1881 (invalid "x" custom-invalid "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1882 INVALID, the displayed value cannot be set.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1883 (modified "*" custom-modified "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1884 EDITED, shown value does not take effect until you set or save it." "\
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1885 something in this group has been edited but not set.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1886 (set "+" custom-set "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1887 SET for current session only." "\
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1888 something in this group has been set but not saved.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1889 (changed ":" custom-changed "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1890 CHANGED outside Customize; operating on it here may be unreliable." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1891 something in this group has been changed outside customize.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1892 (saved "!" custom-saved "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1893 SAVED and set." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1894 something in this group has been set and saved.")
67783
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1895 (themed "o" custom-themed "\
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1896 THEMED." "\
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
1897 visible group members are all at standard values.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1898 (rogue "@" custom-rogue "\
67600
d14352717f67 Introductory comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 67549
diff changeset
1899 NO CUSTOMIZATION DATA; not intended to be customized." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1900 something in this group is not prepared for customization.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1901 (standard " " nil "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1902 STANDARD." "\
67749
1607dd4159f5 (custom-reset-menu, custom-magic-alist, Custom-mode-menu):
Richard M. Stallman <rms@gnu.org>
parents: 67747
diff changeset
1903 visible group members are all at standard values."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1904 "Alist of customize option states.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1905 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1906
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1907 STATE is one of the following symbols:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1908
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1909 `nil'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1910 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1911 `unknown'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1912 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1913 `hidden'
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1914 This item is not being displayed.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1915 `invalid'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1916 This item is modified, but has an invalid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1917 `modified'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1918 This item is modified, and has a valid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1919 `set'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1920 This item has been set but not saved.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1921 `changed'
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1922 The current value of this item has been changed outside Customize.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1923 `saved'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1924 This item is marked for saving.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1925 `rogue'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1926 This item has no customization information.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1927 `standard'
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1928 This item is unchanged from the standard setting.
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1929
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1930 MAGIC is a string used to present that state.
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1931
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1932 FACE is a face used to present the state.
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1933
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1934 ITEM-DESC is a string describing the state for options.
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1935
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1936 GROUP-DESC is a string describing the state for groups. If this is
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1937 left out, ITEM-DESC will be used.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1938
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1939 The string %c in either description will be replaced with the
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1940 category of the item. These are `group'. `option', and `face'.
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1941
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1942 The list should be sorted most significant first.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1943
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1944 (defcustom custom-magic-show 'long
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1945 "If non-nil, show textual description of the state.
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1946 If `long', show a full-line description, not just one word."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1947 :type '(choice (const :tag "no" nil)
22600
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1948 (const long)
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1949 (other :tag "short" short))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1950 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1951
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1952 (defcustom custom-magic-show-hidden '(option face)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1953 "Control whether the State button is shown for hidden items.
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1954 The value should be a list with the custom categories where the State
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1955 button should be visible. Possible categories are `group', `option',
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1956 and `face'."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1957 :type '(set (const group) (const option) (const face))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1958 :group 'custom-buffer)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1959
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1960 (defcustom custom-magic-show-button nil
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1961 "Show a \"magic\" button indicating the state of each customization option."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1962 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1963 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1964
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1965 (define-widget 'custom-magic 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1966 "Show and manipulate state for a customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1967 :format "%v"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1968 :action 'widget-parent-action
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1969 :notify 'ignore
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1970 :value-get 'ignore
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1971 :value-create 'custom-magic-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1972 :value-delete 'widget-children-value-delete)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1973
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1974 (defun widget-magic-mouse-down-action (widget &optional event)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1975 ;; Non-nil unless hidden.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1976 (not (eq (widget-get (widget-get (widget-get widget :parent) :parent)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1977 :custom-state)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1978 'hidden)))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1979
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1980 (defun custom-magic-value-create (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1981 "Create compact status report for WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1982 (let* ((parent (widget-get widget :parent))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1983 (state (widget-get parent :custom-state))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1984 (hidden (eq state 'hidden))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1985 (entry (assq state custom-magic-alist))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1986 (magic (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1987 (face (nth 2 entry))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1988 (category (widget-get parent :custom-category))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1989 (text (or (and (eq category 'group)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1990 (nth 4 entry))
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1991 (nth 3 entry)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1992 (form (widget-get parent :custom-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1993 children)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1994 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1995 (setq text (concat (match-string 1 text)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1996 (symbol-name category)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1997 (match-string 2 text))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1998 (when (and custom-magic-show
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1999 (or (not hidden)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2000 (memq category custom-magic-show-hidden)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2001 (insert " ")
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2002 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2003 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2004 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2005 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2006 (widget-get parent :custom-level))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2007 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2008 widget 'choice-item
18087
05c70aa62552 Synched with 1.9903
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18086
diff changeset
2009 :help-echo "Change the state of this item."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2010 :format (if hidden "%t" "%[%t%]")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2011 :button-prefix 'widget-push-button-prefix
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2012 :button-suffix 'widget-push-button-suffix
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2013 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2014 :tag "State")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2015 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2016 (insert ": ")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2017 (let ((start (point)))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2018 (if (eq custom-magic-show 'long)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2019 (insert text)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2020 (insert (symbol-name state)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2021 (cond ((eq form 'lisp)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2022 (insert " (lisp)"))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2023 ((eq form 'mismatch)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2024 (insert " (mismatch)")))
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2025 (put-text-property start (point) 'face 'custom-state))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2026 (insert "\n"))
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2027 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2028 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2029 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2030 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2031 (widget-get parent :custom-level))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2032 (when custom-magic-show-button
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2033 (when custom-magic-show
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2034 (let ((indent (widget-get parent :indent)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2035 (when indent
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2036 (insert-char ? indent))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2037 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2038 widget 'choice-item
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2039 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2040 :button-face face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2041 :button-prefix ""
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2042 :button-suffix ""
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2043 :help-echo "Change the state."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2044 :format (if hidden "%t" "%[%t%]")
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2045 :tag (if (memq form '(lisp mismatch))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2046 (concat "(" magic ")")
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2047 (concat "[" magic "]")))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2048 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2049 (insert " "))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2050 (widget-put widget :children children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2051
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2052 (defun custom-magic-reset (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2053 "Redraw the :custom-magic property of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2054 (let ((magic (widget-get widget :custom-magic)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2055 (widget-value-set magic (widget-value magic))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2056
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2057 ;;; The `custom' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2058
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2059 (defface custom-button
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96675
diff changeset
2060 '((((type x w32 ns) (class color)) ; Like default modeline
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31744
diff changeset
2061 (:box (:line-width 2 :style released-button)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31744
diff changeset
2062 :background "lightgrey" :foreground "black"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2063 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2064 nil))
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2065 "Face for custom buffer buttons if `custom-raised-buttons' is non-nil."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2066 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2067 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2068 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2069 (put 'custom-button-face 'face-alias 'custom-button)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2070
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2071 (defface custom-button-mouse
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96675
diff changeset
2072 '((((type x w32 ns) (class color))
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2073 (:box (:line-width 2 :style released-button)
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2074 :background "grey90" :foreground "black"))
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2075 (t
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2076 nil))
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2077 "Mouse face for custom buffer buttons if `custom-raised-buttons' is non-nil."
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2078 :version "22.1"
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2079 :group 'custom-faces)
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2080
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2081 (defface custom-button-unraised
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
2082 '((t :inherit underline))
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2083 "Face for custom buffer buttons if `custom-raised-buttons' is nil."
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2084 :version "22.1"
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2085 :group 'custom-faces)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2086
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2087 (setq custom-button
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2088 (if custom-raised-buttons 'custom-button 'custom-button-unraised))
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2089
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2090 (setq custom-button-mouse
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2091 (if custom-raised-buttons 'custom-button-mouse 'highlight))
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
2092
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2093 (defface custom-button-pressed
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96675
diff changeset
2094 '((((type x w32 ns) (class color))
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31744
diff changeset
2095 (:box (:line-width 2 :style pressed-button)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31744
diff changeset
2096 :background "lightgrey" :foreground "black"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2097 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2098 (:inverse-video t)))
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2099 "Face for pressed custom buttons if `custom-raised-buttons' is non-nil."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2100 :version "21.1"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2101 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2102 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2103 (put 'custom-button-pressed-face 'face-alias 'custom-button-pressed)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2104
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2105 (defface custom-button-pressed-unraised
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2106 '((default :inherit custom-button-unraised)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2107 (((class color) (background light)) :foreground "magenta4")
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2108 (((class color) (background dark)) :foreground "violet"))
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2109 "Face for pressed custom buttons if `custom-raised-buttons' is nil."
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2110 :version "22.1"
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2111 :group 'custom-faces)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2112
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2113 (setq custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2114 (if custom-raised-buttons
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2115 'custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2116 'custom-button-pressed-unraised))
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
2117
70179
bdc0573597a9 (custom-documentation): Avoid nil spec in defface.
Luc Teirlinck <teirllm@auburn.edu>
parents: 70021
diff changeset
2118 (defface custom-documentation '((t nil))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2119 "Face used for documentation strings in customization buffers."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2120 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2121 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2122 (put 'custom-documentation-face 'face-alias 'custom-documentation)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2123
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2124 (defface custom-state '((((class color)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2125 (background dark))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2126 (:foreground "lime green"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2127 (((class color)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2128 (background light))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2129 (:foreground "dark green"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2130 (t nil))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2131 "Face used for State descriptions in the customize buffer."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2132 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2133 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2134 (put 'custom-state-face 'face-alias 'custom-state)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2135
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
2136 (defface custom-link
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
2137 '((t :inherit link))
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
2138 "Face for links in customization buffers."
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
2139 :version "22.1"
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
2140 :group 'custom-faces)
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
2141
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2142 (define-widget 'custom 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2143 "Customize a user option."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2144 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2145 :convert-widget 'custom-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2146 :notify 'custom-notify
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2147 :custom-prefix ""
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2148 :custom-level 1
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2149 :custom-state 'hidden
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2150 :documentation-property 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2151 :value-create 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2152 :value-delete 'widget-children-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2153 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2154 :validate 'widget-children-validate
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2155 :match (lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2156
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2157 (defun custom-convert-widget (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2158 "Initialize :value and :tag from :args in WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2159 (let ((args (widget-get widget :args)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2160 (when args
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2161 (widget-put widget :value (widget-apply widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2162 :value-to-internal (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2163 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2164 (widget-put widget :args nil)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2165 widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2166
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2167 (defun custom-notify (widget &rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2168 "Keep track of changes."
18090
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2169 (let ((state (widget-get widget :custom-state)))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2170 (unless (eq state 'modified)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2171 (unless (memq state '(nil unknown hidden))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2172 (widget-put widget :custom-state 'modified))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2173 (custom-magic-reset widget)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2174 (apply 'widget-default-notify widget args))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2175
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2176 (defun custom-redraw (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2177 "Redraw WIDGET with current settings."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2178 (let ((line (count-lines (point-min) (point)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2179 (column (current-column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2180 (pos (point))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2181 (from (marker-position (widget-get widget :from)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2182 (to (marker-position (widget-get widget :to))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2183 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2184 (widget-value-set widget (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2185 (custom-redraw-magic widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2186 (when (and (>= pos from) (<= pos to))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2187 (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2188 (progn
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2189 (if (> column 0)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2190 (goto-line line)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2191 (goto-line (1+ line)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2192 (move-to-column column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2193 (error nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2194
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2195 (defun custom-redraw-magic (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2196 "Redraw WIDGET state with current settings."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2197 (while widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2198 (let ((magic (widget-get widget :custom-magic)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2199 (cond (magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2200 (widget-value-set magic (widget-value magic))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2201 (when (setq widget (widget-get widget :group))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2202 (custom-group-state-update widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2203 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2204 (setq widget nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2205 (widget-setup))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2206
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2207 (defun custom-show (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2208 "Non-nil if WIDGET should be shown with VALUE by default."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2209 (let ((show (widget-get widget :custom-show)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2210 (cond ((null show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2211 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2212 ((eq t show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2213 t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2214 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2215 (funcall show widget value)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2216
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2217 (defun custom-load-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2218 "Load all dependencies for WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2219 (custom-load-symbol (widget-value widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2220
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2221 (defun custom-unloaded-symbol-p (symbol)
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
2222 "Return non-nil if the dependencies of SYMBOL have not yet been loaded."
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2223 (let ((found nil)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2224 (loads (get symbol 'custom-loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2225 load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2226 (while loads
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2227 (setq load (car loads)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2228 loads (cdr loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2229 (cond ((symbolp load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2230 (unless (featurep load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2231 (setq found t)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2232 ((assoc load load-history))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2233 ((assoc (locate-library load) load-history)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2234 (message nil))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2235 (t
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2236 (setq found t))))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2237 found))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2238
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2239 (defun custom-unloaded-widget-p (widget)
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
2240 "Return non-nil if the dependencies of WIDGET have not yet been loaded."
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2241 (custom-unloaded-symbol-p (widget-value widget)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2242
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2243 (defun custom-toggle-hide (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2244 "Toggle visibility of WIDGET."
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2245 (custom-load-widget widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2246 (let ((state (widget-get widget :custom-state)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2247 (cond ((memq state '(invalid modified))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2248 (error "There are unset changes"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2249 ((eq state 'hidden)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2250 (widget-put widget :custom-state 'unknown))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2251 (t
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2252 (widget-put widget :documentation-shown nil)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2253 (widget-put widget :custom-state 'hidden)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2254 (custom-redraw widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2255 (widget-setup)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2256
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2257 (defun custom-toggle-parent (widget &rest ignore)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2258 "Toggle visibility of parent of WIDGET."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2259 (custom-toggle-hide (widget-get widget :parent)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2260
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2261 (defun custom-add-see-also (widget &optional prefix)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2262 "Add `See also ...' to WIDGET if there are any links.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2263 Insert PREFIX first if non-nil."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2264 (let* ((symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2265 (links (get symbol 'custom-links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2266 (many (> (length links) 2))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2267 (buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2268 (indent (widget-get widget :indent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2269 (when links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2270 (when indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2271 (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2272 (when prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2273 (insert prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2274 (insert "See also ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2275 (while links
68178
08dc54e52e8e (custom-add-see-also, custom-add-parent-links): Make sure the links use
Eli Zaretskii <eliz@gnu.org>
parents: 68139
diff changeset
2276 (push (widget-create-child-and-convert
08dc54e52e8e (custom-add-see-also, custom-add-parent-links): Make sure the links use
Eli Zaretskii <eliz@gnu.org>
parents: 68139
diff changeset
2277 widget (car links)
08dc54e52e8e (custom-add-see-also, custom-add-parent-links): Make sure the links use
Eli Zaretskii <eliz@gnu.org>
parents: 68139
diff changeset
2278 :button-face 'custom-link
68892
93b583aac002 * wid-edit.el (widget-button-click): Use :pressed-face property
Chong Yidong <cyd@stupidchicken.com>
parents: 68406
diff changeset
2279 :mouse-face 'highlight
93b583aac002 * wid-edit.el (widget-button-click): Use :pressed-face property
Chong Yidong <cyd@stupidchicken.com>
parents: 68406
diff changeset
2280 :pressed-face 'highlight)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2281 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2282 (setq links (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2283 (cond ((null links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2284 (insert ".\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2285 ((null (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2286 (if many
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2287 (insert ", and ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2288 (insert " and ")))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2289 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2290 (insert ", "))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2291 (widget-put widget :buttons buttons))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2292
79659
a4773f405434 (custom-add-parent-links): New arg DOC-INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 79655
diff changeset
2293 (defun custom-add-parent-links (widget &optional initial-string
a4773f405434 (custom-add-parent-links): New arg DOC-INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 79655
diff changeset
2294 doc-initial-string)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2295 "Add \"Parent groups: ...\" to WIDGET if the group has parents.
66904
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2296 The value is non-nil if any parents were found.
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2297 If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2298 (let ((name (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2299 (type (widget-type widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2300 (buttons (widget-get widget :buttons))
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
2301 (start (point))
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2302 (parents nil))
79659
a4773f405434 (custom-add-parent-links): New arg DOC-INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 79655
diff changeset
2303 (insert (or initial-string "Groups:"))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2304 (mapatoms (lambda (symbol)
66904
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2305 (when (member (list name type) (get symbol 'custom-group))
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2306 (insert " ")
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2307 (push (widget-create-child-and-convert
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2308 widget 'custom-group-link
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2309 :tag (custom-unlispify-tag-name symbol)
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2310 symbol)
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2311 buttons)
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2312 (setq parents (cons symbol parents)))))
54721
5b50970ffa95 2004-04-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 54312
diff changeset
2313 (and (null (get name 'custom-links)) ;No links of its own.
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2314 (= (length parents) 1) ;A single parent.
67378
3fe860e6e6eb (custom-add-parent-links): Filter out custom-group-link,
Juri Linkov <juri@jurta.org>
parents: 67298
diff changeset
2315 (let* ((links (delq nil (mapcar (lambda (w)
3fe860e6e6eb (custom-add-parent-links): Filter out custom-group-link,
Juri Linkov <juri@jurta.org>
parents: 67298
diff changeset
2316 (unless (eq (widget-type w)
3fe860e6e6eb (custom-add-parent-links): Filter out custom-group-link,
Juri Linkov <juri@jurta.org>
parents: 67298
diff changeset
2317 'custom-group-link)
3fe860e6e6eb (custom-add-parent-links): Filter out custom-group-link,
Juri Linkov <juri@jurta.org>
parents: 67298
diff changeset
2318 w))
3fe860e6e6eb (custom-add-parent-links): Filter out custom-group-link,
Juri Linkov <juri@jurta.org>
parents: 67298
diff changeset
2319 (get (car parents) 'custom-links))))
53319
36b31fc002f2 2003-12-12 Jesper Harder <harder@ifa.au.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 53223
diff changeset
2320 (many (> (length links) 2)))
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2321 (when links
79655
4feb30a8db36 (custom-add-parent-links): Fill the "Parent documentation" text.
Richard M. Stallman <rms@gnu.org>
parents: 79190
diff changeset
2322 (let ((pt (point))
4feb30a8db36 (custom-add-parent-links): Fill the "Parent documentation" text.
Richard M. Stallman <rms@gnu.org>
parents: 79190
diff changeset
2323 (left-margin (+ left-margin 2)))
79660
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2324 (insert "\n" (or doc-initial-string "Group documentation:") " ")
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2325 (while links
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2326 (push (widget-create-child-and-convert
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2327 widget (car links)
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2328 :button-face 'custom-link
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2329 :mouse-face 'highlight
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2330 :pressed-face 'highlight)
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2331 buttons)
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2332 (setq links (cdr links))
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2333 (cond ((null links)
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2334 (insert ".\n"))
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2335 ((null (cdr links))
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2336 (if many
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2337 (insert ", and ")
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2338 (insert " and ")))
6fa5fc37cfee Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 79659
diff changeset
2339 (t
79655
4feb30a8db36 (custom-add-parent-links): Fill the "Parent documentation" text.
Richard M. Stallman <rms@gnu.org>
parents: 79190
diff changeset
2340 (insert ", "))))
4feb30a8db36 (custom-add-parent-links): Fill the "Parent documentation" text.
Richard M. Stallman <rms@gnu.org>
parents: 79190
diff changeset
2341 (fill-region-as-paragraph pt (point))
4feb30a8db36 (custom-add-parent-links): Fill the "Parent documentation" text.
Richard M. Stallman <rms@gnu.org>
parents: 79190
diff changeset
2342 (delete-to-left-margin (1+ pt) (+ pt 2))))))
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2343 (if parents
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2344 (insert "\n")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2345 (delete-region start (point)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2346 (widget-put widget :buttons buttons)
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2347 parents))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2348
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2349 ;;; The `custom-comment' Widget.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2350
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2351 ;; like the editable field
68109
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2352 (defface custom-comment '((((type tty))
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2353 :background "yellow3"
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2354 :foreground "black")
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2355 (((class grayscale color)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2356 (background light))
68109
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2357 :background "gray85")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2358 (((class grayscale color)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2359 (background dark))
68109
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2360 :background "dim gray")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2361 (t
68109
d42505f2ff8c (custom-comment) <defface>: Add TTY definitions.
John Paul Wallington <jpw@pobox.com>
parents: 68086
diff changeset
2362 :slant italic))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2363 "Face used for comments on variables or faces"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2364 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2365 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2366 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2367 (put 'custom-comment-face 'face-alias 'custom-comment)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2368
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2369 ;; like font-lock-comment-face
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2370 (defface custom-comment-tag
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2371 '((((class color) (background dark)) (:foreground "gray80"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2372 (((class color) (background light)) (:foreground "blue4"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2373 (((class grayscale) (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2374 (:foreground "DimGray" :weight bold :slant italic))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2375 (((class grayscale) (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2376 (:foreground "LightGray" :weight bold :slant italic))
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2377 (t (:weight bold)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2378 "Face used for variables or faces comment tags"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2379 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2380 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2381 (put 'custom-comment-tag-face 'face-alias 'custom-comment-tag)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2382
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2383 (define-widget 'custom-comment 'string
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2384 "User comment."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2385 :tag "Comment"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2386 :help-echo "Edit a comment here."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2387 :sample-face 'custom-comment-tag-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2388 :value-face 'custom-comment-face
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2389 :shown nil
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2390 :create 'custom-comment-create)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2391
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2392 (defun custom-comment-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2393 (let* ((null-comment (equal "" (widget-value widget))))
25847
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2394 (if (or (widget-get (widget-get widget :parent) :comment-shown)
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2395 (not null-comment))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2396 (widget-default-create widget)
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2397 ;; `widget-default-delete' expects markers in these slots --
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2398 ;; maybe it shouldn't.
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2399 (widget-put widget :from (point-marker))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2400 (widget-put widget :to (point-marker)))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2401
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2402 (defun custom-comment-hide (widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2403 (widget-put (widget-get widget :parent) :comment-shown nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2404
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2405 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2406 ;; the global custom one
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2407 (defun custom-comment-show (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2408 (widget-put widget :comment-shown t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2409 (custom-redraw widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2410 (widget-setup))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2411
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2412 (defun custom-comment-invisible-p (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2413 (let ((val (widget-value (widget-get widget :comment-widget))))
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2414 (and (equal "" val)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2415 (not (widget-get widget :comment-shown)))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2416
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2417 ;;; The `custom-variable' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2418
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2419 ;; When this was underlined blue, users confused it with a
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2420 ;; Mosaic-style hyperlink...
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2421 (defface custom-variable-tag
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2422 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2423 (background dark))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
2424 (:foreground "light blue" :weight bold))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
2425 (((min-colors 88) (class color)
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
2426 (background light))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
2427 (:foreground "blue1" :weight bold))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2428 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2429 (background light))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
2430 (:foreground "blue" :weight bold))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2431 (t (:weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2432 "Face used for unpushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2433 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2434 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2435 (put 'custom-variable-tag-face 'face-alias 'custom-variable-tag)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2436
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2437 (defface custom-variable-button '((t (:underline t :weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2438 "Face used for pushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2439 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2440 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2441 (put 'custom-variable-button-face 'face-alias 'custom-variable-button)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2442
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2443 (defcustom custom-variable-default-form 'edit
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2444 "Default form of displaying variable values."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2445 :type '(choice (const edit)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2446 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2447 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2448 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2449
56161
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2450 (defun custom-variable-documentation (variable)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2451 "Return documentation of VARIABLE for use in Custom buffer.
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2452 Normally just return the docstring. But if VARIABLE automatically
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2453 becomes buffer local when set, append a message to that effect."
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2454 (if (and (local-variable-if-set-p variable)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2455 (or (not (local-variable-p variable))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2456 (with-temp-buffer
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2457 (local-variable-if-set-p variable))))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2458 (concat (documentation-property variable 'variable-documentation)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2459 "\n
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2460 This variable automatically becomes buffer-local when set outside Custom.
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2461 However, setting it through Custom sets the default value.")
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2462 (documentation-property variable 'variable-documentation)))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2463
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2464 (define-widget 'custom-variable 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2465 "Customize variable."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2466 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2467 :help-echo "Set or reset this variable."
56161
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2468 :documentation-property #'custom-variable-documentation
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2469 :custom-category 'option
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2470 :custom-state nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2471 :custom-menu 'custom-variable-menu-create
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2472 :custom-form nil ; defaults to value of `custom-variable-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2473 :value-create 'custom-variable-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2474 :action 'custom-variable-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2475 :custom-set 'custom-variable-set
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2476 :custom-mark-to-save 'custom-variable-mark-to-save
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2477 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2478 :custom-reset-saved 'custom-variable-reset-saved
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2479 :custom-reset-standard 'custom-variable-reset-standard
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2480 :custom-mark-to-reset-standard 'custom-variable-mark-to-reset-standard
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2481 :custom-standard-value 'custom-variable-standard-value
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2482 :custom-state-set-and-redraw 'custom-variable-state-set-and-redraw)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2483
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2484 (defun custom-variable-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2485 "Return a widget suitable for editing the value of SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2486 If SYMBOL has a `custom-type' property, use that.
77997
20578868cbb3 (custom-variable-type): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 77171
diff changeset
2487 Otherwise, try matching SYMBOL against `custom-guess-name-alist' and
20578868cbb3 (custom-variable-type): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 77171
diff changeset
2488 try matching its doc string against `custom-guess-doc-alist'."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2489 (let* ((type (or (get symbol 'custom-type)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2490 (and (not (get symbol 'standard-value))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2491 (custom-guess-type symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2492 'sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2493 (options (get symbol 'custom-options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2494 (tmp (if (listp type)
17534
a5cf59eee84b (custom-variable-type): Use copy-sequence, not copy-list.
Richard M. Stallman <rms@gnu.org>
parents: 17521
diff changeset
2495 (copy-sequence type)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2496 (list type))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2497 (when options
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2498 (widget-put tmp :options options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2499 tmp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2500
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2501 (defun custom-variable-value-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2502 "Here is where you edit the variable's value."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2503 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2504 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2505 (widget-put widget :custom-form custom-variable-default-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2506 (let* ((buttons (widget-get widget :buttons))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2507 (children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2508 (form (widget-get widget :custom-form))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2509 (state (widget-get widget :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2510 (symbol (widget-get widget :value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2511 (tag (widget-get widget :tag))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2512 (type (custom-variable-type symbol))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2513 (conv (widget-convert type))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2514 (get (or (get symbol 'custom-get) 'default-value))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2515 (prefix (widget-get widget :custom-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2516 (last (widget-get widget :custom-last))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2517 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2518 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2519 (widget-get conv :value))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2520 ;; If the widget is new, the child determines whether it is hidden.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2521 (cond (state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2522 ((custom-show type value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2523 (setq state 'unknown))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2524 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2525 (setq state 'hidden)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2526 ;; If we don't know the state, see if we need to edit it in lisp form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2527 (when (eq state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2528 (unless (widget-apply conv :match value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2529 ;; (widget-apply (widget-convert type) :match value)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2530 (setq form 'mismatch)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2531 ;; Now we can create the child widget.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2532 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2533 (insert prefix (if last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2534 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2535 widget 'custom-browse-variable-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2536 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2537 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2538 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2539 ((eq state 'hidden)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2540 ;; Indicate hidden value.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2541 (push (widget-create-child-and-convert
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2542 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2543 :format "%{%t%}: "
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2544 :sample-face 'custom-variable-tag-face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2545 :tag tag
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2546 :parent widget)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2547 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2548 (push (widget-create-child-and-convert
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2549 widget 'visibility
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2550 :help-echo "Show the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2551 :off "Show Value"
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2552 :action 'custom-toggle-parent
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2553 nil)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2554 buttons))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2555 ((memq form '(lisp mismatch))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2556 ;; In lisp mode edit the saved value when possible.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2557 (let* ((value (cond ((get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2558 (car (get symbol 'saved-value)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2559 ((get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2560 (car (get symbol 'standard-value)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2561 ((default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2562 (custom-quote (funcall get symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2563 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2564 (custom-quote (widget-get conv :value))))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2565 (insert (symbol-name symbol) ": ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2566 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2567 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2568 :help-echo "Hide the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2569 :on "Hide Value"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2570 :off "Show Value"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2571 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2572 t)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2573 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2574 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2575 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2576 widget 'sexp
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2577 :button-face 'custom-variable-button-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2578 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2579 :tag (symbol-name symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2580 :parent widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2581 :value value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2582 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2583 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2584 ;; Edit mode.
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2585 (let* ((format (widget-get type :format))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2586 tag-format value-format)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2587 (unless (string-match ":" format)
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
2588 (error "Bad format"))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2589 (setq tag-format (substring format 0 (match-end 0)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2590 (setq value-format (substring format (match-end 0)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2591 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2592 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2593 :format tag-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2594 :action 'custom-tag-action
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2595 :help-echo "Change value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2596 :mouse-down-action 'custom-tag-mouse-down-action
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2597 :button-face 'custom-variable-button-face
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2598 :sample-face 'custom-variable-tag-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2599 tag)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2600 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2601 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2602 (push (widget-create-child-and-convert
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2603 widget 'visibility
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2604 :help-echo "Hide the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2605 :on "Hide Value"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2606 :off "Show Value"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2607 :action 'custom-toggle-parent
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2608 t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2609 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2610 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2611 widget type
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2612 :format value-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2613 :value value)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2614 children))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2615 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2616 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2617 (widget-insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2618 ;; Create the magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2619 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2620 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2621 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2622 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2623 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2624 ;; Insert documentation.
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
2625 (widget-put widget :documentation-indent 3)
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
2626 (widget-add-documentation-string-button
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
2627 widget :visibility-widget 'custom-visibility)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2628
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2629 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2630 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2631 (let* ((comment (get symbol 'variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2632 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2633 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2634 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2635 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2636 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2637 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2638 ;; Don't push it !!! Custom assumes that the first child is the
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2639 ;; value one.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2640 (setq children (append children (list comment-widget)))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2641 ;; Update the rest of the properties properties.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2642 (widget-put widget :custom-form form)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2643 (widget-put widget :children children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2644 ;; Now update the state.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2645 (if (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2646 (widget-put widget :custom-state state)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2647 (custom-variable-state-set widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2648 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2649 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2650 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2651 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2652 (custom-add-see-also widget)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2653
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2654 (defun custom-tag-action (widget &rest args)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2655 "Pass :action to first child of WIDGET's parent."
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2656 (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2657 :action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2658
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2659 (defun custom-tag-mouse-down-action (widget &rest args)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2660 "Pass :mouse-down-action to first child of WIDGET's parent."
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2661 (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2662 :mouse-down-action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2663
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2664 (defun custom-variable-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2665 "Set the state of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2666 (let* ((symbol (widget-value widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2667 (get (or (get symbol 'custom-get) 'default-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2668 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2669 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2670 (widget-get widget :value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2671 (comment (get symbol 'variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2672 tmp
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2673 temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2674 (state (cond ((progn (setq tmp (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2675 (setq temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2676 (get symbol 'customized-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2677 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2678 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2679 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2680 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2681 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2682 'set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2683 'changed))
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2684 ((progn (setq tmp (get symbol 'theme-value))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2685 (setq temp (get symbol 'saved-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2686 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2687 (if (condition-case nil
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2688 (and (equal comment temp)
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2689 (equal value
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2690 (eval
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2691 (car (custom-variable-theme-value
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2692 symbol)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2693 (error nil))
67783
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
2694 (cond
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2695 ((eq (caar tmp) 'user) 'saved)
71953
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2696 ((eq (caar tmp) 'changed)
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2697 (if (condition-case nil
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2698 (and (null comment)
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2699 (equal value
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2700 (eval
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2701 (car (get symbol 'standard-value)))))
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2702 (error nil))
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2703 ;; The value was originally set outside
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2704 ;; custom, but it was set to the standard
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2705 ;; value (probably an autoloaded defcustom).
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2706 'standard
2cbf89629cad (custom-variable-state-set): If the variable was originally set outside
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 71847
diff changeset
2707 'changed))
67783
118df638c3ff 2005-12-23 Chong Yidong <cyd@stupidchicken.com>
Chong Yidong <cyd@stupidchicken.com>
parents: 67749
diff changeset
2708 (t 'themed))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2709 'changed))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2710 ((setq tmp (get symbol 'standard-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2711 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2712 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2713 (equal comment nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2714 (error nil))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2715 'standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2716 'changed))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2717 (t 'rogue))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2718 (widget-put widget :custom-state state)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2719
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2720 (defun custom-variable-standard-value (widget)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2721 (get (widget-value widget) 'standard-value))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2722
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2723 (defvar custom-variable-menu
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2724 `(("Set for Current Session" custom-variable-set
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
2725 (lambda (widget)
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2726 (eq (widget-get widget :custom-state) 'modified)))
79040
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2727 ;; Note that in all the backquoted code in this file, we test
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2728 ;; init-file-user rather than user-init-file. This is in case
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2729 ;; cus-edit is loaded by something in site-start.el, because
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2730 ;; user-init-file is not set at that stage.
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2731 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00310.html
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2732 ,@(when (or custom-file init-file-user)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2733 '(("Save for Future Sessions" custom-variable-save
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2734 (lambda (widget)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2735 (memq (widget-get widget :custom-state)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2736 '(modified set changed rogue))))))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2737 ("Undo Edits" custom-redraw
68021
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2738 (lambda (widget)
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2739 (and (default-boundp (widget-value widget))
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2740 (memq (widget-get widget :custom-state) '(modified changed)))))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2741 ("Reset to Saved" custom-variable-reset-saved
68021
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2742 (lambda (widget)
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2743 (and (or (get (widget-value widget) 'saved-value)
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2744 (get (widget-value widget) 'saved-variable-comment))
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2745 (memq (widget-get widget :custom-state)
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
2746 '(modified set changed rogue)))))
79040
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
2747 ,@(when (or custom-file init-file-user)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2748 '(("Erase Customization" custom-variable-reset-standard
67744
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
2749 (lambda (widget)
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
2750 (and (get (widget-value widget) 'standard-value)
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
2751 (memq (widget-get widget :custom-state)
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
2752 '(modified set changed saved rogue)))))))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2753 ("Set to Backup Value" custom-variable-reset-backup
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2754 (lambda (widget)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2755 (get (widget-value widget) 'backup-value)))
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2756 ("---" ignore ignore)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2757 ("Add Comment" custom-comment-show custom-comment-invisible-p)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2758 ("---" ignore ignore)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2759 ("Show Current Value" custom-variable-edit
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2760 (lambda (widget)
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2761 (eq (widget-get widget :custom-form) 'lisp)))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
2762 ("Show Saved Lisp Expression" custom-variable-edit-lisp
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2763 (lambda (widget)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
2764 (eq (widget-get widget :custom-form) 'edit))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2765 "Alist of actions for the `custom-variable' widget.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2766 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2767 the menu entry, ACTION is the function to call on the widget when the
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2768 menu is selected, and FILTER is a predicate which takes a `custom-variable'
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2769 widget as an argument, and returns non-nil if ACTION is valid on that
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
2770 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2771
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2772 (defun custom-variable-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2773 "Show the menu for `custom-variable' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2774 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2775 (if (eq (widget-get widget :custom-state) 'hidden)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2776 (custom-toggle-hide widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2777 (unless (eq (widget-get widget :custom-state) 'modified)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2778 (custom-variable-state-set widget))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2779 (custom-redraw-magic widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2780 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2781 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2782 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2783 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2784 (custom-menu-filter custom-variable-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2785 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2786 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2787 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2788 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2789
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2790 (defun custom-variable-edit (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2791 "Edit value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2792 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2793 (widget-put widget :custom-form 'edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2794 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2795
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2796 (defun custom-variable-edit-lisp (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2797 "Edit the Lisp representation of the value of WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2798 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2799 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2800 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2801
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2802 (defun custom-variable-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2803 "Set the current value for the variable being edited by WIDGET."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2804 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2805 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2806 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2807 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2808 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2809 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2810 (comment (widget-value comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2811 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2812 (cond ((eq state 'hidden)
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
2813 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2814 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2815 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2816 (error "%s" (widget-get val :error)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2817 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2818 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2819 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2820 ;; Make the comment invisible by hand if it's empty
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2821 (custom-comment-hide comment-widget))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2822 (custom-variable-backup-value widget)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2823 (custom-push-theme 'theme-value symbol 'user
67797
7bdbb812b2f9 * custom.el (custom-push-theme): Fix docstring.
Chong Yidong <cyd@stupidchicken.com>
parents: 67793
diff changeset
2824 'set (custom-quote (widget-value child)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2825 (funcall set symbol (eval (setq val (widget-value child))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2826 (put symbol 'customized-value (list val))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2827 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2828 (put symbol 'customized-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2829 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2830 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2831 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2832 ;; Make the comment invisible by hand if it's empty
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2833 (custom-comment-hide comment-widget))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2834 (custom-variable-backup-value widget)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2835 (custom-push-theme 'theme-value symbol 'user
67797
7bdbb812b2f9 * custom.el (custom-push-theme): Fix docstring.
Chong Yidong <cyd@stupidchicken.com>
parents: 67793
diff changeset
2836 'set (custom-quote (widget-value child)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2837 (funcall set symbol (setq val (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2838 (put symbol 'customized-value (list (custom-quote val)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2839 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2840 (put symbol 'customized-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2841 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2842 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2843
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2844 (defun custom-variable-mark-to-save (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2845 "Set value and mark for saving the variable edited by WIDGET."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2846 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2847 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2848 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2849 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2850 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2851 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2852 (comment (widget-value comment-widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2853 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2854 (cond ((eq state 'hidden)
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
2855 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2856 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2857 (goto-char (widget-get val :from))
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
2858 (error "Saving %s: %s" symbol (widget-get val :error)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2859 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2860 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2861 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2862 ;; Make the comment invisible by hand if it's empty
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2863 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2864 (put symbol 'saved-value (list (widget-value child)))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2865 (custom-push-theme 'theme-value symbol 'user
67797
7bdbb812b2f9 * custom.el (custom-push-theme): Fix docstring.
Chong Yidong <cyd@stupidchicken.com>
parents: 67793
diff changeset
2866 'set (custom-quote (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2867 (funcall set symbol (eval (widget-value child)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2868 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2869 (put symbol 'saved-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2870 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2871 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2872 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2873 ;; Make the comment invisible by hand if it's empty
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2874 (custom-comment-hide comment-widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2875 (put symbol 'saved-value
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2876 (list (custom-quote (widget-value child))))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2877 (custom-push-theme 'theme-value symbol 'user
67797
7bdbb812b2f9 * custom.el (custom-push-theme): Fix docstring.
Chong Yidong <cyd@stupidchicken.com>
parents: 67793
diff changeset
2878 'set (custom-quote (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2879 (funcall set symbol (widget-value child))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2880 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2881 (put symbol 'saved-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2882 (put symbol 'customized-value nil)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2883 (put symbol 'customized-variable-comment nil)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2884
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2885 (defsubst custom-variable-state-set-and-redraw (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2886 "Set state of variable widget WIDGET and redraw with current settings."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2887 (custom-variable-state-set widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2888 (custom-redraw-magic widget))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2889
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2890 (defun custom-variable-save (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2891 "Save value of variable edited by widget WIDGET."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2892 (custom-variable-mark-to-save widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2893 (custom-save-all)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2894 (custom-variable-state-set-and-redraw widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2895
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2896 (defun custom-variable-reset-saved (widget)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2897 "Restore the saved value for the variable being edited by WIDGET.
68086
742bf2516c24 (Custom-set, Custom-save): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 68028
diff changeset
2898 This also updates the buffer to show that value.
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2899 The value that was current before this operation
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2900 becomes the backup value, so you can get it again."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2901 (let* ((symbol (widget-value widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2902 (set (or (get symbol 'custom-set) 'set-default))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2903 (value (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2904 (comment (get symbol 'saved-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2905 (cond ((or value comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2906 (put symbol 'variable-comment comment)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2907 (custom-variable-backup-value widget)
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2908 (custom-push-theme 'theme-value symbol 'user 'set (car-safe value))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2909 (condition-case nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2910 (funcall set symbol (eval (car value)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2911 (error nil)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2912 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2913 (error "No saved value for %s" symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2914 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2915 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2916 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2917 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2918 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2919
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2920 (defun custom-variable-mark-to-reset-standard (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2921 "Mark to restore standard setting for the variable edited by widget WIDGET.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2922 If `custom-reset-standard-variables-list' is nil, save, reset and
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2923 redraw the widget immediately."
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2924 (let* ((symbol (widget-value widget)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2925 (if (get symbol 'standard-value)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2926 (custom-variable-backup-value widget)
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
2927 (error "No standard setting known for %S" symbol))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2928 (put symbol 'variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2929 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2930 (put symbol 'customized-variable-comment nil)
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
2931 (custom-push-theme 'theme-value symbol 'user 'reset)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2932 (custom-theme-recalc-variable symbol)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2933 (if (and custom-reset-standard-variables-list
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2934 (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2935 (progn
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2936 (put symbol 'saved-value nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2937 (put symbol 'saved-variable-comment nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2938 ;; Append this to `custom-reset-standard-variables-list' to
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2939 ;; have `custom-reset-standard-save-and-update' save setting
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2940 ;; to the file, update the widget's state, and redraw it.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2941 (setq custom-reset-standard-variables-list
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2942 (cons widget custom-reset-standard-variables-list)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2943 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2944 (put symbol 'saved-value nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2945 (put symbol 'saved-variable-comment nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2946 (custom-save-all))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2947 (widget-put widget :custom-state 'unknown)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2948 ;; This call will possibly make the comment invisible
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2949 (custom-redraw widget))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2950
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2951 (defun custom-variable-reset-standard (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2952 "Restore standard setting for the variable edited by WIDGET.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2953 This operation eliminates any saved setting for the variable,
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2954 restoring it to the state of a variable that has never been customized.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2955 The value that was current before this operation
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2956 becomes the backup value, so you can get it again."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2957 (let (custom-reset-standard-variables-list)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
2958 (custom-variable-mark-to-reset-standard widget)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2959
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2960 (defun custom-variable-backup-value (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2961 "Back up the current value for WIDGET's variable.
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2962 The backup value is kept in the car of the `backup-value' property."
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2963 (let* ((symbol (widget-value widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2964 (get (or (get symbol 'custom-get) 'default-value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2965 (type (custom-variable-type symbol))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2966 (conv (widget-convert type))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2967 (value (if (default-boundp symbol)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2968 (funcall get symbol)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2969 (widget-get conv :value))))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2970 (put symbol 'backup-value (list value))))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2971
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2972 (defun custom-variable-reset-backup (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2973 "Restore the backup value for the variable being edited by WIDGET.
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2974 The value that was current before this operation
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2975 becomes the backup value, so you can use this operation repeatedly
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2976 to switch between two values."
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2977 (let* ((symbol (widget-value widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2978 (set (or (get symbol 'custom-set) 'set-default))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2979 (value (get symbol 'backup-value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2980 (comment-widget (widget-get widget :comment-widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2981 (comment (widget-value comment-widget)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2982 (if value
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2983 (progn
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2984 (custom-variable-backup-value widget)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
2985 (custom-push-theme 'theme-value symbol 'user 'set value)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2986 (condition-case nil
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2987 (funcall set symbol (car value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2988 (error nil)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2989 (error "No backup value for %s" symbol))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2990 (put symbol 'customized-value (list (car value)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2991 (put symbol 'variable-comment comment)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2992 (put symbol 'customized-variable-comment comment)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2993 (custom-variable-state-set widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2994 ;; This call will possibly make the comment invisible
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2995 (custom-redraw widget)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2996
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
2997 ;;; The `custom-visibility' Widget
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
2998
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
2999 (define-widget 'custom-visibility 'visibility
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3000 "Show or hide a documentation string."
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3001 :button-face 'custom-visibility
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3002 :pressed-face 'custom-visibility
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3003 :mouse-face 'highlight
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3004 :pressed-face 'highlight)
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3005
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3006 (defface custom-visibility
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3007 '((t :height 0.8 :inherit link))
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3008 "Face for the `custom-visibility' widget."
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3009 :version "23.1"
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3010 :group 'custom-faces)
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3011
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3012 ;;; The `custom-face-edit' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3013
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3014 (define-widget 'custom-face-edit 'checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3015 "Edit face attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3016 :format "%t: %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3017 :tag "Attributes"
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3018 :extra-offset 13
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3019 :button-args '(:help-echo "Control whether this attribute has any effect.")
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
3020 :value-to-internal 'custom-face-edit-fix-value
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
3021 :match (lambda (widget value)
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
3022 (widget-checklist-match widget
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
3023 (custom-face-edit-fix-value widget value)))
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3024 :convert-widget 'custom-face-edit-convert-widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3025 :args (mapcar (lambda (att)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3026 (list 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3027 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3028 :sibling-args (widget-get (nth 1 att) :sibling-args)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3029 (list 'const :format "" :value (nth 0 att))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3030 (nth 1 att)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3031 custom-face-attributes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3032
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
3033 (defun custom-face-edit-fix-value (widget value)
48709
d1efe2b99d8a (custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents: 48633
diff changeset
3034 "Ignoring WIDGET, convert :bold and :italic in VALUE to new form.
d1efe2b99d8a (custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents: 48633
diff changeset
3035 Also change :reverse-video to :inverse-video."
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3036 (if (listp value)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3037 (let (result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3038 (while value
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3039 (let ((key (car value))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3040 (val (car (cdr value))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3041 (cond ((eq key :italic)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3042 (push :slant result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3043 (push (if val 'italic 'normal) result))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3044 ((eq key :bold)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3045 (push :weight result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3046 (push (if val 'bold 'normal) result))
48709
d1efe2b99d8a (custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents: 48633
diff changeset
3047 ((eq key :reverse-video)
d1efe2b99d8a (custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents: 48633
diff changeset
3048 (push :inverse-video result)
d1efe2b99d8a (custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents: 48633
diff changeset
3049 (push val result))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
3050 (t
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3051 (push key result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3052 (push val result))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3053 (setq value (cdr (cdr value))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3054 (setq result (nreverse result))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3055 result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3056 value))
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
3057
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3058 (defun custom-face-edit-convert-widget (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3059 "Convert :args as widget types in WIDGET."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3060 (widget-put
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3061 widget
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3062 :args (mapcar (lambda (arg)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3063 (widget-convert arg
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3064 :deactivate 'custom-face-edit-deactivate
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3065 :activate 'custom-face-edit-activate
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3066 :delete 'custom-face-edit-delete))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3067 (widget-get widget :args)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3068 widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3069
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3070 (defun custom-face-edit-deactivate (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3071 "Make face widget WIDGET inactive for user modifications."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3072 (unless (widget-get widget :inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3073 (let ((tag (custom-face-edit-attribute-tag widget))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3074 (from (copy-marker (widget-get widget :from)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3075 (value (widget-value widget))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3076 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3077 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3078 (save-excursion
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3079 (goto-char from)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3080 (widget-default-delete widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3081 (insert tag ": *\n")
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3082 (widget-put widget :inactive
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3083 (cons value (cons from (- (point) from))))))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3084
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3085 (defun custom-face-edit-activate (widget)
78803
6b503866d323 Drew Adams <drew.adams at oracle.com>
Glenn Morris <rgm@gnu.org>
parents: 78394
diff changeset
3086 "Make face widget WIDGET active for user modifications."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3087 (let ((inactive (widget-get widget :inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3088 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3089 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3090 (when (consp inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3091 (save-excursion
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3092 (goto-char (car (cdr inactive)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3093 (delete-region (point) (+ (point) (cdr (cdr inactive))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3094 (widget-put widget :inactive nil)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3095 (widget-apply widget :create)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3096 (widget-value-set widget (car inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3097 (widget-setup)))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3098
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3099 (defun custom-face-edit-delete (widget)
55789
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
3100 "Remove WIDGET from the buffer."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3101 (let ((inactive (widget-get widget :inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3102 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3103 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3104 (if (not inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3105 ;; Widget is alive, we don't have to do anything special
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3106 (widget-default-delete widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3107 ;; WIDGET is already deleted because we did so to inactivate it;
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3108 ;; now just get rid of the label we put in its place.
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3109 (delete-region (car (cdr inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3110 (+ (car (cdr inactive)) (cdr (cdr inactive))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3111 (widget-put widget :inactive nil))))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
3112
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3113
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3114 (defun custom-face-edit-attribute-tag (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3115 "Returns the first :tag property in WIDGET or one of its children."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3116 (let ((tag (widget-get widget :tag)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3117 (or (and (not (equal tag "")) tag)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3118 (let ((children (widget-get widget :children)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3119 (while (and (null tag) children)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3120 (setq tag (custom-face-edit-attribute-tag (pop children))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3121 tag))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3122
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3123 ;;; The `custom-display' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3124
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3125 (define-widget 'custom-display 'menu-choice
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3126 "Select a display type."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3127 :tag "Display"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3128 :value t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3129 :help-echo "Specify frames where the face attributes should be used."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3130 :args '((const :tag "all" t)
58941
a7271df99c36 (custom-display): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58940
diff changeset
3131 (const :tag "defaults" default)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3132 (checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3133 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3134 :extra-offset 9
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3135 :args ((group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3136 Only match the specified window systems.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3137 (const :format "Type: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3138 type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3139 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3140 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3141 (const :format "X "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3142 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3143 The X11 Window System.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3144 x)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3145 (const :format "PM "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3146 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3147 OS/2 Presentation Manager.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3148 pm)
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
3149 (const :format "W32 "
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3150 :sibling-args (:help-echo "\
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
3151 Windows NT/9X.")
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
3152 w32)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94678
diff changeset
3153 (const :format "NS "
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94678
diff changeset
3154 :sibling-args (:help-echo "\
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94678
diff changeset
3155 GNUstep or Macintosh OS Cocoa interface.")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94678
diff changeset
3156 ns)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3157 (const :format "DOS "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3158 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3159 Plain MS-DOS.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3160 pc)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3161 (const :format "TTY%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3162 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3163 Plain text terminals.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3164 tty)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3165 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3166 Only match the frames with the specified color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3167 (const :format "Class: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3168 class)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3169 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3170 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3171 (const :format "Color "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3172 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3173 Match color frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3174 color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3175 (const :format "Grayscale "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3176 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3177 Match grayscale frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3178 grayscale)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3179 (const :format "Monochrome%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3180 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3181 Match frames with no color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3182 mono)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3183 (group :sibling-args (:help-echo "\
55944
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
3184 The minimum number of colors the frame should support.")
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
3185 (const :format "" min-colors)
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
3186 (integer :tag "Minimum number of colors" ))
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
3187 (group :sibling-args (:help-echo "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3188 Only match frames with the specified intensity.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3189 (const :format "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3190 Background brightness: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3191 background)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3192 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3193 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3194 (const :format "Light "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3195 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3196 Match frames with light backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3197 light)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3198 (const :format "Dark\n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3199 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3200 Match frames with dark backgrounds.")
45724
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
3201 dark)))
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
3202 (group :sibling-args (:help-echo "\
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
3203 Only match frames that support the specified face attributes.")
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
3204 (const :format "Supports attributes:" supports)
45725
abb237aa3c61 (custom-display): Use correct syntax for `supports' attributes.
Miles Bader <miles@gnu.org>
parents: 45724
diff changeset
3205 (custom-face-edit :inline t :format "%n%v"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3206
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3207 ;;; The `custom-face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3208
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3209 (defface custom-face-tag
97091
49ee444c9f1b (custom-face-tag): Inherit from custom-variable-tag
Juri Linkov <juri@jurta.org>
parents: 97043
diff changeset
3210 `((t :inherit custom-variable-tag))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3211 "Face used for face tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3212 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3213 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3214 (put 'custom-face-tag-face 'face-alias 'custom-face-tag)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3215
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3216 (defcustom custom-face-default-form 'selected
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3217 "Default form of displaying face definition."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3218 :type '(choice (const all)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3219 (const selected)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3220 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
3221 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
3222 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3223
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3224 (define-widget 'custom-face 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3225 "Customize face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3226 :sample-face 'custom-face-tag-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3227 :help-echo "Set or reset this face."
28716
e9fb71a3e51d (custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28700
diff changeset
3228 :documentation-property #'face-doc-string
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3229 :value-create 'custom-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3230 :action 'custom-face-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
3231 :custom-category 'face
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3232 :custom-form nil ; defaults to value of `custom-face-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3233 :custom-set 'custom-face-set
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3234 :custom-mark-to-save 'custom-face-mark-to-save
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3235 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3236 :custom-reset-saved 'custom-face-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3237 :custom-reset-standard 'custom-face-reset-standard
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3238 :custom-mark-to-reset-standard 'custom-face-mark-to-reset-standard
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3239 :custom-standard-value 'custom-face-standard-value
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3240 :custom-state-set-and-redraw 'custom-face-state-set-and-redraw
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3241 :custom-menu 'custom-face-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3242
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3243 (define-widget 'custom-face-all 'editable-list
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3244 "An editable list of display specifications and attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3245 :entry-format "%i %d %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3246 :insert-button-args '(:help-echo "Insert new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3247 :append-button-args '(:help-echo "Append new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3248 :delete-button-args '(:help-echo "Delete this display specification.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3249 :args '((group :format "%v" custom-display custom-face-edit)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3250
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3251 (defconst custom-face-all (widget-convert 'custom-face-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3252 "Converted version of the `custom-face-all' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3253
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3254 (define-widget 'custom-display-unselected 'item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3255 "A display specification that doesn't match the selected display."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3256 :match 'custom-display-unselected-match)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3257
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3258 (defun custom-display-unselected-match (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3259 "Non-nil if VALUE is an unselected display specification."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3260 (not (face-spec-set-match-display value (selected-frame))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3261
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3262 (define-widget 'custom-face-selected 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3263 "Edit the attributes of the selected display in a face specification."
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3264 :args '((choice :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3265 (group :tag "With Defaults" :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3266 (group (const :tag "" default)
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3267 (custom-face-edit :tag " Default\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3268 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3269 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3270 (group custom-display-unselected sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3271 (group (sexp :format "")
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3272 (custom-face-edit :tag " Overriding\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3273 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3274 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3275 sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3276 (group :tag "No Defaults" :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3277 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3278 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3279 (group custom-display-unselected sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3280 (group (sexp :format "")
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3281 (custom-face-edit :tag "\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3282 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3283 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3284 sexp)))))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3285
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3286
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3287
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3288 (defconst custom-face-selected (widget-convert 'custom-face-selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3289 "Converted version of the `custom-face-selected' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3290
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3291 (defun custom-filter-face-spec (spec filter-index &optional default-filter)
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3292 "Return a canonicalized version of SPEC using.
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3293 FILTER-INDEX is the index in the entry for each attribute in
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3294 `custom-face-attributes' at which the appropriate filter function can be
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3295 found, and DEFAULT-FILTER is the filter to apply for attributes that
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3296 don't specify one."
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3297 (mapcar (lambda (entry)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3298 ;; Filter a single face-spec entry
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3299 (let ((tests (car entry))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3300 (unfiltered-attrs
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3301 ;; Handle both old- and new-style attribute syntax
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3302 (if (listp (car (cdr entry)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3303 (car (cdr entry))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3304 (cdr entry)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3305 (filtered-attrs nil))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3306 ;; Filter each face attribute
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3307 (while unfiltered-attrs
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3308 (let* ((attr (pop unfiltered-attrs))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3309 (pre-filtered-value (pop unfiltered-attrs))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3310 (filter
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3311 (or (nth filter-index (assq attr custom-face-attributes))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3312 default-filter))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3313 (filtered-value
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3314 (if filter
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3315 (funcall filter pre-filtered-value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3316 pre-filtered-value)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3317 (push filtered-value filtered-attrs)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3318 (push attr filtered-attrs)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3319 ;;
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3320 (list tests filtered-attrs)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3321 spec))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3322
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3323 (defun custom-pre-filter-face-spec (spec)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3324 "Return SPEC changed as necessary for editing by the face customization widget.
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3325 SPEC must be a full face spec."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3326 (custom-filter-face-spec spec 2))
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3327
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3328 (defun custom-post-filter-face-spec (spec)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3329 "Return the customized SPEC in a form suitable for setting the face."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3330 (custom-filter-face-spec spec 3))
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3331
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3332 (defun custom-face-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3333 "Create a list of the display specifications for WIDGET."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3334 (let ((buttons (widget-get widget :buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3335 children
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3336 (symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3337 (tag (widget-get widget :tag))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3338 (state (widget-get widget :custom-state))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3339 (begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3340 (is-last (widget-get widget :custom-last))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3341 (prefix (widget-get widget :custom-prefix)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3342 (unless tag
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3343 (setq tag (prin1-to-string symbol)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3344 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3345 (insert prefix (if is-last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3346 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3347 widget 'custom-browse-face-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3348 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3349 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3350 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3351 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3352 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3353 (insert tag)
34041
40708840c132 (custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents: 33986
diff changeset
3354 (widget-specify-sample widget begin (point))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3355 (if (eq custom-buffer-style 'face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3356 (insert " ")
33024
42e118959715 (custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents: 32936
diff changeset
3357 (if (string-match "face\\'" tag)
42e118959715 (custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents: 32936
diff changeset
3358 (insert ":")
42e118959715 (custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents: 32936
diff changeset
3359 (insert " face: ")))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3360 ;; Sample.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3361 (push (widget-create-child-and-convert widget 'item
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3362 :format "(%{%t%})"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3363 :sample-face symbol
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3364 :tag "sample")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3365 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3366 ;; Visibility.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3367 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3368 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3369 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3370 :help-echo "Hide or show this face."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
3371 :on "Hide Face"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
3372 :off "Show Face"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3373 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3374 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3375 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3376 ;; Magic.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3377 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3378 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3379 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3380 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3381 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3382 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3383 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3384 ;; Insert documentation.
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3385 (widget-put widget :documentation-indent 3)
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3386 (widget-add-documentation-string-button
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3387 widget :visibility-widget 'custom-visibility)
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3388
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3389 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3390 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3391 (let* ((comment (get symbol 'face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3392 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3393 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3394 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3395 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3396 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3397 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3398 (push comment-widget children)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3399 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3400 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3401 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3402 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3403 (custom-add-see-also widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3404 ;; Editor.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3405 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3406 (insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3407 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3408 (message "Creating face editor...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3409 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3410 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3411 (widget-put widget :custom-form custom-face-default-form))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3412 (let* ((symbol (widget-value widget))
40825
22caa22b7399 2001-11-07 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 40801
diff changeset
3413 (spec (or (get symbol 'customized-face)
22caa22b7399 2001-11-07 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 40801
diff changeset
3414 (get symbol 'saved-face)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3415 (get symbol 'face-defface-spec)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3416 ;; Attempt to construct it.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3417 (list (list t (custom-face-attributes-get
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3418 symbol (selected-frame))))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3419 (form (widget-get widget :custom-form))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3420 (indent (widget-get widget :indent))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3421 edit)
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3422 ;; If the user has changed this face in some other way,
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3423 ;; edit it as the user has specified it.
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3424 (if (not (face-spec-match-p symbol spec (selected-frame)))
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3425 (setq spec (list (list t (face-attr-construct symbol (selected-frame))))))
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3426 (setq spec (custom-pre-filter-face-spec spec))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3427 (setq edit (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3428 widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3429 (cond ((and (eq form 'selected)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3430 (widget-apply custom-face-selected
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3431 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3432 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3433 'custom-face-selected)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3434 ((and (not (eq form 'lisp))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3435 (widget-apply custom-face-all
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3436 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3437 'custom-face-all)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3438 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3439 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3440 'sexp))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3441 :value spec))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3442 (custom-face-state-set widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3443 (push edit children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3444 (widget-put widget :children children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3445 (message "Creating face editor...done"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3446
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3447 (defvar custom-face-menu
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3448 `(("Set for Current Session" custom-face-set)
79040
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
3449 ,@(when (or custom-file init-file-user)
68278
125d04254c22 (custom-buffer-create-internal): State in the text above
Luc Teirlinck <teirllm@auburn.edu>
parents: 68232
diff changeset
3450 '(("Save for Future Sessions" custom-face-save)))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3451 ("Undo Edits" custom-redraw
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3452 (lambda (widget)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3453 (memq (widget-get widget :custom-state) '(modified changed))))
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3454 ("Reset to Saved" custom-face-reset-saved
68021
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
3455 (lambda (widget)
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
3456 (or (get (widget-value widget) 'saved-face)
271ab3aed790 * cus-edit.el (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68020
diff changeset
3457 (get (widget-value widget) 'saved-face-comment))))
79040
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
3458 ,@(when (or custom-file init-file-user)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3459 '(("Erase Customization" custom-face-reset-standard
67744
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
3460 (lambda (widget)
1c62bde28518 (custom-variable-prompt): Say "variable" in prompt.
Richard M. Stallman <rms@gnu.org>
parents: 67677
diff changeset
3461 (get (widget-value widget) 'face-defface-spec)))))
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
3462 ("---" ignore ignore)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3463 ("Add Comment" custom-comment-show custom-comment-invisible-p)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3464 ("---" ignore ignore)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3465 ("For Current Display" custom-face-edit-selected
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3466 (lambda (widget)
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3467 (not (eq (widget-get widget :custom-form) 'selected))))
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3468 ("For All Kinds of Displays" custom-face-edit-all
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
3469 (lambda (widget)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
3470 (not (eq (widget-get widget :custom-form) 'all))))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
3471 ("Show Lisp Expression" custom-face-edit-lisp
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
3472 (lambda (widget)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
3473 (not (eq (widget-get widget :custom-form) 'lisp)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3474 "Alist of actions for the `custom-face' widget.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3475 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3476 the menu entry, ACTION is the function to call on the widget when the
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3477 menu is selected, and FILTER is a predicate which takes a `custom-face'
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3478 widget as an argument, and returns non-nil if ACTION is valid on that
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3479 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3480
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3481 (defun custom-face-edit-selected (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3482 "Edit selected attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3483 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3484 (widget-put widget :custom-form 'selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3485 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3486
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3487 (defun custom-face-edit-all (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3488 "Edit all attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3489 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3490 (widget-put widget :custom-form 'all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3491 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3492
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3493 (defun custom-face-edit-lisp (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3494 "Edit the Lisp representation of the value of WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3495 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3496 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3497 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3498
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3499 (defun custom-face-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3500 "Set the state of WIDGET."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3501 (let* ((symbol (widget-value widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3502 (comment (get symbol 'face-comment))
51277
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3503 tmp temp
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3504 (state
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3505 (cond ((progn
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3506 (setq tmp (get symbol 'customized-face))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3507 (setq temp (get symbol 'customized-face-comment))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3508 (or tmp temp))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3509 (if (equal temp comment)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3510 'set
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3511 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3512 ((progn
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3513 (setq tmp (get symbol 'saved-face))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3514 (setq temp (get symbol 'saved-face-comment))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3515 (or tmp temp))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3516 (if (equal temp comment)
67784
7c9d6a4a35c7 (custom-face-state-set): Check theme-value.
Chong Yidong <cyd@stupidchicken.com>
parents: 67783
diff changeset
3517 (cond
7c9d6a4a35c7 (custom-face-state-set): Check theme-value.
Chong Yidong <cyd@stupidchicken.com>
parents: 67783
diff changeset
3518 ((eq 'user (caar (get symbol 'theme-face)))
7c9d6a4a35c7 (custom-face-state-set): Check theme-value.
Chong Yidong <cyd@stupidchicken.com>
parents: 67783
diff changeset
3519 'saved)
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
3520 ((eq 'changed (caar (get symbol 'theme-face)))
67784
7c9d6a4a35c7 (custom-face-state-set): Check theme-value.
Chong Yidong <cyd@stupidchicken.com>
parents: 67783
diff changeset
3521 'changed)
7c9d6a4a35c7 (custom-face-state-set): Check theme-value.
Chong Yidong <cyd@stupidchicken.com>
parents: 67783
diff changeset
3522 (t 'themed))
51277
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3523 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3524 ((get symbol 'face-defface-spec)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3525 (if (equal comment nil)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3526 'standard
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3527 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3528 (t
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3529 'rogue))))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3530 ;; If the user called set-face-attribute to change the default
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3531 ;; for new frames, this face is "set outside of Customize".
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3532 (if (and (not (eq state 'rogue))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3533 (get symbol 'face-modified))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3534 (setq state 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3535 (widget-put widget :custom-state state)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3536
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3537 (defun custom-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3538 "Show the menu for `custom-face' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3539 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3540 (if (eq (widget-get widget :custom-state) 'hidden)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3541 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3542 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3543 (symbol (widget-get widget :value))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3544 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3545 (custom-unlispify-tag-name symbol))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3546 (custom-menu-filter custom-face-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3547 widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3548 event)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3549 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3550 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3551
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3552 (defun custom-face-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3553 "Make the face attributes in WIDGET take effect."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3554 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3555 (child (car (widget-get widget :children)))
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3556 (value (custom-post-filter-face-spec (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3557 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3558 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3559 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3560 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3561 ;; Make the comment invisible by hand if it's empty
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
3562 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3563 (put symbol 'customized-face value)
69624
efd1add5bedf * cus-edit.el (custom-face-set): Call custom-push-theme before
Chong Yidong <cyd@stupidchicken.com>
parents: 69540
diff changeset
3564 (custom-push-theme 'theme-face symbol 'user 'set value)
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3565 (if (face-spec-choose value)
87486
a4cfa0059507 (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
Richard M. Stallman <rms@gnu.org>
parents: 86334
diff changeset
3566 (face-spec-set symbol value t)
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3567 ;; face-set-spec ignores empty attribute lists, so just give it
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3568 ;; something harmless instead.
87486
a4cfa0059507 (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
Richard M. Stallman <rms@gnu.org>
parents: 86334
diff changeset
3569 (face-spec-set symbol '((t :foreground unspecified)) t))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3570 (put symbol 'customized-face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3571 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3572 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3573 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3574
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3575 (defun custom-face-mark-to-save (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3576 "Mark for saving the face edited by WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3577 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3578 (child (car (widget-get widget :children)))
35441
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3579 (value (custom-post-filter-face-spec (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3580 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3581 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3582 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3583 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3584 ;; Make the comment invisible by hand if it's empty
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
3585 (custom-comment-hide comment-widget))
68026
c7ec296cf313 * cus-edit.el (custom-face-save): Push to theme-face before
Chong Yidong <cyd@stupidchicken.com>
parents: 68021
diff changeset
3586 (custom-push-theme 'theme-face symbol 'user 'set value)
35441
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3587 (if (face-spec-choose value)
87486
a4cfa0059507 (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
Richard M. Stallman <rms@gnu.org>
parents: 86334
diff changeset
3588 (face-spec-set symbol value t)
35441
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3589 ;; face-set-spec ignores empty attribute lists, so just give it
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3590 ;; something harmless instead.
87486
a4cfa0059507 (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
Richard M. Stallman <rms@gnu.org>
parents: 86334
diff changeset
3591 (face-spec-set symbol '((t :foreground unspecified)) t))
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3592 (unless (eq (widget-get widget :custom-state) 'standard)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3593 (put symbol 'saved-face value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3594 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3595 (put symbol 'face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3596 (put symbol 'customized-face-comment nil)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3597 (put symbol 'saved-face-comment comment)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3598
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3599 (defsubst custom-face-state-set-and-redraw (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3600 "Set state of face widget WIDGET and redraw with current settings."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3601 (custom-face-state-set widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3602 (custom-redraw-magic widget))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3603
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3604 (defun custom-face-save (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3605 "Save the face edited by WIDGET."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3606 (custom-face-mark-to-save widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3607 (custom-save-all)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3608 (custom-face-state-set-and-redraw widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3609
68278
125d04254c22 (custom-buffer-create-internal): State in the text above
Luc Teirlinck <teirllm@auburn.edu>
parents: 68232
diff changeset
3610 ;; For backward compatibility.
125d04254c22 (custom-buffer-create-internal): State in the text above
Luc Teirlinck <teirllm@auburn.edu>
parents: 68232
diff changeset
3611 (define-obsolete-function-alias 'custom-face-save-command 'custom-face-save
125d04254c22 (custom-buffer-create-internal): State in the text above
Luc Teirlinck <teirllm@auburn.edu>
parents: 68232
diff changeset
3612 "22.1")
125d04254c22 (custom-buffer-create-internal): State in the text above
Luc Teirlinck <teirllm@auburn.edu>
parents: 68232
diff changeset
3613
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3614 (defun custom-face-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3615 "Restore WIDGET to the face's default attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3616 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3617 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3618 (value (get symbol 'saved-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3619 (comment (get symbol 'saved-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3620 (comment-widget (widget-get widget :comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3621 (unless (or value comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3622 (error "No saved value for this face"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3623 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3624 (put symbol 'customized-face-comment nil)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
3625 (custom-push-theme 'theme-face symbol 'user 'set value)
87486
a4cfa0059507 (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
Richard M. Stallman <rms@gnu.org>
parents: 86334
diff changeset
3626 (face-spec-set symbol value t)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3627 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3628 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3629 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3630 (widget-value-set comment-widget (or comment ""))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3631 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3632 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3633
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3634 (defun custom-face-standard-value (widget)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3635 (get (widget-value widget) 'face-defface-spec))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3636
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3637 (defun custom-face-mark-to-reset-standard (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3638 "Restore widget WIDGET to the face's standard attribute values.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3639 If `custom-reset-standard-faces-list' is nil, save, reset and
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3640 redraw the widget immediately."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3641 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3642 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3643 (value (get symbol 'face-defface-spec))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3644 (comment-widget (widget-get widget :comment-widget)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3645 (unless value
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
3646 (error "No standard setting for this face"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3647 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3648 (put symbol 'customized-face-comment nil)
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
3649 (custom-push-theme 'theme-face symbol 'user 'reset)
87486
a4cfa0059507 (custom-face-set): Call `face-spec-set' with FOR-DEFFACE.
Richard M. Stallman <rms@gnu.org>
parents: 86334
diff changeset
3650 (face-spec-set symbol value t)
67792
1c774eee2980 * cus-edit.el (custom-variable-set, custom-variable-set)
Chong Yidong <cyd@stupidchicken.com>
parents: 67791
diff changeset
3651 (custom-theme-recalc-face symbol)
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3652 (if (and custom-reset-standard-faces-list
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3653 (or (get symbol 'saved-face) (get symbol 'saved-face-comment)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3654 ;; Do this later.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3655 (progn
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3656 (put symbol 'saved-face nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3657 (put symbol 'saved-face-comment nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3658 ;; Append this to `custom-reset-standard-faces-list' and have
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3659 ;; `custom-reset-standard-save-and-update' save setting to the
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3660 ;; file, update the widget's state, and redraw it.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3661 (setq custom-reset-standard-faces-list
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3662 (cons widget custom-reset-standard-faces-list)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3663 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3664 (put symbol 'saved-face nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3665 (put symbol 'saved-face-comment nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3666 (custom-save-all))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3667 (put symbol 'face-comment nil)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3668 (widget-value-set child
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3669 (custom-pre-filter-face-spec
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3670 (list (list t (custom-face-attributes-get
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3671 symbol nil)))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3672 ;; This call manages the comment visibility
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3673 (widget-value-set comment-widget "")
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3674 (custom-face-state-set widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3675 (custom-redraw-magic widget))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3676
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3677 (defun custom-face-reset-standard (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3678 "Restore WIDGET to the face's standard attribute values.
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3679 This operation eliminates any saved attributes for the face,
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3680 restoring it to the state of a face that has never been customized."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3681 (let (custom-reset-standard-faces-list)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3682 (custom-face-mark-to-reset-standard widget)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3683
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3684 ;;; The `face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3685
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3686 (defvar widget-face-prompt-value-history nil
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3687 "History of input to `widget-face-prompt-value'.")
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3688
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3689 (define-widget 'face 'symbol
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3690 "A Lisp face name (with sample)."
66941
1710aca8150f (Custom-reset-standard): Verify that
Richard M. Stallman <rms@gnu.org>
parents: 66904
diff changeset
3691 :format "%{%t%}: (%{sample%}) %v"
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3692 :tag "Face"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3693 :value 'default
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3694 :sample-face-get 'widget-face-sample-face-get
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3695 :notify 'widget-face-notify
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3696 :match (lambda (widget value) (facep value))
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3697 :complete-function (lambda ()
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3698 (interactive)
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3699 (lisp-complete-symbol 'facep))
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3700 :prompt-match 'facep
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3701 :prompt-history 'widget-face-prompt-value-history
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3702 :validate (lambda (widget)
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3703 (unless (facep (widget-value widget))
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3704 (widget-put widget
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3705 :error (format "Invalid face: %S"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3706 (widget-value widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3707 widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3708
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3709 (defun widget-face-sample-face-get (widget)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3710 (let ((value (widget-value widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3711 (if (facep value)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3712 value
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3713 'default)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3714
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3715 (defun widget-face-notify (widget child &optional event)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3716 "Update the sample, and notify the parent."
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3717 (overlay-put (widget-get widget :sample-overlay)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3718 'face (widget-apply widget :sample-face-get))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3719 (widget-default-notify widget child event))
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3720
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3721
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3722 ;;; The `hook' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3723
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3724 (define-widget 'hook 'list
73797
2e5ad09135ff (hook): Fix typos in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 73795
diff changeset
3725 "An Emacs Lisp hook."
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3726 :value-to-internal (lambda (widget value)
19886
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
3727 (if (and value (symbolp value))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3728 (list value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3729 value))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3730 :match (lambda (widget value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3731 (or (symbolp value)
20174
e1ca1fe89e6e (hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents: 20100
diff changeset
3732 (widget-group-match widget value)))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3733 ;; Avoid adding undefined functions to the hook, especially for
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3734 ;; things like `find-file-hook' or even more basic ones, to avoid
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3735 ;; chaos.
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3736 :set (lambda (symbol value)
28310
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3737 (dolist (elt value)
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3738 (if (fboundp elt)
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3739 (add-hook symbol elt))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3740 :convert-widget 'custom-hook-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3741 :tag "Hook")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3742
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3743 (defun custom-hook-convert-widget (widget)
27250
807fc106b24c (custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents: 26803
diff changeset
3744 ;; Handle `:options'.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3745 (let* ((options (widget-get widget :options))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3746 (other `(editable-list :inline t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3747 :entry-format "%i %d%v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3748 (function :format " %v")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3749 (args (if options
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3750 (list `(checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3751 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3752 `(function-item ,entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3753 options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3754 other)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3755 (list other))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3756 (widget-put widget :args args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3757 widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3758
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3759 ;;; The `custom-group-link' Widget.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3760
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3761 (define-widget 'custom-group-link 'link
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3762 "Show parent in other window when activated."
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
3763 :button-face 'custom-link
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
3764 :mouse-face 'highlight
68892
93b583aac002 * wid-edit.el (widget-button-click): Use :pressed-face property
Chong Yidong <cyd@stupidchicken.com>
parents: 68406
diff changeset
3765 :pressed-face 'highlight
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3766 :help-echo "Create customization buffer for this group."
73795
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
3767 :keymap custom-mode-link-map
4064a5037466 (custom-mode-map): Move defvar above code using it.
Chong Yidong <cyd@stupidchicken.com>
parents: 73762
diff changeset
3768 :follow-link 'mouse-face
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3769 :action 'custom-group-link-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3770
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3771 (defun custom-group-link-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3772 (customize-group (widget-value widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3773
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3774 ;;; The `custom-group' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3775
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3776 (defcustom custom-group-tag-faces nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3777 ;; In XEmacs, this ought to play games with font size.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3778 ;; Fixme: make it do so in Emacs.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3779 "Face used for group tags.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3780 The first member is used for level 1 groups, the second for level 2,
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3781 and so forth. The remaining group tags are shown with `custom-group-tag'."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3782 :type '(repeat face)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3783 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3784
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3785 (defface custom-group-tag-1
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3786 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3787 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3788 (:foreground "pink" :weight bold :height 1.2 :inherit variable-pitch))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3789 (((min-colors 88) (class color)
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3790 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3791 (:foreground "red1" :weight bold :height 1.2 :inherit variable-pitch))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3792 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3793 (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3794 (:foreground "red" :weight bold :height 1.2 :inherit variable-pitch))
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3795 (t (:weight bold)))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3796 "Face used for group tags."
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3797 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3798 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3799 (put 'custom-group-tag-face-1 'face-alias 'custom-group-tag-1)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3800
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3801 (defface custom-group-tag
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3802 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3803 (background dark))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3804 (:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3805 (((min-colors 88) (class color)
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3806 (background light))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3807 (:foreground "blue1" :weight bold :height 1.2 :inherit variable-pitch))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3808 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3809 (background light))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3810 (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3811 (t (:weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3812 "Face used for low level group tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3813 :group 'custom-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3814 ;; backward-compatibility alias
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3815 (put 'custom-group-tag-face 'face-alias 'custom-group-tag)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3816
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3817 (define-widget 'custom-group 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3818 "Customize group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3819 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3820 :sample-face-get 'custom-group-sample-face-get
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3821 :documentation-property 'group-documentation
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3822 :help-echo "Set or reset all members of this group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3823 :value-create 'custom-group-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3824 :action 'custom-group-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
3825 :custom-category 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3826 :custom-set 'custom-group-set
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3827 :custom-mark-to-save 'custom-group-mark-to-save
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3828 :custom-reset-current 'custom-group-reset-current
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3829 :custom-reset-saved 'custom-group-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3830 :custom-reset-standard 'custom-group-reset-standard
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3831 :custom-mark-to-reset-standard 'custom-group-mark-to-reset-standard
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
3832 :custom-state-set-and-redraw 'custom-group-state-set-and-redraw
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3833 :custom-menu 'custom-group-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3834
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3835 (defun custom-group-sample-face-get (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3836 ;; Use :sample-face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3837 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3838 'custom-group-tag))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3839
18430
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3840 (define-widget 'custom-group-visibility 'visibility
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3841 "An indicator and manipulator for hidden group contents."
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3842 :create 'custom-group-visibility-create)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3843
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3844 (defun custom-group-visibility-create (widget)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3845 (let ((visible (widget-value widget)))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3846 (if visible
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3847 (insert "--------")))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3848 (widget-default-create widget))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3849
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3850 (defun custom-group-members (symbol groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3851 "Return SYMBOL's custom group members.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3852 If GROUPS-ONLY non-nil, return only those members that are groups."
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3853 (if (not groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3854 (get symbol 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3855 (let (members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3856 (dolist (entry (get symbol 'custom-group))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3857 (when (eq (nth 1 entry) 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3858 (push entry members)))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3859 (nreverse members))))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3860
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3861 (defun custom-group-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3862 "Insert a customize group for WIDGET in the current buffer."
49126
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
3863 (unless (eq (widget-get widget :custom-state) 'hidden)
49300
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
3864 (custom-load-widget widget))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3865 (let* ((state (widget-get widget :custom-state))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3866 (level (widget-get widget :custom-level))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3867 ;; (indent (widget-get widget :indent))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3868 (prefix (widget-get widget :custom-prefix))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3869 (buttons (widget-get widget :buttons))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3870 (tag (widget-get widget :tag))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3871 (symbol (widget-value widget))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3872 (members (custom-group-members symbol
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3873 (and (eq custom-buffer-style 'tree)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3874 custom-browse-only-groups))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3875 (cond ((and (eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3876 (eq state 'hidden)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3877 (or members (custom-unloaded-widget-p widget)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3878 (custom-browse-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3879 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3880 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3881 ;; :tag-glyph "plus"
18856
03eeb83520d8 (custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents: 18812
diff changeset
3882 :tag "+")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3883 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3884 (insert "-- ")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3885 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3886 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3887 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3888 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3889 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3890 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3891 ((and (eq custom-buffer-style 'tree)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3892 (zerop (length members)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3893 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3894 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3895 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3896 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3897 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3898 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3899 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3900 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3901 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3902 ((eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3903 (custom-browse-insert-prefix prefix)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3904 (if (zerop (length members))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3905 (progn
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3906 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3907 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3908 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3909 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3910 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3911 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3912 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3913 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3914 (widget-put widget :buttons buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3915 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3916 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3917 ;; :tag-glyph "minus"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3918 :tag "-")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3919 buttons)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3920 (insert "-\\ ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3921 ;; (widget-glyph-insert nil "-\\ " "top")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3922 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3923 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3924 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3925 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3926 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3927 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3928 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3929 custom-browse-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3930 custom-browse-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3931 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3932 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3933 (extra-prefix (if (widget-get widget :custom-last)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3934 " "
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3935 " | "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3936 (prefix (concat prefix extra-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3937 children entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3938 (while members
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3939 (setq entry (car members)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3940 members (cdr members))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3941 (push (widget-create-child-and-convert
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3942 widget (nth 1 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3943 :group widget
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3944 :tag (custom-unlispify-tag-name (nth 0 entry))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3945 :custom-prefixes custom-prefix-list
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3946 :custom-level (1+ level)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3947 :custom-last (null members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3948 :value (nth 0 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3949 :custom-prefix prefix)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3950 children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3951 (widget-put widget :children (reverse children)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3952 (message "Creating group...done")))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3953 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3954 ((eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3955 ;; Create level indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3956 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3957 (if (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3958 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3959 widget 'custom-group-link
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3960 :tag tag
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3961 symbol)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3962 buttons)
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3963 (insert-char ?\ (* custom-buffer-indent (1- level)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3964 (insert "-- ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3965 (push (widget-create-child-and-convert
20100
0db4553d47cc (custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents: 19886
diff changeset
3966 widget 'custom-group-visibility
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3967 :help-echo "Show members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3968 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3969 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3970 buttons))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
3971 (insert " : ")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3972 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3973 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3974 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3975 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3976 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3977 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3978 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3979 ;; Insert documentation.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3980 (if (and (eq custom-buffer-style 'links) (> level 1))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3981 (widget-put widget :documentation-indent 0))
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3982 (widget-add-documentation-string-button
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3983 widget :visibility-widget 'custom-visibility))
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
3984
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3985 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3986 (t ;Visible.
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3987 ;; Add parent groups references above the group.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3988 (if t ;;; This should test that the buffer
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3989 ;;; was made to display a group.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3990 (when (eq level 1)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
3991 (if (custom-add-parent-links widget
79659
a4773f405434 (custom-add-parent-links): New arg DOC-INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 79655
diff changeset
3992 "Parent groups:"
a4773f405434 (custom-add-parent-links): New arg DOC-INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 79655
diff changeset
3993 "Parent group documentation:")
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3994 (insert "\n"))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3995 ;; Create level indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3996 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3997 (insert "/- ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3998 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3999 (let ((start (point)))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4000 (insert tag " group: ")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4001 (widget-specify-sample widget start (point)))
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4002 (insert (widget-docstring widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4003 ;; Create visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4004 (unless (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4005 (insert "--------")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4006 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4007 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4008 :help-echo "Hide members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4009 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4010 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4011 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4012 (insert " "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4013 ;; Create more dashes.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4014 ;; Use 76 instead of 75 to compensate for the temporary "<"
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4015 ;; added by `widget-insert'.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4016 (insert-char ?- (- 76 (current-column)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4017 (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4018 (insert "\\\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4019 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4020 (let ((magic (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4021 widget 'custom-magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4022 :indent 0
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4023 nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4024 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4025 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4026 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4027 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4028 ;; Insert documentation.
81429
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
4029 (widget-add-documentation-string-button
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
4030 widget :visibility-widget 'custom-visibility)
fb627c8fac18 (custom-split-regexp-maybe): Simplify.
Chong Yidong <cyd@stupidchicken.com>
parents: 77997
diff changeset
4031
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
4032 ;; Parent groups.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
4033 (if nil ;;; This should test that the buffer
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
4034 ;;; was not made to display a group.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
4035 (when (eq level 1)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
4036 (insert-char ?\ custom-buffer-indent)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
4037 (custom-add-parent-links widget)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4038 (custom-add-see-also widget
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4039 (make-string (* custom-buffer-indent level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4040 ?\ ))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4041 ;; Members.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4042 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4043 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4044 custom-buffer-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4045 custom-buffer-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4046 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4047 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4048 (length (length members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4049 (count 0)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4050 (children (mapcar (lambda (entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4051 (widget-insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4052 (message "\
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4053 Creating group members... %2d%%"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4054 (/ (* 100.0 count) length))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4055 (setq count (1+ count))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4056 (prog1
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4057 (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4058 widget (nth 1 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4059 :group widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4060 :tag (custom-unlispify-tag-name
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4061 (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4062 :custom-prefixes custom-prefix-list
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4063 :custom-level (1+ level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4064 :value (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4065 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4066 (widget-insert "\n"))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4067 members)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4068 (message "Creating group magic...")
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
4069 (mapc 'custom-magic-reset children)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4070 (message "Creating group state...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4071 (widget-put widget :children children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4072 (custom-group-state-update widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4073 (message "Creating group... done"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4074 ;; End line
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4075 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4076 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4077 (insert "\\- " (widget-get widget :tag) " group end ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4078 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4079 (insert "/\n")))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4080
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4081 (defvar custom-group-menu
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
4082 `(("Set for Current Session" custom-group-set
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
4083 (lambda (widget)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
4084 (eq (widget-get widget :custom-state) 'modified)))
79040
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
4085 ,@(when (or custom-file init-file-user)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
4086 '(("Save for Future Sessions" custom-group-save
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
4087 (lambda (widget)
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
4088 (memq (widget-get widget :custom-state) '(modified set))))))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
4089 ("Undo Edits" custom-group-reset-current
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
4090 (lambda (widget)
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
4091 (memq (widget-get widget :custom-state) '(modified))))
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
4092 ("Reset to Saved" custom-group-reset-saved
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
4093 (lambda (widget)
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
4094 (memq (widget-get widget :custom-state) '(modified set))))
79040
853a17baf2b0 (custom-variable-menu, custom-face-menu)
Glenn Morris <rgm@gnu.org>
parents: 78803
diff changeset
4095 ,@(when (or custom-file init-file-user)
68139
058a6e577709 (custom-reset-menu, custom-buffer-create-internal)
Luc Teirlinck <teirllm@auburn.edu>
parents: 68109
diff changeset
4096 '(("Erase Customization" custom-group-reset-standard
68020
d8acae190ef7 * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68017
diff changeset
4097 (lambda (widget)
68028
b0c2a07f73f6 (custom-reset-menu, Custom-mode-menu)
Chong Yidong <cyd@stupidchicken.com>
parents: 68026
diff changeset
4098 (memq (widget-get widget :custom-state) '(modified set saved)))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4099 "Alist of actions for the `custom-group' widget.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4100 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4101 the menu entry, ACTION is the function to call on the widget when the
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4102 menu is selected, and FILTER is a predicate which takes a `custom-group'
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4103 widget as an argument, and returns non-nil if ACTION is valid on that
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4104 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4105
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4106 (defun custom-group-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4107 "Show the menu for `custom-group' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4108 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4109 (if (eq (widget-get widget :custom-state) 'hidden)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4110 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4111 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4112 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4113 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4114 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4115 (custom-menu-filter custom-group-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4116 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4117 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4118 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4119 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4120
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4121 (defun custom-group-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4122 "Set changes in all modified group members."
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4123 (dolist (child (widget-get widget :children))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4124 (when (eq (widget-get child :custom-state) 'modified)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4125 (widget-apply child :custom-set))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4126
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4127 (defun custom-group-mark-to-save (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4128 "Mark all modified group members for saving."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4129 (dolist (child (widget-get widget :children))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4130 (when (memq (widget-get child :custom-state) '(modified set))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4131 (widget-apply child :custom-mark-to-save))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4132
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4133 (defsubst custom-group-state-set-and-redraw (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4134 "Set state of group widget WIDGET and redraw with current settings."
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4135 (dolist (child (widget-get widget :children))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4136 (when (memq (widget-get child :custom-state) '(modified set))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4137 (widget-apply child :custom-state-set-and-redraw))))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4138
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4139 (defun custom-group-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4140 "Save all modified group members."
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4141 (custom-group-mark-to-save widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4142 (custom-save-all)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4143 (custom-group-state-set-and-redraw widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4144
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4145 (defun custom-group-reset-current (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4146 "Reset all modified group members."
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4147 (dolist (child (widget-get widget :children))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4148 (when (eq (widget-get child :custom-state) 'modified)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4149 (widget-apply child :custom-reset-current))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4150
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4151 (defun custom-group-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4152 "Reset all modified or set group members."
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4153 (dolist (child (widget-get widget :children))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4154 (when (memq (widget-get child :custom-state) '(modified set))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4155 (widget-apply child :custom-reset-saved))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4156
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4157 (defun custom-group-reset-standard (widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4158 "Reset all modified, set, or saved group members."
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4159 (let ((custom-reset-standard-variables-list '(t))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4160 (custom-reset-standard-faces-list '(t)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4161 (custom-group-mark-to-reset-standard widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4162 (custom-reset-standard-save-and-update)))
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4163
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4164 (defun custom-group-mark-to-reset-standard (widget)
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4165 "Mark to reset all modified, set, or saved group members."
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4166 (dolist (child (widget-get widget :children))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4167 (when (memq (widget-get child :custom-state)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4168 '(modified set saved))
87795
299387a1f305 (custom-reset-standard-variables-list)
Martin Rudalics <rudalics@gmx.at>
parents: 87597
diff changeset
4169 (widget-apply child :custom-mark-to-reset-standard))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4170
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4171 (defun custom-group-state-update (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4172 "Update magic."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4173 (unless (eq (widget-get widget :custom-state) 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4174 (let* ((children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4175 (states (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4176 (widget-get child :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4177 children))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4178 (magics custom-magic-alist)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4179 (found 'standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4180 (while magics
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4181 (let ((magic (car (car magics))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4182 (if (and (not (eq magic 'hidden))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4183 (memq magic states))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4184 (setq found magic
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4185 magics nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4186 (setq magics (cdr magics)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4187 (widget-put widget :custom-state found)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4188 (custom-magic-reset widget))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4189
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4190 ;;; Reading and writing the custom file.
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4191
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
4192 ;;;###autoload
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
4193 (defcustom custom-file nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4194 "File used for storing customization information.
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
4195 The default is nil, which means to use your init file
58797
0b90a17a09e1 (custom-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 58779
diff changeset
4196 as specified by `user-init-file'. If the value is not nil,
0b90a17a09e1 (custom-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 58779
diff changeset
4197 it should be an absolute file name.
0b90a17a09e1 (custom-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 58779
diff changeset
4198
59335
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4199 You can set this option through Custom, if you carefully read the
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4200 last paragraph below. However, usually it is simpler to write
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4201 something like the following in your init file:
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4202
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4203 \(setq custom-file \"~/.emacs-custom.el\")
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4204 \(load custom-file)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4205
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4206 Note that both lines are necessary: the first line tells Custom to
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4207 save all customizations in this file, but does not load it.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4208
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4209 When you change this variable outside Custom, look in the
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4210 previous custom file \(usually your init file) for the
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4211 forms `(custom-set-variables ...)' and `(custom-set-faces ...)',
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4212 and copy them (whichever ones you find) to the new custom file.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4213 This will preserve your existing customizations.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4214
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4215 If you save this option using Custom, Custom will write all
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4216 currently saved customizations, including the new one for this
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4217 option itself, into the file you specify, overwriting any
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4218 `custom-set-variables' and `custom-set-faces' forms already
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4219 present in that file. It will not delete any customizations from
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4220 the old custom file. You should do that manually if that is what you
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4221 want. You also have to put something like `\(load \"CUSTOM-FILE\")
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4222 in your init file, where CUSTOM-FILE is the actual name of the
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4223 file. Otherwise, Emacs will not load the file when it starts up,
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4224 and hence will not set `custom-file' to that file either."
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4225 :type '(choice (const :tag "Your Emacs init file" nil)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4226 (file :format "%t:%v%d"
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4227 :doc
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4228 "Please read entire docstring below before setting \
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4229 this through Custom.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4230 Click om \"More\" \(or position point there and press RETURN)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
4231 if only the first line of the docstring is shown."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4232 :group 'customize)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4233
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
4234 (defun custom-file ()
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
4235 "Return the file name for saving customizations."
62211
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4236 (file-chase-links
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4237 (or custom-file
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4238 (let ((user-init-file user-init-file)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4239 (default-init-file
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4240 (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4241 (when (null user-init-file)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4242 (if (or (file-exists-p default-init-file)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4243 (and (eq system-type 'windows-nt)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4244 (file-exists-p "~/_emacs")))
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4245 ;; Started with -q, i.e. the file containing
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4246 ;; Custom settings hasn't been read. Saving
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4247 ;; settings there would overwrite other settings.
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4248 (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4249 (setq user-init-file default-init-file))
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
4250 user-init-file))))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
4251
86219
16c8cf994132 (recentf-expand-file-name): Declare as function.
Glenn Morris <rgm@gnu.org>
parents: 85724
diff changeset
4252 ;; If recentf-mode is non-nil, this is defined.
16c8cf994132 (recentf-expand-file-name): Declare as function.
Glenn Morris <rgm@gnu.org>
parents: 85724
diff changeset
4253 (declare-function recentf-expand-file-name "recentf" (name))
16c8cf994132 (recentf-expand-file-name): Declare as function.
Glenn Morris <rgm@gnu.org>
parents: 85724
diff changeset
4254
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4255 ;;;###autoload
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4256 (defun custom-save-all ()
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4257 "Save all customizations in `custom-file'."
73702
2bd04d2f629a (custom-save-all): Error if saving in .emacs and it had an error when loaded.
Richard M. Stallman <rms@gnu.org>
parents: 73643
diff changeset
4258 (when (and (null custom-file) init-file-had-error)
2bd04d2f629a (custom-save-all): Error if saving in .emacs and it had an error when loaded.
Richard M. Stallman <rms@gnu.org>
parents: 73643
diff changeset
4259 (error "Cannot save customizations; init file was not fully loaded"))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4260 (let* ((filename (custom-file))
76100
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4261 (recentf-exclude
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4262 (if recentf-mode
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4263 (cons (concat "\\`"
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4264 (regexp-quote
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4265 (recentf-expand-file-name (custom-file)))
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4266 "\\'")
3556f653e301 (custom-save-all): Canonicalize custom-file before storing it in
Eli Zaretskii <eliz@gnu.org>
parents: 75347
diff changeset
4267 recentf-exclude)))
97242
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4268 (old-buffer (find-buffer-visiting filename))
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4269 old-buffer-name)
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4270
73942
a1e596bbf76d (custom-save-all): Use find-file-visit-truename for visiting the custom file.
Richard M. Stallman <rms@gnu.org>
parents: 73797
diff changeset
4271 (with-current-buffer (let ((find-file-visit-truename t))
a1e596bbf76d (custom-save-all): Use find-file-visit-truename for visiting the custom file.
Richard M. Stallman <rms@gnu.org>
parents: 73797
diff changeset
4272 (or old-buffer (find-file-noselect filename)))
97242
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4273 ;; We'll save using file-precious-flag, so avoid destroying
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4274 ;; symlinks. (If we're not already visiting the buffer, this is
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4275 ;; handled by find-file-visit-truename, above.)
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4276 (when old-buffer
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4277 (setq old-buffer-name (buffer-file-name))
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4278 (set-visited-file-name (file-chase-links filename)))
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4279
73169
f11aa3b5788d * cus-edit.el (custom-save-all): Switch to emacs-lisp mode before
Chong Yidong <cyd@stupidchicken.com>
parents: 73062
diff changeset
4280 (unless (eq major-mode 'emacs-lisp-mode)
f11aa3b5788d * cus-edit.el (custom-save-all): Switch to emacs-lisp mode before
Chong Yidong <cyd@stupidchicken.com>
parents: 73062
diff changeset
4281 (emacs-lisp-mode))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4282 (let ((inhibit-read-only t))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4283 (custom-save-variables)
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4284 (custom-save-faces))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4285 (let ((file-precious-flag t))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4286 (save-buffer))
97242
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4287 (if old-buffer
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4288 (progn
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4289 (set-visited-file-name old-buffer-name)
cc5f94eeb1d8 (custom-save-all): Avoid destrying symlink if already visiting the
Chong Yidong <cyd@stupidchicken.com>
parents: 97142
diff changeset
4290 (set-buffer-modified-p nil))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4291 (kill-buffer (current-buffer))))))
67939
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4292
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4293 ;;;###autoload
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4294 (defun customize-save-customized ()
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4295 "Save all user options which have been set in this session."
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4296 (interactive)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4297 (mapatoms (lambda (symbol)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4298 (let ((face (get symbol 'customized-face))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4299 (value (get symbol 'customized-value))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4300 (face-comment (get symbol 'customized-face-comment))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4301 (variable-comment
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4302 (get symbol 'customized-variable-comment)))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4303 (when face
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4304 (put symbol 'saved-face face)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4305 (custom-push-theme 'theme-face symbol 'user 'set value)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4306 (put symbol 'customized-face nil))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4307 (when value
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4308 (put symbol 'saved-value value)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4309 (custom-push-theme 'theme-value symbol 'user 'set value)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4310 (put symbol 'customized-value nil))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4311 (when variable-comment
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4312 (put symbol 'saved-variable-comment variable-comment)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4313 (put symbol 'customized-variable-comment nil))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4314 (when face-comment
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4315 (put symbol 'saved-face-comment face-comment)
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4316 (put symbol 'customized-face-comment nil)))))
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4317 ;; We really should update all custom buffers here.
66965e79dd66 (custom-save-loaded-themes): Call custom-save-delete.
Richard M. Stallman <rms@gnu.org>
parents: 67797
diff changeset
4318 (custom-save-all))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4319
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4320 ;; Editing the custom file contents in a buffer.
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4321
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4322 (defun custom-save-delete (symbol)
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4323 "Delete all calls to SYMBOL from the contents of the current buffer.
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4324 Leave point at the old location of the first such call,
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4325 or (if there were none) at the end of the buffer.
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4326
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4327 This function does not save the buffer."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4328 (goto-char (point-min))
25058
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
4329 ;; Skip all whitespace and comments.
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
4330 (while (forward-comment 1))
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
4331 (or (eobp)
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
4332 (save-excursion (forward-sexp (buffer-size)))) ; Test for scan errors.
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4333 (let (first)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4334 (catch 'found
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4335 (while t ;; We exit this loop only via throw.
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4336 ;; Skip all whitespace and comments.
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4337 (while (forward-comment 1))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4338 (let ((start (point))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4339 (sexp (condition-case nil
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4340 (read (current-buffer))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4341 (end-of-file (throw 'found nil)))))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4342 (when (and (listp sexp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4343 (eq (car sexp) symbol))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4344 (delete-region start (point))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4345 (unless first
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4346 (setq first (point)))))))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4347 (if first
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4348 (goto-char first)
36628
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4349 ;; Move in front of local variables, otherwise long Custom
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4350 ;; entries would make them ineffective.
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4351 (let ((pos (point-max))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4352 (case-fold-search t))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4353 (save-excursion
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4354 (goto-char (point-max))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4355 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4356 'move)
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4357 (when (search-forward "Local Variables:" nil t)
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4358 (setq pos (line-beginning-position))))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4359 (goto-char pos)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4360
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4361 (defun custom-save-variables ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4362 "Save all customized variables in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4363 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4364 (custom-save-delete 'custom-set-variables)
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4365 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4366 (saved-list (make-list 1 0))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4367 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4368 ;; First create a sorted list of saved variables.
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4369 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4370 (lambda (symbol)
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
4371 (if (and (get symbol 'saved-value)
69004
f4a06252f47c * cus-edit.el (custom-save-variables): Allow unthemed values.
Chong Yidong <cyd@stupidchicken.com>
parents: 68913
diff changeset
4372 ;; ignore theme values
f4a06252f47c * cus-edit.el (custom-save-variables): Allow unthemed values.
Chong Yidong <cyd@stupidchicken.com>
parents: 68913
diff changeset
4373 (or (null (get symbol 'theme-value))
f4a06252f47c * cus-edit.el (custom-save-variables): Allow unthemed values.
Chong Yidong <cyd@stupidchicken.com>
parents: 68913
diff changeset
4374 (eq 'user (caar (get symbol 'theme-value)))))
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4375 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4376 (setq saved-list (sort (cdr saved-list) 'string<))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4377 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4378 (princ "\n"))
26653
ea8ae3c8fad5 (custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents: 26625
diff changeset
4379 (princ "(custom-set-variables
47315
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4380 ;; custom-set-variables was added by Custom.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4381 ;; If you edit it by hand, you could mess it up, so be careful.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4382 ;; Your init file should contain only one such instance.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4383 ;; If there is more than one, they won't work right.\n")
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4384 (dolist (symbol saved-list)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4385 (let ((spec (car-safe (get symbol 'theme-value)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4386 (value (get symbol 'saved-value))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4387 (requests (get symbol 'custom-requests))
72588
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4388 (now (and (not (custom-variable-p symbol))
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4389 (or (boundp symbol)
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4390 (eq (get symbol 'force-value)
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4391 'rogue))))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
4392 (comment (get symbol 'saved-variable-comment)))
73797
2e5ad09135ff (hook): Fix typos in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 73795
diff changeset
4393 ;; Check REQUESTS for validity.
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4394 (dolist (request requests)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4395 (when (and (symbolp request) (not (featurep request)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4396 (message "Unknown requested feature: %s" request)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4397 (setq requests (delq request requests))))
72588
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4398 ;; Is there anything customized about this variable?
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
4399 (when (or (and spec (eq (car spec) 'user))
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4400 comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4401 (and (null spec) (get symbol 'saved-value)))
72588
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4402 ;; Output an element for this variable.
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4403 ;; It has the form (SYMBOL VALUE-FORM NOW REQUESTS COMMENT).
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4404 ;; SYMBOL is the variable name.
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4405 ;; VALUE-FORM is an expression to return the customized value.
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4406 ;; NOW if non-nil means always set the variable immediately
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4407 ;; when the customizations are reloaded. This is used
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4408 ;; for rogue variables
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4409 ;; REQUESTS is a list of packages to load before setting the
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4410 ;; variable. Each element of it will be passed to `require'.
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4411 ;; COMMENT is whatever comment the user has specified
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4412 ;; with the customize facility.
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4413 (unless (bolp)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4414 (princ "\n"))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4415 (princ " '(")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4416 (prin1 symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4417 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4418 (prin1 (car value))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4419 (when (or now requests comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4420 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4421 (prin1 now)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4422 (when (or requests comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4423 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4424 (prin1 requests)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4425 (when comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4426 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4427 (prin1 comment))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4428 (princ ")"))))
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4429 (if (bolp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4430 (princ " "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4431 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4432 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4433 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4434
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4435 (defun custom-save-faces ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4436 "Save all customized faces in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4437 (save-excursion
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4438 (custom-save-delete 'custom-reset-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4439 (custom-save-delete 'custom-set-faces)
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4440 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4441 (saved-list (make-list 1 0))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4442 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4443 ;; First create a sorted list of saved faces.
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4444 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4445 (lambda (symbol)
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
4446 (if (and (get symbol 'saved-face)
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
4447 (eq 'user (car (car-safe (get symbol 'theme-face)))))
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4448 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4449 (setq saved-list (sort (cdr saved-list) 'string<))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4450 ;; The default face must be first, since it affects the others.
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4451 (if (memq 'default saved-list)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4452 (setq saved-list (cons 'default (delq 'default saved-list))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4453 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4454 (princ "\n"))
26653
ea8ae3c8fad5 (custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents: 26625
diff changeset
4455 (princ "(custom-set-faces
47315
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4456 ;; custom-set-faces was added by Custom.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4457 ;; If you edit it by hand, you could mess it up, so be careful.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4458 ;; Your init file should contain only one such instance.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4459 ;; If there is more than one, they won't work right.\n")
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4460 (dolist (symbol saved-list)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4461 (let ((spec (car-safe (get symbol 'theme-face)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4462 (value (get symbol 'saved-face))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4463 (now (not (or (get symbol 'face-defface-spec)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4464 (and (not (custom-facep symbol))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4465 (not (get symbol 'force-face))))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4466 (comment (get symbol 'saved-face-comment)))
67977
03ee9bccbfeb * custom.el: Move Custom Themes commentary to start of theme code.
Chong Yidong <cyd@stupidchicken.com>
parents: 67972
diff changeset
4467 (when (or (and spec (eq (nth 0 spec) 'user))
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4468 comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4469 (and (null spec) (get symbol 'saved-face)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4470 ;; Don't print default face here.
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4471 (unless (bolp)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4472 (princ "\n"))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4473 (princ " '(")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4474 (prin1 symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4475 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4476 (prin1 value)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4477 (when (or now comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4478 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4479 (prin1 now)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4480 (when comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4481 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4482 (prin1 comment)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4483 (princ ")"))))
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4484 (if (bolp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4485 (princ " "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4486 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4487 (unless (looking-at "\n")
48958
6b4f6412de76 (custom-save-faces): Fix typo.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48949
diff changeset
4488 (princ "\n")))))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4489
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4490 ;;; The Customize Menu.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4491
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4492 ;;; Menu support
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4493
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4494 (defcustom custom-menu-nesting 2
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4495 "Maximum nesting in custom menus."
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4496 :type 'integer
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
4497 :group 'custom-menu)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4498
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4499 (defun custom-face-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4500 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4501 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4502 `(customize-face ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4503 t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4504
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4505 (defun custom-variable-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4506 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4507 (let ((type (get symbol 'custom-type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4508 (unless (listp type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4509 (setq type (list type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4510 (if (and type (widget-get type :custom-menu))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4511 (widget-apply type :custom-menu symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4512 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4513 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4514 t))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4515
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4516 ;; Add checkboxes to boolean variable entries.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4517 (widget-put (get 'boolean 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4518 :custom-menu (lambda (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4519 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4520 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4521 ':style 'toggle
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4522 ':selected symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4523
30184
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4524 (defun custom-group-menu-create (widget symbol)
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4525 "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4526 `( ,(custom-unlispify-menu-entry symbol t)
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4527 :filter (lambda (&rest junk)
72715
b51738f67f62 (custom-menu-create): Bind deactivate-mark here
Richard M. Stallman <rms@gnu.org>
parents: 72629
diff changeset
4528 (let* ((menu (custom-menu-create ',symbol)))
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4529 (if (consp menu) (cdr menu) menu)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4530
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4531 ;;;###autoload
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4532 (defun custom-menu-create (symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4533 "Create menu for customization group SYMBOL.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4534 The menu is in a format applicable to `easy-menu-define'."
72715
b51738f67f62 (custom-menu-create): Bind deactivate-mark here
Richard M. Stallman <rms@gnu.org>
parents: 72629
diff changeset
4535 (let* ((deactivate-mark nil)
b51738f67f62 (custom-menu-create): Bind deactivate-mark here
Richard M. Stallman <rms@gnu.org>
parents: 72629
diff changeset
4536 (item (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4537 `(customize-group ',symbol)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4538 t)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4539 (if (and (or (not (boundp 'custom-menu-nesting))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4540 (>= custom-menu-nesting 0))
49126
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4541 (progn
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4542 (custom-load-symbol symbol)
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4543 (< (length (get symbol 'custom-group)) widget-menu-max-size)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4544 (let ((custom-prefix-list (custom-prefix-add symbol
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4545 custom-prefix-list))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4546 (members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4547 custom-menu-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4548 custom-menu-order-groups)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4549 `(,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4550 ,item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4551 "--"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4552 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4553 (widget-apply (if (listp (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4554 (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4555 (list (nth 1 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4556 :custom-menu (nth 0 entry)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4557 members)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4558 item)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4559
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4560 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4561 (defun customize-menu-create (symbol &optional name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4562 "Return a customize menu for customization group SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4563 If optional NAME is given, use that as the name of the menu.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4564 Otherwise the menu will be named `Customize'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4565 The format is suitable for use with `easy-menu-define'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4566 (unless name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4567 (setq name "Customize"))
30184
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4568 `(,name
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4569 :filter (lambda (&rest junk)
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4570 (let ((menu (custom-menu-create ',symbol)))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4571 (if (consp menu) (cdr menu) menu)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4572
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4573 ;;; Toolbar and menubar support
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4574
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4575 (easy-menu-define
86232
74f276f67957 (custom-field-keymap): Move to other Custom mode
Martin Rudalics <rudalics@gmx.at>
parents: 86219
diff changeset
4576 Custom-mode-menu (list custom-mode-map custom-field-keymap)
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4577 "Menu used in customization buffers."
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4578 (nconc (list "Custom"
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4579 (customize-menu-create 'customize))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4580 (mapcar (lambda (arg)
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4581 (let ((tag (nth 0 arg))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4582 (command (nth 1 arg))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4583 (active (nth 2 arg))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4584 (help (nth 3 arg)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4585 (vector tag command :active (eval active) :help help)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4586 custom-commands)))
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4587
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4588 (defvar tool-bar-map)
87597
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4589
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4590 ;;; `custom-tool-bar-map' used to be set up here. This will fail to
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4591 ;;; DTRT when `display-graphic-p' returns nil during compilation. Hence
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4592 ;;; we set this up lazily in `Custom-mode'.
87597
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4593 (defvar custom-tool-bar-map nil
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4594 "Keymap for toolbar in Custom mode.")
81707
cfd3797706aa (custom-commands): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 81429
diff changeset
4595
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4596 ;;; The Custom Mode.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4597
72588
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4598 (defun Custom-no-edit (pos &optional event)
72149
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
4599 "Invoke button at POS, or refuse to allow editing of Custom buffer."
dd56da5d679d (customize-package-emacs-version-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 71953
diff changeset
4600 (interactive "@d")
72159
97e2fe60196f * cus-edit.el (custom-no-edit): Revert 2006-07-27 change, so that
Chong Yidong <cyd@stupidchicken.com>
parents: 72149
diff changeset
4601 (error "You can't edit this part of the Custom buffer"))
71847
61f3d6be1e92 (custom-no-edit): New command.
Richard M. Stallman <rms@gnu.org>
parents: 71438
diff changeset
4602
72588
97860dfadca5 (custom-save-variables): Slight cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 72409
diff changeset
4603 (defun Custom-newline (pos &optional event)
72409
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4604 "Invoke button at POS, or refuse to allow editing of Custom buffer."
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4605 (interactive "@d")
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4606 (let ((button (get-char-property pos 'button)))
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4607 (if button
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4608 (widget-apply-action button event)
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4609 (error "You can't edit this part of the Custom buffer"))))
4130a8f38950 (custom-newline): New function.
Richard M. Stallman <rms@gnu.org>
parents: 72159
diff changeset
4610
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4611 (defun Custom-goto-parent ()
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4612 "Go to the parent group listed at the top of this buffer.
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4613 If several parents are listed, go to the first of them."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4614 (interactive)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4615 (save-excursion
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4616 (goto-char (point-min))
78377
8a9d5af6fdf2 Fix parent groups link
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents: 78236
diff changeset
4617 (if (search-forward "\nParent groups: " nil t)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4618 (let* ((button (get-char-property (point) 'button))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4619 (parent (downcase (widget-get button :tag))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4620 (customize-group parent)))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4621
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4622 (defcustom Custom-mode-hook nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4623 "Hook called when entering Custom mode."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4624 :type 'hook
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4625 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4626
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4627 (defun custom-state-buffer-message (widget)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4628 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4629 (message "To install your edits, invoke [State] and choose the Set operation")))
18430
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
4630
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4631 (define-derived-mode Custom-mode nil "Custom"
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4632 "Major mode for editing customization buffers.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4633
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4634 The following commands are available:
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4635
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
4636 \\<widget-keymap>\
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
4637 Move to next button, link or editable field. \\[widget-forward]
68406
5020a0c4a1aa (custom-mode): Doc: Use advertised-widget-backward.
Richard M. Stallman <rms@gnu.org>
parents: 68343
diff changeset
4638 Move to previous button, link or editable field. \\[advertised-widget-backward]
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
4639 \\<custom-field-keymap>\
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4640 Complete content of editable text field. \\[widget-complete]
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4641 \\<custom-mode-map>\
68913
08407ff48591 * cus-edit.el (custom-mode): Update docstring.
Chong Yidong <cyd@stupidchicken.com>
parents: 68911
diff changeset
4642 Invoke button under the mouse pointer. \\[widget-button-click]
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
4643 Invoke button under point. \\[widget-button-press]
67970
ece93c7b34d4 (Custom-set, Custom-save): Ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents: 67961
diff changeset
4644 Set all options from current text. \\[Custom-set]
ece93c7b34d4 (Custom-set, Custom-save): Ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents: 67961
diff changeset
4645 Make values in current text permanent. \\[Custom-save]
68343
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
4646 Make text match actual option values. \\[Custom-reset-current]
05dbd20a248e (custom-buffer-create-internal): Use widget type
Juri Linkov <juri@jurta.org>
parents: 68278
diff changeset
4647 Reset options to permanent settings. \\[Custom-reset-saved]
67970
ece93c7b34d4 (Custom-set, Custom-save): Ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents: 67961
diff changeset
4648 Erase customizations; set options
ece93c7b34d4 (Custom-set, Custom-save): Ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents: 67961
diff changeset
4649 and buffer text to the standard values. \\[Custom-reset-standard]
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4650
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4651 Entry to this mode calls the value of `Custom-mode-hook'
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4652 if that value is non-nil."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4653 (use-local-map custom-mode-map)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4654 (easy-menu-add Custom-mode-menu)
87597
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4655 (when (display-graphic-p)
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4656 (set (make-local-variable 'tool-bar-map)
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4657 (or custom-tool-bar-map
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4658 ;; Set up `custom-tool-bar-map'.
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4659 (let ((map (make-sparse-keymap)))
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4660 (mapc
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4661 (lambda (arg)
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4662 (tool-bar-local-item-from-menu
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4663 (nth 1 arg) (nth 4 arg) map custom-mode-map))
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4664 custom-commands)
d71a9a15e3d2 (custom-tool-bar-map): Move initialization of this
Martin Rudalics <rudalics@gmx.at>
parents: 87519
diff changeset
4665 (setq custom-tool-bar-map map)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4666 (make-local-variable 'custom-options)
50283
73ab8e5b6d65 2003-03-24 Luc Teirlinck <teirllm@mail.auburn.edu>
John Paul Wallington <jpw@pobox.com>
parents: 50077
diff changeset
4667 (make-local-variable 'custom-local-buffer)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4668 (make-local-variable 'widget-documentation-face)
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
4669 (setq widget-documentation-face 'custom-documentation)
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
4670 (make-local-variable 'widget-button-face)
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4671 (setq widget-button-face custom-button)
86334
005ad07af670 (custom-mode): Define with `define-derived-mode'.
Juanma Barranquero <lekktu@gmail.com>
parents: 86232
diff changeset
4672 (setq show-trailing-whitespace nil)
73194
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4673
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4674 ;; We need this because of the "More" button on docstrings.
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4675 ;; Otherwise clicking on "More" can push point offscreen, which
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4676 ;; causes the window to recenter on point, which pushes the
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4677 ;; newly-revealed docstring offscreen; which is annoying. -- cyd.
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4678 (set (make-local-variable 'widget-button-click-moves-point) t)
1a9d85f409b8 * wid-edit.el (widget-button-click-moves-point): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 73169
diff changeset
4679
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4680 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67941
diff changeset
4681 (set (make-local-variable 'widget-mouse-face) custom-button-mouse)
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4682
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4683 ;; When possible, use relief for buttons, not bracketing. This test
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4684 ;; may not be optimal.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4685 (when custom-raised-buttons
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4686 (set (make-local-variable 'widget-push-button-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4687 (set (make-local-variable 'widget-push-button-suffix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4688 (set (make-local-variable 'widget-link-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4689 (set (make-local-variable 'widget-link-suffix) ""))
86334
005ad07af670 (custom-mode): Define with `define-derived-mode'.
Juanma Barranquero <lekktu@gmail.com>
parents: 86232
diff changeset
4690 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4691
92307
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4692 (put 'Custom-mode 'mode-class 'special)
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4693
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4694 ;; backward-compatibility
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4695 (defun custom-mode ()
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4696 "Non-interactive variant of `Custom-mode'."
55f83f57568d (custom-mode-map, custom-mode-link-map):
Juri Linkov <juri@jurta.org>
parents: 87795
diff changeset
4697 (Custom-mode))
92321
01ce588fc626 (custom-mode, custom-mode-hook): Use 23.1 as version
Juanma Barranquero <lekktu@gmail.com>
parents: 92307
diff changeset
4698 (make-obsolete 'custom-mode 'Custom-mode "23.1")
32904
2109c5fb0c3f (custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents: 32883
diff changeset
4699 (put 'custom-mode 'mode-class 'special)
92321
01ce588fc626 (custom-mode, custom-mode-hook): Use 23.1 as version
Juanma Barranquero <lekktu@gmail.com>
parents: 92307
diff changeset
4700 (define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1")
32904
2109c5fb0c3f (custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents: 32883
diff changeset
4701
71438
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4702 (dolist (regexp
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4703 '("^No user option defaults have been changed since Emacs "
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4704 "^Invalid face:? "
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4705 "^No \\(?:customized\\|rogue\\|saved\\) user options"
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4706 "^No customizable items matching "
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4707 "^There are unset changes"
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4708 "^Cannot set hidden variable"
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4709 "^No \\(?:saved\\|backup\\) value for "
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4710 "^No standard setting known for "
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4711 "^No standard setting for this face"
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4712 "^Saving settings from \"emacs -q\" would overwrite existing customizations"))
2c067711ec9e (customize-apropos): A better error message.
Eli Zaretskii <eliz@gnu.org>
parents: 71390
diff changeset
4713 (add-to-list 'debug-ignored-errors regexp))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4714
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4715 ;;; The End.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4716
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4717 (provide 'cus-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4718
59759
c8a0d09474af (customize-group-other-window, custom-buffer-create-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59434
diff changeset
4719 ;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4720 ;;; cus-edit.el ends here