annotate lisp/cus-edit.el @ 416:ebe98a74bd68 r21-2-16

Import from CVS: tag r21-2-16
author cvs
date Mon, 13 Aug 2007 11:22:23 +0200
parents 697ef44129c6
children 95016f13131a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; cus-edit.el --- Tools for customizating Emacs and Lisp packages.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2 ;;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
6 ;; Maintainer: Hrvoje Niksic <hniksic@srce.hr>
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 ;; Keywords: help, faces
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8 ;; Version: 1.9960-x
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 ;; GNU General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30 ;; This file implements the code to create and edit customize buffers.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32 ;; See `custom.el'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34 ;; No commands should have names starting with `custom-' because
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ;; that interferes with completion. Use `customize-' for commands
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36 ;; that the user will run with M-x, and `Custom-' for interactive commands.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
38 ;; NOTE: In many places within this file we use `mapatoms', which is
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
39 ;; very slow in an average XEmacs because of the large number of
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
40 ;; symbols requiring a large number of funcalls -- XEmacs with Gnus
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
41 ;; can grow to some 17000 symbols without ever doing anything fancy.
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
42 ;; It would probably pay off to make a hash table of symbols known to
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
43 ;; Custom, similar to custom-group-hash-table.
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
44
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
45 ;; This is not top priority, because none of the functions that do
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
46 ;; mapatoms are speed-critical (the one that was now uses
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
47 ;; custom-group-hash-table), but it would be nice to have.
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
48
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52 (require 'cus-face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53 (require 'wid-edit)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54 (require 'easymenu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 (require 'cus-load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57 (require 'cus-start)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 ;; Huh? This looks dirty!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 (put 'custom-define-hook 'custom-type 'hook)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61 (put 'custom-define-hook 'standard-value '(nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 ;;; Customization Groups.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66 (defgroup emacs nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67 "Customization of the One True Editor."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 :link '(custom-manual "(XEmacs)Top"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 ;; Most of these groups are stolen from `finder.el',
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 (defgroup editing nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 "Basic text editing facilities."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75 (defgroup matching nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 "Various sorts of searching and matching."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77 :group 'editing)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
79 (defgroup emulations nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 "Emulations of other editors."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81 :group 'editing)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 (defgroup outlines nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 "Support for hierarchical outlining."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85 :group 'editing)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
87 (defgroup external nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 "Interfacing to external utilities."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91 (defgroup bib nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 "Code related to the `bib' bibliography processor."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 :tag "Bibliography"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 :group 'external)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96 (defgroup programming nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 "Support for programming in other languages."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 (defgroup languages nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 "Specialized modes for editing programming languages."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 :group 'programming)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
104 ;; #### This should be in cc-vars.el
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 (defgroup c nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106 "Support for the C language and related languages."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 :group 'languages)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109 (defgroup tools nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110 "Programming tools."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 :group 'programming)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
112
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 (defgroup oop nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114 "Support for object-oriented programming."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115 :group 'programming)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 (defgroup applications nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118 "Applications written in Emacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
121 ;; #### This should be in calendar.el
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122 (defgroup calendar nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123 "Calendar and time management support."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124 :group 'applications)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 (defgroup mail nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 "Modes for electronic-mail handling."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128 :group 'applications)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130 (defgroup news nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 "Support for netnews reading and posting."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132 :group 'applications)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 (defgroup games nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 "Games, jokes and amusements."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 :group 'applications)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 (defgroup development nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139 "Support for further development of Emacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 (defgroup docs nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143 "Support for Emacs documentation."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 :group 'development)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 (defgroup extensions nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147 "Emacs Lisp language extensions."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 :group 'development)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 (defgroup internal nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151 "Code for Emacs internals, build process, defaults."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 :group 'development)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154 (defgroup maint nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155 "Maintenance aids for the Emacs development group."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156 :tag "Maintenance"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157 :group 'development)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 (defgroup environment nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160 "Fitting Emacs with its environment."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
163 (defgroup comm nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 "Communications, networking, remote access to files."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165 :tag "Communication"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
166 :group 'environment)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
167
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
168 (defgroup hardware nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
169 "Support for interfacing with exotic hardware."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
170 :group 'environment)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
171
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
172 (defgroup terminals nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
173 "Support for terminal types."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
174 :group 'environment)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
175
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
176 (defgroup unix nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
177 "Front-ends/assistants for, or emulators of, UNIX features."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 :group 'environment)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180 (defgroup i18n nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181 "Internationalization and alternate character-set support."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182 :group 'environment
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
183 :group 'editing)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
184
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
185 (defgroup data nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
186 "Support editing files of data."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
187 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
188
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
189 (defgroup wp nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
190 "Word processing."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
191 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
192
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
193 (defgroup tex nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
194 "Code related to the TeX formatter."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
195 :group 'wp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
196
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
197 (defgroup hypermedia nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
198 "Support for links between text or other media types."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
199 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
200
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
201 (defgroup local nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
202 "Code local to your site."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
203 :group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
204
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
205 (defgroup customize '((widgets custom-group))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
206 "Customization of the Customization support."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
207 :link '(custom-manual "(custom)Top")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
208 :link '(url-link :tag "Development Page"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
209 "http://www.dina.kvl.dk/~abraham/custom/")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
210 :prefix "custom-"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
211 :group 'help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
212
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
213 (defgroup custom-faces nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
214 "Faces used by customize."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
215 :group 'customize
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
216 :group 'faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
217
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
218 (defgroup custom-browse nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
219 "Control customize browser."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
220 :prefix "custom-"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
221 :group 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
222
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
223 (defgroup custom-buffer nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
224 "Control customize buffers."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
225 :prefix "custom-"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
226 :group 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
227
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
228 (defgroup custom-menu nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
229 "Control customize menus."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
230 :prefix "custom-"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
231 :group 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
232
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
233 (defgroup alloc nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
234 "Storage allocation and gc for GNU Emacs Lisp interpreter."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
235 :tag "Storage Allocation"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
236 :group 'internal)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
237
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
238 (defgroup undo nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
239 "Undoing changes in buffers."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
240 :group 'editing)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
241
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
242 (defgroup editing-basics nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
243 "Most basic editing facilities."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
244 :group 'editing)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
245
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
246 (defgroup display nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
247 "How characters are displayed in buffers."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
248 :group 'environment)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
249
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
250 (defgroup installation nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
251 "The Emacs installation."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
252 :group 'environment)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
253
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
254 (defgroup limits nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
255 "Internal Emacs limits."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
256 :group 'internal)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
257
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
258 (defgroup debug nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
259 "Debugging Emacs itself."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
260 :group 'development)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
261
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
262 (defgroup mule nil
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
263 "Mule XEmacs internationalization."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
264 :group 'i18n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
265
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
266
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
267 ;;; Utilities.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
268
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
269 (defun custom-quote (sexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
270 "Quote SEXP iff it is not self quoting."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
271 (if (or (memq sexp '(t nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
272 (keywordp sexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
273 (eq (car-safe sexp) 'lambda)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
274 (stringp sexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
275 (numberp sexp)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
276 (characterp sexp)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
277 (vectorp sexp)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
278 (bit-vector-p sexp))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
279 sexp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
280 (list 'quote sexp)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
281
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
282 (defun custom-split-regexp-maybe (regexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
283 "If REGEXP is a string, split it to a list at `\\|'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
284 You can get the original back with from the result with:
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
285 (mapconcat #'identity result \"\\|\")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
286
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
287 IF REGEXP is not a string, return it unchanged."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
288 (if (stringp regexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
289 (split-string regexp "\\\\|")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
290 regexp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
291
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
292 (defun custom-variable-prompt ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
293 ;; Code stolen from `help.el'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
294 "Prompt for a variable, defaulting to the variable at point.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
295 Return a list suitable for use in `interactive'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
296 (let ((v (variable-at-point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
297 (enable-recursive-minibuffers t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
298 val)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
299 (setq val (completing-read
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
300 (if (symbolp v)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
301 (format "Customize variable: (default %s) " v)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
302 "Customize variable: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
303 obarray (lambda (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
304 (and (boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
305 (or (get symbol 'custom-type)
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
306 (user-variable-p symbol)))) t))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
307 (list (if (equal val "")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
308 (if (symbolp v) v nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
309 (intern val)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
310
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
311 ;; Here we take not only the actual groups, but the loads, too.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
312 (defun custom-group-prompt (prompt)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
313 "Read group from minibuffer."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
314 (let ((completion-ignore-case t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
315 (list (completing-read
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
316 prompt obarray
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
317 (lambda (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
318 (or (get symbol 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
319 (get symbol 'custom-loads)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
320 t))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
321
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
322 (defun custom-menu-filter (menu widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
323 "Convert MENU to the form used by `widget-choose'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
324 MENU should be in the same format as `custom-variable-menu'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
325 WIDGET is the widget to apply the filter entries of MENU on."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
326 (let ((result nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
327 current name action filter)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
328 (while menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
329 (setq current (car menu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
330 name (nth 0 current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
331 action (nth 1 current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
332 filter (nth 2 current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
333 menu (cdr menu))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
334 (if (or (null filter) (funcall filter widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
335 (push (cons name action) result)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
336 (push name result)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
337 (nreverse result)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
338
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
339
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
340 ;;; Unlispify.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
341
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
342 (defvar custom-prefix-list nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
343 "List of prefixes that should be ignored by `custom-unlispify'")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
344
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
345 (defcustom custom-unlispify-menu-entries t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
346 "Display menu entries as words instead of symbols if non nil."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
347 :group 'custom-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
348 :type 'boolean)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
349
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
350 (defcustom custom-unlispify-remove-prefixes t
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
351 "Non-nil means remove group prefixes from option names in buffers and menus.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
352 This only has an effect when `custom-unlispify-tag-names' or
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
353 `custom-unlispify-menu-entries' is on."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
354 :group 'custom-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
355 :type 'boolean)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
356
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
357 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
358 "Convert symbol into a menu entry."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
359 (cond ((not custom-unlispify-menu-entries)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
360 (symbol-name symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
361 ((get symbol 'custom-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
362 (if no-suffix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
363 (get symbol 'custom-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
364 (concat (get symbol 'custom-tag) "...")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
365 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
366 (with-current-buffer (get-buffer-create " *Custom-Work*")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
367 (erase-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
368 (princ symbol (current-buffer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
369 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
370 (when (and (eq (get symbol 'custom-type) 'boolean)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
371 (re-search-forward "-p\\'" nil t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
372 (replace-match "" t t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
373 (goto-char (point-min)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
374 (when custom-unlispify-remove-prefixes
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
375 (let ((prefixes custom-prefix-list)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
376 prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
377 (while prefixes
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
378 (setq prefix (car prefixes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
379 (if (search-forward prefix (+ (point) (length prefix)) t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
380 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
381 (setq prefixes nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
382 (delete-region (point-min) (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
383 (setq prefixes (cdr prefixes))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
384 (subst-char-in-region (point-min) (point-max) ?- ?\ t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
385 (capitalize-region (point-min) (point-max))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
386 (unless no-suffix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
387 (goto-char (point-max))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
388 (insert "..."))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
389 (buffer-string)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
390
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
391 (defcustom custom-unlispify-tag-names t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
392 "Display tag names as words instead of symbols if non nil."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
393 :group 'custom-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
394 :type 'boolean)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
395
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
396 (defun custom-unlispify-tag-name (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
397 "Convert symbol into a menu entry."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
398 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
399 (custom-unlispify-menu-entry symbol t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
400
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
401 (defun custom-prefix-add (symbol prefixes)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
402 ;; Addd SYMBOL to list of ignored PREFIXES.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
403 (cons (or (get symbol 'custom-prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
404 (concat (symbol-name symbol) "-"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
405 prefixes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
406
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
407
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
408 ;;; Guess.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
409
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
410 (defcustom custom-guess-name-alist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
411 '(("-p\\'" boolean)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
412 ("-hooks?\\'" hook)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
413 ("-face\\'" face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
414 ("-file\\'" file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
415 ("-function\\'" function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
416 ("-functions\\'" (repeat function))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
417 ("-list\\'" (repeat sexp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
418 ("-alist\\'" (repeat (cons sexp sexp))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
419 "Alist of (MATCH TYPE).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
420
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
421 MATCH should be a regexp matching the name of a symbol, and TYPE should
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
422 be a widget suitable for editing the value of that symbol. The TYPE
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
423 of the first entry where MATCH matches the name of the symbol will be
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
424 used.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
425
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
426 This is used for guessing the type of variables not declared with
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
427 customize."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
428 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
429 :group 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
430
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
431 (defcustom custom-guess-doc-alist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
432 '(("\\`\\*?Non-nil " boolean))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
433 "Alist of (MATCH TYPE).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
434
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
435 MATCH should be a regexp matching a documentation string, and TYPE
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
436 should be a widget suitable for editing the value of a variable with
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
437 that documentation string. The TYPE of the first entry where MATCH
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
438 matches the name of the symbol will be used.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
439
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
440 This is used for guessing the type of variables not declared with
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
441 customize."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
442 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
443 :group 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
444
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
445 (defun custom-guess-type (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
446 "Guess a widget suitable for editing the value of SYMBOL.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
447 This is done by matching SYMBOL with `custom-guess-name-alist' and
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
448 if that fails, the doc string with `custom-guess-doc-alist'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
449 (let ((name (symbol-name symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
450 (names custom-guess-name-alist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
451 current found)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
452 (while names
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
453 (setq current (car names)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
454 names (cdr names))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
455 (when (string-match (nth 0 current) name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
456 (setq found (nth 1 current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
457 names nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
458 (unless found
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
459 (let ((doc (documentation-property symbol 'variable-documentation))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
460 (docs custom-guess-doc-alist))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
461 (when doc
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
462 (while docs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
463 (setq current (car docs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
464 docs (cdr docs))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
465 (when (string-match (nth 0 current) doc)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
466 (setq found (nth 1 current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
467 docs nil))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
468 found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
469
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
470
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
471 ;;; Sorting.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
472
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
473 (defcustom custom-browse-sort-alphabetically nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
474 "If non-nil, sort members of each customization group alphabetically."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
475 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
476 :group 'custom-browse)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
477
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
478 (defcustom custom-browse-order-groups nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
479 "If non-nil, order group members within each customization group.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
480 If `first', order groups before non-groups.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
481 If `last', order groups after non-groups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
482 :type '(choice (const first)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
483 (const last)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
484 (const :tag "none" nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
485 :group 'custom-browse)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
486
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
487 (defcustom custom-browse-only-groups nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
488 "If non-nil, show group members only within each customization group."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
489 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
490 :group 'custom-browse)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
491
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
492 (defcustom custom-buffer-sort-alphabetically nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
493 "If non-nil, sort members of each customization group alphabetically."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
494 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
495 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
496
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
497 (defcustom custom-buffer-order-groups 'last
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
498 "If non-nil, order group members within each customization group.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
499 If `first', order groups before non-groups.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
500 If `last', order groups after non-groups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
501 :type '(choice (const first)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
502 (const last)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
503 (const :tag "none" nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
504 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
505
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
506 (defcustom custom-menu-sort-alphabetically nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
507 "If non-nil, sort members of each customization group alphabetically."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
508 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
509 :group 'custom-menu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
510
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
511 (defcustom custom-menu-order-groups 'first
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
512 "If non-nil, order group members within each customization group.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
513 If `first', order groups before non-groups.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
514 If `last', order groups after non-groups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
515 :type '(choice (const first)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
516 (const last)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
517 (const :tag "none" nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
518 :group 'custom-menu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
519
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
520 (defun custom-sort-items (items sort-alphabetically order-groups)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
521 "Return a sorted copy of ITEMS.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
522 ITEMS should be a `custom-group' property.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
523 If SORT-ALPHABETICALLY non-nil, sort alphabetically.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
524 If ORDER-GROUPS is `first' order groups before non-groups, if `last' order
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
525 groups after non-groups, if nil do not order groups at all."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
526 (sort (copy-sequence items)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
527 (lambda (a b)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
528 (let ((typea (nth 1 a)) (typeb (nth 1 b))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
529 (namea (symbol-name (nth 0 a))) (nameb (symbol-name (nth 0 b))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
530 (cond ((not order-groups)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
531 ;; Since we don't care about A and B order, maybe sort.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
532 (when sort-alphabetically
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
533 (string-lessp namea nameb)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
534 ((eq typea 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
535 ;; If B is also a group, maybe sort. Otherwise, order A and B.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
536 (if (eq typeb 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
537 (when sort-alphabetically
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
538 (string-lessp namea nameb))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
539 (eq order-groups 'first)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
540 ((eq typeb 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
541 ;; Since A cannot be a group, order A and B.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
542 (eq order-groups 'last))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
543 (sort-alphabetically
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
544 ;; Since A and B cannot be groups, sort.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
545 (string-lessp namea nameb)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
546
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
547
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
548 ;;; Custom Mode Commands.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
549
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
550 (defvar custom-options nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
551 "Customization widgets in the current buffer.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
552
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
553 (defun Custom-set ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
554 "Set changes in all modified options."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
555 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
556 (let ((children custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
557 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
558 (when (eq (widget-get child :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
559 (widget-apply child :custom-set)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
560 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
561
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
562 (defun Custom-save ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
563 "Set all modified group members and save them."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
564 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
565 (let ((children custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
566 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
567 (when (memq (widget-get child :custom-state) '(modified set))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
568 (widget-apply child :custom-save)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
569 children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
570 (custom-save-all))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
571
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
572 (defvar custom-reset-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
573 '(("Current" . Custom-reset-current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
574 ("Saved" . Custom-reset-saved)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
575 ("Standard Settings" . Custom-reset-standard))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
576 "Alist of actions for the `Reset' button.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
577 The key is a string containing the name of the action, the value is a
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
578 lisp function taking the widget as an element which will be called
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
579 when the action is chosen.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
580
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
581 (defun custom-reset (event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
582 "Select item from reset menu."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
583 (let* ((completion-ignore-case t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
584 (answer (widget-choose "Reset to"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
585 custom-reset-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
586 event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
587 (if answer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
588 (funcall answer))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
589
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
590 (defun Custom-reset-current (&rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
591 "Reset all modified group members to their current value."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
592 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
593 (let ((children custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
594 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
595 (when (eq (widget-get child :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
596 (widget-apply child :custom-reset-current)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
597 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
598
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
599 (defun Custom-reset-saved (&rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
600 "Reset all modified or set group members to their saved value."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
601 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
602 (let ((children custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
603 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
604 (when (eq (widget-get child :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
605 (widget-apply child :custom-reset-saved)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
606 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
607
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
608 (defun Custom-reset-standard (&rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
609 "Reset all modified, set, or saved group members to their standard settings."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
610 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
611 (let ((children custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
612 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
613 (when (eq (widget-get child :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
614 (widget-apply child :custom-reset-standard)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
615 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
616
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
617
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
618 ;;; The Customize Commands
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
619
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
620 (defun custom-prompt-variable (prompt-var prompt-val)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
621 "Prompt for a variable and a value and return them as a list.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
622 PROMPT-VAR is the prompt for the variable, and PROMPT-VAL is the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
623 prompt for the value. The %s escape in PROMPT-VAL is replaced with
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
624 the name of the variable.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
625
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
626 If the variable has a `variable-interactive' property, that is used as if
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
627 it were the arg to `interactive' (which see) to interactively read the value.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
628
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
629 If the variable has a `custom-type' property, it must be a widget and the
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
630 `:prompt-value' property of that widget will be used for reading the value."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
631 (let* ((var (read-variable prompt-var))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
632 (minibuffer-help-form '(describe-variable var)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
633 (list var
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
634 (let ((prop (get var 'variable-interactive))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
635 (type (get var 'custom-type))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
636 (prompt (format prompt-val var)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
637 (unless (listp type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
638 (setq type (list type)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
639 (cond (prop
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
640 ;; Use VAR's `variable-interactive' property
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
641 ;; as an interactive spec for prompting.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
642 (call-interactively (list 'lambda '(arg)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
643 (list 'interactive prop)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
644 'arg)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
645 (type
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
646 (widget-prompt-value type
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
647 prompt
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
648 (if (boundp var)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
649 (symbol-value var))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
650 (not (boundp var))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
651 (t
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
652 (eval-minibuffer prompt)))))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
653
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
654 ;;;###autoload
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
655 (defun customize-set-value (var val)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
656 "Set VARIABLE to VALUE. VALUE is a Lisp object.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
657
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
658 If VARIABLE has a `variable-interactive' property, that is used as if
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
659 it were the arg to `interactive' (which see) to interactively read the value.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
660
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
661 If VARIABLE has a `custom-type' property, it must be a widget and the
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
662 `:prompt-value' property of that widget will be used for reading the value."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
663 (interactive (custom-prompt-variable "Set variable: "
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
664 "Set %s to value: "))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
665
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
666 (set var val))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
667
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
668 ;;;###autoload
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
669 (defun customize-set-variable (var val)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
670 "Set the default for VARIABLE to VALUE. VALUE is a Lisp object.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
671
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
672 If VARIABLE has a `custom-set' property, that is used for setting
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
673 VARIABLE, otherwise `set-default' is used.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
674
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
675 The `customized-value' property of the VARIABLE will be set to a list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
676 with a quoted VALUE as its sole list member.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
677
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
678 If VARIABLE has a `variable-interactive' property, that is used as if
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
679 it were the arg to `interactive' (which see) to interactively read the value.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
680
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
681 If VARIABLE has a `custom-type' property, it must be a widget and the
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
682 `:prompt-value' property of that widget will be used for reading the value. "
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
683 (interactive (custom-prompt-variable "Set variable: "
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
684 "Set customized value for %s to: "))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
685 (funcall (or (get var 'custom-set) 'set-default) var val)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
686 (put var 'customized-value (list (custom-quote val))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
687
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
688 ;;;###autoload
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
689 (defun customize-save-variable (var val)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
690 "Set the default for VARIABLE to VALUE, and save it for future sessions.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
691 If VARIABLE has a `custom-set' property, that is used for setting
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
692 VARIABLE, otherwise `set-default' is used.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
693
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
694 The `customized-value' property of the VARIABLE will be set to a list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
695 with a quoted VALUE as its sole list member.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
696
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
697 If VARIABLE has a `variable-interactive' property, that is used as if
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
698 it were the arg to `interactive' (which see) to interactively read the value.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
699
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
700 If VARIABLE has a `custom-type' property, it must be a widget and the
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
701 `:prompt-value' property of that widget will be used for reading the value. "
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
702 (interactive (custom-prompt-variable "Set and ave variable: "
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
703 "Set and save value for %s as: "))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
704 (funcall (or (get var 'custom-set) 'set-default) var val)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
705 (put var 'saved-value (list (custom-quote val)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
706 (custom-save-all))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
707
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
708 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
709 (defun customize (group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
710 "Select a customization buffer which you can use to set user options.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
711 User options are structured into \"groups\".
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
712 The default group is `Emacs'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
713 (interactive (custom-group-prompt
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
714 "Customize group: (default emacs) "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
715 (when (stringp group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
716 (if (string-equal "" group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
717 (setq group 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
718 (setq group (intern group))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
719 (let ((name (format "*Customize Group: %s*"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
720 (custom-unlispify-tag-name group))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
721 (if (get-buffer name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
722 (switch-to-buffer name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
723 (custom-buffer-create (list (list group 'custom-group))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
724 name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
725 (concat " for group "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
726 (custom-unlispify-tag-name group))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
727
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
728 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
729 (defalias 'customize-group 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
730
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
731 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
732 (defun customize-other-window (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
733 "Customize SYMBOL, which must be a customization group."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
734 (interactive (custom-group-prompt
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
735 "Customize group: (default emacs) "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
736 (when (stringp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
737 (if (string-equal "" symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
738 (setq symbol 'emacs)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
739 (setq symbol (intern symbol))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
740 (custom-buffer-create-other-window
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
741 (list (list symbol 'custom-group))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
742 (format "*Customize Group: %s*" (custom-unlispify-tag-name symbol))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
743
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
744 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
745 (defalias 'customize-group-other-window 'customize-other-window)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
746
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
747 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
748 (defalias 'customize-option 'customize-variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
749
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
750 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
751 (defun customize-variable (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
752 "Customize SYMBOL, which must be a user option variable."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
753 (interactive (custom-variable-prompt))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
754 (custom-buffer-create (list (list symbol 'custom-variable))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
755 (format "*Customize Variable: %s*"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
756 (custom-unlispify-tag-name symbol))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
757
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
758 ;;;###autoload
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
759 (defun customize-changed-options (since-version)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
760 "Customize all user option variables whose default values changed recently.
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
761 This means, in other words, variables defined with a `:version' keyword."
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
762 (interactive "sCustomize options changed, since version (default all versions): ")
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
763 (if (equal since-version "")
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
764 (setq since-version nil))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
765 (let ((found nil))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
766 (mapatoms (lambda (symbol)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
767 (and (boundp symbol)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
768 (let ((version (get symbol 'custom-version)))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
769 (and version
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
770 (or (null since-version)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
771 (customize-version-lessp since-version version))))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
772 (push (list symbol 'custom-variable) found))))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
773 (unless found
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
774 (error "No user options have changed defaults %s"
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
775 (if since-version
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
776 (format "since XEmacs %s" since-version)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
777 "in recent Emacs versions")))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
778 (custom-buffer-create (custom-sort-items found t nil)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
779 "*Customize Changed Options*")))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
780
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
781 (defun customize-version-lessp (version1 version2)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
782 (let (major1 major2 minor1 minor2)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
783 (string-match "\\([0-9]+\\)[.]\\([0-9]+\\)" version1)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
784 (setq major1 (read (match-string 1 version1)))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
785 (setq minor1 (read (match-string 2 version1)))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
786 (string-match "\\([0-9]+\\)[.]\\([0-9]+\\)" version2)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
787 (setq major2 (read (match-string 1 version2)))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
788 (setq minor2 (read (match-string 2 version2)))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
789 (or (< major1 major2)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
790 (and (= major1 major2)
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
791 (< minor1 minor2)))))
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
792
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 219
diff changeset
793 ;;;###autoload
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
794 (defalias 'customize-variable-other-window 'customize-option-other-window)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
795
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
796 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
797 (defun customize-option-other-window (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
798 "Customize SYMBOL, which must be a user option variable.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
799 Show the buffer in another window, but don't select it."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
800 (interactive (custom-variable-prompt))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
801 (custom-buffer-create-other-window
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
802 (list (list symbol 'custom-variable))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
803 (format "*Customize Option: %s*" (custom-unlispify-tag-name symbol))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
804
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
805 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
806 (defun customize-face (&optional symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
807 "Customize SYMBOL, which should be a face name or nil.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
808 If SYMBOL is nil, customize all faces."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
809 (interactive (list (completing-read "Customize face: (default all) "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
810 obarray 'find-face)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
811 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
812 (custom-buffer-create (custom-sort-items
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
813 (mapcar (lambda (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
814 (list symbol 'custom-face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
815 (face-list))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
816 t nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
817 "*Customize Faces*")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
818 (when (stringp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
819 (setq symbol (intern symbol)))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
820 (check-argument-type 'symbolp symbol)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
821 (custom-buffer-create (list (list symbol 'custom-face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
822 (format "*Customize Face: %s*"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
823 (custom-unlispify-tag-name symbol)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
824
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
825 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
826 (defun customize-face-other-window (&optional symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
827 "Show customization buffer for FACE in other window."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
828 (interactive (list (completing-read "Customize face: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
829 obarray 'find-face)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
830 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
831 ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
832 (if (stringp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
833 (setq symbol (intern symbol)))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
834 (check-argument-type 'symbolp symbol)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
835 (custom-buffer-create-other-window
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
836 (list (list symbol 'custom-face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
837 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
838
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
839 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
840 (defun customize-customized ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
841 "Customize all user options set since the last save in this session."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
842 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
843 (let ((found nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
844 (mapatoms (lambda (symbol)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
845 (and (get symbol 'customized-face)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
846 (find-face symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
847 (push (list symbol 'custom-face) found))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
848 (and (get symbol 'customized-value)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
849 (boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
850 (push (list symbol 'custom-variable) found))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
851 (if (not found)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
852 (error "No customized user options")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
853 (custom-buffer-create (custom-sort-items found t nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
854 "*Customize Customized*"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
855
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
856 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
857 (defun customize-saved ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
858 "Customize all already saved user options."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
859 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
860 (let ((found nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
861 (mapatoms (lambda (symbol)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
862 (and (get symbol 'saved-face)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
863 (find-face symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
864 (push (list symbol 'custom-face) found))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
865 (and (get symbol 'saved-value)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
866 (boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
867 (push (list symbol 'custom-variable) found))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
868 (if (not found )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
869 (error "No saved user options")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
870 (custom-buffer-create (custom-sort-items found t nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
871 "*Customize Saved*"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
872
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
873 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
874 (defun customize-apropos (regexp &optional all)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
875 "Customize all user options matching REGEXP.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
876 If ALL is `options', include only options.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
877 If ALL is `faces', include only faces.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
878 If ALL is `groups', include only groups.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
879 If ALL is t (interactively, with prefix arg), include options which are not
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
880 user-settable, as well as faces and groups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
881 (interactive "sCustomize regexp: \nP")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
882 (let ((found nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
883 (mapatoms (lambda (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
884 (when (string-match regexp (symbol-name symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
885 (when (and (not (memq all '(faces options)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
886 (get symbol 'custom-group))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
887 (push (list symbol 'custom-group) found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
888 (when (and (not (memq all '(options groups)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
889 (find-face symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
890 (push (list symbol 'custom-face) found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
891 (when (and (not (memq all '(groups faces)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
892 (boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
893 (or (get symbol 'saved-value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
894 (get symbol 'standard-value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
895 (if (memq all '(nil options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
896 (user-variable-p symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
897 (get symbol 'variable-documentation))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
898 (push (list symbol 'custom-variable) found)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
899 (if (not found)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
900 (error "No matches")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
901 (custom-buffer-create (custom-sort-items found t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
902 custom-buffer-order-groups)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
903 "*Customize Apropos*"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
904
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
905 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
906 (defun customize-apropos-options (regexp &optional arg)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
907 "Customize all user options matching REGEXP.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
908 With prefix arg, include options which are not user-settable."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
909 (interactive "sCustomize regexp: \nP")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
910 (customize-apropos regexp (or arg 'options)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
911
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
912 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
913 (defun customize-apropos-faces (regexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
914 "Customize all user faces matching REGEXP."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
915 (interactive "sCustomize regexp: \n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
916 (customize-apropos regexp 'faces))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
917
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
918 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
919 (defun customize-apropos-groups (regexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
920 "Customize all user groups matching REGEXP."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
921 (interactive "sCustomize regexp: \n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
922 (customize-apropos regexp 'groups))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
923
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
924
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
925 ;;; Buffer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
926
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
927 (defcustom custom-buffer-style 'links
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
928 "*Control the presentation style for customization buffers.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
929 The value should be a symbol, one of:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
930
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
931 brackets: groups nest within each other with big horizontal brackets.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
932 links: groups have links to subgroups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
933 :type '(radio (const :tag "brackets: Groups nest within each others" brackets)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
934 (const :tag "links: Group have links to subgroups" links))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
935 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
936
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
937 (defcustom custom-buffer-done-function 'kill-buffer
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
938 "*Function to be used to remove the buffer when the user is done with it.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
939 Choices include `kill-buffer' (the default) and `bury-buffer'.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
940 The function will be called with one argument, the buffer to remove."
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
941 :type '(radio (function-item kill-buffer)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
942 (function-item bury-buffer)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
943 (function :tag "Other" nil))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
944 :group 'custom-buffer)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
945
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
946 (defcustom custom-buffer-indent 3
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
947 "Number of spaces to indent nested groups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
948 :type 'integer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
949 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
950
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
951 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
952 (defun custom-buffer-create (options &optional name description)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
953 "Create a buffer containing OPTIONS.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
954 Optional NAME is the name of the buffer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
955 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
956 SYMBOL is a customization option, and WIDGET is a widget for editing
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
957 that option."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
958 (unless name (setq name "*Customization*"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
959 (kill-buffer (get-buffer-create name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
960 (switch-to-buffer (get-buffer-create name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
961 (custom-buffer-create-internal options description))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
962
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
963 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
964 (defun custom-buffer-create-other-window (options &optional name description)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
965 "Create a buffer containing OPTIONS.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
966 Optional NAME is the name of the buffer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
967 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
968 SYMBOL is a customization option, and WIDGET is a widget for editing
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
969 that option."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
970 (unless name (setq name "*Customization*"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
971 (kill-buffer (get-buffer-create name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
972 (let ((window (selected-window)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
973 (switch-to-buffer-other-window (get-buffer-create name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
974 (custom-buffer-create-internal options description)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
975 (select-window window)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
976
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
977 (defcustom custom-reset-button-menu t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
978 "If non-nil, only show a single reset button in customize buffers.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
979 This button will have a menu with all three reset operations."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
980 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
981 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
982
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
983 (defconst custom-skip-messages 5)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
984
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
985 (defun Custom-buffer-done ()
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
986 "Remove current buffer.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
987 This works by calling the function specified by
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
988 `custom-buffer-done-function'."
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
989 (interactive)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
990 (funcall custom-buffer-done-function (current-buffer)))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
991
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
992 (defun custom-buffer-create-buttons ()
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
993 (message "Creating customization buttons...")
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
994 (widget-insert "\nOperate on everything in this buffer:\n ")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
995 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
996 :tag "Set"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
997 :tag-glyph '("set-up" "set-down")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
998 :help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
999 Make your editing in this buffer take effect for this session"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1000 :action (lambda (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1001 (Custom-set)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1002 (widget-insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1003 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1004 :tag "Save"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1005 :tag-glyph '("save-up" "save-down")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1006 :help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1007 Make your editing in this buffer take effect for future Emacs sessions"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1008 :action (lambda (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1009 (Custom-save)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1010 (if custom-reset-button-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1011 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1012 (widget-insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1013 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1014 :tag "Reset"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1015 :tag-glyph '("reset-up" "reset-down")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1016 :help-echo "Show a menu with reset operations"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1017 :mouse-down-action (lambda (&rest junk) t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1018 :action (lambda (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1019 (custom-reset event))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1020 (widget-insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1021 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1022 :tag "Reset"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1023 :help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1024 Reset all edited text in this buffer to reflect current values"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1025 :action 'Custom-reset-current)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1026 (widget-insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1027 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1028 :tag "Reset to Saved"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1029 :help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1030 Reset all values in this buffer to their saved settings"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1031 :action 'Custom-reset-saved)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1032 (widget-insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1033 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1034 :tag "Reset to Standard"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1035 :help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1036 Reset all values in this buffer to their standard settings"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1037 :action 'Custom-reset-standard))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1038 (widget-insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1039 (widget-create 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1040 :tag "Done"
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1041 :tag-glyph '("done-up" "done-down")
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1042 :help-echo "Remove the buffer"
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1043 :action (lambda (widget &optional event)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1044 (Custom-buffer-done)))
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1045 (widget-insert "\n"))
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1046
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1047 (defcustom custom-novice t
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1048 "If non-nil, show help message at top of customize buffers."
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1049 :type 'boolean
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1050 :group 'custom-buffer)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1051
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1052 (defcustom custom-display-global-buttons 'top
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1053 "If `nil' don't display the global buttons. If `top' display at the
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1054 beginning of custom buffers. If `bottom', display at the end."
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1055 :type '(choice (const top)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1056 (const bottom)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1057 (const :tag "don't" nil))
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1058 :group 'custom-buffer)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1059
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1060 (defun custom-buffer-create-internal (options &optional description)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1061 (message "Creating customization buffer...")
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1062 (custom-mode)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1063 (widget-insert "This is a customization buffer")
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1064 (if description
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1065 (widget-insert description))
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1066 (when custom-novice
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1067 (widget-insert ".\n\
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1068 Type RET or click button2 on an active field to invoke its action.
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1069 Invoke ")
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1070 (widget-create 'info-link
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1071 :tag "Help"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1072 :help-echo "Read the online help"
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1073 "(XEmacs)Easy Customization")
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1074 (widget-insert " for more information."))
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1075 (widget-insert "\n")
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1076 (if (equal custom-display-global-buttons 'top)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1077 (custom-buffer-create-buttons))
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1078 (widget-insert "\n")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1079 (message "Creating customization items...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1080 (setq custom-options
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1081 (if (= (length options) 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1082 (mapcar (lambda (entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1083 (widget-create (nth 1 entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1084 :documentation-shown t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1085 :custom-state 'unknown
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1086 :tag (custom-unlispify-tag-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1087 (nth 0 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1088 :value (nth 0 entry)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1089 options)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1090 (let ((count 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1091 (length (length options)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1092 (mapcar (lambda (entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1093 (prog2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1094 (display-message
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1095 'progress
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1096 (format "Creating customization items %2d%%..."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1097 (/ (* 100.0 count) length)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1098 (widget-create (nth 1 entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1099 :tag (custom-unlispify-tag-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1100 (nth 0 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1101 :value (nth 0 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1102 (incf count)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1103 (unless (eq (preceding-char) ?\n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1104 (widget-insert "\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1105 (widget-insert "\n")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1106 options))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1107 (unless (eq (preceding-char) ?\n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1108 (widget-insert "\n"))
225
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1109 (if (equal custom-display-global-buttons 'bottom)
12579d965149 Import from CVS: tag r20-4b11
cvs
parents: 223
diff changeset
1110 (custom-buffer-create-buttons))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1111 (display-message 'progress
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1112 (format
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1113 "Creating customization items %2d%%...done" 100))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1114 (unless (eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1115 (mapc 'custom-magic-reset custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1116 (message "Creating customization setup...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1117 (widget-setup)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1118 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1119 (message "Creating customization buffer...done"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1120
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1121
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1122 ;;; The Tree Browser.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1123
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1124 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1125 (defun customize-browse (&optional group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1126 "Create a tree browser for the customize hierarchy."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1127 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1128 (unless group
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1129 (setq group 'emacs))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1130 (let ((name "*Customize Browser*"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1131 (kill-buffer (get-buffer-create name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1132 (switch-to-buffer (get-buffer-create name)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1133 (custom-mode)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1134 (widget-insert "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1135 Square brackets show active fields; type RET or click button2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1136 on an active field to invoke its action.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1137 Invoke [+] below to expand a group, and [-] to collapse an expanded group.\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1138 (if custom-browse-only-groups
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1139 (widget-insert "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1140 Invoke the [Group] button below to edit that item in another window.\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1141 (widget-insert "Invoke the ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1142 (widget-create 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1143 :format "%t"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1144 :tag "[Group]"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1145 :tag-glyph "folder")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1146 (widget-insert ", ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1147 (widget-create 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1148 :format "%t"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1149 :tag "[Face]"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1150 :tag-glyph "face")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1151 (widget-insert ", and ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1152 (widget-create 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1153 :format "%t"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1154 :tag "[Option]"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1155 :tag-glyph "option")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1156 (widget-insert " buttons below to edit that
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1157 item in another window.\n\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1158 (let ((custom-buffer-style 'tree))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1159 (widget-create 'custom-group
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1160 :custom-last t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1161 :custom-state 'unknown
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1162 :tag (custom-unlispify-tag-name group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1163 :value group))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
1164 (widget-add-change)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1165 (goto-char (point-min)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1166
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1167 (define-widget 'custom-browse-visibility 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1168 "Control visibility of of items in the customize tree browser."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1169 :format "%[[%t]%]"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1170 :action 'custom-browse-visibility-action)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1171
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1172 (defun custom-browse-visibility-action (widget &rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1173 (let ((custom-buffer-style 'tree))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1174 (custom-toggle-parent widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1175
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1176 (define-widget 'custom-browse-group-tag 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1177 "Show parent in other window when activated."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1178 :tag "Group"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1179 :tag-glyph "folder"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1180 :action 'custom-browse-group-tag-action)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1181
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1182 (defun custom-browse-group-tag-action (widget &rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1183 (let ((parent (widget-get widget :parent)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1184 (customize-group-other-window (widget-value parent))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1185
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1186 (define-widget 'custom-browse-variable-tag 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1187 "Show parent in other window when activated."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1188 :tag "Option"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1189 :tag-glyph "option"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1190 :action 'custom-browse-variable-tag-action)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1191
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1192 (defun custom-browse-variable-tag-action (widget &rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1193 (let ((parent (widget-get widget :parent)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1194 (customize-variable-other-window (widget-value parent))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1195
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1196 (define-widget 'custom-browse-face-tag 'push-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1197 "Show parent in other window when activated."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1198 :tag "Face"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1199 :tag-glyph "face"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1200 :action 'custom-browse-face-tag-action)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1201
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1202 (defun custom-browse-face-tag-action (widget &rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1203 (let ((parent (widget-get widget :parent)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1204 (customize-face-other-window (widget-value parent))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1205
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1206 (defconst custom-browse-alist '((" " "space")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1207 (" | " "vertical")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1208 ("-\\ " "top")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1209 (" |-" "middle")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1210 (" `-" "bottom")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1211
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1212 (defun custom-browse-insert-prefix (prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1213 "Insert PREFIX. On XEmacs convert it to line graphics."
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1214 ;; ### Unfinished.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1215 (if nil ; (string-match "XEmacs" emacs-version)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1216 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1217 (insert "*")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1218 (while (not (string-equal prefix ""))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1219 (let ((entry (substring prefix 0 3)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1220 (setq prefix (substring prefix 3))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1221 (let ((overlay (make-overlay (1- (point)) (point) nil t nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1222 (name (nth 1 (assoc entry custom-browse-alist))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1223 (overlay-put overlay 'end-glyph (widget-glyph-find name entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1224 (overlay-put overlay 'start-open t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1225 (overlay-put overlay 'end-open t)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1226 (insert prefix)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1227
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1228
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1229 ;;; Modification of Basic Widgets.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1230 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1231 ;; We add extra properties to the basic widgets needed here. This is
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1232 ;; fine, as long as we are careful to stay within out own namespace.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1233 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1234 ;; We want simple widgets to be displayed by default, but complex
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1235 ;; widgets to be hidden.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1236
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1237 (widget-put (get 'item 'widget-type) :custom-show t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1238 (widget-put (get 'editable-field 'widget-type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1239 :custom-show (lambda (widget value)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1240 ;; This used to call pp-to-string
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1241 (let ((pp (widget-prettyprint-to-string value)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1242 (cond ((string-match "\n" pp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1243 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1244 ((> (length pp) 40)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1245 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1246 (t t)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1247 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1248
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1249 ;;; The `custom-manual' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1250
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1251 (define-widget 'custom-manual 'info-link
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1252 "Link to the manual entry for this customization option."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1253 :tag "Manual")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1254
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1255 ;;; The `custom-magic' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1256
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1257 (defgroup custom-magic-faces nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1258 "Faces used by the magic button."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1259 :group 'custom-faces
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1260 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1261
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1262 (defface custom-invalid-face '((((class color))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1263 (:foreground "yellow" :background "red"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1264 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1265 (:bold t :italic t :underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1266 "Face used when the customize item is invalid."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1267 :group 'custom-magic-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1268
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1269 (defface custom-rogue-face '((((class color))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1270 (:foreground "pink" :background "black"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1271 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1272 (:underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1273 "Face used when the customize item is not defined for customization."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1274 :group 'custom-magic-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1275
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1276 (defface custom-modified-face '((((class color))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1277 (:foreground "white" :background "blue"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1278 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1279 (:italic t :bold)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1280 "Face used when the customize item has been modified."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1281 :group 'custom-magic-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1282
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1283 (defface custom-set-face '((((class color))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1284 (:foreground "blue" :background "white"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1285 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1286 (:italic t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1287 "Face used when the customize item has been set."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1288 :group 'custom-magic-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1289
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1290 (defface custom-changed-face '((((class color))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1291 (:foreground "white" :background "blue"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1292 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1293 (:italic t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1294 "Face used when the customize item has been changed."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1295 :group 'custom-magic-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1296
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1297 (defface custom-saved-face '((t (:underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1298 "Face used when the customize item has been saved."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1299 :group 'custom-magic-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1300
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1301 (defconst custom-magic-alist '((nil "#" underline "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1302 uninitialized, you should not see this.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1303 (unknown "?" italic "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1304 unknown, you should not see this.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1305 (hidden "-" default "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1306 hidden, invoke \"Show\" button in the previous line to show." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1307 group now hidden, invoke the above \"Show\" button to show contents.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1308 (invalid "x" custom-invalid-face "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1309 the value displayed for this %c is invalid and cannot be set.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1310 (modified "*" custom-modified-face "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1311 you have edited the value as text, but you have not set the %c." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1312 you have edited something in this group, but not set it.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1313 (set "+" custom-set-face "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1314 you have set this %c, but not saved it for future sessions." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1315 something in this group has been set, but not saved.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1316 (changed ":" custom-changed-face "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1317 this %c has been changed outside the customize buffer." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1318 something in this group has been changed outside customize.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1319 (saved "!" custom-saved-face "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1320 this %c has been set and saved." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1321 something in this group has been set and saved.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1322 (rogue "@" custom-rogue-face "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1323 this %c has not been changed with customize." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1324 something in this group is not prepared for customization.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1325 (standard " " nil "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1326 this %c is unchanged from its standard setting." "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1327 visible group members are all at standard settings."))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1328 "Alist of customize option states.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1329 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1330
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1331 STATE is one of the following symbols:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1332
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1333 `nil'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1334 For internal use, should never occur.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1335 `unknown'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1336 For internal use, should never occur.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1337 `hidden'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1338 This item is not being displayed.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1339 `invalid'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1340 This item is modified, but has an invalid form.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1341 `modified'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1342 This item is modified, and has a valid form.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1343 `set'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1344 This item has been set but not saved.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1345 `changed'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1346 The current value of this item has been changed temporarily.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1347 `saved'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1348 This item is marked for saving.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1349 `rogue'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1350 This item has no customization information.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1351 `standard'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1352 This item is unchanged from the standard setting.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1353
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1354 MAGIC is a string used to present that state.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1355
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1356 FACE is a face used to present the state.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1357
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1358 ITEM-DESC is a string describing the state for options.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1359
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1360 GROUP-DESC is a string describing the state for groups. If this is
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1361 left out, ITEM-DESC will be used.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1362
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1363 The string %c in either description will be replaced with the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1364 category of the item. These are `group'. `option', and `face'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1365
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1366 The list should be sorted most significant first.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1367
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1368 (defcustom custom-magic-show 'long
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1369 "If non-nil, show textual description of the state.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1370 If `long', show a full-line description, not just one word."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1371 :type '(choice (const :tag "no" nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1372 (const short)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1373 (const long))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1374 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1375
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1376 (defcustom custom-magic-show-hidden '(option face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1377 "Control whether the State button is shown for hidden items.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1378 The value should be a list with the custom categories where the State
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1379 button should be visible. Possible categories are `group', `option',
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1380 and `face'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1381 :type '(set (const group) (const option) (const face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1382 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1383
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1384 (defcustom custom-magic-show-button nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1385 "Show a \"magic\" button indicating the state of each customization option."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1386 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1387 :group 'custom-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1388
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1389 (define-widget 'custom-magic 'default
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1390 "Show and manipulate state for a customization option."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1391 :format "%v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1392 :action 'widget-parent-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1393 :notify 'ignore
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1394 :value-get 'ignore
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1395 :value-create 'custom-magic-value-create
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1396 :value-delete 'widget-children-value-delete)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1397
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1398 (defun widget-magic-mouse-down-action (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1399 ;; Non-nil unless hidden.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1400 (not (eq (widget-get (widget-get (widget-get widget :parent) :parent)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1401 :custom-state)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1402 'hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1403
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1404 (defun custom-magic-value-create (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1405 ;; Create compact status report for WIDGET.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1406 (let* ((parent (widget-get widget :parent))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1407 (state (widget-get parent :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1408 (hidden (eq state 'hidden))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1409 (entry (assq state custom-magic-alist))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1410 (magic (nth 1 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1411 (face (nth 2 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1412 (category (widget-get parent :custom-category))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1413 (text (or (and (eq category 'group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1414 (nth 4 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1415 (nth 3 entry)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1416 (form (widget-get parent :custom-form))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1417 children)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1418 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1419 (setq text (concat (match-string 1 text)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1420 (symbol-name category)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1421 (match-string 2 text))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1422 (when (and custom-magic-show
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1423 (or (not hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1424 (memq category custom-magic-show-hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1425 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1426 (when (and (eq category 'group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1427 (not (and (eq custom-buffer-style 'links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1428 (> (widget-get parent :custom-level) 1))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1429 (insert-char ?\ (* custom-buffer-indent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1430 (widget-get parent :custom-level))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1431 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1432 widget 'choice-item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1433 :help-echo "Change the state of this item"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1434 :format (if hidden "%t" "%[%t%]")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1435 :button-prefix 'widget-push-button-prefix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1436 :button-suffix 'widget-push-button-suffix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1437 :mouse-down-action 'widget-magic-mouse-down-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1438 :tag "State"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1439 ;;:tag-glyph (or hidden '("state-up" "state-down"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1440 )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1441 children)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1442 (insert ": ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1443 (let ((start (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1444 (if (eq custom-magic-show 'long)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1445 (insert text)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1446 (insert (symbol-name state)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1447 (cond ((eq form 'lisp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1448 (insert " (lisp)"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1449 ((eq form 'mismatch)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1450 (insert " (mismatch)")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1451 (put-text-property start (point) 'face 'custom-state-face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1452 (insert "\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1453 (when (and (eq category 'group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1454 (not (and (eq custom-buffer-style 'links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1455 (> (widget-get parent :custom-level) 1))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1456 (insert-char ?\ (* custom-buffer-indent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1457 (widget-get parent :custom-level))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1458 (when custom-magic-show-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1459 (when custom-magic-show
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1460 (let ((indent (widget-get parent :indent)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1461 (when indent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1462 (insert-char ?\ indent))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1463 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1464 widget 'choice-item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1465 :mouse-down-action 'widget-magic-mouse-down-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1466 :button-face face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1467 :button-prefix ""
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1468 :button-suffix ""
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1469 :help-echo "Change the state"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1470 :format (if hidden "%t" "%[%t%]")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1471 :tag (if (memq form '(lisp mismatch))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1472 (concat "(" magic ")")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1473 (concat "[" magic "]")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1474 children)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1475 (insert " "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1476 (widget-put widget :children children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1477
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1478 (defun custom-magic-reset (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1479 "Redraw the :custom-magic property of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1480 (let ((magic (widget-get widget :custom-magic)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1481 (widget-value-set magic (widget-value magic))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1482
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1483 ;;; The `custom' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1484
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1485 (defface custom-button-face '((t (:bold t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1486 "Face used for buttons in customization buffers."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1487 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1488
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1489 (defface custom-documentation-face nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1490 "Face used for documentation strings in customization buffers."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1491 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1492
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1493 (defface custom-state-face '((((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1494 (background dark))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1495 (:foreground "lime green"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1496 (((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1497 (background light))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1498 (:foreground "dark green"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1499 (t nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1500 "Face used for State descriptions in the customize buffer."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1501 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1502
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1503 (define-widget 'custom 'default
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1504 "Customize a user option."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1505 :format "%v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1506 :convert-widget 'custom-convert-widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1507 :notify 'custom-notify
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1508 :custom-prefix ""
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1509 :custom-level 1
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1510 :custom-state 'hidden
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1511 :documentation-property 'widget-subclass-responsibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1512 :value-create 'widget-subclass-responsibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1513 :value-delete 'widget-children-value-delete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1514 :value-get 'widget-value-value-get
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1515 :validate 'widget-children-validate
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1516 :match (lambda (widget value) (symbolp value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1517
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1518 (defun custom-convert-widget (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1519 ;; Initialize :value and :tag from :args in WIDGET.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1520 (let ((args (widget-get widget :args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1521 (when args
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1522 (widget-put widget :value (widget-apply widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1523 :value-to-internal (car args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1524 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1525 (widget-put widget :args nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1526 widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1527
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1528 (defun custom-notify (widget &rest args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1529 "Keep track of changes."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1530 (let ((state (widget-get widget :custom-state)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1531 (unless (eq state 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1532 (unless (memq state '(nil unknown hidden))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1533 (widget-put widget :custom-state 'modified))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1534 (custom-magic-reset widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1535 (apply 'widget-default-notify widget args))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1536
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1537 (defun custom-redraw (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1538 "Redraw WIDGET with current settings."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1539 (let ((line (count-lines (point-min) (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1540 (column (current-column))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1541 (pos (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1542 (from (marker-position (widget-get widget :from)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1543 (to (marker-position (widget-get widget :to))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1544 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1545 (widget-value-set widget (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1546 (custom-redraw-magic widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1547 (when (and (>= pos from) (<= pos to))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1548 (condition-case nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1549 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1550 (if (> column 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1551 (goto-line line)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1552 (goto-line (1+ line)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1553 (move-to-column column))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1554 (error nil)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1555
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1556 (defun custom-redraw-magic (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1557 "Redraw WIDGET state with current settings."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1558 (while widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1559 (let ((magic (widget-get widget :custom-magic)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1560 (cond (magic
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1561 (widget-value-set magic (widget-value magic))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1562 (when (setq widget (widget-get widget :group))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1563 (custom-group-state-update widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1564 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1565 (setq widget nil)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1566 (widget-setup))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1567
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1568 (defun custom-show (widget value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1569 "Non-nil if WIDGET should be shown with VALUE by default."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1570 (let ((show (widget-get widget :custom-show)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1571 (cond ((null show)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1572 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1573 ((eq t show)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1574 t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1575 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1576 (funcall show widget value)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1577
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1578 (defvar custom-load-recursion nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1579 "Hack to avoid recursive dependencies.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1580
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1581 (defun custom-load-symbol (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1582 "Load all dependencies for SYMBOL."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1583 (unless custom-load-recursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1584 (let ((custom-load-recursion t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1585 (loads (get symbol 'custom-loads))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1586 load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1587 (while loads
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1588 (setq load (car loads)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1589 loads (cdr loads))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1590 (cond ((symbolp load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1591 (condition-case nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1592 (require load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1593 (error nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1594 ;; Don't reload a file already loaded.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1595 ((and (boundp 'preloaded-file-list)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1596 (member load preloaded-file-list)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1597 ((assoc load load-history))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1598 ((assoc (locate-library load) load-history))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1599 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1600 (condition-case nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1601 ;; Without this, we would load cus-edit recursively.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1602 ;; We are still loading it when we call this,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1603 ;; and it is not in load-history yet.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1604 (or (equal load "cus-edit")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1605 (load-library load))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1606 (error nil))))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1607
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1608 (defun custom-load-widget (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1609 "Load all dependencies for WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1610 (custom-load-symbol (widget-value widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1611
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1612 (defun custom-unloaded-symbol-p (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1613 "Return non-nil if the dependencies of SYMBOL has not yet been loaded."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1614 (let ((found nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1615 (loads (get symbol 'custom-loads))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1616 load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1617 (while loads
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1618 (setq load (car loads)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1619 loads (cdr loads))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1620 (cond ((symbolp load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1621 (unless (featurep load)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1622 (setq found t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1623 ((assoc load load-history))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1624 ((assoc (locate-library load) load-history)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1625 ;; #### WTF???
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1626 (message nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1627 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1628 (setq found t))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1629 found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1630
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1631 (defun custom-unloaded-widget-p (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1632 "Return non-nil if the dependencies of WIDGET has not yet been loaded."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1633 (custom-unloaded-symbol-p (widget-value widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1634
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1635 (defun custom-toggle-hide (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1636 "Toggle visibility of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1637 (custom-load-widget widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1638 (let ((state (widget-get widget :custom-state)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1639 (cond ((memq state '(invalid modified))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1640 (error "There are unset changes"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1641 ((eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1642 (widget-put widget :custom-state 'unknown))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1643 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1644 (widget-put widget :documentation-shown nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1645 (widget-put widget :custom-state 'hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1646 (custom-redraw widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1647 (widget-setup)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1648
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1649 (defun custom-toggle-parent (widget &rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1650 "Toggle visibility of parent of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1651 (custom-toggle-hide (widget-get widget :parent)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1652
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1653 (defun custom-add-see-also (widget &optional prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1654 "Add `See also ...' to WIDGET if there are any links.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1655 Insert PREFIX first if non-nil."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1656 (let* ((symbol (widget-get widget :value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1657 (links (get symbol 'custom-links))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1658 (many (> (length links) 2))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1659 (buttons (widget-get widget :buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1660 (indent (widget-get widget :indent)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1661 (when links
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1662 (when indent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1663 (insert-char ?\ indent))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1664 (when prefix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1665 (insert prefix))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1666 (insert "See also ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1667 (while links
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1668 (push (widget-create-child-and-convert widget (car links))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1669 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1670 (setq links (cdr links))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1671 (cond ((null links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1672 (insert ".\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1673 ((null (cdr links))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1674 (if many
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1675 (insert ", and ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1676 (insert " and ")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1677 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1678 (insert ", "))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1679 (widget-put widget :buttons buttons))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1680
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1681 (defun custom-add-parent-links (widget &optional initial-string)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1682 "Add \"Parent groups: ...\" to WIDGET if the group has parents.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1683 The value if non-nil if any parents were found.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1684 If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1685 (let ((name (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1686 (type (widget-type widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1687 (buttons (widget-get widget :buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1688 (start (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1689 found)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1690 (insert (or initial-string "Parent groups:"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1691 (maphash (lambda (group ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1692 (let ((entry (assq name (get group 'custom-group))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1693 (when (eq (nth 1 entry) type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1694 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1695 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1696 widget 'custom-group-link
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1697 :tag (custom-unlispify-tag-name group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1698 group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1699 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1700 (setq found t))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1701 custom-group-hash-table)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1702 (widget-put widget :buttons buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1703 (if found
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1704 (insert "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1705 (delete-region start (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1706 found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1707
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1708 ;;; The `custom-variable' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1709
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1710 (defface custom-variable-tag-face '((((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1711 (background dark))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1712 (:foreground "light blue" :underline t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1713 (((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1714 (background light))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1715 (:foreground "blue" :underline t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1716 (t (:underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1717 "Face used for unpushable variable tags."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1718 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1719
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1720 (defface custom-variable-button-face '((t (:underline t :bold t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1721 "Face used for pushable variable tags."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1722 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1723
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1724 (defcustom custom-variable-default-form 'edit
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1725 "Default form of displaying variable values."
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1726 :type '(choice (const edit)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1727 (const lisp))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1728 :group 'custom-buffer)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1729
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1730 (define-widget 'custom-variable 'custom
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1731 "Customize variable."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1732 :format "%v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1733 :help-echo "Set or reset this variable"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1734 :documentation-property 'variable-documentation
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1735 :custom-category 'option
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1736 :custom-state nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1737 :custom-menu 'custom-variable-menu-create
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1738 :custom-form nil ; defaults to value of `custom-variable-default-form'
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1739 :value-create 'custom-variable-value-create
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1740 :action 'custom-variable-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1741 :custom-set 'custom-variable-set
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1742 :custom-save 'custom-variable-save
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1743 :custom-reset-current 'custom-redraw
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1744 :custom-reset-saved 'custom-variable-reset-saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1745 :custom-reset-standard 'custom-variable-reset-standard)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1746
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1747 (defun custom-variable-type (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1748 "Return a widget suitable for editing the value of SYMBOL.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1749 If SYMBOL has a `custom-type' property, use that.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1750 Otherwise, look up symbol in `custom-guess-type-alist'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1751 (let* ((type (or (get symbol 'custom-type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1752 (and (not (get symbol 'standard-value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1753 (custom-guess-type symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1754 'sexp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1755 (options (get symbol 'custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1756 (tmp (if (listp type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1757 (copy-sequence type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1758 (list type))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1759 (when options
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1760 (widget-put tmp :options options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1761 tmp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1762
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1763 (defun custom-variable-value-create (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1764 "Here is where you edit the variables value."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1765 (custom-load-widget widget)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1766 (unless (widget-get widget :custom-form)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
1767 (widget-put widget :custom-form custom-variable-default-form))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1768 (let* ((buttons (widget-get widget :buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1769 (children (widget-get widget :children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1770 (form (widget-get widget :custom-form))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1771 (state (widget-get widget :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1772 (symbol (widget-get widget :value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1773 (tag (widget-get widget :tag))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1774 (type (custom-variable-type symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1775 (conv (widget-convert type))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1776 (get (or (get symbol 'custom-get) 'default-value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1777 (prefix (widget-get widget :custom-prefix))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1778 (last (widget-get widget :custom-last))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1779 (value (if (default-boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1780 (funcall get symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1781 (widget-get conv :value))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1782 ;; If the widget is new, the child determine whether it is hidden.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1783 (cond (state)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1784 ((custom-show type value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1785 (setq state 'unknown))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1786 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1787 (setq state 'hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1788 ;; If we don't know the state, see if we need to edit it in lisp form.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1789 (when (eq state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1790 (unless (widget-apply conv :match value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1791 ;; (widget-apply (widget-convert type) :match value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1792 (setq form 'mismatch)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1793 ;; Now we can create the child widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1794 (cond ((eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1795 (insert prefix (if last " `--- " " |--- "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1796 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1797 widget 'custom-browse-variable-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1798 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1799 (insert " " tag "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1800 (widget-put widget :buttons buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1801 ((eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1802 ;; Indicate hidden value.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1803 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1804 widget 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1805 :format "%{%t%}: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1806 :sample-face 'custom-variable-tag-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1807 :tag tag
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1808 :parent widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1809 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1810 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1811 widget 'visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1812 :help-echo "Show the value of this option"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1813 :action 'custom-toggle-parent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1814 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1815 buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1816 ((memq form '(lisp mismatch))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1817 ;; In lisp mode edit the saved value when possible.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1818 (let* ((value (cond ((get symbol 'saved-value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1819 (car (get symbol 'saved-value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1820 ((get symbol 'standard-value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1821 (car (get symbol 'standard-value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1822 ((default-boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1823 (custom-quote (funcall get symbol)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1824 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1825 (custom-quote (widget-get conv :value))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1826 (insert (symbol-name symbol) ": ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1827 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1828 widget 'visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1829 :help-echo "Hide the value of this option"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1830 :action 'custom-toggle-parent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1831 t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1832 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1833 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1834 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1835 widget 'sexp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1836 :button-face 'custom-variable-button-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1837 :format "%v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1838 :tag (symbol-name symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1839 :parent widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1840 :value value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1841 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1842 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1843 ;; Edit mode.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1844 (let* ((format (widget-get type :format))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1845 tag-format value-format)
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
1846 (while (not (string-match ":" format))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
1847 (setq format (signal 'error (list "Bad format" format))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1848 (setq tag-format (substring format 0 (match-end 0)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1849 (setq value-format (substring format (match-end 0)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1850 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1851 widget 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1852 :format tag-format
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1853 :action 'custom-tag-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1854 :help-echo "Change value of this option"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1855 :mouse-down-action 'custom-tag-mouse-down-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1856 :button-face 'custom-variable-button-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1857 :sample-face 'custom-variable-tag-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1858 tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1859 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1860 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1861 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1862 widget 'visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1863 :help-echo "Hide the value of this option"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1864 :action 'custom-toggle-parent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1865 t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1866 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1867 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1868 widget type
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1869 :format value-format
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1870 :value value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1871 children))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1872 (unless (eq custom-buffer-style 'tree)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1873 ;; Now update the state.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1874 (unless (eq (preceding-char) ?\n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1875 (widget-insert "\n"))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1876 (if (eq state 'hidden)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1877 (widget-put widget :custom-state state)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1878 (custom-variable-state-set widget))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1879 ;; Create the magic button.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1880 (let ((magic (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1881 widget 'custom-magic nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1882 (widget-put widget :custom-magic magic)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1883 (push magic buttons))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1884 ;; Update properties.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1885 (widget-put widget :custom-form form)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1886 (widget-put widget :buttons buttons)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1887 (widget-put widget :children children)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 396
diff changeset
1888 ;; Insert documentation.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 396
diff changeset
1889 (widget-default-format-handler widget ?h)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1890 ;; See also.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1891 (unless (eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1892 (when (eq (widget-get widget :custom-level) 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1893 (custom-add-parent-links widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1894 (custom-add-see-also widget)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1895
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1896 (defun custom-tag-action (widget &rest args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1897 "Pass :action to first child of WIDGET's parent."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1898 (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1899 :action args))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1900
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1901 (defun custom-tag-mouse-down-action (widget &rest args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1902 "Pass :mouse-down-action to first child of WIDGET's parent."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1903 (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1904 :mouse-down-action args))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1905
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1906 (defun custom-variable-state-set (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1907 "Set the state of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1908 (let* ((symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1909 (get (or (get symbol 'custom-get) 'default-value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1910 (value (if (default-boundp symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1911 (funcall get symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1912 (widget-get widget :value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1913 tmp
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1914 (state (cond ((setq tmp (get symbol 'customized-value))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1915 (if (condition-case nil
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1916 (equal value (eval (car tmp)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1917 (error nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1918 'set
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1919 'changed))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1920 ((setq tmp (get symbol 'saved-value))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1921 (if (condition-case nil
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1922 (equal value (eval (car tmp)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1923 (error nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1924 'saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1925 'changed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1926 ((setq tmp (get symbol 'standard-value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1927 (if (condition-case nil
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1928 (equal value (eval (car tmp)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1929 (error nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1930 'standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1931 'changed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1932 (t 'rogue))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1933 (widget-put widget :custom-state state)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1934
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1935 (defvar custom-variable-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1936 '(("Set for Current Session" custom-variable-set
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1937 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1938 (eq (widget-get widget :custom-state) 'modified)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1939 ("Save for Future Sessions" custom-variable-save
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1940 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1941 (memq (widget-get widget :custom-state) '(modified set changed rogue))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1942 ("Reset to Current" custom-redraw
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1943 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1944 (and (default-boundp (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1945 (memq (widget-get widget :custom-state) '(modified changed)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1946 ("Reset to Saved" custom-variable-reset-saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1947 (lambda (widget)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
1948 (and (get (widget-value widget) 'saved-value)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1949 (memq (widget-get widget :custom-state)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1950 '(modified set changed rogue)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1951 ("Reset to Standard Settings" custom-variable-reset-standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1952 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1953 (and (get (widget-value widget) 'standard-value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1954 (memq (widget-get widget :custom-state)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1955 '(modified set changed saved rogue)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1956 ("---" ignore ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1957 ("Don't show as Lisp expression" custom-variable-edit
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1958 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1959 (eq (widget-get widget :custom-form) 'lisp)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1960 ("Show as Lisp expression" custom-variable-edit-lisp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1961 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1962 (eq (widget-get widget :custom-form) 'edit))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1963 "Alist of actions for the `custom-variable' widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1964 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1965 the menu entry, ACTION is the function to call on the widget when the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1966 menu is selected, and FILTER is a predicate which takes a `custom-variable'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1967 widget as an argument, and returns non-nil if ACTION is valid on that
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1968 widget. If FILTER is nil, ACTION is always valid.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1969
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1970 (defun custom-variable-action (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1971 "Show the menu for `custom-variable' WIDGET.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1972 Optional EVENT is the location for the menu."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1973 (if (eq (widget-get widget :custom-state) 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1974 (custom-toggle-hide widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1975 (unless (eq (widget-get widget :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1976 (custom-variable-state-set widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1977 ;; Redrawing magic also depresses the state glyph.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1978 ;(custom-redraw-magic widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1979 (let* ((completion-ignore-case t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1980 (answer (widget-choose (concat "Operation on "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1981 (custom-unlispify-tag-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1982 (widget-get widget :value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1983 (custom-menu-filter custom-variable-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1984 widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1985 event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1986 (if answer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1987 (funcall answer widget)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1988
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1989 (defun custom-variable-edit (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1990 "Edit value of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1991 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1992 (widget-put widget :custom-form 'edit)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1993 (custom-redraw widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1994
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1995 (defun custom-variable-edit-lisp (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1996 "Edit the lisp representation of the value of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1997 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1998 (widget-put widget :custom-form 'lisp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1999 (custom-redraw widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2000
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2001 (defun custom-variable-set (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2002 "Set the current value for the variable being edited by WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2003 (let* ((form (widget-get widget :custom-form))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2004 (state (widget-get widget :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2005 (child (car (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2006 (symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2007 (set (or (get symbol 'custom-set) 'set-default))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2008 val)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2009 (cond ((eq state 'hidden)
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
2010 (error "Cannot set hidden variable"))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2011 ((setq val (widget-apply child :validate))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2012 (goto-char (widget-get val :from))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2013 (error "%s" (widget-get val :error)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2014 ((memq form '(lisp mismatch))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2015 (funcall set symbol (eval (setq val (widget-value child))))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2016 (put symbol 'customized-value (list val)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2017 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2018 (funcall set symbol (setq val (widget-value child)))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2019 (put symbol 'customized-value (list (custom-quote val)))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2020 (custom-variable-state-set widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2021 (custom-redraw-magic widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2022
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2023 (defun custom-variable-save (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2024 "Set and save the value for the variable being edited by WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2025 (let* ((form (widget-get widget :custom-form))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2026 (state (widget-get widget :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2027 (child (car (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2028 (symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2029 (set (or (get symbol 'custom-set) 'set-default))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2030 val)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2031 (cond ((eq state 'hidden)
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
2032 (error "Cannot set hidden variable"))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2033 ((setq val (widget-apply child :validate))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2034 (goto-char (widget-get val :from))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2035 (error "%s" (widget-get val :error)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2036 ((memq form '(lisp mismatch))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2037 (put symbol 'saved-value (list (widget-value child)))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2038 (funcall set symbol (eval (widget-value child))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2039 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2040 (put symbol
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2041 'saved-value (list (custom-quote (widget-value
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2042 child))))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2043 (funcall set symbol (widget-value child))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2044 (put symbol 'customized-value nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2045 (custom-save-all)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2046 (custom-variable-state-set widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2047 (custom-redraw-magic widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2048
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2049 (defun custom-variable-reset-saved (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2050 "Restore the saved value for the variable being edited by WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2051 (let* ((symbol (widget-value widget))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2052 (set (or (get symbol 'custom-set) 'set-default)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2053 (if (get symbol 'saved-value)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2054 (condition-case nil
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2055 (funcall set symbol (eval (car (get symbol 'saved-value))))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2056 (error nil))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2057 (signal 'error (list "No saved value for variable" symbol)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2058 (put symbol 'customized-value nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2059 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2060 (custom-redraw widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2061
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2062 (defun custom-variable-reset-standard (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2063 "Restore the standard setting for the variable being edited by WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2064 (let* ((symbol (widget-value widget))
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 398
diff changeset
2065 (set (or (get symbol 'custom-set) 'set-default)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2066 (if (get symbol 'standard-value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2067 (funcall set symbol (eval (car (get symbol 'standard-value))))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
2068 (signal 'error (list "No standard setting known for variable" symbol)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2069 (put symbol 'customized-value nil)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2070 (when (get symbol 'saved-value)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2071 (put symbol 'saved-value nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2072 (custom-save-all))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2073 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2074 (custom-redraw widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2075
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2076 ;;; The `custom-face-edit' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2077
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2078 (define-widget 'custom-face-edit 'checklist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2079 "Edit face attributes."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2080 :format "%t: %v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2081 :tag "Attributes"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2082 :extra-offset 12
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2083 :button-args '(:help-echo "Control whether this attribute have any effect")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2084 :args (mapcar (lambda (att)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2085 (list 'group
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2086 :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2087 :sibling-args (widget-get (nth 1 att) :sibling-args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2088 (list 'const :format "" :value (nth 0 att))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2089 (nth 1 att)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2090 custom-face-attributes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2091
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2092 ;;; The `custom-display' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2093
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2094 (define-widget 'custom-display 'menu-choice
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2095 "Select a display type."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2096 :tag "Display"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2097 :value t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2098 :help-echo "Specify frames where the face attributes should be used"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2099 :args '((const :tag "all" t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2100 (checklist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2101 :offset 0
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2102 :extra-offset 9
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2103 :args ((group :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2104 Only match the specified window systems")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2105 (const :format "Type: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2106 type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2107 (checklist :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2108 :offset 0
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2109 (const :format "X "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2110 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2111 The X11 Window System")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2112 x)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2113 (const :format "PM "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2114 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2115 OS/2 Presentation Manager")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2116 pm)
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
2117 (const :format "MSWindows "
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2118 :sibling-args (:help-echo "\
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2119 Windows NT/95/97")
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
2120 mswindows)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2121 (const :format "DOS "
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2122 :sibling-args (:help-echo "\
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2123 Plain MS-DOS")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2124 pc)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2125 (const :format "TTY%n"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2126 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2127 Plain text terminals")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2128 tty)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2129 (group :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2130 Only match the frames with the specified color support")
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2131 (const :format "Class: "
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2132 class)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2133 (checklist :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2134 :offset 0
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2135 (const :format "Color "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2136 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2137 Match color frames")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2138 color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2139 (const :format "Grayscale "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2140 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2141 Match grayscale frames")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2142 grayscale)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2143 (const :format "Monochrome%n"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2144 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2145 Match frames with no color support")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2146 mono)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2147 (group :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2148 Only match frames with the specified intensity")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2149 (const :format "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2150 Background brightness: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2151 background)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2152 (checklist :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2153 :offset 0
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2154 (const :format "Light "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2155 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2156 Match frames with light backgrounds")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2157 light)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2158 (const :format "Dark\n"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2159 :sibling-args (:help-echo "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2160 Match frames with dark backgrounds")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2161 dark)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2162
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2163 ;;; The `custom-face' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2164
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2165 (defface custom-face-tag-face '((t (:underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2166 "Face used for face tags."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2167 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2168
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2169 (defcustom custom-face-default-form 'selected
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2170 "Default form of displaying face definition."
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2171 :type '(choice (const all)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2172 (const selected)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2173 (const lisp))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2174 :group 'custom-buffer)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2175
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2176 (define-widget 'custom-face 'custom
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2177 "Customize face."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2178 :sample-face 'custom-face-tag-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2179 :help-echo "Set or reset this face"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2180 :documentation-property '(lambda (face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2181 (face-doc-string face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2182 :value-create 'custom-face-value-create
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2183 :action 'custom-face-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2184 :custom-category 'face
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2185 :custom-form nil ; defaults to value of `custom-face-default-form'
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2186 :custom-set 'custom-face-set
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2187 :custom-save 'custom-face-save
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2188 :custom-reset-current 'custom-redraw
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2189 :custom-reset-saved 'custom-face-reset-saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2190 :custom-reset-standard 'custom-face-reset-standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2191 :custom-menu 'custom-face-menu-create)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2192
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2193 (define-widget 'custom-face-all 'editable-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2194 "An editable list of display specifications and attributes."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2195 :entry-format "%i %d %v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2196 :insert-button-args '(:help-echo "Insert new display specification here")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2197 :append-button-args '(:help-echo "Append new display specification here")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2198 :delete-button-args '(:help-echo "Delete this display specification")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2199 :args '((group :format "%v" custom-display custom-face-edit)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2200
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2201 (defconst custom-face-all (widget-convert 'custom-face-all)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2202 "Converted version of the `custom-face-all' widget.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2203
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2204 (define-widget 'custom-display-unselected 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2205 "A display specification that doesn't match the selected display."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2206 :match 'custom-display-unselected-match)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2207
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2208 (defun custom-display-unselected-match (widget value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2209 "Non-nil if VALUE is an unselected display specification."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2210 (not (face-spec-set-match-display value (selected-frame))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2211
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2212 (define-widget 'custom-face-selected 'group
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2213 "Edit the attributes of the selected display in a face specification."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2214 :args '((repeat :format ""
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2215 :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2216 (group custom-display-unselected sexp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2217 (group (sexp :format "") custom-face-edit)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2218 (repeat :format ""
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2219 :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2220 sexp)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2221
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2222 (defconst custom-face-selected (widget-convert 'custom-face-selected)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2223 "Converted version of the `custom-face-selected' widget.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2224
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2225 (defun custom-face-value-create (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2226 "Create a list of the display specifications for WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2227 (let ((buttons (widget-get widget :buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2228 (symbol (widget-get widget :value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2229 (tag (widget-get widget :tag))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2230 (state (widget-get widget :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2231 (begin (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2232 (is-last (widget-get widget :custom-last))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2233 (prefix (widget-get widget :custom-prefix)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2234 (unless tag
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2235 (setq tag (prin1-to-string symbol)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2236 (cond ((eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2237 (insert prefix (if is-last " `--- " " |--- "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2238 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2239 widget 'custom-browse-face-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2240 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2241 (insert " " tag "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2242 (widget-put widget :buttons buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2243 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2244 ;; Create tag.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2245 (insert tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2246 (if (eq custom-buffer-style 'face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2247 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2248 (widget-specify-sample widget begin (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2249 (insert ": "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2250 ;; Sample.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2251 (and (not (find-face symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2252 ;; XEmacs cannot display uninitialized faces.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2253 (make-face symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2254 (push (widget-create-child-and-convert widget 'item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2255 :format "(%{%t%})"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2256 :sample-face symbol
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2257 :tag "sample")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2258 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2259 ;; Visibility.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2260 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2261 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2262 widget 'visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2263 :help-echo "Hide or show this face"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2264 :action 'custom-toggle-parent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2265 (not (eq state 'hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2266 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2267 ;; Magic.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2268 (insert "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2269 (let ((magic (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2270 widget 'custom-magic nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2271 (widget-put widget :custom-magic magic)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2272 (push magic buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2273 ;; Update buttons.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2274 (widget-put widget :buttons buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2275 ;; Insert documentation.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2276 (widget-default-format-handler widget ?h)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2277 ;; See also.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2278 (unless (eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2279 (when (eq (widget-get widget :custom-level) 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2280 (custom-add-parent-links widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2281 (custom-add-see-also widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2282 ;; Editor.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2283 (unless (eq (preceding-char) ?\n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2284 (insert "\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2285 (unless (eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2286 (message "Creating face editor...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2287 (custom-load-widget widget)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2288 (unless (widget-get widget :custom-form)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2289 (widget-put widget :custom-form custom-face-default-form))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2290 (let* ((symbol (widget-value widget))
416
ebe98a74bd68 Import from CVS: tag r21-2-16
cvs
parents: 412
diff changeset
2291 (spec (custom-face-get-spec symbol))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2292 (form (widget-get widget :custom-form))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2293 (indent (widget-get widget :indent))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2294 (edit (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2295 widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2296 (cond ((and (eq form 'selected)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2297 (widget-apply custom-face-selected
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2298 :match spec))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2299 (when indent (insert-char ?\ indent))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2300 'custom-face-selected)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2301 ((and (not (eq form 'lisp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2302 (widget-apply custom-face-all
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2303 :match spec))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2304 'custom-face-all)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2305 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2306 (when indent (insert-char ?\ indent))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2307 'sexp))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2308 :value spec)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2309 (custom-face-state-set widget)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2310 (widget-put widget :children (list edit)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2311 (message "Creating face editor...done"))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2312
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2313 (defvar custom-face-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2314 '(("Set for Current Session" custom-face-set)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2315 ("Save for Future Sessions" custom-face-save)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2316 ("Reset to Saved" custom-face-reset-saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2317 (lambda (widget)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2318 (get (widget-value widget) 'saved-face)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2319 ("Reset to Standard Setting" custom-face-reset-standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2320 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2321 (get (widget-value widget) 'face-defface-spec)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2322 ("---" ignore ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2323 ("Show all display specs" custom-face-edit-all
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2324 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2325 (not (eq (widget-get widget :custom-form) 'all))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2326 ("Just current attributes" custom-face-edit-selected
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2327 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2328 (not (eq (widget-get widget :custom-form) 'selected))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2329 ("Show as Lisp expression" custom-face-edit-lisp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2330 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2331 (not (eq (widget-get widget :custom-form) 'lisp)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2332 "Alist of actions for the `custom-face' widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2333 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2334 the menu entry, ACTION is the function to call on the widget when the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2335 menu is selected, and FILTER is a predicate which takes a `custom-face'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2336 widget as an argument, and returns non-nil if ACTION is valid on that
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2337 widget. If FILTER is nil, ACTION is always valid.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2338
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2339 (defun custom-face-edit-selected (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2340 "Edit selected attributes of the value of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2341 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2342 (widget-put widget :custom-form 'selected)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2343 (custom-redraw widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2344
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2345 (defun custom-face-edit-all (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2346 "Edit all attributes of the value of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2347 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2348 (widget-put widget :custom-form 'all)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2349 (custom-redraw widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2350
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2351 (defun custom-face-edit-lisp (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2352 "Edit the lisp representation of the value of WIDGET."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2353 (widget-put widget :custom-state 'unknown)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2354 (widget-put widget :custom-form 'lisp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2355 (custom-redraw widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2356
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2357 (defun custom-face-state-set (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2358 "Set the state of WIDGET."
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2359 (let ((symbol (widget-value widget)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2360 (widget-put widget :custom-state (cond ((get symbol 'customized-face)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2361 'set)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2362 ((get symbol 'saved-face)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2363 'saved)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2364 ((get symbol 'face-defface-spec)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2365 'standard)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2366 (t
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2367 'rogue)))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2368
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2369 (defun custom-face-action (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2370 "Show the menu for `custom-face' WIDGET.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2371 Optional EVENT is the location for the menu."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2372 (if (eq (widget-get widget :custom-state) 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2373 (custom-toggle-hide widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2374 (let* ((completion-ignore-case t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2375 (symbol (widget-get widget :value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2376 (answer (widget-choose (concat "Operation on "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2377 (custom-unlispify-tag-name symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2378 (custom-menu-filter custom-face-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2379 widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2380 event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2381 (if answer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2382 (funcall answer widget)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2383
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2384 (defun custom-face-set (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2385 "Make the face attributes in WIDGET take effect."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2386 (let* ((symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2387 (child (car (widget-get widget :children)))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2388 (value (widget-value child)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2389 (put symbol 'customized-face value)
416
ebe98a74bd68 Import from CVS: tag r21-2-16
cvs
parents: 412
diff changeset
2390 (face-spec-set symbol value nil '(custom))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2391 (custom-face-state-set widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2392 (custom-redraw-magic widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2393
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2394 (defun custom-face-save (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2395 "Make the face attributes in WIDGET default."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2396 (let* ((symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2397 (child (car (widget-get widget :children)))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2398 (value (widget-value child)))
416
ebe98a74bd68 Import from CVS: tag r21-2-16
cvs
parents: 412
diff changeset
2399 (face-spec-set symbol value nil '(custom))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2400 (put symbol 'saved-face value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2401 (put symbol 'customized-face nil)
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents: 209
diff changeset
2402 (custom-save-all)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2403 (custom-face-state-set widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2404 (custom-redraw-magic widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2405
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2406 (defun custom-face-reset-saved (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2407 "Restore WIDGET to the face's default attributes."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2408 (let* ((symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2409 (child (car (widget-get widget :children)))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2410 (value (get symbol 'saved-face)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2411 (unless value
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
2412 (signal 'error (list "No saved value for this face" symbol)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2413 (put symbol 'customized-face nil)
416
ebe98a74bd68 Import from CVS: tag r21-2-16
cvs
parents: 412
diff changeset
2414 (face-spec-set symbol value nil '(custom))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2415 (widget-value-set child value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2416 (custom-face-state-set widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2417 (custom-redraw-magic widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2418
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2419 (defun custom-face-reset-standard (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2420 "Restore WIDGET to the face's standard settings."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2421 (let* ((symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2422 (child (car (widget-get widget :children)))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2423 (value (get symbol 'face-defface-spec)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2424 (unless value
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 225
diff changeset
2425 (signal 'error (list "No standard setting for this face" symbol)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2426 (put symbol 'customized-face nil)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2427 (when (get symbol 'saved-face)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2428 (put symbol 'saved-face nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2429 (custom-save-all))
416
ebe98a74bd68 Import from CVS: tag r21-2-16
cvs
parents: 412
diff changeset
2430 (face-spec-set symbol value nil '(custom))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2431 (widget-value-set child value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2432 (custom-face-state-set widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2433 (custom-redraw-magic widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2434
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2435 ;;; The `face' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2436
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2437 (define-widget 'face 'default
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2438 "Select and customize a face."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2439 :convert-widget 'widget-value-convert-widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2440 :button-prefix 'widget-push-button-prefix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2441 :button-suffix 'widget-push-button-suffix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2442 :format "%t: %[select face%] %v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2443 :tag "Face"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2444 :value 'default
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2445 :value-create 'widget-face-value-create
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2446 :value-delete 'widget-face-value-delete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2447 :value-get 'widget-value-value-get
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2448 :validate 'widget-children-validate
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2449 :action 'widget-face-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2450 :match (lambda (widget value) (symbolp value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2451
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2452 (defun widget-face-value-create (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2453 ;; Create a `custom-face' child.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2454 (let* ((symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2455 (custom-buffer-style 'face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2456 (child (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2457 widget 'custom-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2458 :custom-level nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2459 :value symbol)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2460 (custom-magic-reset child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2461 (setq custom-options (cons child custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2462 (widget-put widget :children (list child))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2463
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2464 (defun widget-face-value-delete (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2465 ;; Remove the child from the options.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2466 (let ((child (car (widget-get widget :children))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2467 (setq custom-options (delq child custom-options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2468 (widget-children-value-delete widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2469
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2470 (defvar face-history nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2471 "History of entered face names.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2472
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2473 (defun widget-face-action (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2474 "Prompt for a face."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2475 (let ((answer (completing-read "Face: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2476 (mapcar (lambda (face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2477 (list (symbol-name face)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2478 (face-list))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2479 nil nil nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2480 'face-history)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2481 (unless (zerop (length answer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2482 (widget-value-set widget (intern answer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2483 (widget-apply widget :notify widget event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2484 (widget-setup))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2485
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2486 ;;; The `hook' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2487
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2488 (define-widget 'hook 'list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2489 "A emacs lisp hook"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2490 :value-to-internal (lambda (widget value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2491 (if (symbolp value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2492 (list value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2493 value))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2494 :match (lambda (widget value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2495 (or (symbolp value)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2496 (widget-group-match widget value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2497 :convert-widget 'custom-hook-convert-widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2498 :tag "Hook")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2499
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2500 (defun custom-hook-convert-widget (widget)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2501 ;; Handle `:custom-options'.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2502 (let* ((options (widget-get widget :options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2503 (other `(editable-list :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2504 :entry-format "%i %d%v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2505 (function :format " %v")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2506 (args (if options
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2507 (list `(checklist :inline t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2508 ,@(mapcar (lambda (entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2509 `(function-item ,entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2510 options))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2511 other)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2512 (list other))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2513 (widget-put widget :args args)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2514 widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2515
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2516 ;;; The `plist' Widget.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2517
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2518 (define-widget 'plist 'list
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2519 "A property list."
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2520 :match (lambda (widget value)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2521 (valid-plist-p value))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2522 :convert-widget 'custom-plist-convert-widget
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2523 :tag "Property List")
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2524
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2525 ;; #### Should handle options better.
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2526 (defun custom-plist-convert-widget (widget)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2527 (let* ((options (widget-get widget :options))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2528 (other `(editable-list :inline t
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2529 (group :inline t
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2530 (symbol :format "%t: %v "
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2531 :size 10
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2532 :tag "Property")
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2533 (sexp :tag "Value"))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2534 (args
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2535 (if options
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2536 `((checklist :inline t
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2537 ,@(mapcar 'custom-plist-process-option options))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2538 ,other)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2539 (list other))))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2540 (widget-put widget :args args)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2541 widget))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2542
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2543 (defun custom-plist-process-option (entry)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2544 `(group :inline t
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2545 (const :tag "Property"
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2546 :format "%t: %v "
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2547 :size 10
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2548 ,entry)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2549 (sexp :tag "Value")))
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
2550
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2551 ;;; The `custom-group-link' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2552
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2553 (define-widget 'custom-group-link 'link
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2554 "Show parent in other window when activated."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2555 :help-echo 'custom-group-link-help-echo
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2556 :action 'custom-group-link-action)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2557
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2558 (defun custom-group-link-help-echo (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2559 (concat "Create customization buffer for the `"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2560 (custom-unlispify-tag-name (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2561 "' group"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2562
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2563 (defun custom-group-link-action (widget &rest ignore)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2564 (customize-group (widget-value widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2565
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2566 ;;; The `custom-group' Widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2567
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2568 (defcustom custom-group-tag-faces nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2569 ;; In XEmacs, this ought to play games with font size.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2570 "Face used for group tags.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2571 The first member is used for level 1 groups, the second for level 2,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2572 and so forth. The remaining group tags are shown with
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2573 `custom-group-tag-face'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2574 :type '(repeat face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2575 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2576
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2577 (defface custom-group-tag-face-1 '((((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2578 (background dark))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2579 (:foreground "pink" :underline t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2580 (((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2581 (background light))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2582 (:foreground "red" :underline t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2583 (t (:underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2584 "Face used for group tags.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2585
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2586 (defface custom-group-tag-face '((((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2587 (background dark))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2588 (:foreground "light blue" :underline t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2589 (((class color)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2590 (background light))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2591 (:foreground "blue" :underline t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2592 (t (:underline t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2593 "Face used for low level group tags."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2594 :group 'custom-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2595
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2596 (define-widget 'custom-group 'custom
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2597 "Customize group."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2598 :format "%v"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2599 :sample-face-get 'custom-group-sample-face-get
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2600 :documentation-property 'group-documentation
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2601 :help-echo "Set or reset all members of this group"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2602 :value-create 'custom-group-value-create
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2603 :action 'custom-group-action
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2604 :custom-category 'group
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2605 :custom-set 'custom-group-set
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2606 :custom-save 'custom-group-save
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2607 :custom-reset-current 'custom-group-reset-current
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2608 :custom-reset-saved 'custom-group-reset-saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2609 :custom-reset-standard 'custom-group-reset-standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2610 :custom-menu 'custom-group-menu-create)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2611
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2612 (defun custom-group-sample-face-get (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2613 ;; Use :sample-face.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2614 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2615 'custom-group-tag-face))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2616
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2617 (define-widget 'custom-group-visibility 'visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2618 "An indicator and manipulator for hidden group contents."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2619 :create 'custom-group-visibility-create)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2620
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2621 (defun custom-group-visibility-create (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2622 (let ((visible (widget-value widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2623 (if visible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2624 (insert "--------")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2625 (widget-default-create widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2626
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2627 (defun custom-group-members (symbol groups-only)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2628 "Return SYMBOL's custom group members.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2629 If GROUPS-ONLY non-nil, return only those members that are groups."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2630 (if (not groups-only)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2631 (get symbol 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2632 (let (members)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2633 (dolist (entry (get symbol 'custom-group) (nreverse members))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2634 (when (eq (nth 1 entry) 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2635 (push entry members))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2636
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2637 (defun custom-group-value-create (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2638 "Insert a customize group for WIDGET in the current buffer."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2639 (let* ((state (widget-get widget :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2640 (level (widget-get widget :custom-level))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2641 ;; (indent (widget-get widget :indent))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2642 (prefix (widget-get widget :custom-prefix))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2643 (buttons (widget-get widget :buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2644 (tag (widget-get widget :tag))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2645 (symbol (widget-value widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2646 (members (custom-group-members symbol
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2647 (and (eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2648 custom-browse-only-groups))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2649 (cond ((and (eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2650 (eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2651 (or members (custom-unloaded-widget-p widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2652 (custom-browse-insert-prefix prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2653 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2654 widget 'custom-browse-visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2655 ;; :tag-glyph "plus"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2656 :tag "+")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2657 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2658 (insert "-- ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2659 ;; (widget-glyph-insert nil "-- " "horizontal")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2660 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2661 widget 'custom-browse-group-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2662 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2663 (insert " " tag "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2664 (widget-put widget :buttons buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2665 ((and (eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2666 (zerop (length members)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2667 (custom-browse-insert-prefix prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2668 (insert "[ ]-- ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2669 ;; (widget-glyph-insert nil "[ ]" "empty")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2670 ;; (widget-glyph-insert nil "-- " "horizontal")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2671 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2672 widget 'custom-browse-group-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2673 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2674 (insert " " tag "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2675 (widget-put widget :buttons buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2676 ((eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2677 (custom-browse-insert-prefix prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2678 (custom-load-widget widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2679 (if (zerop (length members))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2680 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2681 (custom-browse-insert-prefix prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2682 (insert "[ ]-- ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2683 ;; (widget-glyph-insert nil "[ ]" "empty")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2684 ;; (widget-glyph-insert nil "-- " "horizontal")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2685 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2686 widget 'custom-browse-group-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2687 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2688 (insert " " tag "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2689 (widget-put widget :buttons buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2690 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2691 widget 'custom-browse-visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2692 ;; :tag-glyph "minus"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2693 :tag "-")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2694 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2695 (insert "-\\ ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2696 ;; (widget-glyph-insert nil "-\\ " "top")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2697 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2698 widget 'custom-browse-group-tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2699 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2700 (insert " " tag "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2701 (widget-put widget :buttons buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2702 (message "Creating group...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2703 (let* ((members (custom-sort-items members
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2704 custom-browse-sort-alphabetically
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2705 custom-browse-order-groups))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2706 (prefixes (widget-get widget :custom-prefixes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2707 (custom-prefix-list (custom-prefix-add symbol prefixes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2708 (extra-prefix (if (widget-get widget :custom-last)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2709 " "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2710 " | "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2711 (prefix (concat prefix extra-prefix))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2712 children entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2713 (while members
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2714 (setq entry (car members)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2715 members (cdr members))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2716 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2717 widget (nth 1 entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2718 :group widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2719 :tag (custom-unlispify-tag-name (nth 0 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2720 :custom-prefixes custom-prefix-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2721 :custom-level (1+ level)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2722 :custom-last (null members)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2723 :value (nth 0 entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2724 :custom-prefix prefix)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2725 children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2726 (widget-put widget :children (reverse children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2727 (message "Creating group...done")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2728 ;; Nested style.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2729 ((eq state 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2730 ;; Create level indicator.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2731 (unless (eq custom-buffer-style 'links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2732 (insert-char ?\ (* custom-buffer-indent (1- level)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2733 (insert "-- "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2734 ;; Create link indicator.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2735 (when (eq custom-buffer-style 'links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2736 (insert " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2737 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2738 widget 'custom-group-link
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2739 :tag "Open"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2740 :tag-glyph '("open-up" "open-down")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2741 symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2742 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2743 (insert " "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2744 ;; Create tag.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2745 (let ((begin (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2746 (insert tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2747 (widget-specify-sample widget begin (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2748 (insert " group")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2749 ;; Create visibility indicator.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2750 (unless (eq custom-buffer-style 'links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2751 (insert ": ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2752 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2753 widget 'custom-group-visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2754 :help-echo "Show members of this group"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2755 :action 'custom-toggle-parent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2756 (not (eq state 'hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2757 buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2758 (insert " \n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2759 ;; Create magic button.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2760 (let ((magic (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2761 widget 'custom-magic nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2762 (widget-put widget :custom-magic magic)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2763 (push magic buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2764 ;; Update buttons.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2765 (widget-put widget :buttons buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2766 ;; Insert documentation.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2767 (if (and (eq custom-buffer-style 'links) (> level 1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2768 (widget-put widget :documentation-indent 0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2769 (widget-default-format-handler widget ?h))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2770 ;; Nested style.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2771 (t ;Visible.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2772 (custom-load-widget widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2773 ;; Update members
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2774 (setq members (custom-group-members
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2775 symbol (and (eq custom-buffer-style 'tree)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2776 custom-browse-only-groups)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2777 ;; Add parent groups references above the group.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2778 (if t ;;; This should test that the buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2779 ;;; was made to display a group.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2780 (when (eq level 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2781 (if (custom-add-parent-links widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2782 "Go to parent group:")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2783 (insert "\n"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2784 ;; Create level indicator.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2785 (insert-char ?\ (* custom-buffer-indent (1- level)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2786 (insert "/- ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2787 ;; Create tag.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2788 (let ((start (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2789 (insert tag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2790 (widget-specify-sample widget start (point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2791 (insert " group: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2792 ;; Create visibility indicator.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2793 (unless (eq custom-buffer-style 'links)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2794 (insert "--------")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2795 (push (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2796 widget 'visibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2797 :help-echo "Hide members of this group"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2798 :action 'custom-toggle-parent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2799 (not (eq state 'hidden)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2800 buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2801 (insert " "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2802 ;; Create more dashes.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2803 ;; Use 76 instead of 75 to compensate for the temporary "<"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2804 ;; added by `widget-insert'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2805 (insert-char ?- (- 76 (current-column)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2806 (* custom-buffer-indent level)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2807 (insert "\\\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2808 ;; Create magic button.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2809 (let ((magic (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2810 widget 'custom-magic
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2811 :indent 0
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2812 nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2813 (widget-put widget :custom-magic magic)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2814 (push magic buttons))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2815 ;; Update buttons.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2816 (widget-put widget :buttons buttons)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2817 ;; Insert documentation.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2818 (widget-default-format-handler widget ?h)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2819 ;; Parent groups.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2820 (if nil ;;; This should test that the buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2821 ;;; was not made to display a group.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2822 (when (eq level 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2823 (insert-char ?\ custom-buffer-indent)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2824 (custom-add-parent-links widget)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2825 (custom-add-see-also widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2826 (make-string (* custom-buffer-indent level)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2827 ?\ ))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2828 ;; Members.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2829 (message "Creating group...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2830 (let* ((members (custom-sort-items members
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2831 custom-buffer-sort-alphabetically
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2832 custom-buffer-order-groups))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2833 (prefixes (widget-get widget :custom-prefixes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2834 (custom-prefix-list (custom-prefix-add symbol prefixes))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2835 (length (length members))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2836 (count 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2837 (children (mapcar
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2838 (lambda (entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2839 (widget-insert "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2840 (when (zerop (% count custom-skip-messages))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2841 (display-message
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2842 'progress
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2843 (format "\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2844 Creating group members... %2d%%"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2845 (/ (* 100.0 count) length))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2846 (incf count)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2847 (prog1
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2848 (widget-create-child-and-convert
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2849 widget (nth 1 entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2850 :group widget
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2851 :tag (custom-unlispify-tag-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2852 (nth 0 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2853 :custom-prefixes custom-prefix-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2854 :custom-level (1+ level)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2855 :value (nth 0 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2856 (unless (eq (preceding-char) ?\n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2857 (widget-insert "\n"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2858 members)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2859 (message "Creating group magic...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2860 (mapc 'custom-magic-reset children)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2861 (message "Creating group state...")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2862 (widget-put widget :children children)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2863 (custom-group-state-update widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2864 (message "Creating group... done"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2865 ;; End line
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2866 (insert "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2867 (insert-char ?\ (* custom-buffer-indent (1- level)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2868 (insert "\\- " (widget-get widget :tag) " group end ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2869 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2870 (insert "/\n")))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2871
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2872 (defvar custom-group-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2873 '(("Set for Current Session" custom-group-set
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2874 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2875 (eq (widget-get widget :custom-state) 'modified)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2876 ("Save for Future Sessions" custom-group-save
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2877 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2878 (memq (widget-get widget :custom-state) '(modified set))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2879 ("Reset to Current" custom-group-reset-current
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2880 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2881 (memq (widget-get widget :custom-state) '(modified))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2882 ("Reset to Saved" custom-group-reset-saved
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2883 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2884 (memq (widget-get widget :custom-state) '(modified set))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2885 ("Reset to standard setting" custom-group-reset-standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2886 (lambda (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2887 (memq (widget-get widget :custom-state) '(modified set saved)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2888 "Alist of actions for the `custom-group' widget.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2889 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2890 the menu entry, ACTION is the function to call on the widget when the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2891 menu is selected, and FILTER is a predicate which takes a `custom-group'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2892 widget as an argument, and returns non-nil if ACTION is valid on that
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2893 widget. If FILTER is nil, ACTION is always valid.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2894
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2895 (defun custom-group-action (widget &optional event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2896 "Show the menu for `custom-group' WIDGET.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2897 Optional EVENT is the location for the menu."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2898 (if (eq (widget-get widget :custom-state) 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2899 (custom-toggle-hide widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2900 (let* ((completion-ignore-case t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2901 (answer (widget-choose (concat "Operation on "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2902 (custom-unlispify-tag-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2903 (widget-get widget :value)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2904 (custom-menu-filter custom-group-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2905 widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2906 event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2907 (if answer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2908 (funcall answer widget)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2909
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2910 (defun custom-group-set (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2911 "Set changes in all modified group members."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2912 (let ((children (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2913 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2914 (when (eq (widget-get child :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2915 (widget-apply child :custom-set)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2916 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2917
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2918 (defun custom-group-save (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2919 "Save all modified group members."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2920 (let ((children (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2921 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2922 (when (memq (widget-get child :custom-state) '(modified set))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2923 (widget-apply child :custom-save)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2924 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2925
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2926 (defun custom-group-reset-current (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2927 "Reset all modified group members."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2928 (let ((children (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2929 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2930 (when (eq (widget-get child :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2931 (widget-apply child :custom-reset-current)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2932 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2933
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2934 (defun custom-group-reset-saved (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2935 "Reset all modified or set group members."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2936 (let ((children (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2937 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2938 (when (memq (widget-get child :custom-state) '(modified set))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2939 (widget-apply child :custom-reset-saved)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2940 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2941
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2942 (defun custom-group-reset-standard (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2943 "Reset all modified, set, or saved group members."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2944 (let ((children (widget-get widget :children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2945 (mapc (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2946 (when (memq (widget-get child :custom-state)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2947 '(modified set saved))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2948 (widget-apply child :custom-reset-standard)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2949 children)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2950
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2951 (defun custom-group-state-update (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2952 "Update magic."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2953 (unless (eq (widget-get widget :custom-state) 'hidden)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2954 (let* ((children (widget-get widget :children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2955 (states (mapcar (lambda (child)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2956 (widget-get child :custom-state))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2957 children))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2958 (magics custom-magic-alist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2959 (found 'standard))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2960 (while magics
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2961 (let ((magic (car (car magics))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2962 (if (and (not (eq magic 'hidden))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2963 (memq magic states))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2964 (setq found magic
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2965 magics nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2966 (setq magics (cdr magics)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2967 (widget-put widget :custom-state found)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2968 (custom-magic-reset widget))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2969
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2970 ;;; The `custom-save-all' Function.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2971 ;;;###autoload
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2972 (defcustom custom-file "~/.emacs"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2973 "File used for storing customization information.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2974 If you change this from the default \"~/.emacs\" you need to
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2975 explicitly load that file for the settings to take effect."
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2976 :type 'file
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2977 :group 'customize)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2978
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2979 (defun custom-save-delete (symbol)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
2980 "Delete the call to SYMBOL form `custom-file'.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2981 Leave point at the location of the call, or after the last expression."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2982 (let ((find-file-hooks nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2983 (auto-mode-alist nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2984 (set-buffer (find-file-noselect custom-file)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2985 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2986 (catch 'found
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2987 (while t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2988 (let ((sexp (condition-case nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2989 (read (current-buffer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2990 (end-of-file (throw 'found nil)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2991 (when (and (listp sexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2992 (eq (car sexp) symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2993 (delete-region (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2994 (backward-sexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2995 (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2996 (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2997 (throw 'found nil))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2998
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2999 (defun custom-save-variables ()
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3000 "Save all customized variables in `custom-file'."
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3001 (save-excursion
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3002 (custom-save-delete 'custom-set-variables)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3003 (let ((standard-output (current-buffer)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3004 (unless (bolp)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3005 (princ "\n"))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3006 (princ "(custom-set-variables")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3007 (mapatoms (lambda (symbol)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3008 (let ((value (get symbol 'saved-value))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3009 (requests (get symbol 'custom-requests))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3010 (now (not (or (get symbol 'standard-value)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3011 (and (not (boundp symbol))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3012 (not (get symbol 'force-value)))))))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3013 (when value
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3014 (princ "\n '(")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3015 (prin1 symbol)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3016 (princ " ")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3017 (prin1 (car value))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3018 (cond (requests
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3019 (if now
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3020 (princ " t ")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3021 (princ " nil "))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3022 (prin1 requests)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3023 (princ ")"))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3024 (now
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3025 (princ " t)"))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3026 (t
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3027 (princ ")")))))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3028 (princ ")")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3029 (unless (looking-at "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3030 (princ "\n")))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3031
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3032 (defun custom-save-faces ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3033 "Save all customized faces in `custom-file'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3034 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3035 (custom-save-delete 'custom-set-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3036 (let ((standard-output (current-buffer)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3037 (unless (bolp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3038 (princ "\n"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3039 (princ "(custom-set-faces")
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3040 (let ((value (get 'default 'saved-face)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3041 ;; The default face must be first, since it affects the others.
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3042 (when value
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3043 (princ "\n '(default ")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3044 (prin1 value)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3045 (if (or (get 'default 'face-defface-spec)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3046 (and (not (find-face 'default))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3047 (not (get 'default 'force-face))))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3048 (princ ")")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3049 (princ " t)"))))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3050 (mapatoms (lambda (symbol)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3051 (let ((value (get symbol 'saved-face)))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3052 (when (and (not (eq symbol 'default))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3053 ;; Don't print default face here.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3054 value)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3055 (princ "\n '(")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3056 (prin1 symbol)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3057 (princ " ")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3058 (prin1 value)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3059 (if (or (get symbol 'face-defface-spec)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3060 (and (not (find-face symbol))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3061 (not (get symbol 'force-face))))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3062 (princ ")")
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3063 (princ " t)"))))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3064 (princ ")")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3065 (unless (looking-at "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3066 (princ "\n")))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3067
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3068 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3069 (defun customize-save-customized ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3070 "Save all user options which have been set in this session."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3071 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3072 (mapatoms (lambda (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3073 (let ((face (get symbol 'customized-face))
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3074 (value (get symbol 'customized-value)))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3075 (when face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3076 (put symbol 'saved-face face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3077 (put symbol 'customized-face nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3078 (when value
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3079 (put symbol 'saved-value value)
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
3080 (put symbol 'customized-value nil)))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3081 ;; We really should update all custom buffers here.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3082 (custom-save-all))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3083
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3084 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3085 (defun custom-save-all ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3086 "Save all customizations in `custom-file'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3087 (let ((inhibit-read-only t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3088 (custom-save-variables)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3089 (custom-save-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3090 (let ((find-file-hooks nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3091 (auto-mode-alist))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3092 (with-current-buffer (find-file-noselect custom-file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3093 (save-buffer)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3094
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3095
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3096 ;;; The Customize Menu.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3097
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3098 ;;; Menu support
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3099
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3100 (defun custom-face-menu-create (widget symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3101 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3102 (vector (custom-unlispify-menu-entry symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3103 `(customize-face ',symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3104 t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3105
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3106 (defun custom-variable-menu-create (widget symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3107 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3108 (let ((type (get symbol 'custom-type)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3109 (unless (listp type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3110 (setq type (list type)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3111 (if (and type (widget-get type :custom-menu))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3112 (widget-apply type :custom-menu symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3113 (vector (custom-unlispify-menu-entry symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3114 `(customize-variable ',symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3115 t))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3116
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3117 ;; Add checkboxes to boolean variable entries.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3118 (widget-put (get 'boolean 'widget-type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3119 :custom-menu (lambda (widget symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3120 `[,(custom-unlispify-menu-entry symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3121 (customize-variable ',symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3122 :style toggle
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3123 :selected ,symbol]))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3124
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3125 ;; XEmacs can create menus dynamically.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3126 (defun custom-group-menu-create (widget symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3127 "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3128 `( ,(custom-unlispify-menu-entry symbol t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3129 :filter (lambda (&rest junk)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3130 (let ((item (custom-menu-create ',symbol)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3131 (if (listp item)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3132 (cdr item)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3133 (list item))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3134
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3135 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3136 (defun custom-menu-create (symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3137 "Create menu for customization group SYMBOL.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3138 The menu is in a format applicable to `easy-menu-define'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3139 (let* ((item (vector (custom-unlispify-menu-entry symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3140 `(customize-group ',symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3141 t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3142 ;; Item is the entry for creating a menu buffer for SYMBOL.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3143 ;; We may nest, if the menu is not too big.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3144 (custom-load-symbol symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3145 (if (< (length (get symbol 'custom-group)) widget-menu-max-size)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3146 ;; The menu is not too big.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3147 (let ((custom-prefix-list (custom-prefix-add symbol
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3148 custom-prefix-list))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3149 (members (custom-sort-items (get symbol 'custom-group)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3150 custom-menu-sort-alphabetically
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3151 custom-menu-order-groups)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3152 ;; Create the menu.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3153 `(,(custom-unlispify-menu-entry symbol t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3154 ,item
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3155 "--"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3156 ,@(mapcar (lambda (entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3157 (widget-apply (if (listp (nth 1 entry))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3158 (nth 1 entry)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3159 (list (nth 1 entry)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3160 :custom-menu (nth 0 entry)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3161 members)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3162 ;; The menu was too big.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3163 item)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3164
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3165 ;;;###autoload
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3166 (defun customize-menu-create (symbol &optional name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3167 "Return a customize menu for customization group SYMBOL.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3168 If optional NAME is given, use that as the name of the menu.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3169 Otherwise the menu will be named `Customize'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3170 The format is suitable for use with `easy-menu-define'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3171 (unless name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3172 (setq name "Customize"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3173 `(,name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3174 :filter (lambda (&rest junk)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3175 (cdr (custom-menu-create ',symbol)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3176
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3177 ;;; The Custom Mode.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3178
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3179 (defvar custom-mode-map nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3180 "Keymap for `custom-mode'.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3181
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3182 (unless custom-mode-map
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3183 (setq custom-mode-map (make-sparse-keymap))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3184 (set-keymap-parents custom-mode-map widget-keymap)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3185 (suppress-keymap custom-mode-map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3186 (define-key custom-mode-map " " 'scroll-up)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
3187 (define-key custom-mode-map [delete] 'scroll-down)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
3188 (define-key custom-mode-map "q" 'Custom-buffer-done)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3189 (define-key custom-mode-map "u" 'Custom-goto-parent)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3190 (define-key custom-mode-map "n" 'widget-forward)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 215
diff changeset
3191 (define-key custom-mode-map "p" 'widget-backward))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3192
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3193 (easy-menu-define Custom-mode-menu
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3194 custom-mode-map
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3195 "Menu used in customization buffers."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3196 `("Custom"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3197 ,(customize-menu-create 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3198 ["Set" Custom-set t]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3199 ["Save" Custom-save t]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3200 ["Reset to Current" Custom-reset-current t]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3201 ["Reset to Saved" Custom-reset-saved t]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3202 ["Reset to Standard Settings" Custom-reset-standard t]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3203 ["Info" (Info-goto-node "(xemacs)Easy Customization") t]))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3204
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3205 (defun Custom-goto-parent ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3206 "Go to the parent group listed at the top of this buffer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3207 If several parents are listed, go to the first of them."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3208 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3209 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3210 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3211 (if (search-forward "\nGo to parent group: " nil t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3212 (let* ((button (get-char-property (point) 'button))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3213 (parent (downcase (widget-get button :tag))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3214 (customize-group parent)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3215
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3216 (defcustom custom-mode-hook nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3217 "Hook called when entering custom-mode."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3218 :type 'hook
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3219 :group 'custom-buffer )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3220
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3221 (defun custom-state-buffer-message (widget)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3222 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3223 (message
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3224 "To install your edits, invoke [State] and choose the Set operation")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3225
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3226 (defun custom-mode ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3227 "Major mode for editing customization buffers.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3228
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3229 The following commands are available:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3230
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3231 Move to next button or editable field. \\[widget-forward]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3232 Move to previous button or editable field. \\[widget-backward]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3233 \\<widget-field-keymap>\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3234 Complete content of editable text field. \\[widget-complete]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3235 \\<custom-mode-map>\
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3236 Invoke button under point. \\[widget-button-press]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3237 Set all modifications. \\[Custom-set]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3238 Make all modifications default. \\[Custom-save]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3239 Reset all modified options. \\[Custom-reset-current]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3240 Reset all modified or set options. \\[Custom-reset-saved]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3241 Reset all options. \\[Custom-reset-standard]
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3242
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3243 Entry to this mode calls the value of `custom-mode-hook'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3244 if that value is non-nil."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3245 (kill-all-local-variables)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3246 (setq major-mode 'custom-mode
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3247 mode-name "Custom")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3248 (use-local-map custom-mode-map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3249 (easy-menu-add Custom-mode-menu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3250 (make-local-variable 'custom-options)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3251 (make-local-variable 'widget-documentation-face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3252 (setq widget-documentation-face 'custom-documentation-face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3253 (make-local-variable 'widget-button-face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3254 (setq widget-button-face 'custom-button-face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3255 (make-local-hook 'widget-edit-functions)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3256 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3257 (run-hooks 'custom-mode-hook))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3258
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3259
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3260 ;;; The End.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3261
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3262 (provide 'cus-edit)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3263
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3264 ;; cus-edit.el ends here