annotate lisp/cus-edit.el @ 61607:22de918e7a8c

*** empty log message ***
author Nick Roberts <nickrob@snap.net.nz>
date Mon, 18 Apr 2005 00:29:13 +0000
parents 89d32002193d
children 6e4e2882c013 146c086df160
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 ;;
59759
c8a0d09474af (customize-group-other-window, custom-buffer-create-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59434
diff changeset
3 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
c8a0d09474af (customize-group-other-window, custom-buffer-create-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59434
diff changeset
4 ;; 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
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
25 ;; Boston, MA 02111-1307, USA.
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
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
144 (defvar custom-versions-load-alist)) ; from cus-load
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
145
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
146 (condition-case nil
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
147 (require 'cus-load)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
148 (error nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
149
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
150 (condition-case nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
151 (require 'cus-start)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
152 (error nil))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
153
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
154 (put 'custom-define-hook 'custom-type 'hook)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
155 (put 'custom-define-hook 'standard-value '(nil))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
156 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
157
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
158 ;;; Customization Groups.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
159
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
160 (defgroup emacs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
161 "Customization of the One True Editor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
162 :link '(custom-manual "(emacs)Top"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
163
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
164 ;; Most of these groups are stolen from `finder.el',
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
165 (defgroup editing nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
166 "Basic text editing facilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
167 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
168
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
169 (defgroup abbrev nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
170 "Abbreviation handling, typing shortcuts, macros."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
171 :tag "Abbreviations"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
172 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
173
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
174 (defgroup matching nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
175 "Various sorts of searching and matching."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
176 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
177
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
178 (defgroup emulations nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
179 "Emulations of other editors."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
180 :link '(custom-manual "(emacs)Emulation")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
181 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
182
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
183 (defgroup mouse nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
184 "Mouse support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
185 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
186
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
187 (defgroup outlines nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
188 "Support for hierarchical outlining."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
189 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
190
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
191 (defgroup external nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
192 "Interfacing to external utilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
193 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
194
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
195 (defgroup processes nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
196 "Process, subshell, compilation, and job control support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
197 :group 'external
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
198 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
199
22068
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
200 (defgroup convenience nil
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
201 "Convenience features for faster editing."
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
202 :group 'emacs)
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
203
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
204 (defgroup programming nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
205 "Support for programming in other languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
206 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
207
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
208 (defgroup languages nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
209 "Specialized modes for editing programming languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
210 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
211
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
212 (defgroup lisp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
213 "Lisp support, including Emacs Lisp."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
214 :group 'languages
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
215 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
216
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
217 (defgroup c nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
218 "Support for the C language and related languages."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
219 :link '(custom-manual "(ccmode)")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
220 :group 'languages)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
221
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
222 (defgroup tools nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
223 "Programming tools."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
224 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
225
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
226 (defgroup oop nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
227 "Support for object-oriented programming."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
228 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
229
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
230 (defgroup applications nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
231 "Applications written in Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
232 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
233
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
234 (defgroup calendar nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
235 "Calendar and time management support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
236 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
237
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
238 (defgroup mail nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
239 "Modes for electronic-mail handling."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
240 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
241
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
242 (defgroup news nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
243 "Support for netnews reading and posting."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
244 :link '(custom-manual "(gnus)")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
245 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
246
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
247 (defgroup games nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
248 "Games, jokes and amusements."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
249 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
250
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
251 (defgroup development nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
252 "Support for further development of Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
253 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
254
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
255 (defgroup docs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
256 "Support for Emacs documentation."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
257 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
258
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
259 (defgroup extensions nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
260 "Emacs Lisp language extensions."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
261 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
262
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
263 (defgroup internal nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
264 "Code for Emacs internals, build process, defaults."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
265 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
266
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
267 (defgroup maint nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
268 "Maintenance aids for the Emacs development group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
269 :tag "Maintenance"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
270 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
271
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
272 (defgroup environment nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
273 "Fitting Emacs with its environment."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
274 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
275
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
276 (defgroup comm nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
277 "Communications, networking, remote access to files."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
278 :tag "Communication"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
279 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
280
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
281 (defgroup hardware nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
282 "Support for interfacing with exotic hardware."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
283 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
284
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
285 (defgroup terminals nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
286 "Support for terminal types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
287 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
288
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
289 (defgroup unix nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
290 "Front-ends/assistants for, or emulators of, UNIX features."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
291 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
292
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
293 (defgroup vms nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
294 "Support code for vms."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
295 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
296
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
297 (defgroup i18n nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
298 "Internationalization and alternate character-set support."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
299 :link '(custom-manual "(emacs)International")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
300 :group 'environment
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
301 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
302
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
303 (defgroup x nil
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
304 "The X Window system."
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
305 :group 'environment)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
306
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
307 (defgroup frames nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
308 "Support for Emacs frames and window systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
309 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
310
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
311 (defgroup data nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
312 "Support editing files of data."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
313 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
314
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
315 (defgroup files nil
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
316 "Support editing files."
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
317 :group 'emacs)
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
318
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
319 (defgroup wp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
320 "Word processing."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
321 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
322
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
323 (defgroup tex nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
324 "Code related to the TeX formatter."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
325 :group 'wp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
326
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
327 (defgroup faces nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
328 "Support for multiple fonts."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
329 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
330
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
331 (defgroup hypermedia nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
332 "Support for links between text or other media types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
333 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
335 (defgroup help nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
336 "Support for on-line help systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
337 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
338
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
339 (defgroup multimedia nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
340 "Non-textual support, specifically images and sound."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
341 :group 'emacs)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
342
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
343 (defgroup local nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
344 "Code local to your site."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
345 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
346
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
347 (defgroup customize '((widgets custom-group))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
348 "Customization of the Customization support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
349 :prefix "custom-"
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
350 :group 'help)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
351
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
352 (defgroup custom-faces nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
353 "Faces used by customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
354 :group 'customize
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
355 :group 'faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
356
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
357 (defgroup custom-browse nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
358 "Control customize browser."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
359 :prefix "custom-"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
360 :group 'customize)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
361
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
362 (defgroup custom-buffer nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
363 "Control customize buffers."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
364 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
365 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
366
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
367 (defgroup custom-menu nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
368 "Control customize menus."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
369 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
370 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
371
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
372 (defgroup abbrev-mode nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
373 "Word abbreviations mode."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
374 :link '(custom-manual "(emacs)Abbrevs")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
375 :group 'abbrev)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
376
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
377 (defgroup alloc nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
378 "Storage allocation and gc for GNU Emacs Lisp interpreter."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
379 :tag "Storage Allocation"
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
380 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
381
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
382 (defgroup undo nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
383 "Undoing changes in buffers."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
384 :link '(custom-manual "(emacs)Undo")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
385 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
386
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
387 (defgroup modeline nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
388 "Content of the modeline."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
389 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
390
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
391 (defgroup editing-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
392 "Most basic editing facilities."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
393 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
394
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
395 (defgroup display nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
396 "How characters are displayed in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
397 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
398
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
399 (defgroup execute nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
400 "Executing external commands."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
401 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
402
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
403 (defgroup installation nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
404 "The Emacs installation."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
405 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
406
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
407 (defgroup dired nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
408 "Directory editing."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
409 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
410
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
411 (defgroup limits nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
412 "Internal Emacs limits."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
413 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
414
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
415 (defgroup debug nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
416 "Debugging Emacs itself."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
417 :group 'development)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
418
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
419 (defgroup minibuffer nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
420 "Controling the behaviour of the minibuffer."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
421 :link '(custom-manual "(emacs)Minibuffer")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
422 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
423
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
424 (defgroup keyboard nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
425 "Input from the keyboard."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
426 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
427
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
428 (defgroup mouse nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
429 "Input from the mouse."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
430 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
431
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
432 (defgroup menu nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
433 "Input from the menus."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
434 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
435
61475
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
436 (defgroup dnd nil
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
437 "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
438 :group 'environment)
89d32002193d * cus-edit.el (dnd): New group.
Jan Djärv <jan.h.d@swipnet.se>
parents: 61396
diff changeset
439
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
440 (defgroup auto-save nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
441 "Preventing accidential loss of data."
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
442 :group 'files)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
443
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
444 (defgroup processes-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
445 "Basic stuff dealing with processes."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
446 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
447
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
448 (defgroup mule nil
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
449 "MULE Emacs internationalization."
18053
941f5d1a241e (cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents: 18033
diff changeset
450 :group 'i18n)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
451
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
452 (defgroup windows nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
453 "Windows within a frame."
52281
5d588ea856f6 Add some :links.
Dave Love <fx@gnu.org>
parents: 51561
diff changeset
454 :link '(custom-manual "(emacs)Windows")
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
455 :group 'environment)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
456
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
457 ;;; Utilities.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
458
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
459 (defun custom-quote (sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
460 "Quote SEXP iff it is not self quoting."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
461 (if (or (memq sexp '(t nil))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
462 (keywordp sexp)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
463 (and (listp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
464 (memq (car sexp) '(lambda)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
465 (stringp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
466 (numberp sexp)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
467 (vectorp sexp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
468 ;;; (and (fboundp 'characterp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
469 ;;; (characterp sexp))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
470 )
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
471 sexp
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
472 (list 'quote sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
473
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
474 (defun custom-split-regexp-maybe (regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
475 "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
476 You can get the original back with from the result with:
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
477 (mapconcat 'identity result \"\\|\")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
478
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
479 IF REGEXP is not a string, return it unchanged."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
480 (if (stringp regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
481 (let ((start 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
482 all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
483 (while (string-match "\\\\|" regexp start)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
484 (setq all (cons (substring regexp start (match-beginning 0)) all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
485 start (match-end 0)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
486 (nreverse (cons (substring regexp start) all)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
487 regexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
488
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
489 (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
490 "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
491 Return a list suitable for use in `interactive'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
492 (let ((v (variable-at-point))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
493 (enable-recursive-minibuffers t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
494 val)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
495 (setq val (completing-read
49104
b74a6560ecbb (custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49013
diff changeset
496 (if (and (symbolp v) (custom-variable-p v))
18131
5711f2e5a643 (custom-variable-prompt): Change prompt.
Richard M. Stallman <rms@gnu.org>
parents: 18090
diff changeset
497 (format "Customize option: (default %s) " v)
49104
b74a6560ecbb (custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49013
diff changeset
498 "Customize option: ")
b74a6560ecbb (custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49013
diff changeset
499 obarray 'custom-variable-p t))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
500 (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
501 (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
502 (intern val)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
503
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
504 (defun custom-menu-filter (menu widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
505 "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
506 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
507 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
508 (let ((result nil)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
509 current name action filter)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
510 (while menu
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
511 (setq current (car menu)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
512 name (nth 0 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
513 action (nth 1 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
514 filter (nth 2 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
515 menu (cdr menu))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
516 (if (or (null filter) (funcall filter widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
517 (push (cons name action) result)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
518 (push name result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
519 (nreverse result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
520
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
521 ;;; Unlispify.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
522
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
523 (defvar custom-prefix-list nil
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
524 "List of prefixes that should be ignored by `custom-unlispify'.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
525
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
526 (defcustom custom-unlispify-menu-entries t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
527 "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
528 :group 'custom-menu
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
529 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
530
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
531 (defcustom custom-unlispify-remove-prefixes nil
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
532 "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
533 :group 'custom-menu
43508
c092c3c65251 2002-02-24 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43246
diff changeset
534 :group 'custom-buffer
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
535 :type 'boolean)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
536
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
537 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
538 "Convert SYMBOL into a menu entry."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
539 (cond ((not custom-unlispify-menu-entries)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
540 (symbol-name symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
541 ((get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
542 (if no-suffix
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 (concat (get symbol 'custom-tag) "...")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
545 (t
49556
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
546 (with-current-buffer (get-buffer-create " *Custom-Work*")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
547 (erase-buffer)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
548 (princ symbol (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
549 (goto-char (point-min))
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
550 ;; 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
551 ;; end with `-p'. -stef
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
552 ;; (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
553 ;; (re-search-forward "-p\\'" nil t))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
554 ;; (replace-match "" t t)
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
555 ;; (goto-char (point-min)))
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
556 (if custom-unlispify-remove-prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
557 (let ((prefixes custom-prefix-list)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
558 prefix)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
559 (while prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
560 (setq prefix (car prefixes))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
561 (if (search-forward prefix (+ (point) (length prefix)) t)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
562 (progn
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
563 (setq prefixes nil)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
564 (delete-region (point-min) (point)))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
565 (setq prefixes (cdr prefixes))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
566 (subst-char-in-region (point-min) (point-max) ?- ?\ t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
567 (capitalize-region (point-min) (point-max))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
568 (unless no-suffix
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
569 (goto-char (point-max))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
570 (insert "..."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
571 (buffer-string)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
572
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
573 (defcustom custom-unlispify-tag-names t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
574 "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
575 :group 'custom-buffer
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
576 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
577
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
578 (defun custom-unlispify-tag-name (symbol)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
579 "Convert SYMBOL into a menu entry."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
580 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
581 (custom-unlispify-menu-entry symbol t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
582
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
583 (defun custom-prefix-add (symbol prefixes)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
584 "Add SYMBOL to list of ignored PREFIXES."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
585 (cons (or (get symbol 'custom-prefix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
586 (concat (symbol-name symbol) "-"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
587 prefixes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
588
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
589 ;;; Guess.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
590
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
591 (defcustom custom-guess-name-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
592 '(("-p\\'" boolean)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
593 ("-hook\\'" hook)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
594 ("-face\\'" face)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
595 ("-file\\'" file)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
596 ("-function\\'" function)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
597 ("-functions\\'" (repeat function))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
598 ("-list\\'" (repeat sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
599 ("-alist\\'" (repeat (cons sexp sexp))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
600 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
601
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
602 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
603 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
604 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
605 used.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
606
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
607 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
608 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
609 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
610 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
611
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
612 (defcustom custom-guess-doc-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
613 '(("\\`\\*?Non-nil " boolean))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
614 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
615
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
616 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
617 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
618 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
619 matches the name of the symbol will be used.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
620
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
621 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
622 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
623 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
624 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
625
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
626 (defun custom-guess-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
627 "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
628 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
629 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
630 (let ((name (symbol-name symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
631 (names custom-guess-name-alist)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
632 current found)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
633 (while names
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
634 (setq current (car names)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
635 names (cdr names))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
636 (when (string-match (nth 0 current) name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
637 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
638 names nil)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
639 (unless found
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
640 (let ((doc (documentation-property symbol 'variable-documentation))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
641 (docs custom-guess-doc-alist))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
642 (when doc
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
643 (while docs
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
644 (setq current (car docs)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
645 docs (cdr docs))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
646 (when (string-match (nth 0 current) doc)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
647 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
648 docs nil))))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
649 found))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
650
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
651 ;;; Sorting.
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
652
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
653 (defcustom custom-browse-sort-alphabetically nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
654 "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
655 :type 'boolean
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
656 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
657
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
658 (defcustom custom-browse-order-groups nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
659 "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
660 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
661 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
662 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
663 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
664 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
665 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
666
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
667 (defcustom custom-browse-only-groups nil
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
668 "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
669 :type 'boolean
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
670 :group 'custom-browse)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
671
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
672 (defcustom custom-buffer-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
673 "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
674 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
675 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
676
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
677 (defcustom custom-buffer-order-groups 'last
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
678 "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
679 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
680 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
681 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
682 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
683 (const :tag "none" nil))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
684 :group 'custom-buffer)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
685
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
686 (defcustom custom-menu-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
687 "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
688 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
689 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
690
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
691 (defcustom custom-menu-order-groups 'first
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
692 "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
693 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
694 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
695 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
696 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
697 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
698 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
699
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
700 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
701
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
702 (defun custom-sort-items (items sort-alphabetically order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
703 "Return a sorted copy of ITEMS.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
704 ITEMS should be a `custom-group' property.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
705 If SORT-ALPHABETICALLY non-nil, sort alphabetically.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
706 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
707 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
708 (sort (copy-sequence items)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
709 (lambda (a b)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
710 (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
711 (namea (nth 0 a)) (nameb (nth 0 b)))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
712 (cond ((not order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
713 ;; 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
714 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
715 (string-lessp namea nameb)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
716 ((eq typea 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
717 ;; 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
718 (if (eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
719 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
720 (string-lessp namea nameb))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
721 (eq order-groups 'first)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
722 ((eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
723 ;; 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
724 (eq order-groups 'last))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
725 (sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
726 ;; Since A and B cannot be groups, sort.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
727 (string-lessp namea nameb)))))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
728
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
729 ;;; Custom Mode Commands.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
730
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
731 (defvar custom-options nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
732 "Customization widgets in the current buffer.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
733
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
734 (defun Custom-set ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
735 "Set changes in all modified options."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
736 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
737 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
738 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
739 (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
740 (widget-apply child :custom-set)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
741 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
742
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
743 (defun Custom-save ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
744 "Set all modified group members and save them."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
745 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
746 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
747 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
748 (when (memq (widget-get child :custom-state)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
749 '(modified set changed rogue))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
750 (widget-apply child :custom-save)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
751 children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
752 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
753
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
754 (defvar custom-reset-menu
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
755 '(("Current" . Custom-reset-current)
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
756 ("Saved" . Custom-reset-saved)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
757 ("Erase Customization (use standard settings)" . Custom-reset-standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
758 "Alist of actions for the `Reset' button.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
759 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
760 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
761 when the action is chosen.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
762
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
763 (defun custom-reset (event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
764 "Select item from reset menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
765 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
766 (answer (widget-choose "Reset to"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
767 custom-reset-menu
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
768 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
769 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
770 (funcall answer))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
771
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
772 (defun Custom-reset-current (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
773 "Reset all modified group members to their current value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
774 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
775 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
776 (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
777 (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
778 '(modified changed))
26938a3af137 (Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47503
diff changeset
779 (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
780 children)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
781
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
782 (defun Custom-reset-saved (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
783 "Reset all modified or set group members to their saved value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
784 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
785 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
786 (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
787 (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
788 '(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
789 (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
790 children)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
791
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
792 (defun Custom-reset-standard (&rest ignore)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
793 "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
794 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
795 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
796 making them as if they had never been customized at all."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
797 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
798 (let ((children custom-options))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
799 (mapc (lambda (widget)
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
800 (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
801 (if (memq (widget-get widget :custom-state)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
802 '(modified set changed saved rogue))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
803 (widget-apply widget :custom-reset-standard))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
804 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
805
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
806 ;;; The Customize Commands
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
807
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
808 (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
809 "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
810 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
811 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
812 the name of the variable.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
813
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
814 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
815 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
816
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
817 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
818 `: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
819
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
820 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
821 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
822 (let* ((var (read-variable prompt-var))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
823 (minibuffer-help-form '(describe-variable var))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
824 (val
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
825 (let ((prop (get var 'variable-interactive))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
826 (type (get var 'custom-type))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
827 (prompt (format prompt-val var)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
828 (unless (listp type)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
829 (setq type (list type)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
830 (cond (prop
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
831 ;; Use VAR's `variable-interactive' property
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
832 ;; as an interactive spec for prompting.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
833 (call-interactively (list 'lambda '(arg)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
834 (list 'interactive prop)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
835 'arg)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
836 (type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
837 (widget-prompt-value type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
838 prompt
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
839 (if (boundp var)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
840 (symbol-value var))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
841 (not (boundp var))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
842 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
843 (eval-minibuffer prompt))))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
844 (if comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
845 (list var val
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
846 (read-string "Comment: " (get var 'variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
847 (list var val))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
848
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
849 ;;;###autoload
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
850 (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
851 "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
852
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
853 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
854 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
855
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
856 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
857 `: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
858
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
859 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
860 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
861 "Set %s to value: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
862 current-prefix-arg))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
863
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
864 (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
865 (put variable 'variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
866 (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 comment)))
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
868 (set variable value))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
869
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
870 ;;;###autoload
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
871 (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
872 "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
873 VALUE is a Lisp object.
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
874
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
875 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
876 VARIABLE, otherwise `set-default' is used.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
877
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
878 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
879 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
880
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
881 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
882 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
883
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
884 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
885 `: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
886
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
887 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
888 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
889 "Set customized value for %s to: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
890 current-prefix-arg))
43246
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
891 (custom-load-symbol variable)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
892 (funcall (or (get variable 'custom-set) 'set-default) variable value)
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
893 (put variable 'customized-value (list (custom-quote value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
894 (cond ((string= comment "")
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
895 (put variable 'variable-comment nil)
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
896 (put variable 'customized-variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
897 (comment
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
898 (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
899 (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
900 value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
901
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
902 ;;;###autoload
45244
3fe5828abc37 (customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents: 45102
diff changeset
903 (defun customize-save-variable (variable value &optional comment)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
904 "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
905 Return VALUE.
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
906
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
907 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
908 VARIABLE, otherwise `set-default' is used.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
909
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
910 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
911 with a quoted VALUE as its sole list member.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
912
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
913 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
914 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
915
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
916 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
917 `: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
918
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
919 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
920 (interactive (custom-prompt-variable "Set and save variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
921 "Set and save value for %s as: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
922 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
923 (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
924 (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
925 (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
926 (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
927 (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
928 (put variable 'saved-variable-comment nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
929 (comment
45244
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 '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
931 (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
932 (custom-save-all)
c187056ac630 2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 43167
diff changeset
933 value)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
934
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
935 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
936 (defun customize ()
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
937 "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
938 User options are structured into \"groups\".
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
939 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
940 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
941 (interactive)
17703
cd6ad557fb57 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17702
diff changeset
942 (customize-group 'emacs))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
943
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
944 ;;;###autoload
47823
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
945 (defun customize-mode (mode)
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
946 "Customize options related to the current major mode.
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
947 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
948 then prompt for the MODE to customize."
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
949 (interactive
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
950 (list
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
951 (let ((completion-regexp-list '("-mode\\'"))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
952 (group (custom-group-of-mode major-mode)))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
953 (if (and group (not current-prefix-arg))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
954 major-mode
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
955 (intern
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
956 (completing-read (if group
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
957 (format "Major mode (default %s): " major-mode)
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
958 "Major mode: ")
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
959 obarray
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
960 'custom-group-of-mode
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
961 t nil nil (if group (symbol-name major-mode))))))))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
962 (customize-group (custom-group-of-mode mode)))
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
963
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
964
4649d9cb92dd (customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 47809
diff changeset
965 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
966 (defun customize-group (group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
967 "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
968 (interactive (list (let ((completion-ignore-case t))
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
969 (completing-read "Customize group: (default emacs) "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
970 obarray
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
971 (lambda (symbol)
19886
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
972 (or (get symbol 'custom-loads)
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
973 (get symbol 'custom-group)))
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
974 t))))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
975 (when (stringp group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
976 (if (string-equal "" group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
977 (setq group 'emacs)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
978 (setq group (intern group))))
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
979 (let ((name (format "*Customize Group: %s*"
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
980 (custom-unlispify-tag-name group))))
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
981 (if (get-buffer name)
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
982 (pop-to-buffer name)
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
983 (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
984 name
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
985 (concat " for group "
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
986 (custom-unlispify-tag-name group))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
987
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
988 ;;;###autoload
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
989 (defun customize-group-other-window (group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
990 "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
991 (interactive (list (let ((completion-ignore-case t))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
992 (completing-read "Customize group: (default emacs) "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
993 obarray
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
994 (lambda (symbol)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
995 (or (get symbol 'custom-loads)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
996 (get symbol 'custom-group)))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
997 t))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
998 (when (stringp group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
999 (if (string-equal "" group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1000 (setq group 'emacs)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1001 (setq group (intern group))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1002 (let ((name (format "*Customize Group: %s*"
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1003 (custom-unlispify-tag-name group))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1004 (if (get-buffer name)
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1005 (let (
48975
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1006 ;; 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
1007 (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
1008 (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
1009 (same-window-regexps nil))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1010 (pop-to-buffer name))
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1011 (custom-buffer-create-other-window
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1012 (list (list group 'custom-group))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1013 name
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1014 (concat " for group "
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
1015 (custom-unlispify-tag-name group))))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1016
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1017 ;;;###autoload
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1018 (defalias 'customize-variable 'customize-option)
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1019
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1020 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1021 (defun customize-option (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1022 "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
1023 (interactive (custom-variable-prompt))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1024 (custom-buffer-create (list (list symbol 'custom-variable))
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1025 (format "*Customize Option: %s*"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1026 (custom-unlispify-tag-name symbol))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1027
48975
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1028 ;;;###autoload
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1029 (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
1030
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1031 ;;;###autoload
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1032 (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
1033 "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
1034 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
1035 (interactive (custom-variable-prompt))
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1036 (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
1037 (list (list symbol 'custom-variable))
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1038 (format "*Customize Option: %s*" (custom-unlispify-tag-name symbol))))
227f251b919a (customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48958
diff changeset
1039
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1040 (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
1041 "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
1042
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1043 ;;;###autoload
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1044 (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
1045 "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
1046 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
1047 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
1048 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
1049
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1050 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
1051 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
1052 version."
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1053
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1054 (interactive "sCustomize options changed, since version (default all versions): ")
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1055 (if (equal since-version "")
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1056 (setq since-version nil)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1057 (unless (condition-case nil
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1058 (numberp (read since-version))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1059 (error nil))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1060 (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
1061 (unless since-version
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1062 (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
1063
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1064 ;; 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
1065 ;; custom-load-symbol for this.
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1066 (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
1067 (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
1068 (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
1069 (dolist (load (cdr elt))
b99be2b86231 (customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49218
diff changeset
1070 (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
1071 (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
1072 (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
1073
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1074 (let (found)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1075 (mapatoms
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1076 (lambda (symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1077 (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
1078 (if version
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1079 (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
1080 (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
1081 (get symbol 'group-documentation))
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1082 (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
1083 (if (custom-variable-p symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1084 (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
1085 (if (custom-facep symbol)
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1086 (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
1087 (if found
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1088 (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
1089 "*Customize Changed Options*")
ddeb57b6c977 (customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49126
diff changeset
1090 (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
1091 since-version))))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1092
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1093 (defun customize-version-lessp (version1 version2)
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1094 ;; 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
1095 ;; 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
1096
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1097 ;; 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
1098 ;; in the :version value.
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1099 (if (numberp version2)
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
1100 (setq version2 (prin1-to-string version2)))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1101 (let (major1 major2 minor1 minor2)
29762
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1102 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1103 (setq major1 (read (or (match-string 1 version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1104 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1105 (setq minor1 (read (or (match-string 3 version1)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1106 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1107 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1108 (setq major2 (read (or (match-string 1 version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1109 "0")))
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1110 (setq minor2 (read (or (match-string 3 version2)
8c4512ba3671 (customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents: 28941
diff changeset
1111 "0")))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1112 (or (< major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1113 (and (= major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1114 (< minor1 minor2)))))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
1115
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1116 ;;;###autoload
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1117 (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
1118 "Customize FACE, which should be a face name or nil.
e004c3c8a4b6 (customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents: 55272
diff changeset
1119 If FACE is nil, customize all faces.
44841
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1120
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1121 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
1122 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
1123 (interactive
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1124 (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
1125 (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
1126 (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
1127 (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
1128 (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
1129 (if (listp face)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1130 (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
1131 (mapcar (lambda (s)
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1132 (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
1133 face)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1134 t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1135 "*Customize Faces*")
44887
01a5b217fd7f (customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents: 44846
diff changeset
1136 (unless (facep face)
49013
4a3d5b9c79b9 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48997
diff changeset
1137 (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
1138 (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
1139 (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
1140 (custom-unlispify-tag-name face)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1141
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1142 ;;;###autoload
44891
5d2dc0b4fd2f Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 44888
diff changeset
1143 (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
1144 "Show customization buffer for face FACE in other window.
44841
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1145
ca88dc883a8d (customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents: 44682
diff changeset
1146 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
1147 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
1148 (interactive
44888
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1149 (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
1150 (if (member face '(nil ""))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1151 (setq face (face-list)))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1152 (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
1153 (setq face (car face)))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1154 (if (listp face)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1155 (custom-buffer-create-other-window
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1156 (custom-sort-items
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1157 (mapcar (lambda (s)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1158 (list s 'custom-face))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1159 face)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1160 t nil)
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1161 "*Customize Faces*")
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1162 (unless (facep face)
49013
4a3d5b9c79b9 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48997
diff changeset
1163 (error "Invalid face %S" face))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1164 (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
1165 (list (list face 'custom-face))
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1166 (format "*Customize Face: %s*"
b74399186334 (customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents: 44887
diff changeset
1167 (custom-unlispify-tag-name face)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1168
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1169 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1170 (defun customize-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1171 "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
1172 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1173 (let ((found nil))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1174 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1175 (and (or (get symbol 'customized-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1176 (get symbol 'customized-face-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1177 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1178 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1179 (and (or (get symbol 'customized-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1180 (get symbol 'customized-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1181 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1182 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1183 (if (not found)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1184 (error "No customized user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1185 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1186 "*Customize Customized*"))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1187
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1188 ;;;###autoload
50077
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1189 (defun customize-rogue ()
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1190 "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
1191 (interactive)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1192 (let ((found nil))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1193 (mapatoms (lambda (symbol)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1194 (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
1195 (get symbol 'saved-value)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1196 (get symbol 'standard-value))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1197 (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
1198 (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
1199 (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
1200 ;; 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
1201 (default-value symbol))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1202 (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
1203 (if (not found)
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1204 (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
1205 (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
1206 "*Customize Rogue*"))))
21135e13f9cd 2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 49556
diff changeset
1207 ;;;###autoload
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1208 (defun customize-saved ()
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1209 "Customize all already saved user options."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1210 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1211 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1212 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1213 (and (or (get symbol 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1214 (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1215 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1216 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1217 (and (or (get symbol 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1218 (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1219 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1220 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1221 (if (not found )
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1222 (error "No saved user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1223 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1224 "*Customize Saved*"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1225
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1226 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1227 (defun customize-apropos (regexp &optional all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1228 "Customize all user options matching REGEXP.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1229 If ALL is `options', include only options.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1230 If ALL is `faces', include only faces.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1231 If ALL is `groups', include only groups.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1232 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
1233 user-settable, as well as faces and groups."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1234 (interactive "sCustomize regexp: \nP")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1235 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1236 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1237 (when (string-match regexp (symbol-name symbol))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1238 (when (and (not (memq all '(faces options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1239 (get symbol 'custom-group))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1240 (push (list symbol 'custom-group) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1241 (when (and (not (memq all '(options groups)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1242 (custom-facep symbol))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1243 (push (list symbol 'custom-face) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1244 (when (and (not (memq all '(groups faces)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1245 (boundp symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1246 (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
1247 (custom-variable-p symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1248 (if (memq all '(nil options))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1249 (user-variable-p symbol)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1250 (get symbol 'variable-documentation))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1251 (push (list symbol 'custom-variable) found)))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1252 (if (not found)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1253 (error "No matches")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1254 (custom-buffer-create (custom-sort-items found t
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1255 custom-buffer-order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1256 "*Customize Apropos*"))))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1257
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1258 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1259 (defun customize-apropos-options (regexp &optional arg)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1260 "Customize all user options matching REGEXP.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1261 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
1262 (interactive "sCustomize regexp: \nP")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1263 (customize-apropos regexp (or arg 'options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1264
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1265 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1266 (defun customize-apropos-faces (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1267 "Customize all user faces matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1268 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1269 (customize-apropos regexp 'faces))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1270
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1271 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1272 (defun customize-apropos-groups (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1273 "Customize all user groups matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1274 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1275 (customize-apropos regexp 'groups))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1276
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1277 ;;; Buffer.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1278
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1279 (defcustom custom-buffer-style 'links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1280 "Control the presentation style for customization buffers.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1281 The value should be a symbol, one of:
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1282
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1283 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
1284 links: groups have links to subgroups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1285 :type '(radio (const brackets)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1286 (const links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1287 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1288
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1289 (defcustom custom-buffer-done-kill nil
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1290 "*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
1291 :type 'boolean
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59795
diff changeset
1292 :version "22.1"
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1293 :group 'custom-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1294
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1295 (defcustom custom-buffer-indent 3
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1296 "Number of spaces to indent nested groups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1297 :type 'integer
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1298 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1299
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1300 (defun custom-get-fresh-buffer (name)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1301 "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
1302 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
1303 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
1304 not for everybody."
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1305 ;; 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
1306 ;; 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
1307 (let ((buf (get-buffer name)))
51429
b107764e9a67 (custom-get-fresh-buffer): Test for nonexistence buffer.
Lute Kamstra <lute@gnu.org>
parents: 51381
diff changeset
1308 (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
1309 ;; 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
1310 (kill-buffer buf)
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1311 (setq buf nil))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1312 (if (null buf)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1313 (get-buffer-create name)
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1314 (with-current-buffer buf
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1315 (kill-all-local-variables)
51381
a2b5bb57e1c9 (custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51362
diff changeset
1316 (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
1317 ;; 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
1318 ;; 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
1319 (let ((ols (overlay-lists)))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1320 (dolist (ol (nconc (car ols) (cdr ols)))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1321 (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
1322 (erase-buffer)
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1323 buf))))
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1324
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1325 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1326 (defun custom-buffer-create (options &optional name description)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1327 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1328 Optional NAME is the name of the buffer.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1329 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1330 SYMBOL is a customization option, and WIDGET is a widget for editing
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1331 that option."
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1332 (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
1333 (custom-buffer-create-internal options description))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1334
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1335 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1336 (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
1337 "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
1338 The result includes selecting that window.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1339 Optional NAME is the name of the buffer.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1340 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
1341 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
1342 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1343 (unless name (setq name "*Customization*"))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1344 (let ((pop-up-windows t)
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1345 (same-window-buffer-names nil)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1346 (same-window-regexps nil))
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 name))
57896
27e0c6aa31c5 (customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents: 56161
diff changeset
1348 (custom-buffer-create-internal options description)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1349
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1350 (defcustom custom-reset-button-menu nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1351 "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
1352 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
1353 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1354 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1355
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1356 (defcustom custom-buffer-verbose-help t
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1357 "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
1358 :type 'boolean
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1359 :group 'custom-buffer)
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1360
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1361 (defun Custom-buffer-done (&rest ignore)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1362 "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
1363 (interactive)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1364 (quit-window custom-buffer-done-kill))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1365
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1366 (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
1367 '(("unspecified" . unspecified))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1368 "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
1369 Otherwise use brackets."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1370 :type 'boolean
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1371 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1372 :group 'custom-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1373
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1374 (defun custom-buffer-create-internal (options &optional description)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1375 (custom-mode)
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1376 (if custom-buffer-verbose-help
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1377 (progn
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1378 (widget-insert "This is a customization buffer")
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1379 (if description
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1380 (widget-insert description))
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1381 (widget-insert (format ".
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1382 %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
1383 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
1384 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
1385 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
1386 Invoke "
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1387 (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
1388 "`Raised' buttons"
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1389 "Square brackets")))
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1390 (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
1391 :tag "Custom file"
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1392 "(emacs)Saving Customizations")
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1393 (widget-insert
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1394 " 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
1395 Invoke ")
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1396 (widget-create 'info-link
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1397 :tag "Help"
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1398 :help-echo "Read the online help."
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1399 "(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
1400 (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
1401 (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
1402 (widget-insert " "))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1403 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1404 :tag "Set for Current Session"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1405 :help-echo "\
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1406 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
1407 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1408 (Custom-set)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1409 (widget-insert " ")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1410 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1411 :tag "Save for Future Sessions"
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1412 :help-echo "\
60004
2832745c4aee (custom-buffer-create-internal): Improve help-echo.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
1413 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
1414 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
1415 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1416 (Custom-save)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1417 (if custom-reset-button-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1418 (progn
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1419 (widget-insert " ")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1420 (widget-create 'push-button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1421 :tag "Reset"
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1422 :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
1423 :mouse-down-action (lambda (&rest junk) t)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1424 :action (lambda (widget &optional event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1425 (custom-reset event))))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1426 (widget-insert "\n ")
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1427 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1428 :tag "Reset"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1429 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1430 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
1431 :action 'Custom-reset-current)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1432 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1433 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1434 :tag "Reset to Saved"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1435 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1436 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
1437 :action 'Custom-reset-saved)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1438 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1439 (widget-create 'push-button
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
1440 :tag "Erase Customization"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1441 :help-echo "\
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
1442 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
1443 :action 'Custom-reset-standard))
45102
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1444 (if (not custom-buffer-verbose-help)
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1445 (progn
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1446 (widget-insert " ")
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1447 (widget-create 'info-link
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1448 :tag "Help"
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1449 :help-echo "Read the online help."
387844a1f703 (custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents: 44912
diff changeset
1450 "(emacs)Easy Customization")))
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1451 (widget-insert " ")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1452 (widget-create 'push-button
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1453 :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
1454 :help-echo
80383e9be1e2 (custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents: 30184
diff changeset
1455 (lambda (&rest ignore)
59795
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1456 (if custom-buffer-done-kill
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1457 "Kill this buffer"
ba8c5b54e390 (custom-bury-buffer): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 59760
diff changeset
1458 "Bury this buffer"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1459 :action #'Custom-buffer-done)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1460 (widget-insert "\n\n")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1461 (message "Creating customization items...")
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1462 (buffer-disable-undo)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1463 (setq custom-options
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1464 (if (= (length options) 1)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1465 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1466 (widget-create (nth 1 entry)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1467 :documentation-shown t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1468 :custom-state 'unknown
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1469 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1470 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1471 :value (nth 0 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1472 options)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1473 (let ((count 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1474 (length (length options)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1475 (mapcar (lambda (entry)
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1476 (prog2
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1477 (message "Creating customization items ...%2d%%"
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1478 (/ (* 100.0 count) length))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1479 (widget-create (nth 1 entry)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1480 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1481 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1482 :value (nth 0 entry))
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1483 (setq count (1+ count))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1484 (unless (eq (preceding-char) ?\n)
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1485 (widget-insert "\n"))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1486 (widget-insert "\n")))
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
1487 options))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1488 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1489 (widget-insert "\n"))
39153
001cb5cd0de9 (custom-buffer-create-internal): Remove "100%" from
Eli Zaretskii <eliz@gnu.org>
parents: 38436
diff changeset
1490 (message "Creating customization items ...done")
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1491 (message "Resetting customization items...")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1492 (unless (eq custom-buffer-style 'tree)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1493 (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
1494 (message "Resetting customization items...done")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1495 (message "Creating customization setup...")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1496 (widget-setup)
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
1497 (buffer-enable-undo)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1498 (goto-char (point-min))
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1499 (message "Creating customization setup...done"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1500
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1501 ;;; The Tree Browser.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1502
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1503 ;;;###autoload
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1504 (defun customize-browse (&optional group)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1505 "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
1506 (interactive)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1507 (unless group
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1508 (setq group 'emacs))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1509 (let ((name "*Customize Browser*"))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
1510 (pop-to-buffer (custom-get-fresh-buffer name)))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1511 (custom-mode)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1512 (widget-insert "\
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
1513 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
1514 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
1515 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
1516 (if custom-browse-only-groups
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1517 (widget-insert "\
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1518 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
1519 (widget-insert "Invoke the ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1520 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1521 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1522 :tag "[Group]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1523 :tag-glyph "folder")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1524 (widget-insert ", ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1525 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1526 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1527 :tag "[Face]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1528 :tag-glyph "face")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1529 (widget-insert ", and ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1530 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1531 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1532 :tag "[Option]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1533 :tag-glyph "option")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1534 (widget-insert " buttons below to edit that
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1535 item in another window.\n\n"))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1536 (let ((custom-buffer-style 'tree))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1537 (widget-create 'custom-group
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1538 :custom-last t
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1539 :custom-state 'unknown
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1540 :tag (custom-unlispify-tag-name group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1541 :value group))
48997
eb9dca992edf (customize-browse): Call `widget-setup'.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48975
diff changeset
1542 (widget-setup)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1543 (goto-char (point-min)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1544
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1545 (define-widget 'custom-browse-visibility 'item
20600
323f33e3e92c (custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 20562
diff changeset
1546 "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
1547 :format "%[[%t]%]"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1548 :action 'custom-browse-visibility-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1549
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1550 (defun custom-browse-visibility-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1551 (let ((custom-buffer-style 'tree))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1552 (custom-toggle-parent widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1553
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1554 (define-widget 'custom-browse-group-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1555 "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
1556 :tag "Group"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1557 :tag-glyph "folder"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1558 :action 'custom-browse-group-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1559
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1560 (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
1561 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1562 (customize-group-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1563
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1564 (define-widget 'custom-browse-variable-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1565 "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
1566 :tag "Option"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1567 :tag-glyph "option"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1568 :action 'custom-browse-variable-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1569
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1570 (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
1571 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1572 (customize-variable-other-window (widget-value parent))))
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-face-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1575 "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
1576 :tag "Face"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1577 :tag-glyph "face"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1578 :action 'custom-browse-face-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1579
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1580 (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
1581 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1582 (customize-face-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1583
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1584 (defconst custom-browse-alist '((" " "space")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1585 (" | " "vertical")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1586 ("-\\ " "top")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1587 (" |-" "middle")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1588 (" `-" "bottom")))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1589
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1590 (defun custom-browse-insert-prefix (prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1591 "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
1592 ;; Fixme: do graphics.
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1593 (if nil ; (string-match "XEmacs" emacs-version)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1594 (progn
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1595 (insert "*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1596 (while (not (string-equal prefix ""))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1597 (let ((entry (substring prefix 0 3)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1598 (setq prefix (substring prefix 3))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1599 (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
1600 (name (nth 1 (assoc entry custom-browse-alist))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1601 (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
1602 (overlay-put overlay 'start-open t)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1603 (overlay-put overlay 'end-open t)))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1604 (insert prefix)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1605
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1606 ;;; Modification of Basic Widgets.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1607 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1608 ;; We add extra properties to the basic widgets needed here. This is
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1609 ;; 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
1610 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1611 ;; We want simple widgets to be displayed by default, but complex
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1612 ;; widgets to be hidden.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1613
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1614 (widget-put (get 'item 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1615 (widget-put (get 'editable-field 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1616 :custom-show (lambda (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1617 (let ((pp (pp-to-string value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1618 (cond ((string-match "\n" pp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1619 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1620 ((> (length pp) 40)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1621 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1622 (t t)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1623 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1624
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1625 ;;; The `custom-manual' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1626
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1627 (define-widget 'custom-manual 'info-link
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1628 "Link to the manual entry for this customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1629 :help-echo "Read the manual entry for this option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1630 :tag "Manual")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1631
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1632 ;;; The `custom-magic' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1633
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1634 (defgroup custom-magic-faces nil
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1635 "Faces used by the magic button."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1636 :group 'custom-faces
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1637 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1638
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1639 (defface custom-invalid-face '((((class color))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1640 (:foreground "yellow1" :background "red1"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1641 (t
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
1642 (:weight bold :slant italic :underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1643 "Face used when the customize item is invalid."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1644 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1645
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1646 (defface custom-rogue-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1647 (:foreground "pink" :background "black"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1648 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1649 (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1650 "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
1651 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1652
61396
a2c0a72230cf * cus-edit.el (custom-modified-face):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61394
diff changeset
1653 (defface custom-modified-face '((((min-colors 88) (class color))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1654 (:foreground "white" :background "blue1"))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1655 (((class color))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1656 (:foreground "white" :background "blue"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1657 (t
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
1658 (:slant italic :bold)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1659 "Face used when the customize item has been modified."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1660 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1661
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1662 (defface custom-set-face '((((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
1663 (:foreground "blue1" :background "white"))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1664 (((class color))
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1665 (:foreground "blue" :background "white"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1666 (t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1667 (:slant italic)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1668 "Face used when the customize item has been set."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1669 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1670
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1671 (defface custom-changed-face '((((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
1672 (:foreground "white" :background "blue1"))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
1673 (((class color))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1674 (:foreground "white" :background "blue"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1675 (t
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
1676 (:slant italic)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1677 "Face used when the customize item has been changed."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1678 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1679
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1680 (defface custom-saved-face '((t (: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 has been saved."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1682 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1683
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1684 (defconst custom-magic-alist
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1685 '((nil "#" underline "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1686 UNINITIALIZED, you should not see this.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1687 (unknown "?" italic "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1688 UNKNOWN, you should not see this.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1689 (hidden "-" default "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1690 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
1691 group now hidden, invoke \"Show\", above, to show contents.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1692 (invalid "x" custom-invalid-face "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1693 INVALID, the displayed value cannot be set.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1694 (modified "*" custom-modified-face "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1695 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
1696 something in this group has been edited but not set.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1697 (set "+" custom-set-face "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1698 SET for current session only." "\
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
1699 something in this group has been set but not saved.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1700 (changed ":" custom-changed-face "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1701 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
1702 something in this group has been changed outside customize.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1703 (saved "!" custom-saved-face "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1704 SAVED and set." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1705 something in this group has been set and saved.")
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
1706 (rogue "@" custom-rogue-face "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1707 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
1708 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
1709 (standard " " nil "\
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1710 STANDARD." "\
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1711 visible group members are all at standard settings."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1712 "Alist of customize option states.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1713 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
1714
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1715 STATE is one of the following symbols:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1716
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1717 `nil'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1718 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1719 `unknown'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1720 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1721 `hidden'
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1722 This item is not being displayed.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1723 `invalid'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1724 This item is modified, but has an invalid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1725 `modified'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1726 This item is modified, and has a valid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1727 `set'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1728 This item has been set but not saved.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1729 `changed'
60295
53b5914886cc (custom-buffer-create-internal): Slightly reword text at top of Custom
Luc Teirlinck <teirllm@auburn.edu>
parents: 60280
diff changeset
1730 The current value of this item has been changed outside Customize.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1731 `saved'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1732 This item is marked for saving.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1733 `rogue'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1734 This item has no customization information.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1735 `standard'
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1736 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
1737
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1738 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
1739
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1740 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
1741
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1742 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
1743
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1744 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
1745 left out, ITEM-DESC will be used.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1746
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1747 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
1748 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
1749
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1750 The list should be sorted most significant first.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1751
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1752 (defcustom custom-magic-show 'long
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1753 "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
1754 If `long', show a full-line description, not just one word."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1755 :type '(choice (const :tag "no" nil)
22600
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1756 (const long)
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1757 (other :tag "short" short))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1758 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1759
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1760 (defcustom custom-magic-show-hidden '(option face)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1761 "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
1762 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
1763 button should be visible. Possible categories are `group', `option',
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1764 and `face'."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1765 :type '(set (const group) (const option) (const face))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1766 :group 'custom-buffer)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1767
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1768 (defcustom custom-magic-show-button nil
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1769 "Show a \"magic\" button indicating the state of each customization option."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1770 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1771 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1772
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1773 (define-widget 'custom-magic 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1774 "Show and manipulate state for a customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1775 :format "%v"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1776 :action 'widget-parent-action
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1777 :notify 'ignore
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1778 :value-get 'ignore
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1779 :value-create 'custom-magic-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1780 :value-delete 'widget-children-value-delete)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1781
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1782 (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
1783 ;; Non-nil unless hidden.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1784 (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
1785 :custom-state)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1786 'hidden)))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1787
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1788 (defun custom-magic-value-create (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1789 "Create compact status report for WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1790 (let* ((parent (widget-get widget :parent))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1791 (state (widget-get parent :custom-state))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1792 (hidden (eq state 'hidden))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1793 (entry (assq state custom-magic-alist))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1794 (magic (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1795 (face (nth 2 entry))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1796 (category (widget-get parent :custom-category))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1797 (text (or (and (eq category 'group)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1798 (nth 4 entry))
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1799 (nth 3 entry)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1800 (form (widget-get parent :custom-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1801 children)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1802 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1803 (setq text (concat (match-string 1 text)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1804 (symbol-name category)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1805 (match-string 2 text))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1806 (when (and custom-magic-show
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1807 (or (not hidden)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1808 (memq category custom-magic-show-hidden)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1809 (insert " ")
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1810 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1811 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1812 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1813 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1814 (widget-get parent :custom-level))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1815 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1816 widget 'choice-item
18087
05c70aa62552 Synched with 1.9903
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18086
diff changeset
1817 :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
1818 :format (if hidden "%t" "%[%t%]")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1819 :button-prefix 'widget-push-button-prefix
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1820 :button-suffix 'widget-push-button-suffix
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1821 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1822 :tag "State")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1823 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1824 (insert ": ")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1825 (let ((start (point)))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1826 (if (eq custom-magic-show 'long)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1827 (insert text)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1828 (insert (symbol-name state)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1829 (cond ((eq form 'lisp)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1830 (insert " (lisp)"))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1831 ((eq form 'mismatch)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1832 (insert " (mismatch)")))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1833 (put-text-property start (point) 'face 'custom-state-face))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1834 (insert "\n"))
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1835 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1836 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1837 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1838 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1839 (widget-get parent :custom-level))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1840 (when custom-magic-show-button
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1841 (when custom-magic-show
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1842 (let ((indent (widget-get parent :indent)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1843 (when indent
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1844 (insert-char ? indent))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1845 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1846 widget 'choice-item
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1847 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1848 :button-face face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1849 :button-prefix ""
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1850 :button-suffix ""
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1851 :help-echo "Change the state."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1852 :format (if hidden "%t" "%[%t%]")
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1853 :tag (if (memq form '(lisp mismatch))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1854 (concat "(" magic ")")
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1855 (concat "[" magic "]")))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1856 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1857 (insert " "))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1858 (widget-put widget :children children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1859
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1860 (defun custom-magic-reset (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1861 "Redraw the :custom-magic property of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1862 (let ((magic (widget-get widget :custom-magic)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1863 (widget-value-set magic (widget-value magic))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1864
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1865 ;;; The `custom' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1866
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1867 (defface custom-button-face
32883
105ad8d20e29 (custom-button-face, custom-button-pressed-face): Merge x w32 and mac
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1868 '((((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
1869 (: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
1870 :background "lightgrey" :foreground "black"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1871 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1872 nil))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1873 "Face used for buttons in customization buffers."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1874 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1875 :group 'custom-faces)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1876
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1877 (defface custom-button-pressed-face
32883
105ad8d20e29 (custom-button-face, custom-button-pressed-face): Merge x w32 and mac
Jason Rumney <jasonr@gnu.org>
parents: 32752
diff changeset
1878 '((((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
1879 (: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
1880 :background "lightgrey" :foreground "black"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1881 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1882 (:inverse-video t)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1883 "Face used for buttons in customization buffers."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1884 :version "21.1"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1885 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1886
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1887 (defface custom-documentation-face nil
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1888 "Face used for documentation strings in customization buffers."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1889 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1890
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1891 (defface custom-state-face '((((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1892 (background dark))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1893 (:foreground "lime green"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1894 (((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1895 (background light))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1896 (:foreground "dark green"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1897 (t nil))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1898 "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
1899 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1900
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1901 (define-widget 'custom 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1902 "Customize a user option."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1903 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1904 :convert-widget 'custom-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1905 :notify 'custom-notify
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1906 :custom-prefix ""
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1907 :custom-level 1
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1908 :custom-state 'hidden
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1909 :documentation-property 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1910 :value-create 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1911 :value-delete 'widget-children-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1912 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1913 :validate 'widget-children-validate
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1914 :match (lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1915
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1916 (defun custom-convert-widget (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
1917 "Initialize :value and :tag from :args in WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1918 (let ((args (widget-get widget :args)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1919 (when args
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1920 (widget-put widget :value (widget-apply widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1921 :value-to-internal (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1922 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1923 (widget-put widget :args nil)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1924 widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1925
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1926 (defun custom-notify (widget &rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1927 "Keep track of changes."
18090
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1928 (let ((state (widget-get widget :custom-state)))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1929 (unless (eq state 'modified)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1930 (unless (memq state '(nil unknown hidden))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1931 (widget-put widget :custom-state 'modified))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1932 (custom-magic-reset widget)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1933 (apply 'widget-default-notify widget args))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1934
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1935 (defun custom-redraw (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1936 "Redraw WIDGET with current settings."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1937 (let ((line (count-lines (point-min) (point)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1938 (column (current-column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1939 (pos (point))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1940 (from (marker-position (widget-get widget :from)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1941 (to (marker-position (widget-get widget :to))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1942 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1943 (widget-value-set widget (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1944 (custom-redraw-magic widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1945 (when (and (>= pos from) (<= pos to))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1946 (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1947 (progn
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1948 (if (> column 0)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1949 (goto-line line)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1950 (goto-line (1+ line)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1951 (move-to-column column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1952 (error nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1953
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1954 (defun custom-redraw-magic (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1955 "Redraw WIDGET state with current settings."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1956 (while widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1957 (let ((magic (widget-get widget :custom-magic)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1958 (cond (magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1959 (widget-value-set magic (widget-value magic))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1960 (when (setq widget (widget-get widget :group))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1961 (custom-group-state-update widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1962 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1963 (setq widget nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1964 (widget-setup))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1965
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1966 (defun custom-show (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1967 "Non-nil if WIDGET should be shown with VALUE by default."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1968 (let ((show (widget-get widget :custom-show)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1969 (cond ((null show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1970 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1971 ((eq t show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1972 t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1973 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1974 (funcall show widget value)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1975
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1976 (defun custom-load-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1977 "Load all dependencies for WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1978 (custom-load-symbol (widget-value widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1979
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1980 (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
1981 "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
1982 (let ((found nil)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1983 (loads (get symbol 'custom-loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1984 load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1985 (while loads
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1986 (setq load (car loads)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1987 loads (cdr loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1988 (cond ((symbolp load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1989 (unless (featurep load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1990 (setq found t)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1991 ((assoc load load-history))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1992 ((assoc (locate-library load) load-history)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1993 (message nil))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1994 (t
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1995 (setq found t))))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1996 found))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1997
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1998 (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
1999 "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
2000 (custom-unloaded-symbol-p (widget-value widget)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2001
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2002 (defun custom-toggle-hide (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2003 "Toggle visibility of WIDGET."
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2004 (custom-load-widget widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2005 (let ((state (widget-get widget :custom-state)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2006 (cond ((memq state '(invalid modified))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2007 (error "There are unset changes"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2008 ((eq state 'hidden)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2009 (widget-put widget :custom-state 'unknown))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2010 (t
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2011 (widget-put widget :documentation-shown nil)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2012 (widget-put widget :custom-state 'hidden)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2013 (custom-redraw widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2014 (widget-setup)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2015
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2016 (defun custom-toggle-parent (widget &rest ignore)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2017 "Toggle visibility of parent of WIDGET."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2018 (custom-toggle-hide (widget-get widget :parent)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2019
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2020 (defun custom-add-see-also (widget &optional prefix)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2021 "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
2022 Insert PREFIX first if non-nil."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2023 (let* ((symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2024 (links (get symbol 'custom-links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2025 (many (> (length links) 2))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2026 (buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2027 (indent (widget-get widget :indent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2028 (when links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2029 (when indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2030 (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2031 (when prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2032 (insert prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2033 (insert "See also ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2034 (while links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2035 (push (widget-create-child-and-convert widget (car links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2036 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2037 (setq links (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2038 (cond ((null links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2039 (insert ".\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2040 ((null (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2041 (if many
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2042 (insert ", and ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2043 (insert " and ")))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2044 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2045 (insert ", "))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2046 (widget-put widget :buttons buttons))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2047
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2048 (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
2049 "Add \"Parent groups: ...\" to WIDGET if the group has parents.
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2050 The value if non-nil if any parents were found.
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2051 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
2052 (let ((name (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2053 (type (widget-type widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2054 (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
2055 (start (point))
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2056 (parents nil))
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2057 (insert (or initial-string "Parent groups:"))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2058 (mapatoms (lambda (symbol)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2059 (let ((entry (assq name (get symbol 'custom-group))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2060 (when (eq (nth 1 entry) type)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2061 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2062 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2063 widget 'custom-group-link
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2064 :tag (custom-unlispify-tag-name symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2065 symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2066 buttons)
53223
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2067 (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
2068 (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
2069 (= (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
2070 (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
2071 (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
2072 (when links
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2073 (insert "\nParent documentation: ")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2074 (while links
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2075 (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
2076 buttons)
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2077 (setq links (cdr links))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2078 (cond ((null links)
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2079 (insert ".\n"))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2080 ((null (cdr links))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2081 (if many
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2082 (insert ", and ")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2083 (insert " and ")))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2084 (t
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2085 (insert ", ")))))))
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2086 (if parents
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2087 (insert "\n")
1fa5a4fc03e5 2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 52401
diff changeset
2088 (delete-region start (point)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2089 (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
2090 parents))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2091
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2092 ;;; The `custom-comment' Widget.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2093
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2094 ;; like the editable field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2095 (defface custom-comment-face '((((class grayscale color)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2096 (background light))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2097 (:background "gray85"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2098 (((class grayscale color)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2099 (background dark))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2100 (:background "dim gray"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2101 (t
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2102 (:slant italic)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2103 "Face used for comments on variables or faces"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2104 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2105 :group 'custom-faces)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2106
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2107 ;; like font-lock-comment-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2108 (defface custom-comment-tag-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2109 '((((class color) (background dark)) (:foreground "gray80"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2110 (((class color) (background light)) (:foreground "blue4"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2111 (((class grayscale) (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2112 (:foreground "DimGray" :weight bold :slant italic))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2113 (((class grayscale) (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2114 (: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
2115 (t (:weight bold)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2116 "Face used for variables or faces comment tags"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2117 :group 'custom-faces)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2118
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2119 (define-widget 'custom-comment 'string
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2120 "User comment."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2121 :tag "Comment"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2122 :help-echo "Edit a comment here."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2123 :sample-face 'custom-comment-tag-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2124 :value-face 'custom-comment-face
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2125 :shown nil
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2126 :create 'custom-comment-create)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2127
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2128 (defun custom-comment-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2129 (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
2130 (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
2131 (not null-comment))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2132 (widget-default-create widget)
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2133 ;; `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
2134 ;; maybe it shouldn't.
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2135 (widget-put widget :from (point-marker))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
2136 (widget-put widget :to (point-marker)))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2137
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2138 (defun custom-comment-hide (widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2139 (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
2140
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2141 ;; 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
2142 ;; the global custom one
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2143 (defun custom-comment-show (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2144 (widget-put widget :comment-shown t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2145 (custom-redraw widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2146 (widget-setup))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2147
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2148 (defun custom-comment-invisible-p (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2149 (let ((val (widget-value (widget-get widget :comment-widget))))
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2150 (and (equal "" val)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2151 (not (widget-get widget :comment-shown)))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2152
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2153 ;;; The `custom-variable' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2154
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2155 ;; When this was underlined blue, users confused it with a
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2156 ;; Mosaic-style hyperlink...
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2157 (defface custom-variable-tag-face
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2158 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2159 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2160 (: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
2161 (((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
2162 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
2163 (: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
2164 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2165 (background light))
61394
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
2166 (: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
2167 (t (:weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2168 "Face used for unpushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2169 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2170
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2171 (defface custom-variable-button-face '((t (:underline t :weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2172 "Face used for pushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2173 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2174
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2175 (defcustom custom-variable-default-form 'edit
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2176 "Default form of displaying variable values."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2177 :type '(choice (const edit)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2178 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2179 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2180 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2181
56161
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2182 (defun custom-variable-documentation (variable)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2183 "Return documentation of VARIABLE for use in Custom buffer.
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2184 Normally just return the docstring. But if VARIABLE automatically
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2185 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
2186 (if (and (local-variable-if-set-p variable)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2187 (or (not (local-variable-p variable))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2188 (with-temp-buffer
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2189 (local-variable-if-set-p variable))))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2190 (concat (documentation-property variable 'variable-documentation)
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2191 "\n
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2192 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
2193 However, setting it through Custom sets the default value.")
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2194 (documentation-property variable 'variable-documentation)))
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2195
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2196 (define-widget 'custom-variable 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2197 "Customize variable."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2198 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2199 :help-echo "Set or reset this variable."
56161
a8ce8bdfcee6 (custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 55944
diff changeset
2200 :documentation-property #'custom-variable-documentation
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2201 :custom-category 'option
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2202 :custom-state nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2203 :custom-menu 'custom-variable-menu-create
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2204 :custom-form nil ; defaults to value of `custom-variable-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2205 :value-create 'custom-variable-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2206 :action 'custom-variable-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2207 :custom-set 'custom-variable-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2208 :custom-save 'custom-variable-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2209 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2210 :custom-reset-saved 'custom-variable-reset-saved
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2211 :custom-reset-standard 'custom-variable-reset-standard
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2212 :custom-standard-value 'custom-variable-standard-value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2213
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2214 (defun custom-variable-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2215 "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
2216 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
2217 Otherwise, look up symbol in `custom-guess-type-alist'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2218 (let* ((type (or (get symbol 'custom-type)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2219 (and (not (get symbol 'standard-value))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2220 (custom-guess-type symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2221 'sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2222 (options (get symbol 'custom-options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2223 (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
2224 (copy-sequence type)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2225 (list type))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2226 (when options
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2227 (widget-put tmp :options options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2228 tmp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2229
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2230 (defun custom-variable-value-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2231 "Here is where you edit the variable's value."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2232 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2233 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2234 (widget-put widget :custom-form custom-variable-default-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2235 (let* ((buttons (widget-get widget :buttons))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2236 (children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2237 (form (widget-get widget :custom-form))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2238 (state (widget-get widget :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2239 (symbol (widget-get widget :value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2240 (tag (widget-get widget :tag))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2241 (type (custom-variable-type symbol))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2242 (conv (widget-convert type))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2243 (get (or (get symbol 'custom-get) 'default-value))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2244 (prefix (widget-get widget :custom-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2245 (last (widget-get widget :custom-last))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2246 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2247 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2248 (widget-get conv :value))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2249 ;; 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
2250 (cond (state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2251 ((custom-show type value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2252 (setq state 'unknown))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2253 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2254 (setq state 'hidden)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2255 ;; 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
2256 (when (eq state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2257 (unless (widget-apply conv :match value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2258 ;; (widget-apply (widget-convert type) :match value)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2259 (setq form 'mismatch)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2260 ;; Now we can create the child widget.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2261 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2262 (insert prefix (if last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2263 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2264 widget 'custom-browse-variable-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2265 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2266 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2267 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2268 ((eq state 'hidden)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2269 ;; Indicate hidden value.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2270 (push (widget-create-child-and-convert
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2271 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2272 :format "%{%t%}: "
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2273 :sample-face 'custom-variable-tag-face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2274 :tag tag
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2275 :parent widget)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2276 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2277 (push (widget-create-child-and-convert
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2278 widget 'visibility
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2279 :help-echo "Show the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2280 :off "Show Value"
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2281 :action 'custom-toggle-parent
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2282 nil)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2283 buttons))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2284 ((memq form '(lisp mismatch))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2285 ;; In lisp mode edit the saved value when possible.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2286 (let* ((value (cond ((get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2287 (car (get symbol 'saved-value)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2288 ((get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2289 (car (get symbol 'standard-value)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2290 ((default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2291 (custom-quote (funcall get symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2292 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2293 (custom-quote (widget-get conv :value))))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2294 (insert (symbol-name symbol) ": ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2295 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2296 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2297 :help-echo "Hide the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2298 :on "Hide Value"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2299 :off "Show Value"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2300 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2301 t)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2302 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2303 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2304 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2305 widget 'sexp
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2306 :button-face 'custom-variable-button-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2307 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2308 :tag (symbol-name symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2309 :parent widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2310 :value value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2311 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2312 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2313 ;; Edit mode.
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2314 (let* ((format (widget-get type :format))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2315 tag-format value-format)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2316 (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
2317 (error "Bad format"))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2318 (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
2319 (setq value-format (substring format (match-end 0)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2320 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2321 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2322 :format tag-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2323 :action 'custom-tag-action
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2324 :help-echo "Change value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2325 :mouse-down-action 'custom-tag-mouse-down-action
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2326 :button-face 'custom-variable-button-face
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2327 :sample-face 'custom-variable-tag-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2328 tag)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2329 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2330 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2331 (push (widget-create-child-and-convert
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2332 widget 'visibility
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2333 :help-echo "Hide the value of this option."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2334 :on "Hide Value"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2335 :off "Show Value"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2336 :action 'custom-toggle-parent
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2337 t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2338 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2339 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2340 widget type
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2341 :format value-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2342 :value value)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2343 children))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2344 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2345 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2346 (widget-insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2347 ;; Create the magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2348 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2349 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2350 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2351 (push magic buttons))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2352 ;; ### 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
2353 ;; 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
2354 ;; 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
2355 ;; 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
2356 ;; --dv
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2357 (widget-put widget :buttons buttons)
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
2358 (insert "\n")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2359 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2360 (widget-default-format-handler widget ?h)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2361
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2362 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2363 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2364 (let* ((comment (get symbol 'variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2365 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2366 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2367 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2368 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2369 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2370 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2371 ;; 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
2372 ;; value one.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2373 (setq children (append children (list comment-widget)))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2374 ;; Update the rest of the properties properties.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2375 (widget-put widget :custom-form form)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2376 (widget-put widget :children children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2377 ;; Now update the state.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2378 (if (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2379 (widget-put widget :custom-state state)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2380 (custom-variable-state-set widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2381 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2382 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2383 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2384 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2385 (custom-add-see-also widget)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2386
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2387 (defun custom-tag-action (widget &rest args)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2388 "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
2389 (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
2390 :action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2391
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2392 (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
2393 "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
2394 (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
2395 :mouse-down-action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2396
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2397 (defun custom-variable-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2398 "Set the state of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2399 (let* ((symbol (widget-value widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2400 (get (or (get symbol 'custom-get) 'default-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2401 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2402 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2403 (widget-get widget :value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2404 (comment (get symbol 'variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2405 tmp
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2406 temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2407 (state (cond ((progn (setq tmp (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2408 (setq temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2409 (get symbol 'customized-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2410 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2411 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2412 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2413 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2414 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2415 'set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2416 'changed))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2417 ((progn (setq tmp (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2418 (setq temp (get symbol 'saved-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2419 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2420 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2421 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2422 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2423 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2424 'saved
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2425 'changed))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2426 ((setq tmp (get symbol 'standard-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2427 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2428 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2429 (equal comment nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2430 (error nil))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2431 'standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2432 'changed))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2433 (t 'rogue))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2434 (widget-put widget :custom-state state)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2435
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2436 (defun custom-variable-standard-value (widget)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2437 (get (widget-value widget) 'standard-value))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2438
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2439 (defvar custom-variable-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
2440 '(("Set for Current Session" custom-variable-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2441 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2442 (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
2443 ("Save for Future Sessions" custom-variable-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2444 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2445 (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
2446 ("Reset to Current" custom-redraw
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2447 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2448 (and (default-boundp (widget-value widget))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2449 (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
2450 ("Reset to Saved" custom-variable-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2451 (lambda (widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2452 (and (or (get (widget-value widget) 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2453 (get (widget-value widget) 'saved-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2454 (memq (widget-get widget :custom-state)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2455 '(modified set changed rogue)))))
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
2456 ("Erase Customization" custom-variable-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2457 (lambda (widget)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2458 (and (get (widget-value widget) 'standard-value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2459 (memq (widget-get widget :custom-state)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2460 '(modified set changed saved rogue)))))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2461 ("Use Backup Value" custom-variable-reset-backup
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2462 (lambda (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2463 (get (widget-value widget) 'backup-value)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2464 ("---" ignore ignore)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2465 ("Add Comment" custom-comment-show custom-comment-invisible-p)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2466 ("---" ignore ignore)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2467 ("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
2468 (lambda (widget)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2469 (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
2470 ("Show initial Lisp expression" custom-variable-edit-lisp
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2471 (lambda (widget)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2472 (eq (widget-get widget :custom-form) 'edit))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2473 "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
2474 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
2475 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
2476 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
2477 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
2478 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2479
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2480 (defun custom-variable-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2481 "Show the menu for `custom-variable' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2482 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2483 (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
2484 (custom-toggle-hide widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2485 (unless (eq (widget-get widget :custom-state) 'modified)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2486 (custom-variable-state-set widget))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2487 (custom-redraw-magic widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2488 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2489 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2490 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2491 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2492 (custom-menu-filter custom-variable-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2493 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2494 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2495 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2496 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2497
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2498 (defun custom-variable-edit (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2499 "Edit value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2500 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2501 (widget-put widget :custom-form 'edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2502 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2503
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2504 (defun custom-variable-edit-lisp (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
2505 "Edit the Lisp representation of the value of WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2506 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2507 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2508 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2509
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2510 (defun custom-variable-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2511 "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
2512 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2513 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2514 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2515 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2516 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2517 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2518 (comment (widget-value comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2519 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2520 (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
2521 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2522 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2523 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2524 (error "%s" (widget-get val :error)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2525 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2526 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2527 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2528 ;; 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
2529 (custom-comment-hide comment-widget))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2530 (custom-variable-backup-value widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2531 (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
2532 (put symbol 'customized-value (list val))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2533 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2534 (put symbol 'customized-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2535 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2536 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2537 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2538 ;; 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
2539 (custom-comment-hide comment-widget))
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2540 (custom-variable-backup-value widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2541 (funcall set symbol (setq val (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2542 (put symbol 'customized-value (list (custom-quote val)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2543 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2544 (put symbol 'customized-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2545 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2546 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2547
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2548 (defun custom-variable-save (widget)
19823
0c1b4a44db76 (custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents: 19822
diff changeset
2549 "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
2550 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2551 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2552 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2553 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2554 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2555 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2556 (comment (widget-value comment-widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2557 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2558 (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
2559 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2560 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2561 (goto-char (widget-get val :from))
33774
77d48dfb2b29 (custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents: 33110
diff changeset
2562 (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
2563 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2564 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2565 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2566 ;; 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
2567 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2568 (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
2569 (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
2570 'set (list (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2571 (funcall set symbol (eval (widget-value child)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2572 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2573 (put symbol 'saved-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2574 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2575 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2576 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2577 ;; 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
2578 (custom-comment-hide comment-widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2579 (put symbol 'saved-value
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2580 (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
2581 (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
2582 'set (list (custom-quote (widget-value
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2583 child))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2584 (funcall set symbol (widget-value child))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2585 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2586 (put symbol 'saved-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2587 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2588 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2589 (custom-save-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2590 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2591 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2592
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2593 (defun custom-variable-reset-saved (widget)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2594 "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
2595 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
2596 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
2597 (let* ((symbol (widget-value widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2598 (set (or (get symbol 'custom-set) 'set-default))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2599 (value (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2600 (comment (get symbol 'saved-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2601 (cond ((or value comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2602 (put symbol 'variable-comment comment)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2603 (custom-variable-backup-value widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2604 (condition-case nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2605 (funcall set symbol (eval (car value)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2606 (error nil)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2607 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2608 (error "No saved value for %s" symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2609 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2610 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2611 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2612 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2613 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2614
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2615 (defun custom-variable-reset-standard (widget)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
2616 "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
2617 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
2618 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
2619 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
2620 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
2621 (let* ((symbol (widget-value widget))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
2622 (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
2623 (if (get symbol 'standard-value)
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2624 (progn
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2625 (custom-variable-backup-value widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2626 (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
2627 (error "No standard setting known for %S" symbol))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2628 (put symbol 'variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2629 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2630 (put symbol 'customized-variable-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2631 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2632 (put symbol 'saved-value nil)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
2633 (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
2634 ;; 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
2635 ;; 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
2636 (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
2637 (put symbol 'theme-value nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2638 (put symbol 'saved-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2639 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2640 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2641 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2642 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2643
47503
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2644 (defun custom-variable-backup-value (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2645 "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
2646 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
2647 (let* ((symbol (widget-value widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2648 (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
2649 (type (custom-variable-type symbol))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2650 (conv (widget-convert type))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2651 (value (if (default-boundp symbol)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2652 (funcall get symbol)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2653 (widget-get conv :value))))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2654 (put symbol 'backup-value (list value))))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2655
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2656 (defun custom-variable-reset-backup (widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2657 "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
2658 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
2659 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
2660 to switch between two values."
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2661 (let* ((symbol (widget-value widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2662 (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
2663 (value (get symbol 'backup-value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2664 (comment-widget (widget-get widget :comment-widget))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2665 (comment (widget-value comment-widget)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2666 (if value
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2667 (progn
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2668 (custom-variable-backup-value widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2669 (condition-case nil
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2670 (funcall set symbol (car value))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2671 (error nil)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2672 (error "No backup value for %s" symbol))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2673 (put symbol 'customized-value (list (car value)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2674 (put symbol 'variable-comment comment)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2675 (put symbol 'customized-variable-comment comment)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2676 (custom-variable-state-set widget)
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2677 ;; 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
2678 (custom-redraw widget)))
8b3fa993e0ad (custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 47315
diff changeset
2679
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2680 ;;; The `custom-face-edit' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2681
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2682 (define-widget 'custom-face-edit 'checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2683 "Edit face attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2684 :format "%t: %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2685 :tag "Attributes"
58940
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2686 :extra-offset 13
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2687 :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
2688 :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
2689 :match (lambda (widget value)
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
2690 (widget-checklist-match widget
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
2691 (custom-face-edit-fix-value widget value)))
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2692 :convert-widget 'custom-face-edit-convert-widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2693 :args (mapcar (lambda (att)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2694 (list 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2695 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2696 :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
2697 (list 'const :format "" :value (nth 0 att))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2698 (nth 1 att)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2699 custom-face-attributes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2700
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
2701 (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
2702 "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
2703 Also change :reverse-video to :inverse-video."
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2704 (if (listp value)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2705 (let (result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2706 (while value
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2707 (let ((key (car value))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2708 (val (car (cdr value))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2709 (cond ((eq key :italic)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2710 (push :slant result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2711 (push (if val 'italic 'normal) result))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2712 ((eq key :bold)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2713 (push :weight result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2714 (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
2715 ((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
2716 (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
2717 (push val result))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
2718 (t
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2719 (push key result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2720 (push val result))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2721 (setq value (cdr (cdr value))))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2722 (setq result (nreverse result))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2723 result)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2724 value))
42448
5269e6fd0fbc (custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents: 41606
diff changeset
2725
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2726 (defun custom-face-edit-convert-widget (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2727 "Convert :args as widget types in WIDGET."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2728 (widget-put
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2729 widget
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2730 :args (mapcar (lambda (arg)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2731 (widget-convert arg
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2732 :deactivate 'custom-face-edit-deactivate
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2733 :activate 'custom-face-edit-activate
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2734 :delete 'custom-face-edit-delete))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2735 (widget-get widget :args)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2736 widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2737
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2738 (defun custom-face-edit-deactivate (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2739 "Make face widget WIDGET inactive for user modifications."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2740 (unless (widget-get widget :inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2741 (let ((tag (custom-face-edit-attribute-tag widget))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2742 (from (copy-marker (widget-get widget :from)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2743 (value (widget-value widget))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2744 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2745 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2746 (save-excursion
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2747 (goto-char from)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2748 (widget-default-delete widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2749 (insert tag ": *\n")
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2750 (widget-put widget :inactive
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2751 (cons value (cons from (- (point) from))))))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2752
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2753 (defun custom-face-edit-activate (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2754 "Make face widget WIDGET inactive for user modifications."
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2755 (let ((inactive (widget-get widget :inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2756 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2757 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2758 (when (consp inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2759 (save-excursion
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2760 (goto-char (car (cdr inactive)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2761 (delete-region (point) (+ (point) (cdr (cdr inactive))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2762 (widget-put widget :inactive nil)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2763 (widget-apply widget :create)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2764 (widget-value-set widget (car inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2765 (widget-setup)))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2766
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2767 (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
2768 "Remove WIDGET from the buffer."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2769 (let ((inactive (widget-get widget :inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2770 (inhibit-read-only t)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2771 (inhibit-modification-hooks t))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2772 (if (not inactive)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2773 ;; 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
2774 (widget-default-delete widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2775 ;; 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
2776 ;; 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
2777 (delete-region (car (cdr inactive))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2778 (+ (car (cdr inactive)) (cdr (cdr inactive))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2779 (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
2780
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2781
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2782 (defun custom-face-edit-attribute-tag (widget)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2783 "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
2784 (let ((tag (widget-get widget :tag)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2785 (or (and (not (equal tag "")) tag)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2786 (let ((children (widget-get widget :children)))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2787 (while (and (null tag) children)
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2788 (setq tag (custom-face-edit-attribute-tag (pop children))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2789 tag))))
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2790
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2791 ;;; The `custom-display' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2792
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2793 (define-widget 'custom-display 'menu-choice
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2794 "Select a display type."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2795 :tag "Display"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2796 :value t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2797 :help-echo "Specify frames where the face attributes should be used."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2798 :args '((const :tag "all" t)
58941
a7271df99c36 (custom-display): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58940
diff changeset
2799 (const :tag "defaults" default)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2800 (checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2801 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2802 :extra-offset 9
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2803 :args ((group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2804 Only match the specified window systems.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2805 (const :format "Type: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2806 type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2807 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2808 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2809 (const :format "X "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2810 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2811 The X11 Window System.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2812 x)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2813 (const :format "PM "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2814 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2815 OS/2 Presentation Manager.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2816 pm)
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2817 (const :format "W32 "
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2818 :sibling-args (:help-echo "\
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2819 Windows NT/9X.")
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2820 w32)
48633
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2821 (const :format "MAC "
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2822 :sibling-args (:help-echo "\
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2823 Macintosh OS.")
8ef126b2490a (custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents: 48243
diff changeset
2824 mac)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2825 (const :format "DOS "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2826 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2827 Plain MS-DOS.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2828 pc)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2829 (const :format "TTY%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2830 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2831 Plain text terminals.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2832 tty)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2833 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2834 Only match the frames with the specified color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2835 (const :format "Class: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2836 class)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2837 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2838 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2839 (const :format "Color "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2840 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2841 Match color frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2842 color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2843 (const :format "Grayscale "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2844 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2845 Match grayscale frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2846 grayscale)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2847 (const :format "Monochrome%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2848 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2849 Match frames with no color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2850 mono)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2851 (group :sibling-args (:help-echo "\
55944
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2852 The minimum number of colors the frame should support.")
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2853 (const :format "" min-colors)
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2854 (integer :tag "Minimum number of colors" ))
173cdf06168d (custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents: 55789
diff changeset
2855 (group :sibling-args (:help-echo "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2856 Only match frames with the specified intensity.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2857 (const :format "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2858 Background brightness: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2859 background)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2860 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2861 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2862 (const :format "Light "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2863 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2864 Match frames with light backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2865 light)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2866 (const :format "Dark\n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2867 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2868 Match frames with dark backgrounds.")
45724
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
2869 dark)))
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
2870 (group :sibling-args (:help-echo "\
ee1a7b81cb0e (custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents: 45244
diff changeset
2871 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
2872 (const :format "Supports attributes:" supports)
45725
abb237aa3c61 (custom-display): Use correct syntax for `supports' attributes.
Miles Bader <miles@gnu.org>
parents: 45724
diff changeset
2873 (custom-face-edit :inline t :format "%n%v"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2874
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2875 ;;; The `custom-face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2876
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
2877 (defface custom-face-tag-face
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
2878 `((t (:weight bold :height 1.2 :inherit variable-pitch)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2879 "Face used for face tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2880 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2881
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2882 (defcustom custom-face-default-form 'selected
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2883 "Default form of displaying face definition."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2884 :type '(choice (const all)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2885 (const selected)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2886 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2887 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2888 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2889
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2890 (define-widget 'custom-face 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2891 "Customize face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2892 :sample-face 'custom-face-tag-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2893 :help-echo "Set or reset this face."
28716
e9fb71a3e51d (custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28700
diff changeset
2894 :documentation-property #'face-doc-string
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2895 :value-create 'custom-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2896 :action 'custom-face-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2897 :custom-category 'face
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2898 :custom-form nil ; defaults to value of `custom-face-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2899 :custom-set 'custom-face-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2900 :custom-save 'custom-face-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2901 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2902 :custom-reset-saved 'custom-face-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2903 :custom-reset-standard 'custom-face-reset-standard
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
2904 :custom-standard-value 'custom-face-standard-value
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2905 :custom-menu 'custom-face-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2906
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2907 (define-widget 'custom-face-all 'editable-list
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2908 "An editable list of display specifications and attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2909 :entry-format "%i %d %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2910 :insert-button-args '(:help-echo "Insert new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2911 :append-button-args '(:help-echo "Append new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2912 :delete-button-args '(:help-echo "Delete this display specification.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2913 :args '((group :format "%v" custom-display custom-face-edit)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2914
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2915 (defconst custom-face-all (widget-convert 'custom-face-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2916 "Converted version of the `custom-face-all' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2917
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2918 (define-widget 'custom-display-unselected 'item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2919 "A display specification that doesn't match the selected display."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2920 :match 'custom-display-unselected-match)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2921
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2922 (defun custom-display-unselected-match (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2923 "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
2924 (not (face-spec-set-match-display value (selected-frame))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2925
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2926 (define-widget 'custom-face-selected 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2927 "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
2928 :args '((choice :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2929 (group :tag "With Defaults" :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2930 (group (const :tag "" default)
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2931 (custom-face-edit :tag " Default\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2932 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2933 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2934 (group custom-display-unselected sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2935 (group (sexp :format "")
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2936 (custom-face-edit :tag " Overriding\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2937 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2938 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2939 sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2940 (group :tag "No Defaults" :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2941 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2942 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2943 (group custom-display-unselected sexp))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2944 (group (sexp :format "")
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2945 (custom-face-edit :tag "\n Attributes"))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2946 (repeat :format ""
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2947 :inline t
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2948 sexp)))))
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2949
841754cd73c6 (custom-face-selected): Handle `default' specs.
Richard M. Stallman <rms@gnu.org>
parents: 58797
diff changeset
2950
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2951
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2952 (defconst custom-face-selected (widget-convert 'custom-face-selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2953 "Converted version of the `custom-face-selected' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2954
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2955 (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
2956 "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
2957 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
2958 `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
2959 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
2960 don't specify one."
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2961 (mapcar (lambda (entry)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2962 ;; 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
2963 (let ((tests (car entry))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2964 (unfiltered-attrs
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2965 ;; 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
2966 (if (listp (car (cdr entry)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2967 (car (cdr entry))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2968 (cdr entry)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2969 (filtered-attrs nil))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2970 ;; Filter each face attribute
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2971 (while unfiltered-attrs
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2972 (let* ((attr (pop unfiltered-attrs))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2973 (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
2974 (filter
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2975 (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
2976 default-filter))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2977 (filtered-value
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2978 (if filter
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2979 (funcall filter pre-filtered-value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2980 pre-filtered-value)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2981 (push filtered-value filtered-attrs)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2982 (push attr filtered-attrs)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2983 ;;
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2984 (list tests filtered-attrs)))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2985 spec))
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2986
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2987 (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
2988 "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
2989 SPEC must be a full face spec."
39606
1b4259bc2f74 (custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents: 39153
diff changeset
2990 (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
2991
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
2992 (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
2993 "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
2994 (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
2995
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2996 (defun custom-face-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2997 "Create a list of the display specifications for WIDGET."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2998 (let ((buttons (widget-get widget :buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2999 children
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3000 (symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3001 (tag (widget-get widget :tag))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3002 (state (widget-get widget :custom-state))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3003 (begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3004 (is-last (widget-get widget :custom-last))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3005 (prefix (widget-get widget :custom-prefix)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3006 (unless tag
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3007 (setq tag (prin1-to-string symbol)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3008 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3009 (insert prefix (if is-last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3010 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3011 widget 'custom-browse-face-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3012 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3013 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3014 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3015 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3016 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3017 (insert tag)
34041
40708840c132 (custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents: 33986
diff changeset
3018 (widget-specify-sample widget begin (point))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3019 (if (eq custom-buffer-style 'face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3020 (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
3021 (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
3022 (insert ":")
42e118959715 (custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents: 32936
diff changeset
3023 (insert " face: ")))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3024 ;; Sample.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3025 (push (widget-create-child-and-convert widget 'item
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3026 :format "(%{%t%})"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3027 :sample-face symbol
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3028 :tag "sample")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3029 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3030 ;; Visibility.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3031 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3032 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3033 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3034 :help-echo "Hide or show this face."
46580
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
3035 :on "Hide Face"
2c25b46baf82 (custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 46408
diff changeset
3036 :off "Show Face"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3037 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3038 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3039 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3040 ;; Magic.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3041 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3042 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3043 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3044 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3045 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3046 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3047 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3048 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3049 (widget-default-format-handler widget ?h)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3050 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3051 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3052 (let* ((comment (get symbol 'face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3053 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3054 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3055 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3056 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3057 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3058 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3059 (push comment-widget children)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3060 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3061 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3062 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3063 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3064 (custom-add-see-also widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3065 ;; Editor.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3066 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3067 (insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3068 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3069 (message "Creating face editor...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3070 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3071 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
3072 (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
3073 (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
3074 (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
3075 (get symbol 'saved-face)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3076 (get symbol 'face-defface-spec)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3077 ;; Attempt to construct it.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3078 (list (list t (custom-face-attributes-get
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3079 symbol (selected-frame))))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3080 (form (widget-get widget :custom-form))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3081 (indent (widget-get widget :indent))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3082 edit)
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3083 ;; 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
3084 ;; 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
3085 (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
3086 (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
3087 (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
3088 (setq edit (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3089 widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3090 (cond ((and (eq form 'selected)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3091 (widget-apply custom-face-selected
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3092 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3093 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3094 'custom-face-selected)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3095 ((and (not (eq form 'lisp))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3096 (widget-apply custom-face-all
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3097 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3098 'custom-face-all)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3099 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3100 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3101 'sexp))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
3102 :value spec))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3103 (custom-face-state-set widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3104 (push edit children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3105 (widget-put widget :children children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3106 (message "Creating face editor...done"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3107
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3108 (defvar custom-face-menu
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3109 '(("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
3110 ("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
3111 ("Reset to Saved" custom-face-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3112 (lambda (widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3113 (or (get (widget-value widget) 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3114 (get (widget-value widget) 'saved-face-comment))))
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3115 ("Erase Customization" custom-face-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3116 (lambda (widget)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3117 (get (widget-value widget) 'face-defface-spec)))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3118 ("---" ignore ignore)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3119 ("Add Comment" custom-comment-show custom-comment-invisible-p)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3120 ("---" ignore ignore)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3121 ("Show all display specs" custom-face-edit-all
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3122 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3123 (not (eq (widget-get widget :custom-form) 'all))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3124 ("Just current attributes" custom-face-edit-selected
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3125 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3126 (not (eq (widget-get widget :custom-form) 'selected))))
40801
f49e883aeab2 Backed out last change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 40800
diff changeset
3127 ("Show as Lisp expression" custom-face-edit-lisp
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3128 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
3129 (not (eq (widget-get widget :custom-form) 'lisp)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3130 "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
3131 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
3132 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
3133 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
3134 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
3135 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3136
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3137 (defun custom-face-edit-selected (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3138 "Edit selected attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3139 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3140 (widget-put widget :custom-form 'selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3141 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3142
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3143 (defun custom-face-edit-all (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3144 "Edit all attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3145 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3146 (widget-put widget :custom-form 'all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3147 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3148
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3149 (defun custom-face-edit-lisp (widget)
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3150 "Edit the Lisp representation of the value of WIDGET."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3151 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3152 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3153 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3154
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3155 (defun custom-face-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3156 "Set the state of WIDGET."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3157 (let* ((symbol (widget-value widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3158 (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
3159 tmp temp
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3160 (state
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3161 (cond ((progn
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3162 (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
3163 (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
3164 (or tmp temp))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3165 (if (equal temp comment)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3166 'set
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3167 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3168 ((progn
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3169 (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
3170 (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
3171 (or tmp temp))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3172 (if (equal temp comment)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3173 'saved
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3174 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3175 ((get symbol 'face-defface-spec)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3176 (if (equal comment nil)
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3177 'standard
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3178 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3179 (t
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3180 'rogue))))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3181 ;; 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
3182 ;; 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
3183 (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
3184 (get symbol 'face-modified))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3185 (setq state 'changed))
caaa4fda6808 (custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents: 50283
diff changeset
3186 (widget-put widget :custom-state state)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3187
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3188 (defun custom-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3189 "Show the menu for `custom-face' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3190 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3191 (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
3192 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3193 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3194 (symbol (widget-get widget :value))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3195 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3196 (custom-unlispify-tag-name symbol))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3197 (custom-menu-filter custom-face-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3198 widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3199 event)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3200 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3201 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3202
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3203 (defun custom-face-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3204 "Make the face attributes in WIDGET take effect."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3205 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3206 (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
3207 (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
3208 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3209 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3210 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3211 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3212 ;; 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
3213 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3214 (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
3215 (if (face-spec-choose value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3216 (face-spec-set symbol value)
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3217 ;; 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
3218 ;; something harmless instead.
388a61e78c53 (custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents: 33774
diff changeset
3219 (face-spec-set symbol '((t :foreground unspecified))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3220 (put symbol 'customized-face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3221 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3222 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3223 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3224
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
3225 (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
3226 "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
3227 (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
3228 (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
3229
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3230 (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
3231 "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
3232 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3233 (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
3234 (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
3235 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3236 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3237 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3238 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3239 ;; 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
3240 (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
3241 (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
3242 (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
3243 ;; 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
3244 ;; 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
3245 (face-spec-set symbol '((t :foreground unspecified))))
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3246 (unless (eq (widget-get widget :custom-state) 'standard)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3247 (put symbol 'saved-face value))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3248 (custom-push-theme 'theme-face symbol 'user 'set value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3249 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3250 (put symbol 'face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3251 (put symbol 'customized-face-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3252 (put symbol 'saved-face-comment comment)
20262
c6532008f2a9 (custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents: 20174
diff changeset
3253 (custom-save-all)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3254 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3255 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3256
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3257 (defun custom-face-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3258 "Restore WIDGET to the face's default attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3259 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3260 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3261 (value (get symbol 'saved-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3262 (comment (get symbol 'saved-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3263 (comment-widget (widget-get widget :comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3264 (unless (or value comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3265 (error "No saved value for this face"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3266 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3267 (put symbol 'customized-face-comment nil)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3268 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3269 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3270 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3271 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3272 (widget-value-set comment-widget (or comment ""))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3273 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3274 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3275
46408
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3276 (defun custom-face-standard-value (widget)
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3277 (get (widget-value widget) 'face-defface-spec))
ccaa90ab16a3 New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents: 45725
diff changeset
3278
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3279 (defun custom-face-reset-standard (widget)
26625
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3280 "Restore WIDGET to the face's standard settings.
faf989c7a28e (Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 26451
diff changeset
3281 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
3282 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
3283 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3284 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3285 (value (get symbol 'face-defface-spec))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3286 (comment-widget (widget-get widget :comment-widget)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3287 (unless value
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
3288 (error "No standard setting for this face"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3289 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3290 (put symbol 'customized-face-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3291 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3292 (put symbol 'saved-face nil)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3293 (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
3294 ;; 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
3295 (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
3296 (put symbol 'theme-face nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3297 (put symbol 'saved-face-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3298 (custom-save-all))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3299 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3300 (put symbol 'face-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3301 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3302 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3303 (widget-value-set comment-widget "")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3304 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3305 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3306
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3307 ;;; The `face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3308
60280
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3309 (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
3310 "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
3311
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3312 (define-widget 'face 'symbol
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3313 "A Lisp face name (with sample)."
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3314 :format "%t: (%{sample%}) %v"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3315 :tag "Face"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3316 :value 'default
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3317 :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
3318 :notify 'widget-face-notify
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3319 :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
3320 :complete-function (lambda ()
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3321 (interactive)
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3322 (lisp-complete-symbol 'facep))
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3323 :prompt-match 'facep
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3324 :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
3325 :validate (lambda (widget)
f0850dec46a9 (custom-buffer-create-internal): Improve progress msgs.
Richard M. Stallman <rms@gnu.org>
parents: 60214
diff changeset
3326 (unless (facep (widget-value widget))
61307
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3327 (widget-put widget
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3328 :error (format "Invalid face: %S"
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3329 (widget-value widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3330 widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3331
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3332 (defun widget-face-sample-face-get (widget)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3333 (let ((value (widget-value widget)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3334 (if (facep value)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3335 value
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3336 'default)))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3337
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3338 (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
3339 "Update the sample, and notify the parent."
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3340 (overlay-put (widget-get widget :sample-overlay)
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3341 'face (widget-apply widget :sample-face-get))
0592ebb75598 (face): Derive from symbol widget. Display sample
David Ponce <david@dponce.com>
parents: 60296
diff changeset
3342 (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
3343
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3344
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3345 ;;; The `hook' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3346
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3347 (define-widget 'hook 'list
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3348 "A emacs lisp hook"
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3349 :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
3350 (if (and value (symbolp value))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3351 (list value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3352 value))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3353 :match (lambda (widget value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3354 (or (symbolp value)
20174
e1ca1fe89e6e (hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents: 20100
diff changeset
3355 (widget-group-match widget value)))
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3356 ;; Avoid adding undefined functions to the hook, especially for
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3357 ;; things like `find-file-hook' or even more basic ones, to avoid
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3358 ;; chaos.
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
3359 :set (lambda (symbol value)
28310
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3360 (dolist (elt value)
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3361 (if (fboundp elt)
9ba6478b7a27 (hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28245
diff changeset
3362 (add-hook symbol elt))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3363 :convert-widget 'custom-hook-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3364 :tag "Hook")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3365
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3366 (defun custom-hook-convert-widget (widget)
27250
807fc106b24c (custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents: 26803
diff changeset
3367 ;; Handle `:options'.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3368 (let* ((options (widget-get widget :options))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3369 (other `(editable-list :inline t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3370 :entry-format "%i %d%v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3371 (function :format " %v")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3372 (args (if options
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3373 (list `(checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3374 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3375 `(function-item ,entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3376 options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3377 other)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3378 (list other))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3379 (widget-put widget :args args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3380 widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3381
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3382 ;;; The `custom-group-link' Widget.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3383
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3384 (define-widget 'custom-group-link 'link
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3385 "Show parent in other window when activated."
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3386 :help-echo "Create customization buffer for this group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3387 :action 'custom-group-link-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3388
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3389 (defun custom-group-link-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3390 (customize-group (widget-value widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3391
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3392 ;;; The `custom-group' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3393
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3394 (defcustom custom-group-tag-faces nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3395 ;; 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
3396 ;; Fixme: make it do so in Emacs.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3397 "Face used for group tags.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3398 The first member is used for level 1 groups, the second for level 2,
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3399 and so forth. The remaining group tags are shown with
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3400 `custom-group-tag-face'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3401 :type '(repeat face)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3402 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3403
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3404 (defface custom-group-tag-face-1
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3405 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3406 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3407 (: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
3408 (((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
3409 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3410 (: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
3411 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3412 (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3413 (: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
3414 (t (:weight bold)))
28172
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3415 "Face used for group tags."
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3416 :group 'custom-faces)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3417
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3418 (defface custom-group-tag-face
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3419 `((((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3420 (background dark))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3421 (: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
3422 (((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
3423 (background light))
31aa9a390538 * mh-customize.el (mh-speedbar-selected-folder-face): Special case
Dan Nicolaescu <dann@ics.uci.edu>
parents: 61307
diff changeset
3424 (: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
3425 (((class color)
b243caac6505 (custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents: 28130
diff changeset
3426 (background light))
42451
cade20d9a300 (custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents: 42448
diff changeset
3427 (: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
3428 (t (:weight bold)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3429 "Face used for low level group tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3430 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3431
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3432 (define-widget 'custom-group 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3433 "Customize group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3434 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3435 :sample-face-get 'custom-group-sample-face-get
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3436 :documentation-property 'group-documentation
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3437 :help-echo "Set or reset all members of this group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3438 :value-create 'custom-group-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3439 :action 'custom-group-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
3440 :custom-category 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3441 :custom-set 'custom-group-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3442 :custom-save 'custom-group-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3443 :custom-reset-current 'custom-group-reset-current
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3444 :custom-reset-saved 'custom-group-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3445 :custom-reset-standard 'custom-group-reset-standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3446 :custom-menu 'custom-group-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3447
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3448 (defun custom-group-sample-face-get (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3449 ;; Use :sample-face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3450 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3451 'custom-group-tag-face))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3452
18430
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3453 (define-widget 'custom-group-visibility 'visibility
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3454 "An indicator and manipulator for hidden group contents."
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3455 :create 'custom-group-visibility-create)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3456
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3457 (defun custom-group-visibility-create (widget)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3458 (let ((visible (widget-value widget)))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3459 (if visible
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3460 (insert "--------")))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3461 (widget-default-create widget))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3462
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3463 (defun custom-group-members (symbol groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3464 "Return SYMBOL's custom group members.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3465 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
3466 (if (not groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3467 (get symbol 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3468 (let (members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3469 (dolist (entry (get symbol 'custom-group))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3470 (when (eq (nth 1 entry) 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3471 (push entry members)))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3472 (nreverse members))))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3473
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3474 (defun custom-group-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3475 "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
3476 (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
3477 (custom-load-widget widget))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3478 (let* ((state (widget-get widget :custom-state))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3479 (level (widget-get widget :custom-level))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3480 ;; (indent (widget-get widget :indent))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3481 (prefix (widget-get widget :custom-prefix))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3482 (buttons (widget-get widget :buttons))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3483 (tag (widget-get widget :tag))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3484 (symbol (widget-value widget))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3485 (members (custom-group-members symbol
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3486 (and (eq custom-buffer-style 'tree)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3487 custom-browse-only-groups))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3488 (cond ((and (eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3489 (eq state 'hidden)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3490 (or members (custom-unloaded-widget-p widget)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3491 (custom-browse-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3492 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3493 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3494 ;; :tag-glyph "plus"
18856
03eeb83520d8 (custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents: 18812
diff changeset
3495 :tag "+")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3496 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3497 (insert "-- ")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3498 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3499 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3500 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3501 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3502 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3503 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3504 ((and (eq custom-buffer-style 'tree)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3505 (zerop (length members)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3506 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3507 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3508 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3509 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3510 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3511 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3512 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3513 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3514 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3515 ((eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3516 (custom-browse-insert-prefix prefix)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3517 (if (zerop (length members))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3518 (progn
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3519 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3520 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3521 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3522 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3523 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3524 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3525 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3526 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3527 (widget-put widget :buttons buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3528 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3529 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3530 ;; :tag-glyph "minus"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3531 :tag "-")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3532 buttons)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3533 (insert "-\\ ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3534 ;; (widget-glyph-insert nil "-\\ " "top")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3535 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3536 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3537 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3538 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3539 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3540 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3541 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3542 custom-browse-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3543 custom-browse-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3544 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3545 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3546 (extra-prefix (if (widget-get widget :custom-last)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3547 " "
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3548 " | "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3549 (prefix (concat prefix extra-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3550 children entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3551 (while members
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3552 (setq entry (car members)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3553 members (cdr members))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3554 (push (widget-create-child-and-convert
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3555 widget (nth 1 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3556 :group widget
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3557 :tag (custom-unlispify-tag-name (nth 0 entry))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3558 :custom-prefixes custom-prefix-list
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3559 :custom-level (1+ level)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3560 :custom-last (null members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3561 :value (nth 0 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3562 :custom-prefix prefix)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3563 children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3564 (widget-put widget :children (reverse children)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3565 (message "Creating group...done")))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3566 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3567 ((eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3568 ;; Create level indicator.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3569 (unless (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3570 (insert-char ?\ (* custom-buffer-indent (1- level)))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3571 (insert "-- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3572 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3573 (let ((begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3574 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3575 (widget-specify-sample widget begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3576 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3577 ;; Create link/visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3578 (if (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3579 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3580 widget 'custom-group-link
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3581 :tag "Go to Group"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3582 symbol)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3583 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3584 (push (widget-create-child-and-convert
20100
0db4553d47cc (custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents: 19886
diff changeset
3585 widget 'custom-group-visibility
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3586 :help-echo "Show members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3587 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3588 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3589 buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3590 (insert " \n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3591 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3592 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3593 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3594 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3595 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3596 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3597 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3598 ;; Insert documentation.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3599 (if (and (eq custom-buffer-style 'links) (> level 1))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3600 (widget-put widget :documentation-indent 0))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3601 (widget-default-format-handler widget ?h))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3602 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3603 (t ;Visible.
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3604 ;; 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
3605 (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
3606 ;;; 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
3607 (when (eq level 1)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
3608 (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
3609 "Go to parent group:")
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3610 (insert "\n"))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3611 ;; Create level indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3612 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3613 (insert "/- ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3614 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3615 (let ((start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3616 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3617 (widget-specify-sample widget start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3618 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3619 ;; Create visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3620 (unless (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3621 (insert "--------")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3622 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3623 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3624 :help-echo "Hide members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3625 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3626 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3627 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3628 (insert " "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3629 ;; Create more dashes.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3630 ;; 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
3631 ;; added by `widget-insert'.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3632 (insert-char ?- (- 76 (current-column)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3633 (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3634 (insert "\\\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3635 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3636 (let ((magic (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3637 widget 'custom-magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3638 :indent 0
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3639 nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3640 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3641 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3642 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3643 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3644 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3645 (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
3646 ;; Parent groups.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3647 (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
3648 ;;; 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
3649 (when (eq level 1)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3650 (insert-char ?\ custom-buffer-indent)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3651 (custom-add-parent-links widget)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3652 (custom-add-see-also widget
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3653 (make-string (* custom-buffer-indent level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3654 ?\ ))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3655 ;; Members.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3656 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3657 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3658 custom-buffer-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3659 custom-buffer-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3660 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3661 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3662 (length (length members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3663 (count 0)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3664 (children (mapcar (lambda (entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3665 (widget-insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3666 (message "\
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3667 Creating group members... %2d%%"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3668 (/ (* 100.0 count) length))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3669 (setq count (1+ count))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3670 (prog1
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3671 (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3672 widget (nth 1 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3673 :group widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3674 :tag (custom-unlispify-tag-name
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3675 (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3676 :custom-prefixes custom-prefix-list
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3677 :custom-level (1+ level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3678 :value (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3679 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3680 (widget-insert "\n"))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3681 members)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3682 (message "Creating group magic...")
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3683 (mapc 'custom-magic-reset children)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3684 (message "Creating group state...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3685 (widget-put widget :children children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3686 (custom-group-state-update widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3687 (message "Creating group... done"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3688 ;; End line
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3689 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3690 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3691 (insert "\\- " (widget-get widget :tag) " group end ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3692 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3693 (insert "/\n")))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3694
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3695 (defvar custom-group-menu
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3696 '(("Set for Current Session" custom-group-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3697 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3698 (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
3699 ("Save for Future Sessions" custom-group-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3700 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3701 (memq (widget-get widget :custom-state) '(modified set))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3702 ("Reset to Current" custom-group-reset-current
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3703 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3704 (memq (widget-get widget :custom-state) '(modified))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3705 ("Reset to Saved" custom-group-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3706 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3707 (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
3708 ("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
3709 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3710 (memq (widget-get widget :custom-state) '(modified set saved)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3711 "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
3712 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
3713 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
3714 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
3715 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
3716 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3717
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3718 (defun custom-group-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3719 "Show the menu for `custom-group' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3720 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3721 (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
3722 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3723 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3724 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3725 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3726 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3727 (custom-menu-filter custom-group-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3728 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3729 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3730 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3731 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3732
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3733 (defun custom-group-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3734 "Set changes in all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3735 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3736 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3737 (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
3738 (widget-apply child :custom-set)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3739 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3740
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3741 (defun custom-group-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3742 "Save all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3743 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3744 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3745 (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
3746 (widget-apply child :custom-save)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3747 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3748
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3749 (defun custom-group-reset-current (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3750 "Reset all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3751 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3752 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3753 (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
3754 (widget-apply child :custom-reset-current)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3755 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3756
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3757 (defun custom-group-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3758 "Reset all modified or set group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3759 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3760 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3761 (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
3762 (widget-apply child :custom-reset-saved)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3763 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3764
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3765 (defun custom-group-reset-standard (widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3766 "Reset all modified, set, or saved group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3767 (let ((children (widget-get widget :children)))
28700
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3768 (mapc (lambda (child)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3769 (when (memq (widget-get child :custom-state)
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3770 '(modified set saved))
a57bafeec17c (Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents: 28612
diff changeset
3771 (widget-apply child :custom-reset-standard)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3772 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3773
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3774 (defun custom-group-state-update (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3775 "Update magic."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3776 (unless (eq (widget-get widget :custom-state) 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3777 (let* ((children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3778 (states (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3779 (widget-get child :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3780 children))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3781 (magics custom-magic-alist)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3782 (found 'standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3783 (while magics
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3784 (let ((magic (car (car magics))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3785 (if (and (not (eq magic 'hidden))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3786 (memq magic states))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3787 (setq found magic
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3788 magics nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3789 (setq magics (cdr magics)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3790 (widget-put widget :custom-state found)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3791 (custom-magic-reset widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3792
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3793 ;;; The `custom-save-all' Function.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
3794 ;;;###autoload
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3795 (defcustom custom-file nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3796 "File used for storing customization information.
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3797 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
3798 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
3799 it should be an absolute file name.
0b90a17a09e1 (custom-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 58779
diff changeset
3800
59335
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3801 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
3802 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
3803 something like the following in your init file:
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3804
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3805 \(setq custom-file \"~/.emacs-custom.el\")
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3806 \(load custom-file)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3807
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3808 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
3809 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
3810
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3811 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
3812 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
3813 forms `(custom-set-variables ...)' and `(custom-set-faces ...)',
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3814 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
3815 This will preserve your existing customizations.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3816
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3817 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
3818 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
3819 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
3820 `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
3821 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
3822 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
3823 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
3824 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
3825 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
3826 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
3827 :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
3828 (file :format "%t:%v%d"
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3829 :doc
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3830 "Please read entire docstring below before setting \
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3831 this through Custom.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3832 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
3833 if only the first line of the docstring is shown."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3834 :group 'customize)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3835
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3836 (defun custom-file ()
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3837 "Return the file name for saving customizations."
59335
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3838 (or custom-file
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3839 (let ((user-init-file user-init-file)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3840 (default-init-file
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3841 (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3842 (when (null user-init-file)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3843 (if (or (file-exists-p default-init-file)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3844 (and (eq system-type 'windows-nt)
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3845 (file-exists-p "~/_emacs")))
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3846 ;; Started with -q, i.e. the file containing
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3847 ;; Custom settings hasn't been read. Saving
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3848 ;; settings there would overwrite other settings.
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3849 (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3850 (setq user-init-file default-init-file))
45239c528a49 (custom-file): Doc fix for defcustom.
Luc Teirlinck <teirllm@auburn.edu>
parents: 58941
diff changeset
3851 user-init-file)))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3852
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3853 (defun custom-save-delete (symbol)
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3854 "Visit `custom-file' and delete all calls to SYMBOL from it.
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3855 Leave point at the old location of the first such call,
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3856 or (if there were none) at the end of the buffer."
48243
dd12a68149b5 (custom-save-delete): Force emacs-lisp-mode.
Juanma Barranquero <lekktu@gmail.com>
parents: 47823
diff changeset
3857 (let ((default-major-mode 'emacs-lisp-mode))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3858 (set-buffer (find-file-noselect (custom-file))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3859 (goto-char (point-min))
25058
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3860 ;; Skip all whitespace and comments.
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3861 (while (forward-comment 1))
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3862 (or (eobp)
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3863 (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
3864 (let (first)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3865 (catch 'found
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3866 (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
3867 ;; Skip all whitespace and comments.
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3868 (while (forward-comment 1))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3869 (let ((start (point))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3870 (sexp (condition-case nil
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3871 (read (current-buffer))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3872 (end-of-file (throw 'found nil)))))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3873 (when (and (listp sexp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3874 (eq (car sexp) symbol))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3875 (delete-region start (point))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3876 (unless first
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3877 (setq first (point)))))))
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3878 (if first
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3879 (goto-char first)
36628
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3880 ;; 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
3881 ;; entries would make them ineffective.
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3882 (let ((pos (point-max))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3883 (case-fold-search t))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3884 (save-excursion
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3885 (goto-char (point-max))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3886 (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
3887 'move)
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3888 (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
3889 (setq pos (line-beginning-position))))
d1106e82508b (custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents: 35441
diff changeset
3890 (goto-char pos)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3891
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3892 (defun custom-save-variables ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3893 "Save all customized variables in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3894 (save-excursion
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3895 (custom-save-delete 'custom-load-themes)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3896 (custom-save-delete 'custom-reset-variables)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3897 (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
3898 (custom-save-loaded-themes)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3899 (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
3900 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3901 (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
3902 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3903 ;; 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
3904 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3905 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3906 (if (get symbol 'saved-value)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3907 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3908 (setq saved-list (sort (cdr saved-list) 'string<))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3909 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3910 (princ "\n"))
26653
ea8ae3c8fad5 (custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents: 26625
diff changeset
3911 (princ "(custom-set-variables
47315
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
3912 ;; custom-set-variables was added by Custom.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
3913 ;; 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
3914 ;; 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
3915 ;; 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
3916 (dolist (symbol saved-list)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3917 (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
3918 (value (get symbol 'saved-value))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3919 (requests (get symbol 'custom-requests))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3920 (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
3921 (and (not (boundp symbol))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3922 (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
3923 'rogue))))))
51362
0b5cb555fd17 (custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 51277
diff changeset
3924 (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
3925 ;; Check `requests'.
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3926 (dolist (request requests)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3927 (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
3928 (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
3929 (setq requests (delq request requests))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3930 (when (or (and spec
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3931 (eq (nth 0 spec) 'user)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3932 (eq (nth 1 spec) 'set))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3933 comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3934 (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
3935 (unless (bolp)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3936 (princ "\n"))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3937 (princ " '(")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3938 (prin1 symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3939 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3940 (prin1 (car value))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3941 (when (or now requests comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3942 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3943 (prin1 now)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3944 (when (or requests comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3945 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3946 (prin1 requests)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3947 (when comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3948 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3949 (prin1 comment))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3950 (princ ")"))))
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3951 (if (bolp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
3952 (princ " "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3953 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3954 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3955 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3956
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3957 (defun custom-save-faces ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3958 "Save all customized faces in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3959 (save-excursion
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
3960 (custom-save-delete 'custom-reset-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3961 (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
3962 (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
3963 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3964 (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
3965 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3966 ;; 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
3967 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3968 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3969 (if (get symbol 'saved-face)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3970 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3971 (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
3972 ;; 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
3973 (if (memq 'default saved-list)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3974 (setq saved-list (cons 'default (delq 'default saved-list))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3975 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3976 (princ "\n"))
26653
ea8ae3c8fad5 (custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents: 26625
diff changeset
3977 (princ "(custom-set-faces
47315
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
3978 ;; custom-set-faces was added by Custom.
655350cd09e5 (custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents: 47168
diff changeset
3979 ;; 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
3980 ;; 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
3981 ;; 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
3982 (dolist (symbol saved-list)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3983 (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
3984 (value (get symbol 'saved-face))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3985 (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
3986 (and (not (custom-facep symbol))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3987 (not (get symbol 'force-face))))))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3988 (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
3989 (when (or (and spec
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3990 (eq (nth 0 spec) 'user)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3991 (eq (nth 1 spec) 'set))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3992 comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3993 (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
3994 ;; 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
3995 (unless (bolp)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3996 (princ "\n"))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3997 (princ " '(")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3998 (prin1 symbol)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
3999 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4000 (prin1 value)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4001 (when (or now comment)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4002 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4003 (prin1 now)
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4004 (when comment
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4005 (princ " ")
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4006 (prin1 comment)))
e8de2a4807e5 (custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 49521
diff changeset
4007 (princ ")"))))
26803
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4008 (if (bolp)
f7c68655bd5d (custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents: 26653
diff changeset
4009 (princ " "))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4010 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4011 (unless (looking-at "\n")
48958
6b4f6412de76 (custom-save-faces): Fix typo.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 48949
diff changeset
4012 (princ "\n")))))
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4013
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4014 (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
4015 (let (started-writing ignored-special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4016 ;; (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
4017 (let ((standard-output (current-buffer))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4018 (mapper `(lambda (object)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4019 (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
4020 (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
4021 (eq (nth 0 spec) 'user)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4022 (eq (nth 1 spec) 'reset))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4023 ;; 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
4024 (unless started-writing
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4025 (setq started-writing t)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4026 (unless (bolp)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4027 (princ "\n"))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4028 (princ "(")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4029 (princ (quote ,setter))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4030 (princ "\n '(")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4031 (prin1 object)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4032 (princ " ")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4033 (prin1 (nth 3 spec))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4034 (princ ")")))))))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4035 (mapc mapper special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4036 (setq ignored-special special)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4037 (mapatoms mapper)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4038 (when started-writing
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4039 (princ ")\n")))))
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
4040
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4041 (defun custom-save-loaded-themes ()
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4042 (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
4043 (standard-output (current-buffer)))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4044 (when themes
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4045 (unless (bolp) (princ "\n"))
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4046 (princ "(custom-load-themes")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4047 (mapc (lambda (theme)
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4048 (princ "\n '")
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4049 (prin1 theme)) themes)
49521
c259d8177692 2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents: 49300
diff changeset
4050 (princ " )\n"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4051
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4052 ;;;###autoload
18436
2163f03bb88f (customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents: 18435
diff changeset
4053 (defun customize-save-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4054 "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
4055 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4056 (mapatoms (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4057 (let ((face (get symbol 'customized-face))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4058 (value (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4059 (face-comment (get symbol 'customized-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4060 (variable-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4061 (get symbol 'customized-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4062 (when face
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4063 (put symbol 'saved-face face)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4064 (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
4065 (put symbol 'customized-face nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4066 (when value
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4067 (put symbol 'saved-value value)
48949
f216c93c4189 (customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents: 48709
diff changeset
4068 (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
4069 (put symbol 'customized-value nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4070 (when variable-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4071 (put symbol 'saved-variable-comment variable-comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4072 (put symbol 'customized-variable-comment nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4073 (when face-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4074 (put symbol 'saved-face-comment face-comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4075 (put symbol 'customized-face-comment nil)))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4076 ;; We really should update all custom buffers here.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4077 (custom-save-all))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4078
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
4079 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4080 (defun custom-save-all ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4081 "Save all customizations in `custom-file'."
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4082 (let ((inhibit-read-only t))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4083 (custom-save-variables)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4084 (custom-save-faces)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4085 (save-excursion
20398
47f326ffb7ba (custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents: 20397
diff changeset
4086 (let ((default-major-mode nil))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
4087 (set-buffer (find-file-noselect (custom-file))))
42930
09e1ef4107e7 (custom-save-all): Bind file-precious-flag to t for saving .emacs.
Richard M. Stallman <rms@gnu.org>
parents: 42451
diff changeset
4088 (let ((file-precious-flag t))
09e1ef4107e7 (custom-save-all): Bind file-precious-flag to t for saving .emacs.
Richard M. Stallman <rms@gnu.org>
parents: 42451
diff changeset
4089 (save-buffer)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4090
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4091 ;;; The Customize Menu.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4092
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4093 ;;; Menu support
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4094
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4095 (defcustom custom-menu-nesting 2
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4096 "Maximum nesting in custom menus."
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4097 :type 'integer
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
4098 :group 'custom-menu)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4099
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4100 (defun custom-face-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4101 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4102 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4103 `(customize-face ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4104 t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4105
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4106 (defun custom-variable-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4107 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4108 (let ((type (get symbol 'custom-type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4109 (unless (listp type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4110 (setq type (list type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4111 (if (and type (widget-get type :custom-menu))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4112 (widget-apply type :custom-menu symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4113 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4114 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4115 t))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4116
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4117 ;; Add checkboxes to boolean variable entries.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4118 (widget-put (get 'boolean 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4119 :custom-menu (lambda (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4120 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
4121 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4122 ':style 'toggle
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4123 ':selected symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4124
30184
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4125 (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
4126 "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
4127 `( ,(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
4128 :filter (lambda (&rest junk)
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4129 (let ((menu (custom-menu-create ',symbol)))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4130 (if (consp menu) (cdr menu) menu)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4131
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4132 ;;;###autoload
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4133 (defun custom-menu-create (symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4134 "Create menu for customization group SYMBOL.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4135 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
4136 (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
4137 `(customize-group ',symbol)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4138 t)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4139 (if (and (or (not (boundp 'custom-menu-nesting))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4140 (>= custom-menu-nesting 0))
49126
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4141 (progn
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4142 (custom-load-symbol symbol)
697ca5db73b8 (customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents: 49104
diff changeset
4143 (< (length (get symbol 'custom-group)) widget-menu-max-size)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4144 (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
4145 custom-prefix-list))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4146 (members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4147 custom-menu-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
4148 custom-menu-order-groups)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4149 `(,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4150 ,item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4151 "--"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4152 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4153 (widget-apply (if (listp (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4154 (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4155 (list (nth 1 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4156 :custom-menu (nth 0 entry)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
4157 members)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4158 item)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4159
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4160 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4161 (defun customize-menu-create (symbol &optional name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4162 "Return a customize menu for customization group SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4163 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
4164 Otherwise the menu will be named `Customize'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4165 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
4166 (unless name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4167 (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
4168 `(,name
aa305b5e66ed (custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents: 29879
diff changeset
4169 :filter (lambda (&rest junk)
47168
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4170 (let ((menu (custom-menu-create ',symbol)))
59fc9e6fd3e8 (custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 46580
diff changeset
4171 (if (consp menu) (cdr menu) menu)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4172
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4173 ;;; The Custom Mode.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4174
59760
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4175 (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
4176 ;; 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
4177 ;; "\r" bindings from the parent map.
59760
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4178 ;; 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
4179 (let ((map (make-keymap)))
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4180 (set-keymap-parent map widget-keymap)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4181 (suppress-keymap map)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4182 (define-key map " " 'scroll-up)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4183 (define-key map "\177" 'scroll-down)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4184 (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
4185 (define-key map "q" 'Custom-buffer-done)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4186 (define-key map "u" 'Custom-goto-parent)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4187 (define-key map "n" 'widget-forward)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4188 (define-key map "p" 'widget-backward)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4189 (define-key map [mouse-1] 'Custom-move-and-invoke)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4190 map)
a7a34c3cb55e (custom-mode-map): Make it dense.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59759
diff changeset
4191 "Keymap for `custom-mode'.")
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4192
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4193 (defun Custom-move-and-invoke (event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4194 "Move to where you click, and if it is an active field, invoke it."
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4195 (interactive "e")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4196 (mouse-set-point event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4197 (if (widget-event-point event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4198 (let* ((pos (widget-event-point event))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4199 (button (get-char-property pos 'button)))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4200 (if button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4201 (widget-button-click event)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4202
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4203 (easy-menu-define Custom-mode-menu
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4204 custom-mode-map
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4205 "Menu used in customization buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4206 `("Custom"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
4207 ,(customize-menu-create 'customize)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4208 ["Set" Custom-set t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4209 ["Save" Custom-save t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4210 ["Reset to Current" Custom-reset-current t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4211 ["Reset to Saved" Custom-reset-saved t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4212 ["Reset to Standard Settings" Custom-reset-standard t]
23357
856a82c440fa (Custom-mode-menu): Fix info node name.
Karl Heuer <kwzh@gnu.org>
parents: 23223
diff changeset
4213 ["Info" (Info-goto-node "(emacs)Easy Customization") t]))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4214
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4215 (defun Custom-goto-parent ()
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4216 "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
4217 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
4218 (interactive)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4219 (save-excursion
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4220 (goto-char (point-min))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4221 (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
4222 (let* ((button (get-char-property (point) 'button))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4223 (parent (downcase (widget-get button :tag))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4224 (customize-group parent)))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4225
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4226 (defcustom custom-mode-hook nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4227 "Hook called when entering Custom mode."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4228 :type 'hook
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
4229 :group 'custom-buffer )
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4230
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4231 (defun custom-state-buffer-message (widget)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4232 (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
4233 (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
4234
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4235 (defun custom-mode ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4236 "Major mode for editing customization buffers.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4237
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4238 The following commands are available:
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4239
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4240 Move to next button or editable field. \\[widget-forward]
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4241 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
4242 \\<widget-field-keymap>\
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4243 Complete content of editable text field. \\[widget-complete]
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
4244 \\<custom-mode-map>\
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
4245 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
4246 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
4247 Set all modifications. \\[Custom-set]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4248 Make all modifications default. \\[Custom-save]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4249 Reset all modified options. \\[Custom-reset-current]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4250 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
4251 Reset all options. \\[Custom-reset-standard]
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4252
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4253 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
4254 if that value is non-nil."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4255 (kill-all-local-variables)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4256 (setq major-mode 'custom-mode
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4257 mode-name "Custom")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4258 (use-local-map custom-mode-map)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
4259 (easy-menu-add Custom-mode-menu)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4260 (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
4261 (make-local-variable 'custom-local-buffer)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4262 (make-local-variable 'widget-documentation-face)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4263 (setq widget-documentation-face 'custom-documentation-face)
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
4264 (make-local-variable 'widget-button-face)
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
4265 (setq widget-button-face 'custom-button-face)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4266 (set (make-local-variable 'widget-button-pressed-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4267 'custom-button-pressed-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4268 (set (make-local-variable 'widget-mouse-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4269 'custom-button-pressed-face) ; buttons `depress' when moused
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4270 ;; 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
4271 ;; may not be optimal.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4272 (when custom-raised-buttons
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4273 (set (make-local-variable 'widget-push-button-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4274 (set (make-local-variable 'widget-push-button-suffix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4275 (set (make-local-variable 'widget-link-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4276 (set (make-local-variable 'widget-link-suffix) ""))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
4277 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
4278 (run-hooks 'custom-mode-hook))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4279
32904
2109c5fb0c3f (custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents: 32883
diff changeset
4280 (put 'custom-mode 'mode-class 'special)
2109c5fb0c3f (custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents: 32883
diff changeset
4281
28130
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4282 (add-to-list
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4283 'debug-ignored-errors
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4284 "^No user options have changed defaults in recent Emacs versions$")
e419308bcc0c Doc fixes.
Dave Love <fx@gnu.org>
parents: 27250
diff changeset
4285
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4286 ;;; The End.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4287
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4288 (provide 'cus-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4289
59759
c8a0d09474af (customize-group-other-window, custom-buffer-create-other-window):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 59434
diff changeset
4290 ;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
4291 ;;; cus-edit.el ends here