annotate lisp/cus-edit.el @ 66904:b39a51cbc6b6

(custom-add-parent-links): Fix bug whereby, for instance, `(fringe custom-face)' shadowed `(fringe custom-group)' in the custom-group property of the symbol frames and the fringe group got no link to its parent group frames. Doc fix.
author Luc Teirlinck <teirllm@auburn.edu>
date Wed, 16 Nov 2005 02:02:03 +0000
parents b148d2fdff12
children 1710aca8150f
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,
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64494
diff changeset
4 ;; 2005 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
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
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
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
15 ;; any later version.
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
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63661
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63661
diff changeset
25 ;; Boston, MA 02110-1301, USA.
17521
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
26
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
27 ;;; Commentary:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
28 ;;
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
29 ;; 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
30 ;;
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
31 ;; See `custom.el'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
32
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
33 ;; 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
34 ;; 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
35 ;; 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
36
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
37 ;; 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
38 ;; 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
39
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
40 ;; 0. The current value.
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 ;; 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
43
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
44 ;; 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
45 ;; 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
46 ;; 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
47 ;; can set it.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
48
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
49 ;; 1. The widget value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
50
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
51 ;; 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
52
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
53 ;; 2. The customized value.
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 ;; 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
56
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
57 ;; 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
58 ;; 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
59
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
60 ;; 3. The saved value.
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 ;; 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
63
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
64 ;; 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
65 ;; 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
66
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
67 ;; 4. The standard value.
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 ;; 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
70
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
71 ;; 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
72 ;; 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
73
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
74 ;; 5. The "think" value.
60214
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 what customize thinks the current value should be.
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
77
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
78 ;; 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
79 ;; 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
80 ;; value.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
81
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
82 ;; 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
83 ;; 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
84 ;; 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
85 ;; 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
86 ;; 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
87 ;; 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
88 ;; compatibility.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
89
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
90 ;; You can see (and modify and save) this unevaluated value by selecting
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
91 ;; "Show initial Lisp expression" from the Lisp interface. This will
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
92 ;; 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
93 ;; unevaluated standard value.
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 ;; 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
96
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
97 ;; 0. unknown
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 ;; 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
100
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
101 ;; 1. modified
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 ;; 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
104
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
105 ;; 2. changed
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
106
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
107 ;; 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
108
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
109 ;; 3. set
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 ;; 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
112
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
113 ;; 4. saved
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 ;; 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
116
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
117 ;; 5. standard
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 ;; 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
120
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
121 ;; 6. rogue
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
122
60214
7cc86e0f08f6 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60034
diff changeset
123 ;; There is no standard value. This means that the variable was
60296
7090a1e062e2 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60295
diff changeset
124 ;; not defined with defcustom, nor handled in cus-start.el. You
7090a1e062e2 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60295
diff changeset
125 ;; can not create a Custom buffer for such variables using the
7090a1e062e2 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60295
diff changeset
126 ;; normal interactive Custom commands. However, such Custom
7090a1e062e2 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60295
diff changeset
127 ;; buffers can be created in other ways, for instance, by calling
7090a1e062e2 Comment change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 60295
diff changeset
128 ;; `customize-option' non-interactively.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
129
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
130 ;; 7. hidden
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
131
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
132 ;; There is no widget value.
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
133
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
134 ;; 8. mismatch
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
135
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
136 ;; 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
137 ;; option.
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
138
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
139 ;;; Code:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
140
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
141 (require 'cus-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
142 (require 'wid-edit)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
143 (eval-when-compile
64931
94a635fcc582 (custom-save-all, custom-save-delete): Bind recentf-exclude to exclude
Eli Zaretskii <eliz@gnu.org>
parents: 64762
diff changeset
144 (defvar custom-versions-load-alist) ; from cus-load
94a635fcc582 (custom-save-all, custom-save-delete): Bind recentf-exclude to exclude
Eli Zaretskii <eliz@gnu.org>
parents: 64762
diff changeset
145 (defvar recentf-exclude)) ; from recentf.el
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
146
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
147 (condition-case nil
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
148 (require 'cus-load)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
149 (error nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
150
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
151 (condition-case nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
152 (require 'cus-start)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
153 (error nil))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
154
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
155 (put 'custom-define-hook 'custom-type 'hook)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
156 (put 'custom-define-hook 'standard-value '(nil))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
157 (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
158
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
159 ;;; Customization Groups.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
160
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
161 (defgroup emacs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
162 "Customization of the One True Editor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
163 :link '(custom-manual "(emacs)Top"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
164
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
165 ;; Most of these groups are stolen from `finder.el',
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
166 (defgroup editing nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
167 "Basic text editing facilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
168 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
169
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
170 (defgroup abbrev nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
171 "Abbreviation handling, typing shortcuts, macros."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
172 :tag "Abbreviations"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
173 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
174
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
175 (defgroup matching nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
176 "Various sorts of searching and matching."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
177 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
178
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
179 (defgroup emulations nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
180 "Emulations of other editors."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
181 :link '(custom-manual "(emacs)Emulation")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
182 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
183
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
184 (defgroup mouse nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
185 "Mouse support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
186 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
187
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
188 (defgroup outlines nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
189 "Support for hierarchical outlining."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
190 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
191
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
192 (defgroup external nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
193 "Interfacing to external utilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
194 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
195
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
196 (defgroup processes nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
197 "Process, subshell, compilation, and job control support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
198 :group 'external
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
199 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
200
22068
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
201 (defgroup convenience nil
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
202 "Convenience features for faster editing."
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
203 :group 'emacs)
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
204
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
205 (defgroup programming nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
206 "Support for programming in other languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
207 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
208
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
209 (defgroup languages nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
210 "Specialized modes for editing programming languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
211 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
212
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
213 (defgroup lisp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
214 "Lisp support, including Emacs Lisp."
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."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
220 :link '(custom-manual "(ccmode)")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
221 :group 'languages)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
222
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
223 (defgroup tools nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
224 "Programming tools."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
225 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
226
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
227 (defgroup oop nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
228 "Support for object-oriented programming."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
229 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
230
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
231 (defgroup applications nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
232 "Applications written in Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
233 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
234
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
235 (defgroup calendar nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
236 "Calendar and time management support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
237 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
238
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
239 (defgroup mail nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
240 "Modes for electronic-mail handling."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
241 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
242
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
243 (defgroup news nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
244 "Support for netnews reading and posting."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
245 :link '(custom-manual "(gnus)")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
246 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
247
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
248 (defgroup games nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
249 "Games, jokes and amusements."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
250 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
251
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
252 (defgroup development nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
253 "Support for further development of Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
254 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
255
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
256 (defgroup docs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
257 "Support for Emacs documentation."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
258 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
259
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
260 (defgroup extensions nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
261 "Emacs Lisp language extensions."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
262 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
263
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
264 (defgroup internal nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
265 "Code for Emacs internals, build process, defaults."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
266 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
267
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
268 (defgroup maint nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
269 "Maintenance aids for the Emacs development group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
270 :tag "Maintenance"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
271 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
272
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
273 (defgroup environment nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
274 "Fitting Emacs with its environment."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
275 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
276
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
277 (defgroup comm nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
278 "Communications, networking, remote access to files."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
279 :tag "Communication"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
280 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
281
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
282 (defgroup hardware nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
283 "Support for interfacing with exotic hardware."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
284 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
285
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
286 (defgroup terminals nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
287 "Support for terminal types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
288 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
289
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
290 (defgroup unix nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
291 "Front-ends/assistants for, or emulators of, UNIX features."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
292 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
293
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
294 (defgroup vms nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
295 "Support code for vms."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
296 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
297
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
298 (defgroup i18n nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
299 "Internationalization and alternate character-set support."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
300 :link '(custom-manual "(emacs)International")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
301 :group 'environment
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
302 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
303
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
304 (defgroup x nil
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
305 "The X Window system."
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
306 :group 'environment)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
307
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
308 (defgroup frames nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
309 "Support for Emacs frames and window systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
310 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
311
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
312 (defgroup data nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
313 "Support editing files of data."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
314 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
315
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
316 (defgroup files nil
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
317 "Support editing files."
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
318 :group 'emacs)
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
319
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
320 (defgroup wp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
321 "Word processing."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
322 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
323
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
324 (defgroup tex nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
325 "Code related to the TeX formatter."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
326 :group 'wp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
327
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
328 (defgroup faces nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
329 "Support for multiple fonts."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
330 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
331
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
332 (defgroup hypermedia nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
333 "Support for links between text or other media types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
334 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
335
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
336 (defgroup help nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
337 "Support for on-line help systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
338 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
339
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
340 (defgroup multimedia nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
341 "Non-textual support, specifically images and sound."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
342 :group 'emacs)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
343
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
344 (defgroup local nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
345 "Code local to your site."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
346 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
347
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
348 (defgroup customize '((widgets custom-group))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
349 "Customization of the Customization support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
350 :prefix "custom-"
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
351 :group 'help)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
352
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
353 (defgroup custom-faces nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
354 "Faces used by customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
355 :group 'customize
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
356 :group 'faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
357
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
358 (defgroup custom-browse nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
359 "Control customize browser."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
360 :prefix "custom-"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
361 :group 'customize)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
362
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
363 (defgroup custom-buffer nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
364 "Control customize buffers."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
365 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
366 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
367
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
368 (defgroup custom-menu nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
369 "Control customize menus."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
370 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
371 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
372
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
373 (defgroup abbrev-mode nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
374 "Word abbreviations mode."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
375 :link '(custom-manual "(emacs)Abbrevs")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
376 :group 'abbrev)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
377
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
378 (defgroup alloc nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
379 "Storage allocation and gc for GNU Emacs Lisp interpreter."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
380 :tag "Storage Allocation"
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
381 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
382
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
383 (defgroup undo nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
384 "Undoing changes in buffers."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
385 :link '(custom-manual "(emacs)Undo")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
386 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
387
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
388 (defgroup modeline nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
389 "Content of the modeline."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
390 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
391
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
392 (defgroup editing-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
393 "Most basic editing facilities."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
394 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
395
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
396 (defgroup display nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
397 "How characters are displayed in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
398 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
399
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
400 (defgroup execute nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
401 "Executing external commands."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
402 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
403
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
404 (defgroup installation nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
405 "The Emacs installation."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
406 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
407
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
408 (defgroup dired nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
409 "Directory editing."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
410 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
411
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
412 (defgroup limits nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
413 "Internal Emacs limits."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
414 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
416 (defgroup debug nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
417 "Debugging Emacs itself."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
418 :group 'development)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
419
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
420 (defgroup minibuffer nil
63249
32b12a7e7c4f (minibuffer): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 63194
diff changeset
421 "Controling the behavior of the minibuffer."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
422 :link '(custom-manual "(emacs)Minibuffer")
17415
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
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
425 (defgroup keyboard nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
426 "Input from the keyboard."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
427 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
428
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
429 (defgroup mouse nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
430 "Input from the mouse."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
431 :group 'environment)
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 menu nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
434 "Input from the menus."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
435 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
436
61475
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
437 (defgroup dnd nil
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
438 "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
439 :group 'environment)
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
440
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
441 (defgroup auto-save nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
442 "Preventing accidential loss of data."
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
443 :group 'files)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
444
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
445 (defgroup processes-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
446 "Basic stuff dealing with processes."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
447 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
448
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
449 (defgroup mule nil
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
450 "MULE Emacs internationalization."
18053
941f5d1a241e (cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents: 18033
diff changeset
451 :group 'i18n)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
452
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
453 (defgroup windows nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
454 "Windows within a frame."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
455 :link '(custom-manual "(emacs)Windows")
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
456 :group 'environment)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
457
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
458 ;;; Utilities.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
459
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
460 (defun custom-quote (sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
461 "Quote SEXP iff it is not self quoting."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
462 (if (or (memq sexp '(t nil))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
463 (keywordp sexp)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
464 (and (listp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
465 (memq (car sexp) '(lambda)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
466 (stringp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
467 (numberp sexp)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
468 (vectorp sexp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
469 ;;; (and (fboundp 'characterp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
470 ;;; (characterp sexp))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
471 )
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
472 sexp
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
473 (list 'quote sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
474
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
475 (defun custom-split-regexp-maybe (regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
476 "If REGEXP is a string, split it to a list at `\\|'.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
477 You can get the original back with from the result with:
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
478 (mapconcat 'identity result \"\\|\")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
479
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
480 IF REGEXP is not a string, return it unchanged."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
481 (if (stringp regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
482 (let ((start 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
483 all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
484 (while (string-match "\\\\|" regexp start)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
485 (setq all (cons (substring regexp start (match-beginning 0)) all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
486 start (match-end 0)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
487 (nreverse (cons (substring regexp start) all)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
488 regexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
489
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
490 (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
491 "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
492 Return a list suitable for use in `interactive'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
493 (let ((v (variable-at-point))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
494 (enable-recursive-minibuffers t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
495 val)
66859
b148d2fdff12 (custom-variable-prompt): Set the default value arg of completing-read.
Juri Linkov <juri@jurta.org>
parents: 66336
diff changeset
496 (setq val (if (and (symbolp v) (custom-variable-p v))
b148d2fdff12 (custom-variable-prompt): Set the default value arg of completing-read.
Juri Linkov <juri@jurta.org>
parents: 66336
diff changeset
497 (completing-read
b148d2fdff12 (custom-variable-prompt): Set the default value arg of completing-read.
Juri Linkov <juri@jurta.org>
parents: 66336
diff changeset
498 (format "Customize option (default %s): " v) obarray
b148d2fdff12 (custom-variable-prompt): Set the default value arg of completing-read.
Juri Linkov <juri@jurta.org>
parents: 66336
diff changeset
499 'custom-variable-p t nil nil (symbol-name v))
b148d2fdff12 (custom-variable-prompt): Set the default value arg of completing-read.
Juri Linkov <juri@jurta.org>
parents: 66336
diff changeset
500 (completing-read "Customize option: " obarray
b148d2fdff12 (custom-variable-prompt): Set the default value arg of completing-read.
Juri Linkov <juri@jurta.org>
parents: 66336
diff changeset
501 'custom-variable-p t)))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
502 (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
503 (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
504 (intern val)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
505
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
506 (defun custom-menu-filter (menu widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
507 "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
508 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
509 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
510 (let ((result nil)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
511 current name action filter)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
512 (while menu
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
513 (setq current (car menu)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
514 name (nth 0 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
515 action (nth 1 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
516 filter (nth 2 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
517 menu (cdr menu))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
518 (if (or (null filter) (funcall filter widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
519 (push (cons name action) result)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
520 (push name result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
521 (nreverse result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
522
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
523 ;;; Unlispify.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
524
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
525 (defvar custom-prefix-list nil
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
526 "List of prefixes that should be ignored by `custom-unlispify'.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
527
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
528 (defcustom custom-unlispify-menu-entries t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
529 "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
530 :group 'custom-menu
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
531 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
532
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
533 (defcustom custom-unlispify-remove-prefixes nil
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
534 "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
535 :group 'custom-menu
43508
c092c3c65251 2002-02-24 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43246
diff changeset
536 :group 'custom-buffer
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
537 :type 'boolean)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
538
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
539 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
540 "Convert SYMBOL into a menu entry."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
541 (cond ((not custom-unlispify-menu-entries)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
542 (symbol-name symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
543 ((get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
544 (if no-suffix
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
545 (get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
546 (concat (get symbol 'custom-tag) "...")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
547 (t
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
548 (with-current-buffer (get-buffer-create " *Custom-Work*")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
549 (erase-buffer)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
550 (princ symbol (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
551 (goto-char (point-min))
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
552 ;; 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
553 ;; end with `-p'. -stef
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
554 ;; (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
555 ;; (re-search-forward "-p\\'" nil t))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
556 ;; (replace-match "" t t)
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
557 ;; (goto-char (point-min)))
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
558 (if custom-unlispify-remove-prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
559 (let ((prefixes custom-prefix-list)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
560 prefix)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
561 (while prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
562 (setq prefix (car prefixes))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
563 (if (search-forward prefix (+ (point) (length prefix)) t)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
564 (progn
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
565 (setq prefixes nil)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
566 (delete-region (point-min) (point)))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
567 (setq prefixes (cdr prefixes))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
568 (subst-char-in-region (point-min) (point-max) ?- ?\ t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
569 (capitalize-region (point-min) (point-max))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
570 (unless no-suffix
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
571 (goto-char (point-max))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
572 (insert "..."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
573 (buffer-string)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
574
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
575 (defcustom custom-unlispify-tag-names t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
576 "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
577 :group 'custom-buffer
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
578 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
579
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
580 (defun custom-unlispify-tag-name (symbol)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
581 "Convert SYMBOL into a menu entry."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
582 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
583 (custom-unlispify-menu-entry symbol t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
584
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
585 (defun custom-prefix-add (symbol prefixes)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
586 "Add SYMBOL to list of ignored PREFIXES."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
587 (cons (or (get symbol 'custom-prefix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
588 (concat (symbol-name symbol) "-"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
589 prefixes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
590
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
591 ;;; Guess.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
592
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
593 (defcustom custom-guess-name-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
594 '(("-p\\'" boolean)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
595 ("-hook\\'" hook)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
596 ("-face\\'" face)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
597 ("-file\\'" file)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
598 ("-function\\'" function)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
599 ("-functions\\'" (repeat function))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
600 ("-list\\'" (repeat sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
601 ("-alist\\'" (repeat (cons sexp sexp))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
602 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
603
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
604 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
605 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
606 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
607 used.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
608
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
609 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
610 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
611 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
612 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
613
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
614 (defcustom custom-guess-doc-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
615 '(("\\`\\*?Non-nil " boolean))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
616 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
617
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
618 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
619 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
620 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
621 matches the name of the symbol will be used.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
622
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
623 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
624 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
625 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
626 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
627
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
628 (defun custom-guess-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
629 "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
630 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
631 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
632 (let ((name (symbol-name symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
633 (names custom-guess-name-alist)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
634 current found)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
635 (while names
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
636 (setq current (car names)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
637 names (cdr names))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
638 (when (string-match (nth 0 current) name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
639 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
640 names nil)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
641 (unless found
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
642 (let ((doc (documentation-property symbol 'variable-documentation))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
643 (docs custom-guess-doc-alist))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
644 (when doc
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
645 (while docs
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
646 (setq current (car docs)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
647 docs (cdr docs))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
648 (when (string-match (nth 0 current) doc)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
649 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
650 docs nil))))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
651 found))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
652
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
653 ;;; Sorting.
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
654
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
655 (defcustom custom-browse-sort-alphabetically nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
656 "If non-nil, sort members of each customization group alphabetically."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
657 :type 'boolean
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
658 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
659
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
660 (defcustom custom-browse-order-groups nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
661 "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
662 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
663 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
664 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
665 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
666 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
667 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
668
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
669 (defcustom custom-browse-only-groups nil
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
670 "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
671 :type 'boolean
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
672 :group 'custom-browse)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
673
65736
d87f6cfbe849 (custom-buffer-sort-alphabetically): Default to nil.
Juri Linkov <juri@jurta.org>
parents: 65680
diff changeset
674 (defcustom custom-buffer-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
675 "If non-nil, sort members of each customization group alphabetically."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
676 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
677 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
678
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
679 (defcustom custom-buffer-order-groups 'last
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
680 "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
681 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
682 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
683 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
684 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
685 (const :tag "none" nil))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
686 :group 'custom-buffer)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
687
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
688 (defcustom custom-menu-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
689 "If non-nil, sort members of each customization group alphabetically."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
690 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
691 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
692
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
693 (defcustom custom-menu-order-groups 'first
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
694 "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
695 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
696 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
697 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
698 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
699 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
700 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
701
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
702 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
703
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
704 (defun custom-sort-items (items sort-alphabetically order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
705 "Return a sorted copy of ITEMS.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
706 ITEMS should be a `custom-group' property.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
707 If SORT-ALPHABETICALLY non-nil, sort alphabetically.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
708 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
709 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
710 (sort (copy-sequence items)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
711 (lambda (a b)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
712 (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
713 (namea (nth 0 a)) (nameb (nth 0 b)))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
714 (cond ((not order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
715 ;; 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
716 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
717 (string-lessp namea nameb)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
718 ((eq typea 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
719 ;; 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
720 (if (eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
721 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
722 (string-lessp namea nameb))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
723 (eq order-groups 'first)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
724 ((eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
725 ;; 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
726 (eq order-groups 'last))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
727 (sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
728 ;; Since A and B cannot be groups, sort.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
729 (string-lessp namea nameb)))))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
730
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
731 ;;; Custom Mode Commands.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
732
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
733 (defvar custom-options nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
734 "Customization widgets in the current buffer.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
735
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
736 (defun Custom-set ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
737 "Set changes in all modified options."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
738 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
739 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
740 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
741 (when (eq (widget-get child :custom-state) 'modified)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
742 (widget-apply child :custom-set)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
743 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
744
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
745 (defun Custom-save ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
746 "Set all modified group members and save them."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
747 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
748 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
749 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
750 (when (memq (widget-get child :custom-state)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
751 '(modified set changed rogue))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
752 (widget-apply child :custom-save)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
753 children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
754 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
755
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
756 (defvar custom-reset-menu
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
757 '(("Current" . Custom-reset-current)
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
758 ("Saved" . Custom-reset-saved)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
759 ("Erase Customization (use standard settings)" . Custom-reset-standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
760 "Alist of actions for the `Reset' button.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
761 The key is a string containing the name of the action, the value is a
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
762 Lisp function taking the widget as an element which will be called
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
763 when the action is chosen.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
764
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
765 (defun custom-reset (event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
766 "Select item from reset menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
767 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
768 (answer (widget-choose "Reset to"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
769 custom-reset-menu
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
770 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
771 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
772 (funcall answer))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
773
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
774 (defun Custom-reset-current (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
775 "Reset all modified group members to their current value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
776 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
777 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
778 (mapc (lambda (widget)
47809
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
779 (if (memq (widget-get widget :custom-state)
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
780 '(modified changed))
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
781 (widget-apply widget :custom-reset-current)))
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
782 children)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
783
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
784 (defun Custom-reset-saved (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
785 "Reset all modified or set group members to their saved value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
786 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
787 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
788 (mapc (lambda (widget)
47809
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
789 (if (memq (widget-get widget :custom-state)
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
790 '(modified set changed rogue))
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
791 (widget-apply widget :custom-reset-saved)))
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
792 children)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
793
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
794 (defun Custom-reset-standard (&rest ignore)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
795 "Erase all customization (either current or saved) for the group members.
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
796 The immediate result is to restore them to their standard settings.
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
797 This operation eliminates any saved settings for the group members,
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
798 making them as if they had never been customized at all."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
799 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
800 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
801 (mapc (lambda (widget)
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
802 (and (widget-apply widget :custom-standard-value)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
803 (if (memq (widget-get widget :custom-state)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
804 '(modified set changed saved rogue))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
805 (widget-apply widget :custom-reset-standard))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
806 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
807
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
808 ;;; The Customize Commands
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
809
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
810 (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
811 "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
812 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
813 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
814 the name of the variable.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
815
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
816 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
817 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
818
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
819 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
820 `: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
821
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
822 If optional COMMENT argument is non nil, also prompt for a comment and return
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
823 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
824 (let* ((var (read-variable prompt-var))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
825 (minibuffer-help-form '(describe-variable var))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
826 (val
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
827 (let ((prop (get var 'variable-interactive))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
828 (type (get var 'custom-type))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
829 (prompt (format prompt-val var)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
830 (unless (listp type)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
831 (setq type (list type)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
832 (cond (prop
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
833 ;; Use VAR's `variable-interactive' property
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
834 ;; as an interactive spec for prompting.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
835 (call-interactively (list 'lambda '(arg)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
836 (list 'interactive prop)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
837 'arg)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
838 (type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
839 (widget-prompt-value type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
840 prompt
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
841 (if (boundp var)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
842 (symbol-value var))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
843 (not (boundp var))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
844 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
845 (eval-minibuffer prompt))))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
846 (if comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
847 (list var val
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
848 (read-string "Comment: " (get var 'variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
849 (list var val))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
850
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
851 ;;;###autoload
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
852 (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
853 "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
854
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
855 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
856 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
857
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
858 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
859 `: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
860
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
861 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
862 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
863 "Set %s to value: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
864 current-prefix-arg))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
865
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
866 (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
867 (put variable 'variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
868 (comment
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
869 (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
870 (set variable value))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
871
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
872 ;;;###autoload
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
873 (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
874 "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
875 VALUE is a Lisp object.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
876
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
877 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
878 VARIABLE, otherwise `set-default' is used.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
879
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
880 The `customized-value' property of the VARIABLE will be set to a list
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
881 with a quoted VALUE as its sole list member.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
882
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
883 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
884 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
885
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
886 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
887 `: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
888
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
889 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
890 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
891 "Set customized value for %s to: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
892 current-prefix-arg))
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
893 (custom-load-symbol variable)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
894 (funcall (or (get variable 'custom-set) 'set-default) variable value)
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
895 (put variable 'customized-value (list (custom-quote value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
896 (cond ((string= comment "")
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
897 (put variable 'variable-comment nil)
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
898 (put variable 'customized-variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
899 (comment
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
900 (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
901 (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
902 value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
903
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
904 ;;;###autoload
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
905 (defun customize-save-variable (variable value &optional comment)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
906 "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
907 Return VALUE.
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
908
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
909 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
910 VARIABLE, otherwise `set-default' is used.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
911
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
912 The `customized-value' property of the VARIABLE will be set to a list
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
913 with a quoted VALUE as its sole list member.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
914
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
915 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
916 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
917
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
918 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
919 `: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
920
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
921 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
922 (interactive (custom-prompt-variable "Set and save variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
923 "Set and save value for %s as: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
924 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
925 (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
926 (put variable 'saved-value (list (custom-quote value)))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
927 (custom-push-theme 'theme-value variable 'user 'set (list (custom-quote value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
928 (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
929 (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
930 (put variable 'saved-variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
931 (comment
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
932 (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
933 (put variable 'saved-variable-comment comment)))
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
934 (custom-save-all)
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
935 value)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
936
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
937 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
938 (defun customize ()
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
939 "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
940 User options are structured into \"groups\".
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
941 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
942 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
943 (interactive)
17703
cd6ad557fb57 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17702
diff changeset
944 (customize-group 'emacs))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
945
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
946 ;;;###autoload
47823
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
947 (defun customize-mode (mode)
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
948 "Customize options related to the current major mode.
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
949 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
950 then prompt for the MODE to customize."
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
951 (interactive
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
952 (list
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
953 (let ((completion-regexp-list '("-mode\\'"))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
954 (group (custom-group-of-mode major-mode)))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
955 (if (and group (not current-prefix-arg))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
956 major-mode
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
957 (intern
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
958 (completing-read (if group
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
959 (format "Major mode (default %s): " major-mode)
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
960 "Major mode: ")
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
961 obarray
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
962 'custom-group-of-mode
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
963 t nil nil (if group (symbol-name major-mode))))))))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
964 (customize-group (custom-group-of-mode mode)))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
965
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
966
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
967 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
968 (defun customize-group (group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
969 "Customize GROUP, which must be a customization group."
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
970 (interactive (list (let ((completion-ignore-case t))
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 65225
diff changeset
971 (completing-read "Customize group (default emacs): "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
972 obarray
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
973 (lambda (symbol)
19886
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
974 (or (get symbol 'custom-loads)
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
975 (get symbol 'custom-group)))
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
976 t))))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
977 (when (stringp group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
978 (if (string-equal "" group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
979 (setq group 'emacs)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
980 (setq group (intern group))))
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
981 (let ((name (format "*Customize Group: %s*"
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
982 (custom-unlispify-tag-name group))))
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
983 (if (get-buffer name)
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
984 (pop-to-buffer name)
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
985 (custom-buffer-create (list (list group 'custom-group))
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
986 name
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
987 (concat " for group "
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
988 (custom-unlispify-tag-name group))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
989
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
990 ;;;###autoload
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
991 (defun customize-group-other-window (group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
992 "Customize GROUP, which must be a customization group."
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
993 (interactive (list (let ((completion-ignore-case t))
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 65225
diff changeset
994 (completing-read "Customize group (default emacs): "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
995 obarray
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
996 (lambda (symbol)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
997 (or (get symbol 'custom-loads)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
998 (get symbol 'custom-group)))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
999 t))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1000 (when (stringp group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1001 (if (string-equal "" group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1002 (setq group 'emacs)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1003 (setq group (intern group))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1004 (let ((name (format "*Customize Group: %s*"
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1005 (custom-unlispify-tag-name group))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1006 (if (get-buffer name)
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1007 (let (
48975
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1008 ;; Copied from `custom-buffer-create-other-window'.
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1009 (pop-up-windows t)
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1010 (same-window-buffer-names nil)
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1011 (same-window-regexps nil))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1012 (pop-to-buffer name))
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1013 (custom-buffer-create-other-window
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1014 (list (list group 'custom-group))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1015 name
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1016 (concat " for group "
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1017 (custom-unlispify-tag-name group))))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1018
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1019 ;;;###autoload
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1020 (defalias 'customize-variable 'customize-option)
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1021
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1022 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1023 (defun customize-option (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1024 "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
1025 (interactive (custom-variable-prompt))
64151
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1026 (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
1027 (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
1028 (format "*Customize Option: %s*"
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1029 (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
1030 (unless (eq symbol basevar)
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1031 (message "`%s' is an alias for `%s'" symbol basevar))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1032
48975
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1033 ;;;###autoload
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1034 (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
1035
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1036 ;;;###autoload
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1037 (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
1038 "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
1039 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
1040 (interactive (custom-variable-prompt))
64151
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1041 (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
1042 (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
1043 (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
1044 (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
1045 (unless (eq symbol basevar)
292d83423c40 (customize-option, customize-option-other-window): Make them handle aliases.
Luc Teirlinck <teirllm@auburn.edu>
parents: 64091
diff changeset
1046 (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
1047
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1048 (defvar customize-changed-options-previous-release "20.2"
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1049 "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
1050
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1051 ;;;###autoload
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1052 (defun customize-changed-options (since-version)
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1053 "Customize all user option variables changed in Emacs itself.
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1054 This includes new user option variables and faces, and new
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1055 customization groups, as well as older options and faces whose default
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1056 values have changed since the previous major Emacs release.
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1057
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1058 With argument SINCE-VERSION (a string), customize all user option
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1059 variables that were added (or their meanings were changed) since that
49300
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
1060 version."
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1061
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1062 (interactive "sCustomize options changed, since version (default all versions): ")
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1063 (if (equal since-version "")
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1064 (setq since-version nil)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1065 (unless (condition-case nil
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1066 (numberp (read since-version))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1067 (error nil))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1068 (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
1069 (unless since-version
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1070 (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
1071
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1072 ;; 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
1073 ;; custom-load-symbol for this.
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1074 (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
1075 (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
1076 (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
1077 (dolist (load (cdr elt))
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
1078 (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
1079 (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
1080 (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
1081
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1082 (let (found)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1083 (mapatoms
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1084 (lambda (symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1085 (let ((version (get symbol 'custom-version)))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1086 (if version
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1087 (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
1088 (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
1089 (get symbol 'group-documentation))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1090 (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
1091 (if (custom-variable-p symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1092 (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
1093 (if (custom-facep symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1094 (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
1095 (if found
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1096 (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
1097 "*Customize Changed Options*")
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1098 (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
1099 since-version))))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1100
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1101 (defun customize-version-lessp (version1 version2)
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1102 ;; 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
1103 ;; 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
1104
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1105 ;; 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
1106 ;; in the :version value.
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1107 (if (numberp version2)
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1108 (setq version2 (prin1-to-string version2)))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1109 (let (major1 major2 minor1 minor2)
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1110 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1111 (setq major1 (read (or (match-string 1 version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1112 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1113 (setq minor1 (read (or (match-string 3 version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1114 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1115 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1116 (setq major2 (read (or (match-string 1 version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1117 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1118 (setq minor2 (read (or (match-string 3 version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1119 "0")))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1120 (or (< major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1121 (and (= major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1122 (< minor1 minor2)))))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
1123
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1124 ;;;###autoload
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1125 (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
1126 "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
1127 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
1128 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
1129
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1130 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
1131 suggest to customize that face, if it's customizable."
44841
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1132 (interactive
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1133 (list (read-face-name "Customize face" "all faces" t)))
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1134 (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
1135 (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
1136 (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
1137 (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
1138 (if (listp face)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1139 (custom-buffer-create (custom-sort-items
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1140 (mapcar (lambda (s)
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1141 (list s 'custom-face))
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1142 face)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1143 t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1144 "*Customize Faces*")
63661
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1145 ;; 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
1146 (if (get face 'face-alias)
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1147 (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
1148 (unless (facep face)
49013
4a3d5b9c79b9 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48997
diff changeset
1149 (error "Invalid face %S" face))
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1150 (custom-buffer-create (list (list face 'custom-face))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1151 (format "*Customize Face: %s*"
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1152 (custom-unlispify-tag-name face)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1153
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1154 ;;;###autoload
44891
5d2dc0b4fd2f Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 44888
diff changeset
1155 (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
1156 "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
1157 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
1158
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1159 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
1160 suggest to customize that face, if it's customizable."
44841
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1161 (interactive
44888
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1162 (list (read-face-name "Customize face" "all faces" t)))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1163 (if (member face '(nil ""))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1164 (setq face (face-list)))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1165 (if (and (listp face) (null (cdr face)))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1166 (setq face (car face)))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1167 (if (listp face)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1168 (custom-buffer-create-other-window
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1169 (custom-sort-items
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1170 (mapcar (lambda (s)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1171 (list s 'custom-face))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1172 face)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1173 t nil)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1174 "*Customize Faces*")
63661
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1175 (if (get face 'face-alias)
49d95c194532 (customize-face, customize-face-other-window): Handle face aliases.
Glenn Morris <rgm@gnu.org>
parents: 63249
diff changeset
1176 (setq face (get face 'face-alias)))
44888
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1177 (unless (facep face)
49013
4a3d5b9c79b9 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48997
diff changeset
1178 (error "Invalid face %S" face))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1179 (custom-buffer-create-other-window
44888
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1180 (list (list face 'custom-face))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1181 (format "*Customize Face: %s*"
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1182 (custom-unlispify-tag-name face)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1183
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1184 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1185 (defun customize-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1186 "Customize all user options set since the last save in this session."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1187 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1188 (let ((found nil))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1189 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1190 (and (or (get symbol 'customized-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1191 (get symbol 'customized-face-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1192 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1193 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1194 (and (or (get symbol 'customized-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1195 (get symbol 'customized-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1196 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1197 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1198 (if (not found)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1199 (error "No customized user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1200 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1201 "*Customize Customized*"))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1202
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1203 ;;;###autoload
50077
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1204 (defun customize-rogue ()
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1205 "Customize all user variable modified outside customize."
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1206 (interactive)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1207 (let ((found nil))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1208 (mapatoms (lambda (symbol)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1209 (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
1210 (get symbol 'saved-value)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1211 (get symbol 'standard-value))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1212 (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
1213 (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
1214 (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
1215 ;; 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
1216 (default-value symbol))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1217 (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
1218 (if (not found)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1219 (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
1220 (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
1221 "*Customize Rogue*"))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1222 ;;;###autoload
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1223 (defun customize-saved ()
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1224 "Customize all already saved user options."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1225 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1226 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1227 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1228 (and (or (get symbol 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1229 (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1230 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1231 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1232 (and (or (get symbol 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1233 (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1234 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1235 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1236 (if (not found )
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1237 (error "No saved user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1238 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1239 "*Customize Saved*"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1240
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1241 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1242 (defun customize-apropos (regexp &optional all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1243 "Customize all user options matching REGEXP.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1244 If ALL is `options', include only options.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1245 If ALL is `faces', include only faces.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1246 If ALL is `groups', include only groups.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1247 If ALL is t (interactively, with prefix arg), include options which are not
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1248 user-settable, as well as faces and groups."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1249 (interactive "sCustomize regexp: \nP")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1250 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1251 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1252 (when (string-match regexp (symbol-name symbol))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1253 (when (and (not (memq all '(faces options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1254 (get symbol 'custom-group))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1255 (push (list symbol 'custom-group) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1256 (when (and (not (memq all '(options groups)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1257 (custom-facep symbol))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1258 (push (list symbol 'custom-face) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1259 (when (and (not (memq all '(groups faces)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1260 (boundp symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1261 (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
1262 (custom-variable-p symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1263 (if (memq all '(nil options))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1264 (user-variable-p symbol)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1265 (get symbol 'variable-documentation))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1266 (push (list symbol 'custom-variable) found)))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1267 (if (not found)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1268 (error "No matches")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1269 (custom-buffer-create (custom-sort-items found t
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1270 custom-buffer-order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1271 "*Customize Apropos*"))))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1272
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1273 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1274 (defun customize-apropos-options (regexp &optional arg)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1275 "Customize all user options matching REGEXP.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1276 With prefix arg, include options which are not user-settable."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1277 (interactive "sCustomize regexp: \nP")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1278 (customize-apropos regexp (or arg 'options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1279
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1280 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1281 (defun customize-apropos-faces (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1282 "Customize all user faces matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1283 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1284 (customize-apropos regexp 'faces))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1285
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1286 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1287 (defun customize-apropos-groups (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1288 "Customize all user groups matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1289 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1290 (customize-apropos regexp 'groups))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1291
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1292 ;;; Buffer.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1293
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1294 (defcustom custom-buffer-style 'links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1295 "Control the presentation style for customization buffers.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1296 The value should be a symbol, one of:
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1297
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1298 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
1299 links: groups have links to subgroups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1300 :type '(radio (const brackets)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1301 (const links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1302 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1303
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1304 (defcustom custom-buffer-done-kill nil
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1305 "*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
1306 :type 'boolean
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59795
diff changeset
1307 :version "22.1"
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1308 :group 'custom-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1309
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1310 (defcustom custom-buffer-indent 3
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1311 "Number of spaces to indent nested groups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1312 :type 'integer
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1313 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1314
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1315 (defun custom-get-fresh-buffer (name)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1316 "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
1317 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
1318 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
1319 not for everybody."
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1320 ;; 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
1321 ;; 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
1322 (let ((buf (get-buffer name)))
51429
b107764e9a67 (custom-get-fresh-buffer): Test for nonexistence buffer.
Lute Kamstra <lute@gnu.org>
parents: 51381
diff changeset
1323 (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
1324 ;; 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
1325 (kill-buffer buf)
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1326 (setq buf nil))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1327 (if (null buf)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1328 (get-buffer-create name)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1329 (with-current-buffer buf
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1330 (kill-all-local-variables)
51381
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1331 (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
1332 ;; 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
1333 ;; 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
1334 (let ((ols (overlay-lists)))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1335 (dolist (ol (nconc (car ols) (cdr ols)))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1336 (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
1337 (erase-buffer)
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1338 buf))))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1339
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1340 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1341 (defun custom-buffer-create (options &optional name description)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1342 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1343 Optional NAME is the name of the buffer.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1344 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1345 SYMBOL is a customization option, and WIDGET is a widget for editing
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1346 that option."
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1347 (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
1348 (custom-buffer-create-internal options description))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1349
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1350 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1351 (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
1352 "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
1353 The result includes selecting that window.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1354 Optional NAME is the name of the buffer.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1355 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
1356 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
1357 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1358 (unless name (setq name "*Customization*"))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1359 (let ((pop-up-windows t)
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1360 (same-window-buffer-names nil)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1361 (same-window-regexps nil))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1362 (pop-to-buffer (custom-get-fresh-buffer name))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1363 (custom-buffer-create-internal options description)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1364
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1365 (defcustom custom-reset-button-menu nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1366 "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
1367 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
1368 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1369 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1370
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1371 (defcustom custom-buffer-verbose-help t
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1372 "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
1373 :type 'boolean
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1374 :group 'custom-buffer)
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1375
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1376 (defun Custom-buffer-done (&rest ignore)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1377 "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
1378 (interactive)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1379 (quit-window custom-buffer-done-kill))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1380
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1381 (defvar custom-button nil
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1382 "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
1383
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1384 (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
1385 "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
1386
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1387 (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
1388 '(("unspecified" . unspecified))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1389 "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
1390 Otherwise use brackets."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1391 :type 'boolean
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1392 :version "21.1"
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1393 :group 'custom-buffer
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1394 :set (lambda (variable value)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1395 (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
1396 (setq custom-button
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1397 (if value '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
1398 (setq custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1399 (if value
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1400 'custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1401 'custom-button-pressed-unraised))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1402
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1403 (defun custom-buffer-create-internal (options &optional description)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1404 (custom-mode)
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1405 (if custom-buffer-verbose-help
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1406 (progn
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1407 (widget-insert "This is a customization buffer")
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1408 (if description
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1409 (widget-insert description))
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1410 (widget-insert (format ".
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1411 %s show active fields; type RET or click mouse-1
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1412 on an active field to invoke its action. Editing an option value
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1413 changes only the text in the buffer. Invoke the State button to set or
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1414 save the option value. Saving an option normally edits your init file.
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1415 Invoke "
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1416 (if custom-raised-buttons
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1417 "`Raised' buttons"
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1418 "Square brackets")))
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1419 (widget-create 'info-link
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1420 :tag "Custom file"
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1421 "(emacs)Saving Customizations")
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1422 (widget-insert
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1423 " for information on how to save in a different file.
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1424 Invoke ")
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1425 (widget-create 'info-link
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1426 :tag "Help"
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1427 :help-echo "Read the online help."
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1428 "(emacs)Easy Customization")
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1429 (widget-insert " for general information.\n\n")
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1430 (widget-insert "Operate on everything in this buffer:\n "))
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1431 (widget-insert " "))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1432 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1433 :tag "Set for Current Session"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1434 :help-echo "\
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1435 Make your editing in this buffer take effect for this session."
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1436 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1437 (Custom-set)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1438 (widget-insert " ")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1439 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1440 :tag "Save for Future Sessions"
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1441 :help-echo "\
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
1442 Make your editing in this buffer take effect for future Emacs sessions.
60034
b99f3d8581c6 (custom-buffer-create-internal): Update help message.
Richard M. Stallman <rms@gnu.org>
parents: 60004
diff changeset
1443 This updates your Emacs initialization file or creates a new one."
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1444 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1445 (Custom-save)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1446 (if custom-reset-button-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1447 (progn
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1448 (widget-insert " ")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1449 (widget-create 'push-button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1450 :tag "Reset"
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1451 :help-echo "Show a menu with reset operations."
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1452 :mouse-down-action (lambda (&rest junk) t)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1453 :action (lambda (widget &optional event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1454 (custom-reset event))))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1455 (widget-insert "\n ")
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1456 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1457 :tag "Reset"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1458 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1459 Reset all edited text in this buffer to reflect current values."
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1460 :action 'Custom-reset-current)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1461 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1462 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1463 :tag "Reset to Saved"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1464 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1465 Reset all values in this buffer to their saved settings."
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1466 :action 'Custom-reset-saved)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1467 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1468 (widget-create 'push-button
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
1469 :tag "Erase Customization"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1470 :help-echo "\
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
1471 Un-customize all values in this buffer. They get their standard settings."
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1472 :action 'Custom-reset-standard))
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1473 (if (not custom-buffer-verbose-help)
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1474 (progn
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1475 (widget-insert " ")
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1476 (widget-create 'info-link
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1477 :tag "Help"
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1478 :help-echo "Read the online help."
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1479 "(emacs)Easy Customization")))
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1480 (widget-insert " ")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1481 (widget-create 'push-button
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1482 :tag "Finish"
30247
80383e9be1e2 (custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents: 30184
diff changeset
1483 :help-echo
80383e9be1e2 (custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents: 30184
diff changeset
1484 (lambda (&rest ignore)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1485 (if custom-buffer-done-kill
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1486 "Kill this buffer"
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1487 "Bury this buffer"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1488 :action #'Custom-buffer-done)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1489 (widget-insert "\n\n")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1490 (message "Creating customization items...")
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1491 (buffer-disable-undo)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1492 (setq custom-options
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1493 (if (= (length options) 1)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1494 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1495 (widget-create (nth 1 entry)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1496 :documentation-shown t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1497 :custom-state 'unknown
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1498 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1499 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1500 :value (nth 0 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1501 options)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1502 (let ((count 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1503 (length (length options)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1504 (mapcar (lambda (entry)
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1505 (prog2
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1506 (message "Creating customization items ...%2d%%"
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1507 (/ (* 100.0 count) length))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1508 (widget-create (nth 1 entry)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1509 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1510 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1511 :value (nth 0 entry))
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1512 (setq count (1+ count))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1513 (unless (eq (preceding-char) ?\n)
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1514 (widget-insert "\n"))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1515 (widget-insert "\n")))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1516 options))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1517 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1518 (widget-insert "\n"))
39153
001cb5cd0de9 (custom-buffer-create-internal): Remove "100%" from
Eli Zaretskii <eliz@gnu.org>
parents: 38436
diff changeset
1519 (message "Creating customization items ...done")
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1520 (message "Resetting customization items...")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1521 (unless (eq custom-buffer-style 'tree)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1522 (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
1523 (message "Resetting customization items...done")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1524 (message "Creating customization setup...")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1525 (widget-setup)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1526 (buffer-enable-undo)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1527 (goto-char (point-min))
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1528 (message "Creating customization setup...done"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1529
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1530 ;;; The Tree Browser.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1531
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1532 ;;;###autoload
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1533 (defun customize-browse (&optional group)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1534 "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
1535 (interactive)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1536 (unless group
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1537 (setq group 'emacs))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1538 (let ((name "*Customize Browser*"))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1539 (pop-to-buffer (custom-get-fresh-buffer name)))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1540 (custom-mode)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1541 (widget-insert "\
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
1542 Square brackets show active fields; type RET or click mouse-1
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
1543 on an active field to invoke its action.
18856
03eeb83520d8 (custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents: 18812
diff changeset
1544 Invoke [+] below to expand a group, and [-] to collapse an expanded group.\n")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1545 (if custom-browse-only-groups
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1546 (widget-insert "\
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1547 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
1548 (widget-insert "Invoke the ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1549 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1550 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1551 :tag "[Group]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1552 :tag-glyph "folder")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1553 (widget-insert ", ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1554 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1555 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1556 :tag "[Face]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1557 :tag-glyph "face")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1558 (widget-insert ", and ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1559 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1560 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1561 :tag "[Option]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1562 :tag-glyph "option")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1563 (widget-insert " buttons below to edit that
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1564 item in another window.\n\n"))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1565 (let ((custom-buffer-style 'tree))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1566 (widget-create 'custom-group
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1567 :custom-last t
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1568 :custom-state 'unknown
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1569 :tag (custom-unlispify-tag-name group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1570 :value group))
48997
eb9dca992edf (customize-browse): Call `widget-setup'.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48975
diff changeset
1571 (widget-setup)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1572 (goto-char (point-min)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1573
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1574 (define-widget 'custom-browse-visibility 'item
20600
323f33e3e92c (custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 20562
diff changeset
1575 "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
1576 :format "%[[%t]%]"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1577 :action 'custom-browse-visibility-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1578
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1579 (defun custom-browse-visibility-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1580 (let ((custom-buffer-style 'tree))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1581 (custom-toggle-parent widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1582
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1583 (define-widget 'custom-browse-group-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1584 "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
1585 :tag "Group"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1586 :tag-glyph "folder"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1587 :action 'custom-browse-group-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1588
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1589 (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
1590 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1591 (customize-group-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1592
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1593 (define-widget 'custom-browse-variable-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1594 "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
1595 :tag "Option"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1596 :tag-glyph "option"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1597 :action 'custom-browse-variable-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1598
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1599 (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
1600 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1601 (customize-variable-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1602
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1603 (define-widget 'custom-browse-face-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1604 "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
1605 :tag "Face"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1606 :tag-glyph "face"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1607 :action 'custom-browse-face-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1608
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1609 (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
1610 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1611 (customize-face-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1612
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1613 (defconst custom-browse-alist '((" " "space")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1614 (" | " "vertical")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1615 ("-\\ " "top")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1616 (" |-" "middle")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1617 (" `-" "bottom")))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1618
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1619 (defun custom-browse-insert-prefix (prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1620 "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
1621 ;; Fixme: do graphics.
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1622 (if nil ; (string-match "XEmacs" emacs-version)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1623 (progn
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1624 (insert "*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1625 (while (not (string-equal prefix ""))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1626 (let ((entry (substring prefix 0 3)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1627 (setq prefix (substring prefix 3))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1628 (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
1629 (name (nth 1 (assoc entry custom-browse-alist))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1630 (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
1631 (overlay-put overlay 'start-open t)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1632 (overlay-put overlay 'end-open t)))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1633 (insert prefix)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1634
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1635 ;;; Modification of Basic Widgets.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1636 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1637 ;; We add extra properties to the basic widgets needed here. This is
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1638 ;; fine, as long as we are careful to stay within out own namespace.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1639 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1640 ;; We want simple widgets to be displayed by default, but complex
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1641 ;; widgets to be hidden.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1642
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1643 (widget-put (get 'item 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1644 (widget-put (get 'editable-field 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1645 :custom-show (lambda (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1646 (let ((pp (pp-to-string value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1647 (cond ((string-match "\n" pp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1648 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1649 ((> (length pp) 40)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1650 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1651 (t t)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1652 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1653
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1654 ;;; The `custom-manual' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1655
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1656 (define-widget 'custom-manual 'info-link
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1657 "Link to the manual entry for this customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1658 :help-echo "Read the manual entry for this option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1659 :tag "Manual")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1660
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1661 ;;; The `custom-magic' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1662
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1663 (defgroup custom-magic-faces nil
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1664 "Faces used by the magic button."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1665 :group 'custom-faces
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1666 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1667
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1668 (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
1669 (: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
1670 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1671 (:weight bold :slant italic :underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1672 "Face used when the customize item is invalid."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1673 :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
1674 ;; 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
1675 (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
1676
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1677 (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
1678 (: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
1679 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1680 (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1681 "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
1682 :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
1683 ;; 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
1684 (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
1685
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1686 (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
1687 (: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
1688 (((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1689 (: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
1690 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1691 (:slant italic :bold)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1692 "Face used when the customize item has been modified."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1693 :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
1694 ;; 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
1695 (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
1696
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1697 (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
1698 (: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
1699 (((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1700 (: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
1701 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1702 (:slant italic)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1703 "Face used when the customize item has been set."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1704 :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
1705 ;; 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
1706 (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
1707
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1708 (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
1709 (: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
1710 (((class color))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1711 (: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
1712 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1713 (:slant italic)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1714 "Face used when the customize item has been changed."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1715 :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
1716 ;; 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
1717 (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
1718
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1719 (defface custom-saved '((t (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1720 "Face used when the customize item has been saved."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1721 :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
1722 ;; 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
1723 (put 'custom-saved-face 'face-alias 'custom-saved)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1724
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1725 (defconst custom-magic-alist
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1726 '((nil "#" underline "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1727 UNINITIALIZED, you should not see this.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1728 (unknown "?" italic "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1729 UNKNOWN, you should not see this.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1730 (hidden "-" default "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1731 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
1732 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
1733 (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
1734 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
1735 (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
1736 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
1737 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
1738 (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
1739 SET for current session only." "\
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1740 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
1741 (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
1742 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
1743 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
1744 (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
1745 SAVED and set." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1746 something in this group has been set and saved.")
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1747 (rogue "@" custom-rogue "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1748 NO CUSTOMIZATION DATA; you should not see this." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1749 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
1750 (standard " " nil "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1751 STANDARD." "\
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1752 visible group members are all at standard settings."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1753 "Alist of customize option states.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1754 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
1755
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1756 STATE is one of the following symbols:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1757
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1758 `nil'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1759 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1760 `unknown'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1761 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1762 `hidden'
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1763 This item is not being displayed.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1764 `invalid'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1765 This item is modified, but has an invalid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1766 `modified'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1767 This item is modified, and has a valid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1768 `set'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1769 This item has been set but not saved.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1770 `changed'
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1771 The current value of this item has been changed outside Customize.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1772 `saved'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1773 This item is marked for saving.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1774 `rogue'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1775 This item has no customization information.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1776 `standard'
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1777 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
1778
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1779 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
1780
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1781 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
1782
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1783 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
1784
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1785 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
1786 left out, ITEM-DESC will be used.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1787
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1788 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
1789 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
1790
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1791 The list should be sorted most significant first.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1792
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1793 (defcustom custom-magic-show 'long
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1794 "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
1795 If `long', show a full-line description, not just one word."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1796 :type '(choice (const :tag "no" nil)
22600
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1797 (const long)
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1798 (other :tag "short" short))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1799 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1800
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1801 (defcustom custom-magic-show-hidden '(option face)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1802 "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
1803 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
1804 button should be visible. Possible categories are `group', `option',
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1805 and `face'."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1806 :type '(set (const group) (const option) (const face))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1807 :group 'custom-buffer)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1808
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1809 (defcustom custom-magic-show-button nil
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1810 "Show a \"magic\" button indicating the state of each customization option."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1811 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1812 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1813
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1814 (define-widget 'custom-magic 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1815 "Show and manipulate state for a customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1816 :format "%v"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1817 :action 'widget-parent-action
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1818 :notify 'ignore
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1819 :value-get 'ignore
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1820 :value-create 'custom-magic-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1821 :value-delete 'widget-children-value-delete)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1822
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1823 (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
1824 ;; Non-nil unless hidden.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1825 (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
1826 :custom-state)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1827 'hidden)))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1828
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1829 (defun custom-magic-value-create (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1830 "Create compact status report for WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1831 (let* ((parent (widget-get widget :parent))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1832 (state (widget-get parent :custom-state))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1833 (hidden (eq state 'hidden))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1834 (entry (assq state custom-magic-alist))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1835 (magic (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1836 (face (nth 2 entry))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1837 (category (widget-get parent :custom-category))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1838 (text (or (and (eq category 'group)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1839 (nth 4 entry))
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1840 (nth 3 entry)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1841 (form (widget-get parent :custom-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1842 children)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1843 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1844 (setq text (concat (match-string 1 text)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1845 (symbol-name category)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1846 (match-string 2 text))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1847 (when (and custom-magic-show
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1848 (or (not hidden)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1849 (memq category custom-magic-show-hidden)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1850 (insert " ")
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1851 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1852 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1853 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1854 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1855 (widget-get parent :custom-level))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1856 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1857 widget 'choice-item
18087
05c70aa62552 Synched with 1.9903
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18086
diff changeset
1858 :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
1859 :format (if hidden "%t" "%[%t%]")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1860 :button-prefix 'widget-push-button-prefix
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1861 :button-suffix 'widget-push-button-suffix
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1862 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1863 :tag "State")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1864 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1865 (insert ": ")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1866 (let ((start (point)))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1867 (if (eq custom-magic-show 'long)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1868 (insert text)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1869 (insert (symbol-name state)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1870 (cond ((eq form 'lisp)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1871 (insert " (lisp)"))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1872 ((eq form 'mismatch)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1873 (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
1874 (put-text-property start (point) 'face 'custom-state))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1875 (insert "\n"))
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1876 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1877 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1878 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1879 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1880 (widget-get parent :custom-level))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1881 (when custom-magic-show-button
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1882 (when custom-magic-show
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1883 (let ((indent (widget-get parent :indent)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1884 (when indent
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1885 (insert-char ? indent))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1886 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1887 widget 'choice-item
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1888 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1889 :button-face face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1890 :button-prefix ""
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1891 :button-suffix ""
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1892 :help-echo "Change the state."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1893 :format (if hidden "%t" "%[%t%]")
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1894 :tag (if (memq form '(lisp mismatch))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1895 (concat "(" magic ")")
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1896 (concat "[" magic "]")))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1897 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1898 (insert " "))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1899 (widget-put widget :children children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1900
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1901 (defun custom-magic-reset (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1902 "Redraw the :custom-magic property of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1903 (let ((magic (widget-get widget :custom-magic)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1904 (widget-value-set magic (widget-value magic))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1905
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1906 ;;; The `custom' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1907
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1908 (defface custom-button
32883
105ad8d20e29 (custom-button-face, custom-button-pressed-face): Merge x w32 and mac
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1909 '((((type x w32 mac) (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
1910 (: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
1911 :background "lightgrey" :foreground "black"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1912 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1913 nil))
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1914 "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
1915 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1916 :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
1917 ;; 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
1918 (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
1919
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1920 (defface custom-button-unraised
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1921 '((((min-colors 88)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1922 (class color) (background light)) :foreground "blue1" :underline t)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1923 (((class color) (background light)) :foreground "blue" :underline t)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1924 (((min-colors 88)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1925 (class color) (background dark)) :foreground "cyan1" :underline t)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1926 (((class color) (background dark)) :foreground "cyan" :underline t)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1927 (t :underline t))
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1928 "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
1929 :version "22.1"
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1930 :group 'custom-faces)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1931
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1932 (setq custom-button
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1933 (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
1934
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1935 (defface custom-button-pressed
32883
105ad8d20e29 (custom-button-face, custom-button-pressed-face): Merge x w32 and mac
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1936 '((((type x w32 mac) (class color))
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents: 31744
diff changeset
1937 (: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
1938 :background "lightgrey" :foreground "black"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1939 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1940 (:inverse-video t)))
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1941 "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
1942 :version "21.1"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1943 :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
1944 ;; 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
1945 (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
1946
66336
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1947 (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
1948 '((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
1949 (((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
1950 (((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
1951 "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
1952 :version "22.1"
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1953 :group 'custom-faces)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1954
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1955 (setq custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1956 (if custom-raised-buttons
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1957 'custom-button-pressed
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1958 'custom-button-pressed-unraised))
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
1959
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1960 (defface custom-documentation nil
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1961 "Face used for documentation strings in customization buffers."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1962 :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
1963 ;; 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
1964 (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
1965
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1966 (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
1967 (background dark))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1968 (: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
1969 (((class color)
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1970 (background light))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
1971 (: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
1972 (t nil))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1973 "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
1974 :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
1975 ;; 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
1976 (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
1977
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1978 (define-widget 'custom 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1979 "Customize a user option."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1980 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1981 :convert-widget 'custom-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1982 :notify 'custom-notify
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1983 :custom-prefix ""
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1984 :custom-level 1
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1985 :custom-state 'hidden
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1986 :documentation-property 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1987 :value-create 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1988 :value-delete 'widget-children-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1989 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1990 :validate 'widget-children-validate
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1991 :match (lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1992
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1993 (defun custom-convert-widget (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1994 "Initialize :value and :tag from :args in WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1995 (let ((args (widget-get widget :args)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1996 (when args
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1997 (widget-put widget :value (widget-apply widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1998 :value-to-internal (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1999 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2000 (widget-put widget :args nil)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2001 widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2002
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2003 (defun custom-notify (widget &rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2004 "Keep track of changes."
18090
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2005 (let ((state (widget-get widget :custom-state)))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2006 (unless (eq state 'modified)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2007 (unless (memq state '(nil unknown hidden))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2008 (widget-put widget :custom-state 'modified))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2009 (custom-magic-reset widget)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
2010 (apply 'widget-default-notify widget args))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2011
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2012 (defun custom-redraw (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2013 "Redraw WIDGET with current settings."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2014 (let ((line (count-lines (point-min) (point)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2015 (column (current-column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2016 (pos (point))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2017 (from (marker-position (widget-get widget :from)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2018 (to (marker-position (widget-get widget :to))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2019 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2020 (widget-value-set widget (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2021 (custom-redraw-magic widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2022 (when (and (>= pos from) (<= pos to))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2023 (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2024 (progn
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2025 (if (> column 0)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2026 (goto-line line)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2027 (goto-line (1+ line)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2028 (move-to-column column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2029 (error nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2030
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2031 (defun custom-redraw-magic (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2032 "Redraw WIDGET state with current settings."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2033 (while widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2034 (let ((magic (widget-get widget :custom-magic)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2035 (cond (magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2036 (widget-value-set magic (widget-value magic))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2037 (when (setq widget (widget-get widget :group))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2038 (custom-group-state-update widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2039 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2040 (setq widget nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2041 (widget-setup))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2042
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2043 (defun custom-show (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2044 "Non-nil if WIDGET should be shown with VALUE by default."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2045 (let ((show (widget-get widget :custom-show)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2046 (cond ((null show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2047 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2048 ((eq t show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2049 t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2050 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2051 (funcall show widget value)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2052
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2053 (defun custom-load-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2054 "Load all dependencies for WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2055 (custom-load-symbol (widget-value widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2056
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2057 (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
2058 "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
2059 (let ((found nil)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2060 (loads (get symbol 'custom-loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2061 load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2062 (while loads
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2063 (setq load (car loads)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2064 loads (cdr loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2065 (cond ((symbolp load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2066 (unless (featurep load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2067 (setq found t)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2068 ((assoc load load-history))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2069 ((assoc (locate-library load) load-history)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2070 (message nil))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2071 (t
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2072 (setq found t))))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2073 found))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2074
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2075 (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
2076 "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
2077 (custom-unloaded-symbol-p (widget-value widget)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2078
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2079 (defun custom-toggle-hide (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2080 "Toggle visibility of WIDGET."
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2081 (custom-load-widget widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2082 (let ((state (widget-get widget :custom-state)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2083 (cond ((memq state '(invalid modified))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2084 (error "There are unset changes"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2085 ((eq state 'hidden)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2086 (widget-put widget :custom-state 'unknown))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2087 (t
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2088 (widget-put widget :documentation-shown nil)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2089 (widget-put widget :custom-state 'hidden)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2090 (custom-redraw widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2091 (widget-setup)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2092
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2093 (defun custom-toggle-parent (widget &rest ignore)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2094 "Toggle visibility of parent of WIDGET."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2095 (custom-toggle-hide (widget-get widget :parent)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2096
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2097 (defun custom-add-see-also (widget &optional prefix)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2098 "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
2099 Insert PREFIX first if non-nil."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2100 (let* ((symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2101 (links (get symbol 'custom-links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2102 (many (> (length links) 2))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2103 (buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2104 (indent (widget-get widget :indent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2105 (when links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2106 (when indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2107 (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2108 (when prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2109 (insert prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2110 (insert "See also ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2111 (while links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2112 (push (widget-create-child-and-convert widget (car links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2113 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2114 (setq links (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2115 (cond ((null links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2116 (insert ".\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2117 ((null (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2118 (if many
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2119 (insert ", and ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2120 (insert " and ")))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2121 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2122 (insert ", "))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2123 (widget-put widget :buttons buttons))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2124
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2125 (defun custom-add-parent-links (widget &optional initial-string)
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2126 "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
2127 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
2128 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
2129 (let ((name (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2130 (type (widget-type widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2131 (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
2132 (start (point))
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2133 (parents nil))
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2134 (insert (or initial-string "Parent groups:"))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2135 (mapatoms (lambda (symbol)
66904
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2136 (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
2137 (insert " ")
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2138 (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
2139 widget 'custom-group-link
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2140 :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
2141 symbol)
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2142 buttons)
b39a51cbc6b6 (custom-add-parent-links): Fix bug whereby, for instance,
Luc Teirlinck <teirllm@auburn.edu>
parents: 66859
diff changeset
2143 (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
2144 (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
2145 (= (length parents) 1) ;A single parent.
53319
36b31fc002f2 2003-12-12 Jesper Harder <harder@ifa.au.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 53223
diff changeset
2146 (let* ((links (get (car parents) 'custom-links))
36b31fc002f2 2003-12-12 Jesper Harder <harder@ifa.au.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 53223
diff changeset
2147 (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
2148 (when links
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2149 (insert "\nParent documentation: ")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2150 (while links
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2151 (push (widget-create-child-and-convert widget (car links))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2152 buttons)
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2153 (setq links (cdr links))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2154 (cond ((null links)
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2155 (insert ".\n"))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2156 ((null (cdr links))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2157 (if many
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2158 (insert ", and ")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2159 (insert " and ")))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2160 (t
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2161 (insert ", ")))))))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2162 (if parents
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2163 (insert "\n")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2164 (delete-region start (point)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2165 (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
2166 parents))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2167
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2168 ;;; The `custom-comment' Widget.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2169
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2170 ;; like the editable field
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2171 (defface custom-comment '((((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
2172 (background light))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2173 (:background "gray85"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2174 (((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
2175 (background dark))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2176 (:background "dim gray"))
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2177 (t
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2178 (:slant italic)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2179 "Face used for comments on variables or faces"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2180 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2181 :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
2182 ;; 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
2183 (put 'custom-comment-face 'face-alias 'custom-comment)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2184
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2185 ;; 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
2186 (defface custom-comment-tag
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2187 '((((class color) (background dark)) (:foreground "gray80"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2188 (((class color) (background light)) (:foreground "blue4"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2189 (((class grayscale) (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2190 (:foreground "DimGray" :weight bold :slant italic))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2191 (((class grayscale) (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2192 (: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
2193 (t (:weight bold)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2194 "Face used for variables or faces comment tags"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2195 :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
2196 ;; 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
2197 (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
2198
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2199 (define-widget 'custom-comment 'string
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2200 "User comment."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2201 :tag "Comment"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2202 :help-echo "Edit a comment here."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2203 :sample-face 'custom-comment-tag-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2204 :value-face 'custom-comment-face
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2205 :shown nil
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2206 :create 'custom-comment-create)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2207
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2208 (defun custom-comment-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2209 (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
2210 (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
2211 (not null-comment))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2212 (widget-default-create widget)
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2213 ;; `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
2214 ;; maybe it shouldn't.
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2215 (widget-put widget :from (point-marker))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2216 (widget-put widget :to (point-marker)))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2217
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2218 (defun custom-comment-hide (widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2219 (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
2220
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2221 ;; 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
2222 ;; the global custom one
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2223 (defun custom-comment-show (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2224 (widget-put widget :comment-shown t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2225 (custom-redraw widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2226 (widget-setup))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2227
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2228 (defun custom-comment-invisible-p (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2229 (let ((val (widget-value (widget-get widget :comment-widget))))
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2230 (and (equal "" val)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2231 (not (widget-get widget :comment-shown)))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2232
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2233 ;;; The `custom-variable' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2234
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2235 ;; When this was underlined blue, users confused it with a
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2236 ;; 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
2237 (defface custom-variable-tag
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2238 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2239 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2240 (: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
2241 (((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
2242 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
2243 (: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
2244 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2245 (background light))
63249
32b12a7e7c4f (minibuffer): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 63194
diff changeset
2246 (: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
2247 (t (:weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2248 "Face used for unpushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2249 :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
2250 ;; 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
2251 (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
2252
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2253 (defface custom-variable-button '((t (:underline t :weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2254 "Face used for pushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2255 :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
2256 ;; 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
2257 (put 'custom-variable-button-face 'face-alias 'custom-variable-button)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2258
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2259 (defcustom custom-variable-default-form 'edit
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2260 "Default form of displaying variable values."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2261 :type '(choice (const edit)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2262 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2263 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2264 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2265
56161
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2266 (defun custom-variable-documentation (variable)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2267 "Return documentation of VARIABLE for use in Custom buffer.
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2268 Normally just return the docstring. But if VARIABLE automatically
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2269 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
2270 (if (and (local-variable-if-set-p variable)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2271 (or (not (local-variable-p variable))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2272 (with-temp-buffer
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2273 (local-variable-if-set-p variable))))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2274 (concat (documentation-property variable 'variable-documentation)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2275 "\n
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2276 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
2277 However, setting it through Custom sets the default value.")
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2278 (documentation-property variable 'variable-documentation)))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2279
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2280 (define-widget 'custom-variable 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2281 "Customize variable."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2282 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2283 :help-echo "Set or reset this variable."
56161
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2284 :documentation-property #'custom-variable-documentation
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2285 :custom-category 'option
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2286 :custom-state nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2287 :custom-menu 'custom-variable-menu-create
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2288 :custom-form nil ; defaults to value of `custom-variable-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2289 :value-create 'custom-variable-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2290 :action 'custom-variable-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2291 :custom-set 'custom-variable-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2292 :custom-save 'custom-variable-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2293 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2294 :custom-reset-saved 'custom-variable-reset-saved
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2295 :custom-reset-standard 'custom-variable-reset-standard
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2296 :custom-standard-value 'custom-variable-standard-value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2297
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2298 (defun custom-variable-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2299 "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
2300 If SYMBOL has a `custom-type' property, use that.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2301 Otherwise, look up symbol in `custom-guess-type-alist'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2302 (let* ((type (or (get symbol 'custom-type)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2303 (and (not (get symbol 'standard-value))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2304 (custom-guess-type symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2305 'sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2306 (options (get symbol 'custom-options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2307 (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
2308 (copy-sequence type)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2309 (list type))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2310 (when options
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2311 (widget-put tmp :options options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2312 tmp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2313
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2314 (defun custom-variable-value-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2315 "Here is where you edit the variable's value."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2316 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2317 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2318 (widget-put widget :custom-form custom-variable-default-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2319 (let* ((buttons (widget-get widget :buttons))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2320 (children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2321 (form (widget-get widget :custom-form))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2322 (state (widget-get widget :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2323 (symbol (widget-get widget :value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2324 (tag (widget-get widget :tag))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2325 (type (custom-variable-type symbol))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2326 (conv (widget-convert type))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2327 (get (or (get symbol 'custom-get) 'default-value))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2328 (prefix (widget-get widget :custom-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2329 (last (widget-get widget :custom-last))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2330 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2331 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2332 (widget-get conv :value))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2333 ;; 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
2334 (cond (state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2335 ((custom-show type value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2336 (setq state 'unknown))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2337 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2338 (setq state 'hidden)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2339 ;; 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
2340 (when (eq state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2341 (unless (widget-apply conv :match value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2342 ;; (widget-apply (widget-convert type) :match value)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2343 (setq form 'mismatch)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2344 ;; Now we can create the child widget.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2345 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2346 (insert prefix (if last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2347 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2348 widget 'custom-browse-variable-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2349 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2350 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2351 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2352 ((eq state 'hidden)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2353 ;; Indicate hidden value.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2354 (push (widget-create-child-and-convert
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2355 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2356 :format "%{%t%}: "
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2357 :sample-face 'custom-variable-tag-face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2358 :tag tag
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2359 :parent widget)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2360 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2361 (push (widget-create-child-and-convert
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2362 widget 'visibility
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2363 :help-echo "Show the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2364 :off "Show Value"
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2365 :action 'custom-toggle-parent
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2366 nil)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2367 buttons))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2368 ((memq form '(lisp mismatch))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2369 ;; In lisp mode edit the saved value when possible.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2370 (let* ((value (cond ((get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2371 (car (get symbol 'saved-value)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2372 ((get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2373 (car (get symbol 'standard-value)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2374 ((default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2375 (custom-quote (funcall get symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2376 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2377 (custom-quote (widget-get conv :value))))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2378 (insert (symbol-name symbol) ": ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2379 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2380 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2381 :help-echo "Hide the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2382 :on "Hide Value"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2383 :off "Show Value"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2384 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2385 t)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2386 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2387 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2388 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2389 widget 'sexp
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2390 :button-face 'custom-variable-button-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2391 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2392 :tag (symbol-name symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2393 :parent widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2394 :value value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2395 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2396 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2397 ;; Edit mode.
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2398 (let* ((format (widget-get type :format))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2399 tag-format value-format)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2400 (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
2401 (error "Bad format"))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2402 (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
2403 (setq value-format (substring format (match-end 0)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2404 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2405 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2406 :format tag-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2407 :action 'custom-tag-action
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2408 :help-echo "Change value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2409 :mouse-down-action 'custom-tag-mouse-down-action
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2410 :button-face 'custom-variable-button-face
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2411 :sample-face 'custom-variable-tag-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2412 tag)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2413 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2414 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2415 (push (widget-create-child-and-convert
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2416 widget 'visibility
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2417 :help-echo "Hide the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2418 :on "Hide Value"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2419 :off "Show Value"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2420 :action 'custom-toggle-parent
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2421 t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2422 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2423 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2424 widget type
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2425 :format value-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2426 :value value)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2427 children))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2428 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2429 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2430 (widget-insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2431 ;; Create the magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2432 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2433 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2434 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2435 (push magic buttons))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2436 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2437 ;; before the call to `widget-default-format-handler'. Otherwise, I
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2438 ;; loose my current `buttons'. This function shouldn't be called like
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2439 ;; this anyway. The doc string widget should be added like the others.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2440 ;; --dv
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2441 (widget-put widget :buttons buttons)
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2442 (insert "\n")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2443 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2444 (widget-default-format-handler widget ?h)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2445
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2446 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2447 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2448 (let* ((comment (get symbol 'variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2449 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2450 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2451 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2452 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2453 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2454 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2455 ;; 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
2456 ;; value one.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2457 (setq children (append children (list comment-widget)))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2458 ;; Update the rest of the properties properties.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2459 (widget-put widget :custom-form form)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2460 (widget-put widget :children children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2461 ;; Now update the state.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2462 (if (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2463 (widget-put widget :custom-state state)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2464 (custom-variable-state-set widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2465 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2466 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2467 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2468 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2469 (custom-add-see-also widget)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2470
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2471 (defun custom-tag-action (widget &rest args)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2472 "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
2473 (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
2474 :action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2475
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2476 (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
2477 "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
2478 (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
2479 :mouse-down-action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2480
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2481 (defun custom-variable-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2482 "Set the state of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2483 (let* ((symbol (widget-value widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2484 (get (or (get symbol 'custom-get) 'default-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2485 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2486 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2487 (widget-get widget :value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2488 (comment (get symbol 'variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2489 tmp
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2490 temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2491 (state (cond ((progn (setq tmp (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2492 (setq temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2493 (get symbol 'customized-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2494 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2495 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2496 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2497 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2498 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2499 'set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2500 'changed))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2501 ((progn (setq tmp (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2502 (setq temp (get symbol 'saved-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2503 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2504 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2505 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2506 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2507 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2508 'saved
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2509 'changed))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2510 ((setq tmp (get symbol 'standard-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2511 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2512 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2513 (equal comment nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2514 (error nil))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2515 'standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2516 'changed))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2517 (t 'rogue))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2518 (widget-put widget :custom-state state)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2519
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2520 (defun custom-variable-standard-value (widget)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2521 (get (widget-value widget) 'standard-value))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2522
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2523 (defvar custom-variable-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
2524 '(("Set for Current Session" custom-variable-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2525 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2526 (eq (widget-get widget :custom-state) 'modified)))
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
2527 ("Save for Future Sessions" custom-variable-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2528 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2529 (memq (widget-get widget :custom-state) '(modified set changed rogue))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2530 ("Reset to Current" custom-redraw
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2531 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2532 (and (default-boundp (widget-value widget))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2533 (memq (widget-get widget :custom-state) '(modified changed)))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2534 ("Reset to Saved" custom-variable-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2535 (lambda (widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2536 (and (or (get (widget-value widget) 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2537 (get (widget-value widget) 'saved-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2538 (memq (widget-get widget :custom-state)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2539 '(modified set changed rogue)))))
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
2540 ("Erase Customization" custom-variable-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2541 (lambda (widget)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2542 (and (get (widget-value widget) 'standard-value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2543 (memq (widget-get widget :custom-state)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2544 '(modified set changed saved rogue)))))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2545 ("Use Backup Value" custom-variable-reset-backup
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2546 (lambda (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2547 (get (widget-value widget) 'backup-value)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2548 ("---" ignore ignore)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2549 ("Add Comment" custom-comment-show custom-comment-invisible-p)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2550 ("---" ignore ignore)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2551 ("Don't show as Lisp expression" custom-variable-edit
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2552 (lambda (widget)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2553 (eq (widget-get widget :custom-form) 'lisp)))
19823
0c1b4a44db76 (custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents: 19822
diff changeset
2554 ("Show initial Lisp expression" custom-variable-edit-lisp
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2555 (lambda (widget)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2556 (eq (widget-get widget :custom-form) 'edit))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2557 "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
2558 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
2559 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
2560 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
2561 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
2562 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2563
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2564 (defun custom-variable-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2565 "Show the menu for `custom-variable' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2566 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2567 (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
2568 (custom-toggle-hide widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2569 (unless (eq (widget-get widget :custom-state) 'modified)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2570 (custom-variable-state-set widget))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2571 (custom-redraw-magic widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2572 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2573 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2574 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2575 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2576 (custom-menu-filter custom-variable-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2577 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2578 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2579 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2580 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2581
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2582 (defun custom-variable-edit (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2583 "Edit value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2584 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2585 (widget-put widget :custom-form 'edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2586 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2587
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2588 (defun custom-variable-edit-lisp (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2589 "Edit the Lisp representation of the value of WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2590 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2591 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2592 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2593
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2594 (defun custom-variable-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2595 "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
2596 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2597 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2598 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2599 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2600 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2601 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2602 (comment (widget-value comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2603 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2604 (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
2605 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2606 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2607 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2608 (error "%s" (widget-get val :error)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2609 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2610 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2611 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2612 ;; 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
2613 (custom-comment-hide comment-widget))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2614 (custom-variable-backup-value widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2615 (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
2616 (put symbol 'customized-value (list val))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2617 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2618 (put symbol 'customized-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2619 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2620 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2621 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2622 ;; 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
2623 (custom-comment-hide comment-widget))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2624 (custom-variable-backup-value widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2625 (funcall set symbol (setq val (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2626 (put symbol 'customized-value (list (custom-quote val)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2627 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2628 (put symbol 'customized-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2629 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2630 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2631
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2632 (defun custom-variable-save (widget)
19823
0c1b4a44db76 (custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents: 19822
diff changeset
2633 "Set and save the 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
2634 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2635 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2636 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2637 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2638 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2639 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2640 (comment (widget-value comment-widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2641 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2642 (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
2643 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2644 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2645 (goto-char (widget-get val :from))
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
2646 (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
2647 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2648 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2649 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2650 ;; 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
2651 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2652 (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
2653 (custom-push-theme 'theme-value symbol 'user
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2654 'set (list (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2655 (funcall set symbol (eval (widget-value child)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2656 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2657 (put symbol 'saved-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2658 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2659 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2660 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2661 ;; 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
2662 (custom-comment-hide comment-widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2663 (put symbol 'saved-value
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2664 (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
2665 (custom-push-theme 'theme-value symbol 'user
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2666 'set (list (custom-quote (widget-value
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2667 child))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2668 (funcall set symbol (widget-value child))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2669 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2670 (put symbol 'saved-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2671 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2672 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2673 (custom-save-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2674 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2675 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2676
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2677 (defun custom-variable-reset-saved (widget)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2678 "Restore the saved 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
2679 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
2680 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
2681 (let* ((symbol (widget-value widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2682 (set (or (get symbol 'custom-set) 'set-default))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2683 (value (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2684 (comment (get symbol 'saved-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2685 (cond ((or value comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2686 (put symbol 'variable-comment comment)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2687 (custom-variable-backup-value widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2688 (condition-case nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2689 (funcall set symbol (eval (car value)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2690 (error nil)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2691 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2692 (error "No saved value for %s" symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2693 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2694 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2695 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2696 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2697 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2698
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2699 (defun custom-variable-reset-standard (widget)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
2700 "Restore the standard setting for the variable being edited by WIDGET.
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
2701 This operation eliminates any saved setting for the variable,
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2702 restoring it to the state of a variable that has never been customized.
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2703 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
2704 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
2705 (let* ((symbol (widget-value widget))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
2706 (set (or (get symbol 'custom-set) 'set-default)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2707 (if (get symbol 'standard-value)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2708 (progn
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2709 (custom-variable-backup-value widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2710 (funcall set symbol (eval (car (get symbol 'standard-value)))))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
2711 (error "No standard setting known for %S" symbol))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2712 (put symbol 'variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2713 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2714 (put symbol 'customized-variable-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2715 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2716 (put symbol 'saved-value nil)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2717 (custom-push-theme 'theme-value symbol 'user 'reset 'standard)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2718 ;; As a special optimizations we do not (explictly)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2719 ;; save resets to standard when no theme set the value.
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2720 (if (null (cdr (get symbol 'theme-value)))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2721 (put symbol 'theme-value nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2722 (put symbol 'saved-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2723 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2724 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2725 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2726 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2727
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2728 (defun custom-variable-backup-value (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2729 "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
2730 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
2731 (let* ((symbol (widget-value widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2732 (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
2733 (type (custom-variable-type symbol))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2734 (conv (widget-convert type))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2735 (value (if (default-boundp symbol)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2736 (funcall get symbol)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2737 (widget-get conv :value))))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2738 (put symbol 'backup-value (list value))))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2739
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2740 (defun custom-variable-reset-backup (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2741 "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
2742 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
2743 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
2744 to switch between two values."
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2745 (let* ((symbol (widget-value widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2746 (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
2747 (value (get symbol 'backup-value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2748 (comment-widget (widget-get widget :comment-widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2749 (comment (widget-value comment-widget)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2750 (if value
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2751 (progn
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2752 (custom-variable-backup-value widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2753 (condition-case nil
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2754 (funcall set symbol (car value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2755 (error nil)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2756 (error "No backup value for %s" symbol))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2757 (put symbol 'customized-value (list (car value)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2758 (put symbol 'variable-comment comment)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2759 (put symbol 'customized-variable-comment comment)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2760 (custom-variable-state-set widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2761 ;; 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
2762 (custom-redraw widget)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2763
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2764 ;;; The `custom-face-edit' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2765
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2766 (define-widget 'custom-face-edit 'checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2767 "Edit face attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2768 :format "%t: %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2769 :tag "Attributes"
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2770 :extra-offset 13
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2771 :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
2772 :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
2773 :match (lambda (widget value)
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
2774 (widget-checklist-match widget
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
2775 (custom-face-edit-fix-value widget value)))
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2776 :convert-widget 'custom-face-edit-convert-widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2777 :args (mapcar (lambda (att)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2778 (list 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2779 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2780 :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
2781 (list 'const :format "" :value (nth 0 att))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2782 (nth 1 att)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2783 custom-face-attributes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2784
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
2785 (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
2786 "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
2787 Also change :reverse-video to :inverse-video."
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2788 (if (listp value)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2789 (let (result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2790 (while value
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2791 (let ((key (car value))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2792 (val (car (cdr value))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2793 (cond ((eq key :italic)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2794 (push :slant result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2795 (push (if val 'italic 'normal) result))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2796 ((eq key :bold)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2797 (push :weight result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2798 (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
2799 ((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
2800 (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
2801 (push val result))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
2802 (t
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2803 (push key result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2804 (push val result))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2805 (setq value (cdr (cdr value))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2806 (setq result (nreverse result))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2807 result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2808 value))
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
2809
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2810 (defun custom-face-edit-convert-widget (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2811 "Convert :args as widget types in WIDGET."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2812 (widget-put
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2813 widget
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2814 :args (mapcar (lambda (arg)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2815 (widget-convert arg
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2816 :deactivate 'custom-face-edit-deactivate
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2817 :activate 'custom-face-edit-activate
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2818 :delete 'custom-face-edit-delete))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2819 (widget-get widget :args)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2820 widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2821
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2822 (defun custom-face-edit-deactivate (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2823 "Make face widget WIDGET inactive for user modifications."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2824 (unless (widget-get widget :inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2825 (let ((tag (custom-face-edit-attribute-tag widget))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2826 (from (copy-marker (widget-get widget :from)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2827 (value (widget-value widget))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2828 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2829 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2830 (save-excursion
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2831 (goto-char from)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2832 (widget-default-delete widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2833 (insert tag ": *\n")
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2834 (widget-put widget :inactive
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2835 (cons value (cons from (- (point) from))))))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2836
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2837 (defun custom-face-edit-activate (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2838 "Make face widget WIDGET inactive for user modifications."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2839 (let ((inactive (widget-get widget :inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2840 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2841 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2842 (when (consp inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2843 (save-excursion
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2844 (goto-char (car (cdr inactive)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2845 (delete-region (point) (+ (point) (cdr (cdr inactive))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2846 (widget-put widget :inactive nil)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2847 (widget-apply widget :create)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2848 (widget-value-set widget (car inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2849 (widget-setup)))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2850
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2851 (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
2852 "Remove WIDGET from the buffer."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2853 (let ((inactive (widget-get widget :inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2854 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2855 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2856 (if (not inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2857 ;; 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
2858 (widget-default-delete widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2859 ;; 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
2860 ;; 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
2861 (delete-region (car (cdr inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2862 (+ (car (cdr inactive)) (cdr (cdr inactive))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2863 (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
2864
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2865
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2866 (defun custom-face-edit-attribute-tag (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2867 "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
2868 (let ((tag (widget-get widget :tag)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2869 (or (and (not (equal tag "")) tag)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2870 (let ((children (widget-get widget :children)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2871 (while (and (null tag) children)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2872 (setq tag (custom-face-edit-attribute-tag (pop children))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2873 tag))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2874
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2875 ;;; The `custom-display' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2876
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2877 (define-widget 'custom-display 'menu-choice
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2878 "Select a display type."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2879 :tag "Display"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2880 :value t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2881 :help-echo "Specify frames where the face attributes should be used."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2882 :args '((const :tag "all" t)
58941
a7271df99c36 (custom-display): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58940
diff changeset
2883 (const :tag "defaults" default)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2884 (checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2885 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2886 :extra-offset 9
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2887 :args ((group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2888 Only match the specified window systems.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2889 (const :format "Type: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2890 type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2891 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2892 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2893 (const :format "X "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2894 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2895 The X11 Window System.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2896 x)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2897 (const :format "PM "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2898 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2899 OS/2 Presentation Manager.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2900 pm)
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2901 (const :format "W32 "
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2902 :sibling-args (:help-echo "\
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2903 Windows NT/9X.")
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2904 w32)
48633
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2905 (const :format "MAC "
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2906 :sibling-args (:help-echo "\
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2907 Macintosh OS.")
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2908 mac)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2909 (const :format "DOS "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2910 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2911 Plain MS-DOS.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2912 pc)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2913 (const :format "TTY%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2914 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2915 Plain text terminals.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2916 tty)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2917 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2918 Only match the frames with the specified color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2919 (const :format "Class: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2920 class)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2921 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2922 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2923 (const :format "Color "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2924 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2925 Match color frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2926 color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2927 (const :format "Grayscale "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2928 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2929 Match grayscale frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2930 grayscale)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2931 (const :format "Monochrome%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2932 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2933 Match frames with no color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2934 mono)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2935 (group :sibling-args (:help-echo "\
55944
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2936 The minimum number of colors the frame should support.")
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2937 (const :format "" min-colors)
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2938 (integer :tag "Minimum number of colors" ))
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2939 (group :sibling-args (:help-echo "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2940 Only match frames with the specified intensity.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2941 (const :format "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2942 Background brightness: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2943 background)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2944 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2945 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2946 (const :format "Light "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2947 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2948 Match frames with light backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2949 light)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2950 (const :format "Dark\n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2951 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2952 Match frames with dark backgrounds.")
45724
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
2953 dark)))
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
2954 (group :sibling-args (:help-echo "\
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
2955 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
2956 (const :format "Supports attributes:" supports)
45725
abb237aa3c61 (custom-display): Use correct syntax for `supports' attributes.
Miles Bader <miles@gnu.org>
parents: 45724
diff changeset
2957 (custom-face-edit :inline t :format "%n%v"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2958
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2959 ;;; The `custom-face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2960
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
2961 (defface custom-face-tag
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2962 `((t (:weight bold :height 1.2 :inherit variable-pitch)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2963 "Face used for face tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2964 :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
2965 ;; 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
2966 (put 'custom-face-tag-face 'face-alias 'custom-face-tag)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2967
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2968 (defcustom custom-face-default-form 'selected
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2969 "Default form of displaying face definition."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2970 :type '(choice (const all)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2971 (const selected)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2972 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2973 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2974 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2975
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2976 (define-widget 'custom-face 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2977 "Customize face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2978 :sample-face 'custom-face-tag-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2979 :help-echo "Set or reset this face."
28716
e9fb71a3e51d (custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28700
diff changeset
2980 :documentation-property #'face-doc-string
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2981 :value-create 'custom-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2982 :action 'custom-face-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2983 :custom-category 'face
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2984 :custom-form nil ; defaults to value of `custom-face-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2985 :custom-set 'custom-face-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2986 :custom-save 'custom-face-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2987 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2988 :custom-reset-saved 'custom-face-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2989 :custom-reset-standard 'custom-face-reset-standard
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2990 :custom-standard-value 'custom-face-standard-value
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2991 :custom-menu 'custom-face-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2992
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2993 (define-widget 'custom-face-all 'editable-list
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2994 "An editable list of display specifications and attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2995 :entry-format "%i %d %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2996 :insert-button-args '(:help-echo "Insert new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2997 :append-button-args '(:help-echo "Append new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2998 :delete-button-args '(:help-echo "Delete this display specification.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2999 :args '((group :format "%v" custom-display custom-face-edit)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3000
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3001 (defconst custom-face-all (widget-convert 'custom-face-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3002 "Converted version of the `custom-face-all' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3003
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3004 (define-widget 'custom-display-unselected 'item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3005 "A display specification that doesn't match the selected display."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3006 :match 'custom-display-unselected-match)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3007
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3008 (defun custom-display-unselected-match (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3009 "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
3010 (not (face-spec-set-match-display value (selected-frame))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3011
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3012 (define-widget 'custom-face-selected 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3013 "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
3014 :args '((choice :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3015 (group :tag "With Defaults" :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3016 (group (const :tag "" default)
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3017 (custom-face-edit :tag " Default\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3018 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3019 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3020 (group custom-display-unselected sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3021 (group (sexp :format "")
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3022 (custom-face-edit :tag " Overriding\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3023 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3024 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3025 sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3026 (group :tag "No Defaults" :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3027 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3028 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3029 (group custom-display-unselected sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3030 (group (sexp :format "")
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3031 (custom-face-edit :tag "\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3032 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3033 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3034 sexp)))))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3035
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
3036
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3037
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3038 (defconst custom-face-selected (widget-convert 'custom-face-selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3039 "Converted version of the `custom-face-selected' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3040
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3041 (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
3042 "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
3043 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
3044 `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
3045 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
3046 don't specify one."
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3047 (mapcar (lambda (entry)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3048 ;; 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
3049 (let ((tests (car entry))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3050 (unfiltered-attrs
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3051 ;; 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
3052 (if (listp (car (cdr entry)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3053 (car (cdr entry))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3054 (cdr entry)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3055 (filtered-attrs nil))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3056 ;; Filter each face attribute
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3057 (while unfiltered-attrs
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3058 (let* ((attr (pop unfiltered-attrs))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3059 (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
3060 (filter
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3061 (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
3062 default-filter))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3063 (filtered-value
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3064 (if filter
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3065 (funcall filter pre-filtered-value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3066 pre-filtered-value)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3067 (push filtered-value filtered-attrs)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3068 (push attr filtered-attrs)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3069 ;;
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3070 (list tests filtered-attrs)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3071 spec))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3072
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3073 (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
3074 "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
3075 SPEC must be a full face spec."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
3076 (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
3077
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3078 (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
3079 "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
3080 (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
3081
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3082 (defun custom-face-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3083 "Create a list of the display specifications for WIDGET."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3084 (let ((buttons (widget-get widget :buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3085 children
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3086 (symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3087 (tag (widget-get widget :tag))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3088 (state (widget-get widget :custom-state))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3089 (begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3090 (is-last (widget-get widget :custom-last))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3091 (prefix (widget-get widget :custom-prefix)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3092 (unless tag
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3093 (setq tag (prin1-to-string symbol)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3094 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3095 (insert prefix (if is-last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3096 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3097 widget 'custom-browse-face-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3098 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3099 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3100 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3101 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3102 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3103 (insert tag)
34041
40708840c132 (custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents: 33986
diff changeset
3104 (widget-specify-sample widget begin (point))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3105 (if (eq custom-buffer-style 'face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3106 (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
3107 (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
3108 (insert ":")
42e118959715 (custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents: 32936
diff changeset
3109 (insert " face: ")))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3110 ;; Sample.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3111 (push (widget-create-child-and-convert widget 'item
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3112 :format "(%{%t%})"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3113 :sample-face symbol
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3114 :tag "sample")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3115 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3116 ;; Visibility.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3117 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3118 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3119 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3120 :help-echo "Hide or show this face."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
3121 :on "Hide Face"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
3122 :off "Show Face"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3123 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3124 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3125 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3126 ;; Magic.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3127 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3128 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3129 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3130 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3131 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3132 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3133 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3134 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3135 (widget-default-format-handler widget ?h)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3136 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3137 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3138 (let* ((comment (get symbol 'face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3139 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3140 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3141 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3142 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3143 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3144 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3145 (push comment-widget children)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3146 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3147 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3148 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3149 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3150 (custom-add-see-also widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3151 ;; Editor.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3152 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3153 (insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3154 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3155 (message "Creating face editor...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3156 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3157 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3158 (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
3159 (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
3160 (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
3161 (get symbol 'saved-face)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3162 (get symbol 'face-defface-spec)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3163 ;; Attempt to construct it.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3164 (list (list t (custom-face-attributes-get
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3165 symbol (selected-frame))))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3166 (form (widget-get widget :custom-form))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3167 (indent (widget-get widget :indent))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3168 edit)
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3169 ;; 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
3170 ;; 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
3171 (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
3172 (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
3173 (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
3174 (setq edit (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3175 widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3176 (cond ((and (eq form 'selected)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3177 (widget-apply custom-face-selected
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3178 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3179 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3180 'custom-face-selected)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3181 ((and (not (eq form 'lisp))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3182 (widget-apply custom-face-all
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3183 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3184 'custom-face-all)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3185 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3186 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3187 'sexp))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3188 :value spec))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3189 (custom-face-state-set widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3190 (push edit children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3191 (widget-put widget :children children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3192 (message "Creating face editor...done"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3193
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3194 (defvar custom-face-menu
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3195 '(("Set for Current Session" custom-face-set)
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3196 ("Save for Future Sessions" custom-face-save-command)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3197 ("Reset to Saved" custom-face-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3198 (lambda (widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3199 (or (get (widget-value widget) 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3200 (get (widget-value widget) 'saved-face-comment))))
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3201 ("Erase Customization" custom-face-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3202 (lambda (widget)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3203 (get (widget-value widget) 'face-defface-spec)))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3204 ("---" ignore ignore)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3205 ("Add Comment" custom-comment-show custom-comment-invisible-p)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3206 ("---" ignore ignore)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3207 ("Show all display specs" custom-face-edit-all
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3208 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3209 (not (eq (widget-get widget :custom-form) 'all))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3210 ("Just current attributes" custom-face-edit-selected
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3211 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3212 (not (eq (widget-get widget :custom-form) 'selected))))
40801
f49e883aeab2 Backed out last change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 40800
diff changeset
3213 ("Show as Lisp expression" custom-face-edit-lisp
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3214 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3215 (not (eq (widget-get widget :custom-form) 'lisp)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3216 "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
3217 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
3218 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
3219 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
3220 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
3221 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3222
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3223 (defun custom-face-edit-selected (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3224 "Edit selected attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3225 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3226 (widget-put widget :custom-form 'selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3227 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3228
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3229 (defun custom-face-edit-all (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3230 "Edit all attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3231 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3232 (widget-put widget :custom-form 'all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3233 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3234
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3235 (defun custom-face-edit-lisp (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3236 "Edit the Lisp representation of the value of WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3237 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3238 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3239 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3240
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3241 (defun custom-face-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3242 "Set the state of WIDGET."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3243 (let* ((symbol (widget-value widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3244 (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
3245 tmp temp
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3246 (state
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3247 (cond ((progn
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3248 (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
3249 (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
3250 (or tmp temp))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3251 (if (equal temp comment)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3252 'set
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3253 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3254 ((progn
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3255 (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
3256 (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
3257 (or tmp temp))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3258 (if (equal temp comment)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3259 'saved
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3260 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3261 ((get symbol 'face-defface-spec)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3262 (if (equal comment nil)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3263 'standard
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3264 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3265 (t
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3266 'rogue))))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3267 ;; 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
3268 ;; 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
3269 (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
3270 (get symbol 'face-modified))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3271 (setq state 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3272 (widget-put widget :custom-state state)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3273
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3274 (defun custom-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3275 "Show the menu for `custom-face' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3276 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3277 (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
3278 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3279 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3280 (symbol (widget-get widget :value))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3281 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3282 (custom-unlispify-tag-name symbol))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3283 (custom-menu-filter custom-face-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3284 widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3285 event)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3286 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3287 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3288
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3289 (defun custom-face-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3290 "Make the face attributes in WIDGET take effect."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3291 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3292 (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
3293 (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
3294 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3295 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3296 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3297 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3298 ;; 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
3299 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3300 (put symbol 'customized-face value)
33843
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3301 (if (face-spec-choose value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3302 (face-spec-set symbol value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3303 ;; 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
3304 ;; something harmless instead.
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3305 (face-spec-set symbol '((t :foreground unspecified))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3306 (put symbol 'customized-face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3307 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3308 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3309 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3310
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3311 (defun custom-face-save-command (widget)
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3312 "Save in `.emacs' the face attributes in WIDGET."
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3313 (custom-face-save widget)
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3314 (custom-save-all))
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3315
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3316 (defun custom-face-save (widget)
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3317 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3318 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3319 (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
3320 (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
3321 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3322 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3323 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3324 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3325 ;; 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
3326 (custom-comment-hide comment-widget))
35441
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3327 (if (face-spec-choose value)
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3328 (face-spec-set symbol value)
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3329 ;; 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
3330 ;; something harmless instead.
d85fe63db92b (custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents: 35265
diff changeset
3331 (face-spec-set symbol '((t :foreground unspecified))))
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3332 (unless (eq (widget-get widget :custom-state) 'standard)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3333 (put symbol 'saved-face value))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3334 (custom-push-theme 'theme-face symbol 'user 'set value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3335 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3336 (put symbol 'face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3337 (put symbol 'customized-face-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3338 (put symbol 'saved-face-comment comment)
20262
c6532008f2a9 (custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents: 20174
diff changeset
3339 (custom-save-all)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3340 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3341 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3342
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3343 (defun custom-face-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3344 "Restore WIDGET to the face's default attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3345 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3346 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3347 (value (get symbol 'saved-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3348 (comment (get symbol 'saved-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3349 (comment-widget (widget-get widget :comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3350 (unless (or value comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3351 (error "No saved value for this face"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3352 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3353 (put symbol 'customized-face-comment nil)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3354 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3355 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3356 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3357 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3358 (widget-value-set comment-widget (or comment ""))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3359 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3360 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3361
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3362 (defun custom-face-standard-value (widget)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3363 (get (widget-value widget) 'face-defface-spec))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3364
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3365 (defun custom-face-reset-standard (widget)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3366 "Restore WIDGET to the face's standard settings.
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3367 This operation eliminates any saved setting for the face,
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3368 restoring it to the state of a face that has never been customized."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3369 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3370 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3371 (value (get symbol 'face-defface-spec))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3372 (comment-widget (widget-get widget :comment-widget)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3373 (unless value
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
3374 (error "No standard setting for this face"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3375 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3376 (put symbol 'customized-face-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3377 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3378 (put symbol 'saved-face nil)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3379 (custom-push-theme 'theme-face symbol 'user 'reset 'standard)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3380 ;; Do not explictly save resets to standards without themes.
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3381 (if (null (cdr (get symbol 'theme-face)))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3382 (put symbol 'theme-face nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3383 (put symbol 'saved-face-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3384 (custom-save-all))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3385 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3386 (put symbol 'face-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3387 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3388 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3389 (widget-value-set comment-widget "")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3390 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3391 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3392
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3393 ;;; The `face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3394
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3395 (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
3396 "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
3397
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3398 (define-widget 'face 'symbol
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3399 "A Lisp face name (with sample)."
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3400 :format "%t: (%{sample%}) %v"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3401 :tag "Face"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3402 :value 'default
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3403 :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
3404 :notify 'widget-face-notify
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3405 :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
3406 :complete-function (lambda ()
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3407 (interactive)
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3408 (lisp-complete-symbol 'facep))
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3409 :prompt-match 'facep
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3410 :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
3411 :validate (lambda (widget)
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3412 (unless (facep (widget-value widget))
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3413 (widget-put widget
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3414 :error (format "Invalid face: %S"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3415 (widget-value widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3416 widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3417
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3418 (defun widget-face-sample-face-get (widget)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3419 (let ((value (widget-value widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3420 (if (facep value)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3421 value
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3422 'default)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3423
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3424 (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
3425 "Update the sample, and notify the parent."
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3426 (overlay-put (widget-get widget :sample-overlay)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3427 'face (widget-apply widget :sample-face-get))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3428 (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
3429
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3430
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3431 ;;; The `hook' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3432
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3433 (define-widget 'hook 'list
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3434 "A emacs lisp hook"
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3435 :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
3436 (if (and value (symbolp value))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3437 (list value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3438 value))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3439 :match (lambda (widget value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3440 (or (symbolp value)
20174
e1ca1fe89e6e (hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents: 20100
diff changeset
3441 (widget-group-match widget value)))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3442 ;; Avoid adding undefined functions to the hook, especially for
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3443 ;; things like `find-file-hook' or even more basic ones, to avoid
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3444 ;; chaos.
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3445 :set (lambda (symbol value)
28310
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3446 (dolist (elt value)
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3447 (if (fboundp elt)
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3448 (add-hook symbol elt))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3449 :convert-widget 'custom-hook-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3450 :tag "Hook")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3451
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3452 (defun custom-hook-convert-widget (widget)
27250
807fc106b24c (custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents: 26803
diff changeset
3453 ;; Handle `:options'.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3454 (let* ((options (widget-get widget :options))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3455 (other `(editable-list :inline t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3456 :entry-format "%i %d%v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3457 (function :format " %v")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3458 (args (if options
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3459 (list `(checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3460 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3461 `(function-item ,entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3462 options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3463 other)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3464 (list other))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3465 (widget-put widget :args args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3466 widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3467
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3468 ;;; The `custom-group-link' Widget.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3469
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3470 (define-widget 'custom-group-link 'link
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3471 "Show parent in other window when activated."
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3472 :help-echo "Create customization buffer for this group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3473 :action 'custom-group-link-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3474
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3475 (defun custom-group-link-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3476 (customize-group (widget-value widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3477
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3478 ;;; The `custom-group' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3479
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3480 (defcustom custom-group-tag-faces nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3481 ;; 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
3482 ;; Fixme: make it do so in Emacs.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3483 "Face used for group tags.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3484 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
3485 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
3486 :type '(repeat face)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3487 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3488
63194
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3489 (defface custom-group-tag-1
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3490 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3491 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3492 (: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
3493 (((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
3494 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3495 (: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
3496 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3497 (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3498 (: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
3499 (t (:weight bold)))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3500 "Face used for group tags."
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3501 :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
3502 ;; 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
3503 (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
3504
acd4cec2decf Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Miles Bader <miles@gnu.org>
parents: 62722
diff changeset
3505 (defface custom-group-tag
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3506 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3507 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3508 (:foreground "light blue" :weight bold :height 1.2))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3509 (((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
3510 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3511 (:foreground "blue1" :weight bold :height 1.2))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3512 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3513 (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3514 (:foreground "blue" :weight bold :height 1.2))
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3515 (t (:weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3516 "Face used for low level group tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3517 :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
3518 ;; 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
3519 (put 'custom-group-tag-face 'face-alias 'custom-group-tag)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3520
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3521 (define-widget 'custom-group 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3522 "Customize group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3523 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3524 :sample-face-get 'custom-group-sample-face-get
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3525 :documentation-property 'group-documentation
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3526 :help-echo "Set or reset all members of this group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3527 :value-create 'custom-group-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3528 :action 'custom-group-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
3529 :custom-category 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3530 :custom-set 'custom-group-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3531 :custom-save 'custom-group-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3532 :custom-reset-current 'custom-group-reset-current
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3533 :custom-reset-saved 'custom-group-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3534 :custom-reset-standard 'custom-group-reset-standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3535 :custom-menu 'custom-group-menu-create)
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-group-sample-face-get (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3538 ;; Use :sample-face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3539 (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
3540 'custom-group-tag))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3541
18430
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3542 (define-widget 'custom-group-visibility 'visibility
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3543 "An indicator and manipulator for hidden group contents."
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3544 :create 'custom-group-visibility-create)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3545
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3546 (defun custom-group-visibility-create (widget)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3547 (let ((visible (widget-value widget)))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3548 (if visible
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3549 (insert "--------")))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3550 (widget-default-create widget))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3551
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3552 (defun custom-group-members (symbol groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3553 "Return SYMBOL's custom group members.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3554 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
3555 (if (not groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3556 (get symbol 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3557 (let (members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3558 (dolist (entry (get symbol 'custom-group))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3559 (when (eq (nth 1 entry) 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3560 (push entry members)))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3561 (nreverse members))))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3562
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3563 (defun custom-group-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3564 "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
3565 (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
3566 (custom-load-widget widget))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3567 (let* ((state (widget-get widget :custom-state))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3568 (level (widget-get widget :custom-level))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3569 ;; (indent (widget-get widget :indent))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3570 (prefix (widget-get widget :custom-prefix))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3571 (buttons (widget-get widget :buttons))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3572 (tag (widget-get widget :tag))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3573 (symbol (widget-value widget))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3574 (members (custom-group-members symbol
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3575 (and (eq custom-buffer-style 'tree)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3576 custom-browse-only-groups))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3577 (cond ((and (eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3578 (eq state 'hidden)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3579 (or members (custom-unloaded-widget-p widget)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3580 (custom-browse-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3581 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3582 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3583 ;; :tag-glyph "plus"
18856
03eeb83520d8 (custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents: 18812
diff changeset
3584 :tag "+")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3585 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3586 (insert "-- ")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3587 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3588 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3589 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3590 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3591 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3592 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3593 ((and (eq custom-buffer-style 'tree)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3594 (zerop (length members)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3595 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3596 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3597 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3598 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3599 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3600 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3601 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3602 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3603 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3604 ((eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3605 (custom-browse-insert-prefix prefix)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3606 (if (zerop (length members))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3607 (progn
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3608 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3609 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3610 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3611 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3612 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3613 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3614 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3615 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3616 (widget-put widget :buttons buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3617 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3618 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3619 ;; :tag-glyph "minus"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3620 :tag "-")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3621 buttons)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3622 (insert "-\\ ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3623 ;; (widget-glyph-insert nil "-\\ " "top")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3624 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3625 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3626 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3627 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3628 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3629 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3630 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3631 custom-browse-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3632 custom-browse-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3633 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3634 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3635 (extra-prefix (if (widget-get widget :custom-last)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3636 " "
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3637 " | "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3638 (prefix (concat prefix extra-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3639 children entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3640 (while members
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3641 (setq entry (car members)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3642 members (cdr members))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3643 (push (widget-create-child-and-convert
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3644 widget (nth 1 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3645 :group widget
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3646 :tag (custom-unlispify-tag-name (nth 0 entry))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3647 :custom-prefixes custom-prefix-list
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3648 :custom-level (1+ level)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3649 :custom-last (null members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3650 :value (nth 0 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3651 :custom-prefix prefix)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3652 children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3653 (widget-put widget :children (reverse children)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3654 (message "Creating group...done")))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3655 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3656 ((eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3657 ;; Create level indicator.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3658 (unless (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3659 (insert-char ?\ (* custom-buffer-indent (1- level)))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3660 (insert "-- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3661 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3662 (let ((begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3663 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3664 (widget-specify-sample widget begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3665 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3666 ;; Create link/visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3667 (if (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3668 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3669 widget 'custom-group-link
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3670 :tag "Go to Group"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3671 symbol)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3672 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3673 (push (widget-create-child-and-convert
20100
0db4553d47cc (custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents: 19886
diff changeset
3674 widget 'custom-group-visibility
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3675 :help-echo "Show members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3676 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3677 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3678 buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3679 (insert " \n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3680 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3681 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3682 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3683 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3684 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3685 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3686 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3687 ;; Insert documentation.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3688 (if (and (eq custom-buffer-style 'links) (> level 1))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3689 (widget-put widget :documentation-indent 0))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3690 (widget-default-format-handler widget ?h))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3691 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3692 (t ;Visible.
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3693 ;; 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
3694 (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
3695 ;;; 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
3696 (when (eq level 1)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
3697 (if (custom-add-parent-links widget
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
3698 "Go to parent group:")
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3699 (insert "\n"))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3700 ;; Create level indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3701 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3702 (insert "/- ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3703 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3704 (let ((start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3705 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3706 (widget-specify-sample widget start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3707 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3708 ;; Create visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3709 (unless (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3710 (insert "--------")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3711 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3712 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3713 :help-echo "Hide members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3714 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3715 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3716 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3717 (insert " "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3718 ;; Create more dashes.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3719 ;; 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
3720 ;; added by `widget-insert'.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3721 (insert-char ?- (- 76 (current-column)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3722 (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3723 (insert "\\\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3724 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3725 (let ((magic (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3726 widget 'custom-magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3727 :indent 0
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3728 nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3729 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3730 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3731 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3732 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3733 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3734 (widget-default-format-handler widget ?h)
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3735 ;; Parent groups.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3736 (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
3737 ;;; 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
3738 (when (eq level 1)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3739 (insert-char ?\ custom-buffer-indent)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3740 (custom-add-parent-links widget)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3741 (custom-add-see-also widget
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3742 (make-string (* custom-buffer-indent level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3743 ?\ ))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3744 ;; Members.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3745 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3746 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3747 custom-buffer-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3748 custom-buffer-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3749 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3750 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3751 (length (length members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3752 (count 0)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3753 (children (mapcar (lambda (entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3754 (widget-insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3755 (message "\
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3756 Creating group members... %2d%%"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3757 (/ (* 100.0 count) length))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3758 (setq count (1+ count))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3759 (prog1
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3760 (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3761 widget (nth 1 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3762 :group widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3763 :tag (custom-unlispify-tag-name
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3764 (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3765 :custom-prefixes custom-prefix-list
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3766 :custom-level (1+ level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3767 :value (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3768 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3769 (widget-insert "\n"))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3770 members)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3771 (message "Creating group magic...")
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3772 (mapc 'custom-magic-reset children)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3773 (message "Creating group state...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3774 (widget-put widget :children children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3775 (custom-group-state-update widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3776 (message "Creating group... done"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3777 ;; End line
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3778 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3779 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3780 (insert "\\- " (widget-get widget :tag) " group end ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3781 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3782 (insert "/\n")))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3783
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3784 (defvar custom-group-menu
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3785 '(("Set for Current Session" custom-group-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3786 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3787 (eq (widget-get widget :custom-state) 'modified)))
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3788 ("Save for Future Sessions" custom-group-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3789 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3790 (memq (widget-get widget :custom-state) '(modified set))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3791 ("Reset to Current" custom-group-reset-current
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3792 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3793 (memq (widget-get widget :custom-state) '(modified))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3794 ("Reset to Saved" custom-group-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3795 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3796 (memq (widget-get widget :custom-state) '(modified set))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3797 ("Reset to standard setting" custom-group-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3798 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3799 (memq (widget-get widget :custom-state) '(modified set saved)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3800 "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
3801 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
3802 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
3803 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
3804 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
3805 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3806
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3807 (defun custom-group-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3808 "Show the menu for `custom-group' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3809 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3810 (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
3811 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3812 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3813 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3814 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3815 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3816 (custom-menu-filter custom-group-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3817 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3818 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3819 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3820 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3821
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3822 (defun custom-group-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3823 "Set changes in all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3824 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3825 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3826 (when (eq (widget-get child :custom-state) 'modified)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3827 (widget-apply child :custom-set)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3828 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3829
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3830 (defun custom-group-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3831 "Save all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3832 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3833 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3834 (when (memq (widget-get child :custom-state) '(modified set))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3835 (widget-apply child :custom-save)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3836 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3837
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3838 (defun custom-group-reset-current (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3839 "Reset all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3840 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3841 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3842 (when (eq (widget-get child :custom-state) 'modified)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3843 (widget-apply child :custom-reset-current)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3844 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3845
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3846 (defun custom-group-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3847 "Reset all modified or set group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3848 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3849 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3850 (when (memq (widget-get child :custom-state) '(modified set))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3851 (widget-apply child :custom-reset-saved)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3852 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3853
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3854 (defun custom-group-reset-standard (widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3855 "Reset all modified, set, or saved group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3856 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3857 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3858 (when (memq (widget-get child :custom-state)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3859 '(modified set saved))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3860 (widget-apply child :custom-reset-standard)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3861 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3862
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3863 (defun custom-group-state-update (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3864 "Update magic."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3865 (unless (eq (widget-get widget :custom-state) 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3866 (let* ((children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3867 (states (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3868 (widget-get child :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3869 children))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3870 (magics custom-magic-alist)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3871 (found 'standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3872 (while magics
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3873 (let ((magic (car (car magics))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3874 (if (and (not (eq magic 'hidden))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3875 (memq magic states))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3876 (setq found magic
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3877 magics nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3878 (setq magics (cdr magics)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3879 (widget-put widget :custom-state found)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3880 (custom-magic-reset widget))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3881
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3882 ;;; Reading and writing the custom file.
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3883
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
3884 ;;;###autoload
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3885 (defcustom custom-file nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3886 "File used for storing customization information.
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3887 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
3888 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
3889 it should be an absolute file name.
0b90a17a09e1 (custom-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 58779
diff changeset
3890
59335
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3891 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
3892 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
3893 something like the following in your init file:
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3894
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3895 \(setq custom-file \"~/.emacs-custom.el\")
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3896 \(load custom-file)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3897
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3898 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
3899 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
3900
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3901 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
3902 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
3903 forms `(custom-set-variables ...)' and `(custom-set-faces ...)',
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3904 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
3905 This will preserve your existing customizations.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3906
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3907 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
3908 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
3909 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
3910 `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
3911 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
3912 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
3913 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
3914 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
3915 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
3916 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
3917 :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
3918 (file :format "%t:%v%d"
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3919 :doc
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3920 "Please read entire docstring below before setting \
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3921 this through Custom.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3922 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
3923 if only the first line of the docstring is shown."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3924 :group 'customize)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3925
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3926 (defun custom-file ()
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3927 "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
3928 (file-chase-links
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3929 (or custom-file
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3930 (let ((user-init-file user-init-file)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3931 (default-init-file
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3932 (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
3933 (when (null user-init-file)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3934 (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
3935 (and (eq system-type 'windows-nt)
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3936 (file-exists-p "~/_emacs")))
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3937 ;; 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
3938 ;; Custom settings hasn't been read. Saving
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3939 ;; settings there would overwrite other settings.
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3940 (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
3941 (setq user-init-file default-init-file))
6e4e2882c013 (custom-file): Call file-chase-links.
Richard M. Stallman <rms@gnu.org>
parents: 61475
diff changeset
3942 user-init-file))))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3943
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3944 ;;;###autoload
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3945 (defun custom-save-all ()
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3946 "Save all customizations in `custom-file'."
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3947 (let* ((filename (custom-file))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3948 (recentf-exclude (if recentf-mode
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3949 (cons (concat "\\`"
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3950 (regexp-quote (custom-file))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3951 "\\'")
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3952 recentf-exclude)))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3953 (old-buffer (find-buffer-visiting filename)))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3954 (with-current-buffer (or old-buffer (find-file-noselect filename))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3955 (let ((inhibit-read-only t))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3956 (custom-save-variables)
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3957 (custom-save-faces))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3958 (let ((file-precious-flag t))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3959 (save-buffer))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3960 (unless old-buffer
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3961 (kill-buffer (current-buffer))))))
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3962
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3963 ;; 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
3964
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3965 (defun custom-save-delete (symbol)
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3966 "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
3967 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
3968 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
3969
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
3970 This function does not save the buffer."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3971 (goto-char (point-min))
25058
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3972 ;; Skip all whitespace and comments.
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3973 (while (forward-comment 1))
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3974 (or (eobp)
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3975 (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
3976 (let (first)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3977 (catch 'found
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3978 (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
3979 ;; Skip all whitespace and comments.
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3980 (while (forward-comment 1))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3981 (let ((start (point))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3982 (sexp (condition-case nil
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3983 (read (current-buffer))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3984 (end-of-file (throw 'found nil)))))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3985 (when (and (listp sexp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3986 (eq (car sexp) symbol))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3987 (delete-region start (point))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3988 (unless first
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3989 (setq first (point)))))))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3990 (if first
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3991 (goto-char first)
36628
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3992 ;; 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
3993 ;; entries would make them ineffective.
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3994 (let ((pos (point-max))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3995 (case-fold-search t))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3996 (save-excursion
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3997 (goto-char (point-max))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3998 (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
3999 'move)
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4000 (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
4001 (setq pos (line-beginning-position))))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
4002 (goto-char pos)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4003
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4004 (defun custom-save-variables ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4005 "Save all customized variables in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4006 (save-excursion
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4007 (custom-save-delete 'custom-load-themes)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4008 (custom-save-delete 'custom-reset-variables)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4009 (custom-save-delete 'custom-set-variables)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4010 (custom-save-loaded-themes)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4011 (custom-save-resets 'theme-value 'custom-reset-variables nil)
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4012 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4013 (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
4014 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4015 ;; 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
4016 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4017 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4018 (if (get symbol 'saved-value)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4019 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4020 (setq saved-list (sort (cdr saved-list) 'string<))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4021 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4022 (princ "\n"))
26653
ea8ae3c8fad5 (custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents: 26625
diff changeset
4023 (princ "(custom-set-variables
47315
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4024 ;; custom-set-variables was added by Custom.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4025 ;; 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
4026 ;; 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
4027 ;; 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
4028 (dolist (symbol saved-list)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4029 (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
4030 (value (get symbol 'saved-value))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4031 (requests (get symbol 'custom-requests))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4032 (now (not (or (custom-variable-p symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4033 (and (not (boundp symbol))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4034 (not (eq (get symbol 'force-value)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4035 'rogue))))))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
4036 (comment (get symbol 'saved-variable-comment)))
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4037 ;; Check `requests'.
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4038 (dolist (request requests)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4039 (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
4040 (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
4041 (setq requests (delq request requests))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4042 (when (or (and spec
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4043 (eq (nth 0 spec) 'user)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4044 (eq (nth 1 spec) 'set))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4045 comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4046 (and (null spec) (get symbol 'saved-value)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4047 (unless (bolp)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4048 (princ "\n"))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4049 (princ " '(")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4050 (prin1 symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4051 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4052 (prin1 (car value))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4053 (when (or now requests comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4054 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4055 (prin1 now)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4056 (when (or requests comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4057 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4058 (prin1 requests)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4059 (when comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4060 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4061 (prin1 comment))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4062 (princ ")"))))
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4063 (if (bolp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4064 (princ " "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4065 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4066 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4067 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4068
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4069 (defun custom-save-faces ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4070 "Save all customized faces in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4071 (save-excursion
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4072 (custom-save-delete 'custom-reset-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4073 (custom-save-delete 'custom-set-faces)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4074 (custom-save-resets 'theme-face 'custom-reset-faces '(default))
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4075 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4076 (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
4077 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4078 ;; 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
4079 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4080 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4081 (if (get symbol 'saved-face)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4082 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4083 (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
4084 ;; 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
4085 (if (memq 'default saved-list)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
4086 (setq saved-list (cons 'default (delq 'default saved-list))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4087 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4088 (princ "\n"))
26653
ea8ae3c8fad5 (custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents: 26625
diff changeset
4089 (princ "(custom-set-faces
47315
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4090 ;; custom-set-faces was added by Custom.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
4091 ;; 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
4092 ;; 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
4093 ;; 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
4094 (dolist (symbol saved-list)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4095 (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
4096 (value (get symbol 'saved-face))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4097 (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
4098 (and (not (custom-facep symbol))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4099 (not (get symbol 'force-face))))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4100 (comment (get symbol 'saved-face-comment)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4101 (when (or (and spec
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4102 (eq (nth 0 spec) 'user)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4103 (eq (nth 1 spec) 'set))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4104 comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4105 (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
4106 ;; 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
4107 (unless (bolp)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4108 (princ "\n"))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4109 (princ " '(")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4110 (prin1 symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4111 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4112 (prin1 value)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4113 (when (or now comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4114 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4115 (prin1 now)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4116 (when comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4117 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4118 (prin1 comment)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4119 (princ ")"))))
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4120 (if (bolp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4121 (princ " "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4122 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4123 (unless (looking-at "\n")
48958
6b4f6412de76 (custom-save-faces): Fix typo.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48949
diff changeset
4124 (princ "\n")))))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4125
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4126 (defun custom-save-resets (property setter special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4127 (let (started-writing ignored-special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4128 ;; (custom-save-delete setter) Done by caller
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4129 (let ((standard-output (current-buffer))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4130 (mapper `(lambda (object)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4131 (let ((spec (car-safe (get object (quote ,property)))))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4132 (when (and (not (memq object ignored-special))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4133 (eq (nth 0 spec) 'user)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4134 (eq (nth 1 spec) 'reset))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4135 ;; Do not write reset statements unless necessary.
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4136 (unless started-writing
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4137 (setq started-writing t)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4138 (unless (bolp)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4139 (princ "\n"))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4140 (princ "(")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4141 (princ (quote ,setter))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4142 (princ "\n '(")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4143 (prin1 object)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4144 (princ " ")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4145 (prin1 (nth 3 spec))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4146 (princ ")")))))))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4147 (mapc mapper special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4148 (setq ignored-special special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4149 (mapatoms mapper)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4150 (when started-writing
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4151 (princ ")\n")))))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
4152
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4153 (defun custom-save-loaded-themes ()
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4154 (let ((themes (reverse (get 'user 'theme-loads-themes)))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4155 (standard-output (current-buffer)))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4156 (when themes
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4157 (unless (bolp) (princ "\n"))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4158 (princ "(custom-load-themes")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4159 (mapc (lambda (theme)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4160 (princ "\n '")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4161 (prin1 theme)) themes)
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
4162 (princ " )\n"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4163
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4164 ;;;###autoload
18436
2163f03bb88f (customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents: 18435
diff changeset
4165 (defun customize-save-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4166 "Save all user options which have been set in this session."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4167 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4168 (mapatoms (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4169 (let ((face (get symbol 'customized-face))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4170 (value (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4171 (face-comment (get symbol 'customized-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4172 (variable-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4173 (get symbol 'customized-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4174 (when face
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4175 (put symbol 'saved-face face)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4176 (custom-push-theme 'theme-face symbol 'user 'set value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4177 (put symbol 'customized-face nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4178 (when value
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4179 (put symbol 'saved-value value)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4180 (custom-push-theme 'theme-value symbol 'user 'set value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4181 (put symbol 'customized-value nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4182 (when variable-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4183 (put symbol 'saved-variable-comment variable-comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4184 (put symbol 'customized-variable-comment nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4185 (when face-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4186 (put symbol 'saved-face-comment face-comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4187 (put symbol 'customized-face-comment nil)))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4188 ;; We really should update all custom buffers here.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4189 (custom-save-all))
65225
131c93f081eb (custom-buffer-sort-alphabetically): Default to t.
Richard M. Stallman <rms@gnu.org>
parents: 64931
diff changeset
4190
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4191 ;;; The Customize Menu.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4192
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4193 ;;; Menu support
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4194
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4195 (defcustom custom-menu-nesting 2
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4196 "Maximum nesting in custom menus."
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4197 :type 'integer
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
4198 :group 'custom-menu)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4199
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4200 (defun custom-face-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4201 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4202 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4203 `(customize-face ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4204 t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4205
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4206 (defun custom-variable-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4207 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4208 (let ((type (get symbol 'custom-type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4209 (unless (listp type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4210 (setq type (list type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4211 (if (and type (widget-get type :custom-menu))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4212 (widget-apply type :custom-menu symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4213 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4214 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4215 t))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4216
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4217 ;; Add checkboxes to boolean variable entries.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4218 (widget-put (get 'boolean 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4219 :custom-menu (lambda (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4220 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4221 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4222 ':style 'toggle
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4223 ':selected symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4224
30184
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4225 (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
4226 "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
4227 `( ,(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
4228 :filter (lambda (&rest junk)
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4229 (let ((menu (custom-menu-create ',symbol)))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4230 (if (consp menu) (cdr menu) menu)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4231
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4232 ;;;###autoload
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4233 (defun custom-menu-create (symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4234 "Create menu for customization group SYMBOL.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4235 The menu is in a format applicable to `easy-menu-define'."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4236 (let* ((item (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4237 `(customize-group ',symbol)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4238 t)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4239 (if (and (or (not (boundp 'custom-menu-nesting))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4240 (>= custom-menu-nesting 0))
49126
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4241 (progn
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4242 (custom-load-symbol symbol)
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4243 (< (length (get symbol 'custom-group)) widget-menu-max-size)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4244 (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
4245 custom-prefix-list))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4246 (members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4247 custom-menu-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4248 custom-menu-order-groups)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4249 `(,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4250 ,item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4251 "--"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4252 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4253 (widget-apply (if (listp (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4254 (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4255 (list (nth 1 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4256 :custom-menu (nth 0 entry)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4257 members)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4258 item)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4259
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4260 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4261 (defun customize-menu-create (symbol &optional name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4262 "Return a customize menu for customization group SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4263 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
4264 Otherwise the menu will be named `Customize'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4265 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
4266 (unless name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4267 (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
4268 `(,name
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4269 :filter (lambda (&rest junk)
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4270 (let ((menu (custom-menu-create ',symbol)))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4271 (if (consp menu) (cdr menu) menu)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4272
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4273 ;;; The Custom Mode.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4274
59760
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4275 (defvar custom-mode-map
33110
10379d59910e (custom-mode-map): Switch back to a sparse keymap.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33024
diff changeset
4276 ;; This keymap should be dense, but a dense keymap would prevent inheriting
10379d59910e (custom-mode-map): Switch back to a sparse keymap.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33024
diff changeset
4277 ;; "\r" bindings from the parent map.
59760
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4278 ;; Actually, this misfeature of dense keymaps was fixed on 2001-11-26.
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4279 (let ((map (make-keymap)))
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4280 (set-keymap-parent map widget-keymap)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4281 (suppress-keymap map)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4282 (define-key map " " 'scroll-up)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4283 (define-key map "\177" 'scroll-down)
64494
ca001bc998df (custom-mode-map): Bind `C-c C-c' to `Custom-set'.
Juri Linkov <juri@jurta.org>
parents: 64151
diff changeset
4284 (define-key map "\C-c\C-c" 'Custom-set)
59760
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4285 (define-key map "\C-x\C-s" 'Custom-save)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4286 (define-key map "q" 'Custom-buffer-done)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4287 (define-key map "u" 'Custom-goto-parent)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4288 (define-key map "n" 'widget-forward)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4289 (define-key map "p" 'widget-backward)
66171
1b475d6de39b * cus-edit.el (Custom-move-and-invoke): Deleted.
Chong Yidong <cyd@stupidchicken.com>
parents: 66170
diff changeset
4290 (define-key map [mouse-1] 'widget-move-and-invoke)
59760
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4291 map)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4292 "Keymap for `custom-mode'.")
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4293
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4294 (easy-menu-define Custom-mode-menu
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4295 custom-mode-map
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4296 "Menu used in customization buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4297 `("Custom"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4298 ,(customize-menu-create 'customize)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4299 ["Set" Custom-set t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4300 ["Save" Custom-save t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4301 ["Reset to Current" Custom-reset-current t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4302 ["Reset to Saved" Custom-reset-saved t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4303 ["Reset to Standard Settings" Custom-reset-standard t]
64494
ca001bc998df (custom-mode-map): Bind `C-c C-c' to `Custom-set'.
Juri Linkov <juri@jurta.org>
parents: 64151
diff changeset
4304 ["Info" (info "(emacs)Easy Customization") t]))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4305
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4306 (defun Custom-goto-parent ()
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4307 "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
4308 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
4309 (interactive)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4310 (save-excursion
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4311 (goto-char (point-min))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4312 (if (search-forward "\nGo to parent group: " nil t)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4313 (let* ((button (get-char-property (point) 'button))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4314 (parent (downcase (widget-get button :tag))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4315 (customize-group parent)))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4316
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4317 (defcustom custom-mode-hook nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4318 "Hook called when entering Custom mode."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4319 :type 'hook
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
4320 :group 'custom-buffer )
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4321
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4322 (defun custom-state-buffer-message (widget)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4323 (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
4324 (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
4325
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4326 (defun custom-mode ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4327 "Major mode for editing customization buffers.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4328
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4329 The following commands are available:
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4330
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4331 Move to next button or editable field. \\[widget-forward]
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4332 Move to previous button or editable field. \\[widget-backward]
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4333 \\<widget-field-keymap>\
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4334 Complete content of editable text field. \\[widget-complete]
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4335 \\<custom-mode-map>\
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4336 Invoke button under the mouse pointer. \\[Custom-move-and-invoke]
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4337 Invoke button under point. \\[widget-button-press]
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4338 Set all modifications. \\[Custom-set]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4339 Make all modifications default. \\[Custom-save]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4340 Reset all modified options. \\[Custom-reset-current]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4341 Reset all modified or set options. \\[Custom-reset-saved]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4342 Reset all options. \\[Custom-reset-standard]
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4343
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4344 Entry to this mode calls the value of `custom-mode-hook'
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4345 if that value is non-nil."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4346 (kill-all-local-variables)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4347 (setq major-mode 'custom-mode
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4348 mode-name "Custom")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4349 (use-local-map custom-mode-map)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4350 (easy-menu-add Custom-mode-menu)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4351 (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
4352 (make-local-variable 'custom-local-buffer)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4353 (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
4354 (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
4355 (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
4356 (setq widget-button-face custom-button)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4357 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4358 (if custom-raised-buttons
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4359 (set (make-local-variable 'widget-mouse-face) custom-button))
d9a2701e02cd * cus-edit.el (custom-button, custom-button-pressed): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents: 66171
diff changeset
4360
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4361 ;; 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
4362 ;; may not be optimal.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4363 (when custom-raised-buttons
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4364 (set (make-local-variable 'widget-push-button-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4365 (set (make-local-variable 'widget-push-button-suffix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4366 (set (make-local-variable 'widget-link-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4367 (set (make-local-variable 'widget-link-suffix) ""))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4368 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
62722
44ff539fa276 (custom-mode): Use run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents: 62211
diff changeset
4369 (run-mode-hooks 'custom-mode-hook))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4370
32904
2109c5fb0c3f (custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents: 32883
diff changeset
4371 (put 'custom-mode 'mode-class 'special)
2109c5fb0c3f (custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents: 32883
diff changeset
4372
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4373 (add-to-list
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4374 'debug-ignored-errors
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4375 "^No user options have changed defaults in recent Emacs versions$")
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4376
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4377 ;;; The End.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4378
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4379 (provide 'cus-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4380
59759
c8a0d09474af (customize-group-other-window, custom-buffer-create-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59434
diff changeset
4381 ;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4382 ;;; cus-edit.el ends here