Mercurial > emacs
annotate lisp/cus-edit.el @ 43403:fef73ecd984e
(calc-split-manual): Look for calc.texi.
(calc-public-autoloads): Obsolete; remove.
(calc-private-autoloads): Ditto.
(calc-add-autoloads): Ditto.
author | Colin Walters <walters@gnu.org> |
---|---|
date | Mon, 18 Feb 2002 20:06:07 +0000 |
parents | c187056ac630 |
children | c092c3c65251 |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37911
diff
changeset
|
1 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages |
17334 | 2 ;; |
43167
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
17334 | 4 ;; |
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> | |
6 ;; Keywords: help, faces | |
7 | |
17521
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
9 |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
13 ;; any later version. |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
14 |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
18 ;; GNU General Public License for more details. |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
19 |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
23 ;; Boston, MA 02111-1307, USA. |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
24 |
17334 | 25 ;;; Commentary: |
26 ;; | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
27 ;; This file implements the code to create and edit customize buffers. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
28 ;; |
17334 | 29 ;; See `custom.el'. |
30 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
31 ;; No commands should have names starting with `custom-' because |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
32 ;; that interferes with completion. Use `customize-' for commands |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
33 ;; that the user will run with M-x, and `Custom-' for interactive commands. |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
34 |
17334 | 35 ;;; Code: |
36 | |
37 (require 'cus-face) | |
38 (require 'wid-edit) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
39 (eval-when-compile |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
40 (defvar custom-versions-load-alist)) ; from cus-load |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
41 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
42 (condition-case nil |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
43 (require 'cus-load) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
44 (error nil)) |
17334 | 45 |
18089 | 46 (condition-case nil |
47 (require 'cus-start) | |
48 (error nil)) | |
49 | |
17415 | 50 (put 'custom-define-hook 'custom-type 'hook) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
51 (put 'custom-define-hook 'standard-value '(nil)) |
17415 | 52 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable) |
53 | |
17334 | 54 ;;; Customization Groups. |
55 | |
56 (defgroup emacs nil | |
57 "Customization of the One True Editor." | |
58 :link '(custom-manual "(emacs)Top")) | |
59 | |
60 ;; Most of these groups are stolen from `finder.el', | |
61 (defgroup editing nil | |
62 "Basic text editing facilities." | |
63 :group 'emacs) | |
64 | |
65 (defgroup abbrev nil | |
66 "Abbreviation handling, typing shortcuts, macros." | |
67 :tag "Abbreviations" | |
68 :group 'editing) | |
69 | |
70 (defgroup matching nil | |
71 "Various sorts of searching and matching." | |
72 :group 'editing) | |
73 | |
74 (defgroup emulations nil | |
75 "Emulations of other editors." | |
76 :group 'editing) | |
77 | |
78 (defgroup mouse nil | |
79 "Mouse support." | |
80 :group 'editing) | |
81 | |
82 (defgroup outlines nil | |
83 "Support for hierarchical outlining." | |
84 :group 'editing) | |
85 | |
86 (defgroup external nil | |
87 "Interfacing to external utilities." | |
88 :group 'emacs) | |
89 | |
90 (defgroup bib nil | |
91 "Code related to the `bib' bibliography processor." | |
92 :tag "Bibliography" | |
93 :group 'external) | |
94 | |
95 (defgroup processes nil | |
96 "Process, subshell, compilation, and job control support." | |
97 :group 'external | |
98 :group 'development) | |
99 | |
22068
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
100 (defgroup convenience nil |
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
101 "Convenience features for faster editing." |
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
102 :group 'emacs) |
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
103 |
17334 | 104 (defgroup programming nil |
105 "Support for programming in other languages." | |
106 :group 'emacs) | |
107 | |
108 (defgroup languages nil | |
109 "Specialized modes for editing programming languages." | |
110 :group 'programming) | |
111 | |
112 (defgroup lisp nil | |
113 "Lisp support, including Emacs Lisp." | |
114 :group 'languages | |
115 :group 'development) | |
116 | |
117 (defgroup c nil | |
118 "Support for the C language and related languages." | |
119 :group 'languages) | |
120 | |
121 (defgroup tools nil | |
122 "Programming tools." | |
123 :group 'programming) | |
124 | |
125 (defgroup oop nil | |
126 "Support for object-oriented programming." | |
127 :group 'programming) | |
128 | |
129 (defgroup applications nil | |
130 "Applications written in Emacs." | |
131 :group 'emacs) | |
132 | |
133 (defgroup calendar nil | |
134 "Calendar and time management support." | |
135 :group 'applications) | |
136 | |
137 (defgroup mail nil | |
138 "Modes for electronic-mail handling." | |
139 :group 'applications) | |
140 | |
141 (defgroup news nil | |
142 "Support for netnews reading and posting." | |
143 :group 'applications) | |
144 | |
145 (defgroup games nil | |
146 "Games, jokes and amusements." | |
147 :group 'applications) | |
148 | |
149 (defgroup development nil | |
150 "Support for further development of Emacs." | |
151 :group 'emacs) | |
152 | |
153 (defgroup docs nil | |
154 "Support for Emacs documentation." | |
155 :group 'development) | |
156 | |
157 (defgroup extensions nil | |
158 "Emacs Lisp language extensions." | |
159 :group 'development) | |
160 | |
161 (defgroup internal nil | |
162 "Code for Emacs internals, build process, defaults." | |
163 :group 'development) | |
164 | |
165 (defgroup maint nil | |
166 "Maintenance aids for the Emacs development group." | |
167 :tag "Maintenance" | |
168 :group 'development) | |
169 | |
170 (defgroup environment nil | |
171 "Fitting Emacs with its environment." | |
172 :group 'emacs) | |
173 | |
174 (defgroup comm nil | |
175 "Communications, networking, remote access to files." | |
176 :tag "Communication" | |
177 :group 'environment) | |
178 | |
179 (defgroup hardware nil | |
180 "Support for interfacing with exotic hardware." | |
181 :group 'environment) | |
182 | |
183 (defgroup terminals nil | |
184 "Support for terminal types." | |
185 :group 'environment) | |
186 | |
187 (defgroup unix nil | |
188 "Front-ends/assistants for, or emulators of, UNIX features." | |
189 :group 'environment) | |
190 | |
191 (defgroup vms nil | |
192 "Support code for vms." | |
193 :group 'environment) | |
194 | |
195 (defgroup i18n nil | |
196 "Internationalization and alternate character-set support." | |
197 :group 'environment | |
198 :group 'editing) | |
199 | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
200 (defgroup x nil |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
201 "The X Window system." |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
202 :group 'environment) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
203 |
17334 | 204 (defgroup frames nil |
205 "Support for Emacs frames and window systems." | |
206 :group 'environment) | |
207 | |
208 (defgroup data nil | |
209 "Support editing files of data." | |
210 :group 'emacs) | |
211 | |
18320
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
212 (defgroup files nil |
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
213 "Support editing files." |
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
214 :group 'emacs) |
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
215 |
17334 | 216 (defgroup wp nil |
217 "Word processing." | |
218 :group 'emacs) | |
219 | |
220 (defgroup tex nil | |
221 "Code related to the TeX formatter." | |
222 :group 'wp) | |
223 | |
224 (defgroup faces nil | |
225 "Support for multiple fonts." | |
226 :group 'emacs) | |
227 | |
228 (defgroup hypermedia nil | |
229 "Support for links between text or other media types." | |
230 :group 'emacs) | |
231 | |
232 (defgroup help nil | |
233 "Support for on-line help systems." | |
234 :group 'emacs) | |
235 | |
25685 | 236 (defgroup multimedia nil |
237 "Non-textual support, specifically images and sound." | |
238 :group 'emacs) | |
239 | |
17334 | 240 (defgroup local nil |
241 "Code local to your site." | |
242 :group 'emacs) | |
243 | |
244 (defgroup customize '((widgets custom-group)) | |
245 "Customization of the Customization support." | |
23357
856a82c440fa
(Custom-mode-menu): Fix info node name.
Karl Heuer <kwzh@gnu.org>
parents:
23223
diff
changeset
|
246 :link '(custom-manual "(elisp)Customization") |
25685 | 247 :link '(url-link :tag "(Old?) Development Page" |
17334 | 248 "http://www.dina.kvl.dk/~abraham/custom/") |
249 :prefix "custom-" | |
17415 | 250 :group 'help) |
251 | |
252 (defgroup custom-faces nil | |
253 "Faces used by customize." | |
254 :group 'customize | |
17334 | 255 :group 'faces) |
256 | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
257 (defgroup custom-browse nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
258 "Control customize browser." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
259 :prefix "custom-" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
260 :group 'customize) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
261 |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
262 (defgroup custom-buffer nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
263 "Control customize buffers." |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
264 :prefix "custom-" |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
265 :group 'customize) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
266 |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
267 (defgroup custom-menu nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
268 "Control customize menus." |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
269 :prefix "custom-" |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
270 :group 'customize) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
271 |
17415 | 272 (defgroup abbrev-mode nil |
273 "Word abbreviations mode." | |
274 :group 'abbrev) | |
275 | |
276 (defgroup alloc nil | |
277 "Storage allocation and gc for GNU Emacs Lisp interpreter." | |
278 :tag "Storage Allocation" | |
279 :group 'internal) | |
280 | |
281 (defgroup undo nil | |
282 "Undoing changes in buffers." | |
283 :group 'editing) | |
284 | |
285 (defgroup modeline nil | |
286 "Content of the modeline." | |
287 :group 'environment) | |
288 | |
289 (defgroup fill nil | |
290 "Indenting and filling text." | |
291 :group 'editing) | |
292 | |
293 (defgroup editing-basics nil | |
294 "Most basic editing facilities." | |
295 :group 'editing) | |
296 | |
297 (defgroup display nil | |
298 "How characters are displayed in buffers." | |
299 :group 'environment) | |
300 | |
301 (defgroup execute nil | |
302 "Executing external commands." | |
303 :group 'processes) | |
304 | |
305 (defgroup installation nil | |
306 "The Emacs installation." | |
307 :group 'environment) | |
308 | |
309 (defgroup dired nil | |
310 "Directory editing." | |
311 :group 'environment) | |
312 | |
313 (defgroup limits nil | |
314 "Internal Emacs limits." | |
315 :group 'internal) | |
316 | |
317 (defgroup debug nil | |
318 "Debugging Emacs itself." | |
319 :group 'development) | |
320 | |
321 (defgroup minibuffer nil | |
322 "Controling the behaviour of the minibuffer." | |
323 :group 'environment) | |
324 | |
325 (defgroup keyboard nil | |
326 "Input from the keyboard." | |
327 :group 'environment) | |
328 | |
329 (defgroup mouse nil | |
330 "Input from the mouse." | |
331 :group 'environment) | |
332 | |
333 (defgroup menu nil | |
334 "Input from the menus." | |
335 :group 'environment) | |
336 | |
337 (defgroup auto-save nil | |
338 "Preventing accidential loss of data." | |
18320
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
339 :group 'files) |
17415 | 340 |
341 (defgroup processes-basics nil | |
342 "Basic stuff dealing with processes." | |
343 :group 'processes) | |
344 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
345 (defgroup mule nil |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
346 "MULE Emacs internationalization." |
18053
941f5d1a241e
(cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
347 :group 'i18n) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
348 |
17415 | 349 (defgroup windows nil |
350 "Windows within a frame." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
351 :group 'environment) |
17415 | 352 |
17334 | 353 ;;; Utilities. |
354 | |
355 (defun custom-quote (sexp) | |
356 "Quote SEXP iff it is not self quoting." | |
357 (if (or (memq sexp '(t nil)) | |
28130 | 358 (keywordp sexp) |
17334 | 359 (and (listp sexp) |
360 (memq (car sexp) '(lambda))) | |
361 (stringp sexp) | |
362 (numberp sexp) | |
25685 | 363 (vectorp sexp) |
364 ;;; (and (fboundp 'characterp) | |
365 ;;; (characterp sexp)) | |
366 ) | |
17334 | 367 sexp |
368 (list 'quote sexp))) | |
369 | |
370 (defun custom-split-regexp-maybe (regexp) | |
371 "If REGEXP is a string, split it to a list at `\\|'. | |
25685 | 372 You can get the original back with from the result with: |
17334 | 373 (mapconcat 'identity result \"\\|\") |
374 | |
375 IF REGEXP is not a string, return it unchanged." | |
376 (if (stringp regexp) | |
377 (let ((start 0) | |
378 all) | |
379 (while (string-match "\\\\|" regexp start) | |
380 (setq all (cons (substring regexp start (match-beginning 0)) all) | |
381 start (match-end 0))) | |
382 (nreverse (cons (substring regexp start) all))) | |
383 regexp)) | |
384 | |
17415 | 385 (defun custom-variable-prompt () |
386 "Prompt for a variable, defaulting to the variable at point. | |
387 Return a list suitable for use in `interactive'." | |
388 (let ((v (variable-at-point)) | |
389 (enable-recursive-minibuffers t) | |
390 val) | |
25685 | 391 (setq val (completing-read |
18085
3da4eaba1fe8
(custom-variable-prompt): Handle variable-at-point returning 0.
Richard M. Stallman <rms@gnu.org>
parents:
18067
diff
changeset
|
392 (if (symbolp v) |
18131
5711f2e5a643
(custom-variable-prompt): Change prompt.
Richard M. Stallman <rms@gnu.org>
parents:
18090
diff
changeset
|
393 (format "Customize option: (default %s) " v) |
17415 | 394 "Customize variable: ") |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
395 obarray (lambda (symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
396 (and (boundp symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
397 (or (get symbol 'custom-type) |
24509
3cb266497eb3
(custom-variable-prompt): Allow customization of
Karl Heuer <kwzh@gnu.org>
parents:
24030
diff
changeset
|
398 (get symbol 'custom-loads) |
28941 | 399 (get symbol 'standard-value)))) t)) |
17415 | 400 (list (if (equal val "") |
18085
3da4eaba1fe8
(custom-variable-prompt): Handle variable-at-point returning 0.
Richard M. Stallman <rms@gnu.org>
parents:
18067
diff
changeset
|
401 (if (symbolp v) v nil) |
3da4eaba1fe8
(custom-variable-prompt): Handle variable-at-point returning 0.
Richard M. Stallman <rms@gnu.org>
parents:
18067
diff
changeset
|
402 (intern val))))) |
17415 | 403 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
404 (defun custom-menu-filter (menu widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
405 "Convert MENU to the form used by `widget-choose'. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
406 MENU should be in the same format as `custom-variable-menu'. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
407 WIDGET is the widget to apply the filter entries of MENU on." |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
408 (let ((result nil) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
409 current name action filter) |
25685 | 410 (while menu |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
411 (setq current (car menu) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
412 name (nth 0 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
413 action (nth 1 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
414 filter (nth 2 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
415 menu (cdr menu)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
416 (if (or (null filter) (funcall filter widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
417 (push (cons name action) result) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
418 (push name result))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
419 (nreverse result))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
420 |
17415 | 421 ;;; Unlispify. |
422 | |
17334 | 423 (defvar custom-prefix-list nil |
28130 | 424 "List of prefixes that should be ignored by `custom-unlispify'.") |
17334 | 425 |
426 (defcustom custom-unlispify-menu-entries t | |
427 "Display menu entries as words instead of symbols if non nil." | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
428 :group 'custom-menu |
17334 | 429 :type 'boolean) |
430 | |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
431 (defcustom custom-unlispify-remove-prefixes nil |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
432 "Non-nil means remove group prefixes from option names in buffer." |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
433 :group 'custom-menu |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
434 :type 'boolean) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
435 |
17334 | 436 (defun custom-unlispify-menu-entry (symbol &optional no-suffix) |
28130 | 437 "Convert SYMBOL into a menu entry." |
17334 | 438 (cond ((not custom-unlispify-menu-entries) |
439 (symbol-name symbol)) | |
440 ((get symbol 'custom-tag) | |
441 (if no-suffix | |
442 (get symbol 'custom-tag) | |
443 (concat (get symbol 'custom-tag) "..."))) | |
444 (t | |
445 (save-excursion | |
446 (set-buffer (get-buffer-create " *Custom-Work*")) | |
447 (erase-buffer) | |
448 (princ symbol (current-buffer)) | |
449 (goto-char (point-min)) | |
17415 | 450 (when (and (eq (get symbol 'custom-type) 'boolean) |
451 (re-search-forward "-p\\'" nil t)) | |
452 (replace-match "" t t) | |
453 (goto-char (point-min))) | |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
454 (if custom-unlispify-remove-prefixes |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
455 (let ((prefixes custom-prefix-list) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
456 prefix) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
457 (while prefixes |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
458 (setq prefix (car prefixes)) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
459 (if (search-forward prefix (+ (point) (length prefix)) t) |
25685 | 460 (progn |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
461 (setq prefixes nil) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
462 (delete-region (point-min) (point))) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
463 (setq prefixes (cdr prefixes)))))) |
17334 | 464 (subst-char-in-region (point-min) (point-max) ?- ?\ t) |
465 (capitalize-region (point-min) (point-max)) | |
25685 | 466 (unless no-suffix |
17334 | 467 (goto-char (point-max)) |
468 (insert "...")) | |
469 (buffer-string))))) | |
470 | |
471 (defcustom custom-unlispify-tag-names t | |
472 "Display tag names as words instead of symbols if non nil." | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
473 :group 'custom-buffer |
17334 | 474 :type 'boolean) |
475 | |
476 (defun custom-unlispify-tag-name (symbol) | |
28130 | 477 "Convert SYMBOL into a menu entry." |
17334 | 478 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names)) |
479 (custom-unlispify-menu-entry symbol t))) | |
480 | |
481 (defun custom-prefix-add (symbol prefixes) | |
28130 | 482 "Add SYMBOL to list of ignored PREFIXES." |
17334 | 483 (cons (or (get symbol 'custom-prefix) |
484 (concat (symbol-name symbol) "-")) | |
485 prefixes)) | |
486 | |
17415 | 487 ;;; Guess. |
488 | |
489 (defcustom custom-guess-name-alist | |
490 '(("-p\\'" boolean) | |
491 ("-hook\\'" hook) | |
492 ("-face\\'" face) | |
493 ("-file\\'" file) | |
494 ("-function\\'" function) | |
495 ("-functions\\'" (repeat function)) | |
496 ("-list\\'" (repeat sexp)) | |
497 ("-alist\\'" (repeat (cons sexp sexp)))) | |
498 "Alist of (MATCH TYPE). | |
499 | |
25685 | 500 MATCH should be a regexp matching the name of a symbol, and TYPE should |
17415 | 501 be a widget suitable for editing the value of that symbol. The TYPE |
502 of the first entry where MATCH matches the name of the symbol will be | |
25685 | 503 used. |
17415 | 504 |
505 This is used for guessing the type of variables not declared with | |
506 customize." | |
507 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) | |
508 :group 'customize) | |
509 | |
510 (defcustom custom-guess-doc-alist | |
511 '(("\\`\\*?Non-nil " boolean)) | |
512 "Alist of (MATCH TYPE). | |
513 | |
514 MATCH should be a regexp matching a documentation string, and TYPE | |
515 should be a widget suitable for editing the value of a variable with | |
516 that documentation string. The TYPE of the first entry where MATCH | |
517 matches the name of the symbol will be used. | |
518 | |
519 This is used for guessing the type of variables not declared with | |
520 customize." | |
521 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) | |
522 :group 'customize) | |
523 | |
524 (defun custom-guess-type (symbol) | |
525 "Guess a widget suitable for editing the value of SYMBOL. | |
25685 | 526 This is done by matching SYMBOL with `custom-guess-name-alist' and |
17415 | 527 if that fails, the doc string with `custom-guess-doc-alist'." |
528 (let ((name (symbol-name symbol)) | |
529 (names custom-guess-name-alist) | |
530 current found) | |
531 (while names | |
532 (setq current (car names) | |
533 names (cdr names)) | |
534 (when (string-match (nth 0 current) name) | |
535 (setq found (nth 1 current) | |
536 names nil))) | |
537 (unless found | |
538 (let ((doc (documentation-property symbol 'variable-documentation)) | |
539 (docs custom-guess-doc-alist)) | |
25685 | 540 (when doc |
17415 | 541 (while docs |
542 (setq current (car docs) | |
543 docs (cdr docs)) | |
544 (when (string-match (nth 0 current) doc) | |
545 (setq found (nth 1 current) | |
546 docs nil)))))) | |
547 found)) | |
548 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
549 ;;; Sorting. |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
550 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
551 (defcustom custom-browse-sort-alphabetically nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
552 "If non-nil, sort members of each customization group alphabetically." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
553 :type 'boolean |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
554 :group 'custom-browse) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
555 |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
556 (defcustom custom-browse-order-groups nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
557 "If non-nil, order group members within each customization group. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
558 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
559 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
560 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
561 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
562 (const :tag "none" nil)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
563 :group 'custom-browse) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
564 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
565 (defcustom custom-browse-only-groups nil |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
566 "If non-nil, show group members only within each customization group." |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
567 :type 'boolean |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
568 :group 'custom-browse) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
569 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
570 (defcustom custom-buffer-sort-alphabetically nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
571 "If non-nil, sort members of each customization group alphabetically." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
572 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
573 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
574 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
575 (defcustom custom-buffer-order-groups 'last |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
576 "If non-nil, order group members within each customization group. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
577 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
578 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
579 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
580 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
581 (const :tag "none" nil)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
582 :group 'custom-buffer) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
583 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
584 (defcustom custom-menu-sort-alphabetically nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
585 "If non-nil, sort members of each customization group alphabetically." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
586 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
587 :group 'custom-menu) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
588 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
589 (defcustom custom-menu-order-groups 'first |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
590 "If non-nil, order group members within each customization group. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
591 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
592 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
593 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
594 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
595 (const :tag "none" nil)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
596 :group 'custom-menu) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
597 |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
598 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'") |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
599 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
600 (defun custom-sort-items (items sort-alphabetically order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
601 "Return a sorted copy of ITEMS. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
602 ITEMS should be a `custom-group' property. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
603 If SORT-ALPHABETICALLY non-nil, sort alphabetically. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
604 If ORDER-GROUPS is `first' order groups before non-groups, if `last' order |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
605 groups after non-groups, if nil do not order groups at all." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
606 (sort (copy-sequence items) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
607 (lambda (a b) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
608 (let ((typea (nth 1 a)) (typeb (nth 1 b)) |
28568
cfff869d8a3d
(custom-sort-items): Avoid symbol-name with new
Dave Love <fx@gnu.org>
parents:
28310
diff
changeset
|
609 (namea (nth 0 a)) (nameb (nth 0 b))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
610 (cond ((not order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
611 ;; Since we don't care about A and B order, maybe sort. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
612 (when sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
613 (string-lessp namea nameb))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
614 ((eq typea 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
615 ;; If B is also a group, maybe sort. Otherwise, order A and B. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
616 (if (eq typeb 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
617 (when sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
618 (string-lessp namea nameb)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
619 (eq order-groups 'first))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
620 ((eq typeb 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
621 ;; Since A cannot be a group, order A and B. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
622 (eq order-groups 'last)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
623 (sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
624 ;; Since A and B cannot be groups, sort. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
625 (string-lessp namea nameb))))))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
626 |
17415 | 627 ;;; Custom Mode Commands. |
17334 | 628 |
629 (defvar custom-options nil | |
630 "Customization widgets in the current buffer.") | |
631 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
632 (defun Custom-set () |
17334 | 633 "Set changes in all modified options." |
634 (interactive) | |
635 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
636 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
637 (when (eq (widget-get child :custom-state) 'modified) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
638 (widget-apply child :custom-set))) |
17334 | 639 children))) |
640 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
641 (defun Custom-save () |
17334 | 642 "Set all modified group members and save them." |
643 (interactive) | |
644 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
645 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
646 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
647 '(modified set changed rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
648 (widget-apply child :custom-save))) |
17334 | 649 children)) |
650 (custom-save-all)) | |
651 | |
25685 | 652 (defvar custom-reset-menu |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
653 '(("Current" . Custom-reset-current) |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
654 ("Saved" . Custom-reset-saved) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
655 ("Erase Customization (use standard settings)" . Custom-reset-standard)) |
17334 | 656 "Alist of actions for the `Reset' button. |
657 The key is a string containing the name of the action, the value is a | |
28130 | 658 Lisp function taking the widget as an element which will be called |
17334 | 659 when the action is chosen.") |
660 | |
661 (defun custom-reset (event) | |
662 "Select item from reset menu." | |
663 (let* ((completion-ignore-case t) | |
664 (answer (widget-choose "Reset to" | |
665 custom-reset-menu | |
666 event))) | |
667 (if answer | |
668 (funcall answer)))) | |
669 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
670 (defun Custom-reset-current (&rest ignore) |
17334 | 671 "Reset all modified group members to their current value." |
672 (interactive) | |
673 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
674 (mapc (lambda (widget) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
675 (and (default-boundp (widget-value widget)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
676 (if (memq (widget-get widget :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
677 '(modified changed)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
678 (widget-apply widget :custom-reset-current)))) |
17334 | 679 children))) |
680 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
681 (defun Custom-reset-saved (&rest ignore) |
17334 | 682 "Reset all modified or set group members to their saved value." |
683 (interactive) | |
684 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
685 (mapc (lambda (widget) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
686 (and (get (widget-value widget) 'saved-value) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
687 (if (memq (widget-get widget :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
688 '(modified set changed rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
689 (widget-apply widget :custom-reset-saved)))) |
17334 | 690 children))) |
691 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
692 (defun Custom-reset-standard (&rest ignore) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
693 "Erase all customization (either current or saved) for the group members. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
694 The immediate result is to restore them to their standard settings. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
695 This operation eliminates any saved settings for the group members, |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
696 making them as if they had never been customized at all." |
17334 | 697 (interactive) |
698 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
699 (mapc (lambda (widget) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
700 (and (get (widget-value widget) 'standard-value) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
701 (if (memq (widget-get widget :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
702 '(modified set changed saved rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
703 (widget-apply widget :custom-reset-standard)))) |
17334 | 704 children))) |
705 | |
706 ;;; The Customize Commands | |
707 | |
25685 | 708 (defun custom-prompt-variable (prompt-var prompt-val &optional comment) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
709 "Prompt for a variable and a value and return them as a list. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
710 PROMPT-VAR is the prompt for the variable, and PROMPT-VAL is the |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
711 prompt for the value. The %s escape in PROMPT-VAL is replaced with |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
712 the name of the variable. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
713 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
714 If the variable has a `variable-interactive' property, that is used as if |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
715 it were the arg to `interactive' (which see) to interactively read the value. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
716 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
717 If the variable has a `custom-type' property, it must be a widget and the |
25685 | 718 `:prompt-value' property of that widget will be used for reading the value. |
719 | |
720 If optional COMMENT argument is non nil, also prompt for a comment and return | |
721 it as the third element in the list." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
722 (let* ((var (read-variable prompt-var)) |
25685 | 723 (minibuffer-help-form '(describe-variable var)) |
724 (val | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
725 (let ((prop (get var 'variable-interactive)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
726 (type (get var 'custom-type)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
727 (prompt (format prompt-val var))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
728 (unless (listp type) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
729 (setq type (list type))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
730 (cond (prop |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
731 ;; Use VAR's `variable-interactive' property |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
732 ;; as an interactive spec for prompting. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
733 (call-interactively (list 'lambda '(arg) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
734 (list 'interactive prop) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
735 'arg))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
736 (type |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
737 (widget-prompt-value type |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
738 prompt |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
739 (if (boundp var) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
740 (symbol-value var)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
741 (not (boundp var)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
742 (t |
25685 | 743 (eval-minibuffer prompt)))))) |
744 (if comment | |
745 (list var val | |
746 (read-string "Comment: " (get var 'variable-comment))) | |
747 (list var val)))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
748 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
749 ;;;###autoload |
25685 | 750 (defun customize-set-value (var val &optional comment) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
751 "Set VARIABLE to VALUE, and return VALUE. VALUE is a Lisp object. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
752 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
753 If VARIABLE has a `variable-interactive' property, that is used as if |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
754 it were the arg to `interactive' (which see) to interactively read the value. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
755 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
756 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 757 `:prompt-value' property of that widget will be used for reading the value. |
758 | |
759 If given a prefix (or a COMMENT argument), also prompt for a comment." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
760 (interactive (custom-prompt-variable "Set variable: " |
25685 | 761 "Set %s to value: " |
762 current-prefix-arg)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
763 |
25685 | 764 (cond ((string= comment "") |
765 (put var 'variable-comment nil)) | |
766 (comment | |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
767 (put var 'variable-comment comment))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
768 (set var val)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
769 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
770 ;;;###autoload |
28130 | 771 (defun customize-set-variable (variable value &optional comment) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
772 "Set the default for VARIABLE to VALUE, and return VALUE. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
773 VALUE is a Lisp object. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
774 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
775 If VARIABLE has a `custom-set' property, that is used for setting |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
776 VARIABLE, otherwise `set-default' is used. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
777 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
778 The `customized-value' property of the VARIABLE will be set to a list |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
779 with a quoted VALUE as its sole list member. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
780 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
781 If VARIABLE has a `variable-interactive' property, that is used as if |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
782 it were the arg to `interactive' (which see) to interactively read the value. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
783 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
784 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 785 `:prompt-value' property of that widget will be used for reading the value. |
786 | |
787 If given a prefix (or a COMMENT argument), also prompt for a comment." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
788 (interactive (custom-prompt-variable "Set variable: " |
25685 | 789 "Set customized value for %s to: " |
790 current-prefix-arg)) | |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
791 (custom-load-symbol variable) |
28130 | 792 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
793 (put variable 'customized-value (list (custom-quote value))) | |
25685 | 794 (cond ((string= comment "") |
28130 | 795 (put variable 'variable-comment nil) |
796 (put variable 'customized-variable-comment nil)) | |
25685 | 797 (comment |
28130 | 798 (put variable 'variable-comment comment) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
799 (put variable 'customized-variable-comment comment))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
800 value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
801 |
17334 | 802 ;;;###autoload |
28130 | 803 (defun customize-save-variable (var value &optional comment) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
804 "Set the default for VARIABLE to VALUE, and save it for future sessions. |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
805 Return VALUE. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
806 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
807 If VARIABLE has a `custom-set' property, that is used for setting |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
808 VARIABLE, otherwise `set-default' is used. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
809 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
810 The `customized-value' property of the VARIABLE will be set to a list |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
811 with a quoted VALUE as its sole list member. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
812 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
813 If VARIABLE has a `variable-interactive' property, that is used as if |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
814 it were the arg to `interactive' (which see) to interactively read the value. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
815 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
816 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 817 `:prompt-value' property of that widget will be used for reading the value. |
818 | |
819 If given a prefix (or a COMMENT argument), also prompt for a comment." | |
43063 | 820 (interactive (custom-prompt-variable "Set and save variable: " |
25685 | 821 "Set and save value for %s as: " |
822 current-prefix-arg)) | |
28130 | 823 (funcall (or (get var 'custom-set) 'set-default) var value) |
824 (put var 'saved-value (list (custom-quote value))) | |
25685 | 825 (cond ((string= comment "") |
826 (put var 'variable-comment nil) | |
827 (put var 'saved-variable-comment nil)) | |
828 (comment | |
829 (put var 'variable-comment comment) | |
830 (put var 'saved-variable-comment comment))) | |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
831 (custom-save-all) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
832 value) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
833 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
834 ;;;###autoload |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
835 (defun customize () |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
836 "Select a customization buffer which you can use to set user options. |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
837 User options are structured into \"groups\". |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
838 Initially the top-level group `Emacs' and its immediate subgroups |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
839 are shown; the contents of those subgroups are initially hidden." |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
840 (interactive) |
17703 | 841 (customize-group 'emacs)) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
842 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
843 ;;;###autoload |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
844 (defun customize-group (group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
845 "Customize GROUP, which must be a customization group." |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
846 (interactive (list (let ((completion-ignore-case t)) |
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
847 (completing-read "Customize group: (default emacs) " |
25685 | 848 obarray |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
849 (lambda (symbol) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
850 (or (get symbol 'custom-loads) |
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
851 (get symbol 'custom-group))) |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
852 t)))) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
853 (when (stringp group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
854 (if (string-equal "" group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
855 (setq group 'emacs) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
856 (setq group (intern group)))) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
857 (or (get group 'custom-group) |
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
858 (custom-load-symbol group)) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
859 (let ((name (format "*Customize Group: %s*" |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
860 (custom-unlispify-tag-name group)))) |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
861 (if (get-buffer name) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
862 (pop-to-buffer name) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
863 (custom-buffer-create (list (list group 'custom-group)) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
864 name |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
865 (concat " for group " |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
866 (custom-unlispify-tag-name group)))))) |
17334 | 867 |
868 ;;;###autoload | |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
869 (defun customize-group-other-window (group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
870 "Customize GROUP, which must be a customization group." |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
871 (interactive (list (let ((completion-ignore-case t)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
872 (completing-read "Customize group: (default emacs) " |
25685 | 873 obarray |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
874 (lambda (symbol) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
875 (or (get symbol 'custom-loads) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
876 (get symbol 'custom-group))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
877 t)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
878 (when (stringp group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
879 (if (string-equal "" group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
880 (setq group 'emacs) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
881 (setq group (intern group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
882 (or (get group 'custom-group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
883 (custom-load-symbol group)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
884 (let ((name (format "*Customize Group: %s*" |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
885 (custom-unlispify-tag-name group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
886 (if (get-buffer name) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
887 (let ((window (selected-window))) |
22348
86cb09249796
(customize-group-other-window): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents:
22332
diff
changeset
|
888 (pop-to-buffer name) |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
889 (select-window window)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
890 (custom-buffer-create-other-window |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
891 (list (list group 'custom-group)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
892 name |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
893 (concat " for group " |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
894 (custom-unlispify-tag-name group)))))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
895 |
18089 | 896 ;;;###autoload |
897 (defalias 'customize-variable 'customize-option) | |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
898 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
899 ;;;###autoload |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
900 (defun customize-option (symbol) |
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
901 "Customize SYMBOL, which must be a user option variable." |
17415 | 902 (interactive (custom-variable-prompt)) |
23190
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
903 ;; If we don't have SYMBOL's real definition loaded, |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
904 ;; try to load it. |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
905 (unless (get symbol 'custom-type) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
906 (let ((loaddefs-file (locate-library "loaddefs.el" t)) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
907 file) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
908 ;; See if it is autoloaded from some library. |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
909 (when loaddefs-file |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
910 (with-temp-buffer |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
911 (insert-file-contents loaddefs-file) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
912 (when (re-search-forward (concat "^(defvar " (symbol-name symbol)) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
913 nil t) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
914 (search-backward "\n;;; Generated autoloads from ") |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
915 (goto-char (match-end 0)) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
916 (setq file (buffer-substring (point) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
917 (progn (end-of-line) (point))))))) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
918 ;; If it is, load that library. |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
919 (when file |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
920 (when (string-match "\\.el\\'" file) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
921 (setq file (substring file 0 (match-beginning 0)))) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
922 (load file)))) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
923 (unless (get symbol 'custom-type) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
924 (error "Variable %s cannot be customized" symbol)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
925 (custom-buffer-create (list (list symbol 'custom-variable)) |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
926 (format "*Customize Option: %s*" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
927 (custom-unlispify-tag-name symbol)))) |
17334 | 928 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
929 (defvar customize-changed-options-previous-release "20.2" |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
930 "Version for `customize-changed-options' to refer back to by default.") |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
931 |
17334 | 932 ;;;###autoload |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
933 (defun customize-changed-options (since-version) |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
934 "Customize all user option variables changed in Emacs itself. |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
935 This includes new user option variables and faces, and new |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
936 customization groups, as well as older options and faces whose default |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
937 values have changed since the previous major Emacs release. |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
938 |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
939 With argument SINCE-VERSION (a string), customize all user option |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
940 variables that were added (or their meanings were changed) since that |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
941 version." |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
942 |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
943 (interactive "sCustomize options changed, since version (default all versions): ") |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
944 (if (equal since-version "") |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
945 (setq since-version nil) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
946 (unless (condition-case nil |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
947 (numberp (read since-version)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
948 (error nil)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
949 (signal 'wrong-type-argument (list 'numberp since-version)))) |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
950 (unless since-version |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
951 (setq since-version customize-changed-options-previous-release)) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
952 (let ((found nil) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
953 (versions nil)) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
954 (mapatoms (lambda (symbol) |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
955 (and (or (boundp symbol) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
956 ;; For variables not yet loaded. |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
957 (get symbol 'standard-value) |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
958 ;; For groups the previous test fails, this one |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
959 ;; could be used to determine if symbol is a |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
960 ;; group. Is there a better way for this? |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
961 (get symbol 'group-documentation)) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
962 (let ((version (get symbol 'custom-version))) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
963 (and version |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
964 (or (null since-version) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
965 (customize-version-lessp since-version version)) |
25685 | 966 (if (member version versions) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
967 t |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
968 ;;; Collect all versions that we use. |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
969 (push version versions)))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
970 (setq found |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
971 ;; We have to set the right thing here, |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
972 ;; depending if we have a group or a |
25685 | 973 ;; variable. |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
974 (if (get symbol 'group-documentation) |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
975 (cons (list symbol 'custom-group) found) |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
976 (cons (list symbol 'custom-variable) found)))))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
977 (if (not found) |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
978 (error "No user option defaults have been changed since Emacs %s" |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
979 since-version) |
22667
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
980 (let ((flist nil)) |
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
981 (while versions |
25685 | 982 (push (copy-sequence |
22667
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
983 (cdr (assoc (car versions) custom-versions-load-alist))) |
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
984 flist) |
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
985 (setq versions (cdr versions))) |
25685 | 986 (put 'custom-versions-load-alist 'custom-loads |
22667
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
987 ;; Get all the files that correspond to element from the |
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
988 ;; VERSIONS list. This could use some simplification. |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
989 (apply 'nconc flist))) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
990 ;; Because we set all the files needed to be loaded as a |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
991 ;; `custom-loads' property to `custom-versions-load-alist' this |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
992 ;; call will actually load them. |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
993 (custom-load-symbol 'custom-versions-load-alist) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
994 ;; Clean up |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
995 (put 'custom-versions-load-alist 'custom-loads nil) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
996 (custom-buffer-create (custom-sort-items found t 'first) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
997 "*Customize Changed Options*")))) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
998 |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
999 (defun customize-version-lessp (version1 version2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1000 ;; Why are the versions strings, and given that they are, why aren't |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1001 ;; they converted to numbers and compared as such here? -- fx |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1002 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1003 ;; In case someone made a mistake and left out the quotes |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1004 ;; in the :version value. |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1005 (if (numberp version2) |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1006 (setq version2 (prin1-to-string version2))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1007 (let (major1 major2 minor1 minor2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1008 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1009 (setq major1 (read (or (match-string 1 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1010 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1011 (setq minor1 (read (or (match-string 3 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1012 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1013 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1014 (setq major2 (read (or (match-string 1 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1015 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1016 (setq minor2 (read (or (match-string 3 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1017 "0"))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1018 (or (< major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1019 (and (= major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1020 (< minor1 minor2))))) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1021 |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1022 ;;;###autoload |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1023 (defalias 'customize-variable-other-window 'customize-option-other-window) |
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1024 |
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1025 ;;;###autoload |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1026 (defun customize-option-other-window (symbol) |
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1027 "Customize SYMBOL, which must be a user option variable. |
17415 | 1028 Show the buffer in another window, but don't select it." |
1029 (interactive (custom-variable-prompt)) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1030 (custom-buffer-create-other-window |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1031 (list (list symbol 'custom-variable)) |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1032 (format "*Customize Option: %s*" (custom-unlispify-tag-name symbol)))) |
17415 | 1033 |
1034 ;;;###autoload | |
17334 | 1035 (defun customize-face (&optional symbol) |
1036 "Customize SYMBOL, which should be a face name or nil. | |
1037 If SYMBOL is nil, customize all faces." | |
25685 | 1038 (interactive (list (completing-read "Customize face: (default all) " |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1039 obarray 'custom-facep t))) |
17334 | 1040 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1041 (custom-buffer-create (custom-sort-items |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1042 (mapcar (lambda (symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1043 (list symbol 'custom-face)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1044 (face-list)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1045 t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1046 "*Customize Faces*") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1047 (when (stringp symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1048 (setq symbol (intern symbol))) |
17334 | 1049 (unless (symbolp symbol) |
1050 (error "Should be a symbol %S" symbol)) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1051 (custom-buffer-create (list (list symbol 'custom-face)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1052 (format "*Customize Face: %s*" |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1053 (custom-unlispify-tag-name symbol))))) |
17334 | 1054 |
1055 ;;;###autoload | |
17415 | 1056 (defun customize-face-other-window (&optional symbol) |
28130 | 1057 "Show customization buffer for face SYMBOL in other window." |
25685 | 1058 (interactive (list (completing-read "Customize face: " |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1059 obarray 'custom-facep t))) |
17415 | 1060 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol)))) |
1061 () | |
1062 (if (stringp symbol) | |
1063 (setq symbol (intern symbol))) | |
1064 (unless (symbolp symbol) | |
1065 (error "Should be a symbol %S" symbol)) | |
25685 | 1066 (custom-buffer-create-other-window |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1067 (list (list symbol 'custom-face)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1068 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol))))) |
17415 | 1069 |
1070 ;;;###autoload | |
17334 | 1071 (defun customize-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1072 "Customize all user options set since the last save in this session." |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1073 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1074 (let ((found nil)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1075 (mapatoms (lambda (symbol) |
25685 | 1076 (and (or (get symbol 'customized-face) |
1077 (get symbol 'customized-face-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1078 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1079 (push (list symbol 'custom-face) found)) |
25685 | 1080 (and (or (get symbol 'customized-value) |
1081 (get symbol 'customized-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1082 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1083 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1084 (if (not found) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1085 (error "No customized user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1086 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1087 "*Customize Customized*")))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1088 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1089 ;;;###autoload |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1090 (defun customize-saved () |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1091 "Customize all already saved user options." |
17334 | 1092 (interactive) |
1093 (let ((found nil)) | |
1094 (mapatoms (lambda (symbol) | |
25685 | 1095 (and (or (get symbol 'saved-face) |
1096 (get symbol 'saved-face-comment)) | |
17334 | 1097 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1098 (push (list symbol 'custom-face) found)) |
25685 | 1099 (and (or (get symbol 'saved-value) |
1100 (get symbol 'saved-variable-comment)) | |
17334 | 1101 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1102 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1103 (if (not found ) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1104 (error "No saved user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1105 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1106 "*Customize Saved*")))) |
17334 | 1107 |
1108 ;;;###autoload | |
1109 (defun customize-apropos (regexp &optional all) | |
1110 "Customize all user options matching REGEXP. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1111 If ALL is `options', include only options. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1112 If ALL is `faces', include only faces. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1113 If ALL is `groups', include only groups. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1114 If ALL is t (interactively, with prefix arg), include options which are not |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1115 user-settable, as well as faces and groups." |
17334 | 1116 (interactive "sCustomize regexp: \nP") |
1117 (let ((found nil)) | |
1118 (mapatoms (lambda (symbol) | |
1119 (when (string-match regexp (symbol-name symbol)) | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1120 (when (and (not (memq all '(faces options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1121 (get symbol 'custom-group)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1122 (push (list symbol 'custom-group) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1123 (when (and (not (memq all '(options groups))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1124 (custom-facep symbol)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1125 (push (list symbol 'custom-face) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1126 (when (and (not (memq all '(groups faces))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1127 (boundp symbol) |
17334 | 1128 (or (get symbol 'saved-value) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1129 (get symbol 'standard-value) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1130 (if (memq all '(nil options)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1131 (user-variable-p symbol) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1132 (get symbol 'variable-documentation)))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1133 (push (list symbol 'custom-variable) found))))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1134 (if (not found) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1135 (error "No matches") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1136 (custom-buffer-create (custom-sort-items found t |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1137 custom-buffer-order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1138 "*Customize Apropos*")))) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1139 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1140 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1141 (defun customize-apropos-options (regexp &optional arg) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1142 "Customize all user options matching REGEXP. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1143 With prefix arg, include options which are not user-settable." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1144 (interactive "sCustomize regexp: \nP") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1145 (customize-apropos regexp (or arg 'options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1146 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1147 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1148 (defun customize-apropos-faces (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1149 "Customize all user faces matching REGEXP." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1150 (interactive "sCustomize regexp: \n") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1151 (customize-apropos regexp 'faces)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1152 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1153 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1154 (defun customize-apropos-groups (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1155 "Customize all user groups matching REGEXP." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1156 (interactive "sCustomize regexp: \n") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1157 (customize-apropos regexp 'groups)) |
17334 | 1158 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1159 ;;; Buffer. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1160 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1161 (defcustom custom-buffer-style 'links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1162 "Control the presentation style for customization buffers. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1163 The value should be a symbol, one of: |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1164 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1165 brackets: groups nest within each other with big horizontal brackets. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1166 links: groups have links to subgroups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1167 :type '(radio (const brackets) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1168 (const links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1169 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1170 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1171 ;; If we pass BUFFER to `bury-buffer', the buffer isn't removed from |
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1172 ;; the window. |
25840
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1173 (defun custom-bury-buffer (buffer) |
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1174 (bury-buffer)) |
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1175 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1176 (defcustom custom-buffer-done-function 'custom-bury-buffer |
25685 | 1177 "*Function called to remove a Custom buffer when the user is done with it. |
1178 Called with one argument, the buffer to remove." | |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1179 :type '(choice (function-item :tag "Bury buffer" custom-bury-buffer) |
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1180 (function-item :tag "Kill buffer" kill-buffer) |
25685 | 1181 (function :tag "Other")) |
1182 :version "21.1" | |
1183 :group 'custom-buffer) | |
1184 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1185 (defcustom custom-buffer-indent 3 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1186 "Number of spaces to indent nested groups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1187 :type 'integer |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1188 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1189 |
17334 | 1190 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1191 (defun custom-buffer-create (options &optional name description) |
17334 | 1192 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1193 Optional NAME is the name of the buffer. |
17334 | 1194 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1195 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1196 that option." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1197 (unless name (setq name "*Customization*")) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1198 (kill-buffer (get-buffer-create name)) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1199 (pop-to-buffer (get-buffer-create name)) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1200 (custom-buffer-create-internal options description)) |
17415 | 1201 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1202 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1203 (defun custom-buffer-create-other-window (options &optional name description) |
17415 | 1204 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1205 Optional NAME is the name of the buffer. |
17415 | 1206 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1207 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1208 that option." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1209 (unless name (setq name "*Customization*")) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1210 (kill-buffer (get-buffer-create name)) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1211 (let ((window (selected-window)) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1212 (pop-up-windows t) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1213 (special-display-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1214 (special-display-regexps nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1215 (same-window-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1216 (same-window-regexps nil)) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1217 (pop-to-buffer (get-buffer-create name)) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1218 (custom-buffer-create-internal options description) |
17415 | 1219 (select-window window))) |
18089 | 1220 |
1221 (defcustom custom-reset-button-menu nil | |
1222 "If non-nil, only show a single reset button in customize buffers. | |
1223 This button will have a menu with all three reset operations." | |
1224 :type 'boolean | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1225 :group 'custom-buffer) |
17415 | 1226 |
25685 | 1227 (defun Custom-buffer-done (&rest ignore) |
1228 "Remove current buffer by calling `custom-buffer-done-function'." | |
1229 (interactive) | |
1230 (funcall custom-buffer-done-function (current-buffer))) | |
1231 | |
1232 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box) | |
1233 '(("unspecified" . unspecified)))) | |
1234 "If non-nil, indicate active buttons in a `raised-button' style. | |
1235 Otherwise use brackets." | |
1236 :type 'boolean | |
1237 :version "21.1" | |
1238 :group 'custom-buffer) | |
1239 | |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1240 (defun custom-buffer-create-internal (options &optional description) |
17415 | 1241 (message "Creating customization buffer...") |
17334 | 1242 (custom-mode) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1243 (widget-insert "This is a customization buffer") |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1244 (if description |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1245 (widget-insert description)) |
25685 | 1246 (widget-insert (format ". |
1247 %s show active fields; type RET or click mouse-1 | |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1248 on an active field to invoke its action. Editing an option value |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1249 changes the text in the buffer; invoke the State button and |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1250 choose the Set operation to set the option value. |
25685 | 1251 Invoke " (if custom-raised-buttons |
1252 "`Raised' buttons" | |
1253 "Square brackets"))) | |
1254 (widget-create 'info-link | |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1255 :tag "Help" |
17334 | 1256 :help-echo "Read the online help." |
18032
fd3f0a7e79b9
(custom-face-display-set): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
17800
diff
changeset
|
1257 "(emacs)Easy Customization") |
17334 | 1258 (widget-insert " for more information.\n\n") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1259 (message "Creating customization buttons...") |
18373
45ef45c34aa4
(custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents:
18371
diff
changeset
|
1260 (widget-insert "Operate on everything in this buffer:\n ") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1261 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1262 :tag "Set for Current Session" |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1263 :help-echo "\ |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1264 Make your editing in this buffer take effect for this session." |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1265 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1266 (Custom-set))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1267 (widget-insert " ") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1268 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1269 :tag "Save for Future Sessions" |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1270 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1271 Make your editing in this buffer take effect for future Emacs sessions." |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1272 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1273 (Custom-save))) |
18089 | 1274 (if custom-reset-button-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1275 (progn |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1276 (widget-insert " ") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1277 (widget-create 'push-button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1278 :tag "Reset" |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1279 :help-echo "Show a menu with reset operations." |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1280 :mouse-down-action (lambda (&rest junk) t) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1281 :action (lambda (widget &optional event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1282 (custom-reset event)))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1283 (widget-insert "\n ") |
18089 | 1284 (widget-create 'push-button |
1285 :tag "Reset" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1286 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1287 Reset all edited text in this buffer to reflect current values." |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1288 :action 'Custom-reset-current) |
18089 | 1289 (widget-insert " ") |
1290 (widget-create 'push-button | |
1291 :tag "Reset to Saved" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1292 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1293 Reset all values in this buffer to their saved settings." |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1294 :action 'Custom-reset-saved) |
18089 | 1295 (widget-insert " ") |
1296 (widget-create 'push-button | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1297 :tag "Erase Customization" |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1298 :help-echo "\ |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1299 Un-customize all values in this buffer. They get their standard settings." |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1300 :action 'Custom-reset-standard)) |
18373
45ef45c34aa4
(custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents:
18371
diff
changeset
|
1301 (widget-insert " ") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1302 (widget-create 'push-button |
25685 | 1303 :tag "Finish" |
30247
80383e9be1e2
(custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents:
30184
diff
changeset
|
1304 :help-echo |
80383e9be1e2
(custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents:
30184
diff
changeset
|
1305 (lambda (&rest ignore) |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1306 (cond |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1307 ((eq custom-buffer-done-function |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1308 'custom-bury-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1309 "Bury this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1310 ((eq custom-buffer-done-function 'kill-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1311 "Kill this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1312 (t "Finish with this buffer"))) |
25685 | 1313 :action #'Custom-buffer-done) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1314 (widget-insert "\n\n") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1315 (message "Creating customization items...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1316 (buffer-disable-undo) |
25685 | 1317 (setq custom-options |
17334 | 1318 (if (= (length options) 1) |
1319 (mapcar (lambda (entry) | |
1320 (widget-create (nth 1 entry) | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1321 :documentation-shown t |
17334 | 1322 :custom-state 'unknown |
1323 :tag (custom-unlispify-tag-name | |
1324 (nth 0 entry)) | |
1325 :value (nth 0 entry))) | |
1326 options) | |
1327 (let ((count 0) | |
1328 (length (length options))) | |
1329 (mapcar (lambda (entry) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1330 (prog2 |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1331 (message "Creating customization items ...%2d%%" |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1332 (/ (* 100.0 count) length)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1333 (widget-create (nth 1 entry) |
17334 | 1334 :tag (custom-unlispify-tag-name |
1335 (nth 0 entry)) | |
1336 :value (nth 0 entry)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1337 (setq count (1+ count)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1338 (unless (eq (preceding-char) ?\n) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1339 (widget-insert "\n")) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1340 (widget-insert "\n"))) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1341 options)))) |
17334 | 1342 (unless (eq (preceding-char) ?\n) |
1343 (widget-insert "\n")) | |
39153
001cb5cd0de9
(custom-buffer-create-internal): Remove "100%" from
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
1344 (message "Creating customization items ...done") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1345 (unless (eq custom-buffer-style 'tree) |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1346 (mapc 'custom-magic-reset custom-options)) |
17334 | 1347 (message "Creating customization setup...") |
1348 (widget-setup) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1349 (buffer-enable-undo) |
17334 | 1350 (goto-char (point-min)) |
1351 (message "Creating customization buffer...done")) | |
1352 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1353 ;;; The Tree Browser. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1354 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1355 ;;;###autoload |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1356 (defun customize-browse (&optional group) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1357 "Create a tree browser for the customize hierarchy." |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
1358 (interactive) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1359 (unless group |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1360 (setq group 'emacs)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1361 (let ((name "*Customize Browser*")) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1362 (kill-buffer (get-buffer-create name)) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1363 (pop-to-buffer (get-buffer-create name))) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1364 (custom-mode) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1365 (widget-insert "\ |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
1366 Square brackets show active fields; type RET or click mouse-1 |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
1367 on an active field to invoke its action. |
18856
03eeb83520d8
(custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents:
18812
diff
changeset
|
1368 Invoke [+] below to expand a group, and [-] to collapse an expanded group.\n") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1369 (if custom-browse-only-groups |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1370 (widget-insert "\ |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1371 Invoke the [Group] button below to edit that item in another window.\n\n") |
25685 | 1372 (widget-insert "Invoke the ") |
1373 (widget-create 'item | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1374 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1375 :tag "[Group]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1376 :tag-glyph "folder") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1377 (widget-insert ", ") |
25685 | 1378 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1379 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1380 :tag "[Face]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1381 :tag-glyph "face") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1382 (widget-insert ", and ") |
25685 | 1383 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1384 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1385 :tag "[Option]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1386 :tag-glyph "option") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1387 (widget-insert " buttons below to edit that |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1388 item in another window.\n\n")) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1389 (let ((custom-buffer-style 'tree)) |
25685 | 1390 (widget-create 'custom-group |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1391 :custom-last t |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1392 :custom-state 'unknown |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1393 :tag (custom-unlispify-tag-name group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1394 :value group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1395 (goto-char (point-min))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1396 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1397 (define-widget 'custom-browse-visibility 'item |
20600
323f33e3e92c
(custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
20562
diff
changeset
|
1398 "Control visibility of items in the customize tree browser." |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1399 :format "%[[%t]%]" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1400 :action 'custom-browse-visibility-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1401 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1402 (defun custom-browse-visibility-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1403 (let ((custom-buffer-style 'tree)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1404 (custom-toggle-parent widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1405 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1406 (define-widget 'custom-browse-group-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1407 "Show parent in other window when activated." |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1408 :tag "Group" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1409 :tag-glyph "folder" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1410 :action 'custom-browse-group-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1411 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1412 (defun custom-browse-group-tag-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1413 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1414 (customize-group-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1415 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1416 (define-widget 'custom-browse-variable-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1417 "Show parent in other window when activated." |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1418 :tag "Option" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1419 :tag-glyph "option" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1420 :action 'custom-browse-variable-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1421 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1422 (defun custom-browse-variable-tag-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1423 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1424 (customize-variable-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1425 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1426 (define-widget 'custom-browse-face-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1427 "Show parent in other window when activated." |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1428 :tag "Face" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1429 :tag-glyph "face" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1430 :action 'custom-browse-face-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1431 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1432 (defun custom-browse-face-tag-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1433 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1434 (customize-face-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1435 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1436 (defconst custom-browse-alist '((" " "space") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1437 (" | " "vertical") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1438 ("-\\ " "top") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1439 (" |-" "middle") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1440 (" `-" "bottom"))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1441 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1442 (defun custom-browse-insert-prefix (prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1443 "Insert PREFIX. On XEmacs convert it to line graphics." |
25685 | 1444 ;; Fixme: do graphics. |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1445 (if nil ; (string-match "XEmacs" emacs-version) |
25685 | 1446 (progn |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1447 (insert "*") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1448 (while (not (string-equal prefix "")) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1449 (let ((entry (substring prefix 0 3))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1450 (setq prefix (substring prefix 3)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1451 (let ((overlay (make-overlay (1- (point)) (point) nil t nil)) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1452 (name (nth 1 (assoc entry custom-browse-alist)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1453 (overlay-put overlay 'end-glyph (widget-glyph-find name entry)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1454 (overlay-put overlay 'start-open t) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1455 (overlay-put overlay 'end-open t))))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1456 (insert prefix))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1457 |
17334 | 1458 ;;; Modification of Basic Widgets. |
1459 ;; | |
1460 ;; We add extra properties to the basic widgets needed here. This is | |
1461 ;; fine, as long as we are careful to stay within out own namespace. | |
1462 ;; | |
1463 ;; We want simple widgets to be displayed by default, but complex | |
1464 ;; widgets to be hidden. | |
1465 | |
1466 (widget-put (get 'item 'widget-type) :custom-show t) | |
1467 (widget-put (get 'editable-field 'widget-type) | |
1468 :custom-show (lambda (widget value) | |
1469 (let ((pp (pp-to-string value))) | |
1470 (cond ((string-match "\n" pp) | |
1471 nil) | |
1472 ((> (length pp) 40) | |
1473 nil) | |
1474 (t t))))) | |
1475 (widget-put (get 'menu-choice 'widget-type) :custom-show t) | |
1476 | |
1477 ;;; The `custom-manual' Widget. | |
1478 | |
1479 (define-widget 'custom-manual 'info-link | |
1480 "Link to the manual entry for this customization option." | |
1481 :help-echo "Read the manual entry for this option." | |
1482 :tag "Manual") | |
1483 | |
1484 ;;; The `custom-magic' Widget. | |
1485 | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1486 (defgroup custom-magic-faces nil |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1487 "Faces used by the magic button." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1488 :group 'custom-faces |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1489 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1490 |
17334 | 1491 (defface custom-invalid-face '((((class color)) |
1492 (:foreground "yellow" :background "red")) | |
1493 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1494 (:weight bold :slant italic :underline t))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1495 "Face used when the customize item is invalid." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1496 :group 'custom-magic-faces) |
17334 | 1497 |
1498 (defface custom-rogue-face '((((class color)) | |
1499 (:foreground "pink" :background "black")) | |
1500 (t | |
1501 (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1502 "Face used when the customize item is not defined for customization." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1503 :group 'custom-magic-faces) |
17334 | 1504 |
25685 | 1505 (defface custom-modified-face '((((class color)) |
17334 | 1506 (:foreground "white" :background "blue")) |
1507 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1508 (:slant italic :bold))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1509 "Face used when the customize item has been modified." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1510 :group 'custom-magic-faces) |
17334 | 1511 |
25685 | 1512 (defface custom-set-face '((((class color)) |
17334 | 1513 (:foreground "blue" :background "white")) |
1514 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1515 (:slant italic))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1516 "Face used when the customize item has been set." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1517 :group 'custom-magic-faces) |
17334 | 1518 |
25685 | 1519 (defface custom-changed-face '((((class color)) |
17334 | 1520 (:foreground "white" :background "blue")) |
1521 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1522 (:slant italic))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1523 "Face used when the customize item has been changed." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1524 :group 'custom-magic-faces) |
17334 | 1525 |
1526 (defface custom-saved-face '((t (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1527 "Face used when the customize item has been saved." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1528 :group 'custom-magic-faces) |
17334 | 1529 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1530 (defconst custom-magic-alist '((nil "#" underline "\ |
17334 | 1531 uninitialized, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1532 (unknown "?" italic "\ |
17334 | 1533 unknown, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1534 (hidden "-" default "\ |
18362
4655515f51cc
(custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents:
18360
diff
changeset
|
1535 hidden, invoke \"Show\" in the previous line to show." "\ |
4655515f51cc
(custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents:
18360
diff
changeset
|
1536 group now hidden, invoke \"Show\", above, to show contents.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1537 (invalid "x" custom-invalid-face "\ |
18089 | 1538 the value displayed for this %c is invalid and cannot be set.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1539 (modified "*" custom-modified-face "\ |
18462
0e65e5074881
(custom-magic-alist): Update messages for `modified' and `set' states.
Richard M. Stallman <rms@gnu.org>
parents:
18460
diff
changeset
|
1540 you have edited the value as text, but you have not set the %c." "\ |
0e65e5074881
(custom-magic-alist): Update messages for `modified' and `set' states.
Richard M. Stallman <rms@gnu.org>
parents:
18460
diff
changeset
|
1541 you have edited something in this group, but not set it.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1542 (set "+" custom-set-face "\ |
18462
0e65e5074881
(custom-magic-alist): Update messages for `modified' and `set' states.
Richard M. Stallman <rms@gnu.org>
parents:
18460
diff
changeset
|
1543 you have set this %c, but not saved it for future sessions." "\ |
0e65e5074881
(custom-magic-alist): Update messages for `modified' and `set' states.
Richard M. Stallman <rms@gnu.org>
parents:
18460
diff
changeset
|
1544 something in this group has been set, but not saved.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1545 (changed ":" custom-changed-face "\ |
18089 | 1546 this %c has been changed outside the customize buffer." "\ |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1547 something in this group has been changed outside customize.") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1548 (saved "!" custom-saved-face "\ |
18089 | 1549 this %c has been set and saved." "\ |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1550 something in this group has been set and saved.") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1551 (rogue "@" custom-rogue-face "\ |
18089 | 1552 this %c has not been changed with customize." "\ |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1553 something in this group is not prepared for customization.") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1554 (standard " " nil "\ |
18089 | 1555 this %c is unchanged from its standard setting." "\ |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1556 visible group members are all at standard settings.")) |
17334 | 1557 "Alist of customize option states. |
25685 | 1558 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where |
17334 | 1559 |
1560 STATE is one of the following symbols: | |
1561 | |
1562 `nil' | |
1563 For internal use, should never occur. | |
1564 `unknown' | |
1565 For internal use, should never occur. | |
1566 `hidden' | |
25685 | 1567 This item is not being displayed. |
17334 | 1568 `invalid' |
1569 This item is modified, but has an invalid form. | |
1570 `modified' | |
1571 This item is modified, and has a valid form. | |
1572 `set' | |
1573 This item has been set but not saved. | |
1574 `changed' | |
1575 The current value of this item has been changed temporarily. | |
1576 `saved' | |
1577 This item is marked for saving. | |
1578 `rogue' | |
1579 This item has no customization information. | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1580 `standard' |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1581 This item is unchanged from the standard setting. |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1582 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1583 MAGIC is a string used to present that state. |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1584 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1585 FACE is a face used to present the state. |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1586 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1587 ITEM-DESC is a string describing the state for options. |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1588 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1589 GROUP-DESC is a string describing the state for groups. If this is |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1590 left out, ITEM-DESC will be used. |
17334 | 1591 |
18089 | 1592 The string %c in either description will be replaced with the |
1593 category of the item. These are `group'. `option', and `face'. | |
1594 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1595 The list should be sorted most significant first.") |
17334 | 1596 |
1597 (defcustom custom-magic-show 'long | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1598 "If non-nil, show textual description of the state. |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1599 If `long', show a full-line description, not just one word." |
17334 | 1600 :type '(choice (const :tag "no" nil) |
22600
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1601 (const long) |
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1602 (other :tag "short" short)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1603 :group 'custom-buffer) |
17334 | 1604 |
18089 | 1605 (defcustom custom-magic-show-hidden '(option face) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1606 "Control whether the State button is shown for hidden items. |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1607 The value should be a list with the custom categories where the State |
18089 | 1608 button should be visible. Possible categories are `group', `option', |
1609 and `face'." | |
1610 :type '(set (const group) (const option) (const face)) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1611 :group 'custom-buffer) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1612 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1613 (defcustom custom-magic-show-button nil |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1614 "Show a \"magic\" button indicating the state of each customization option." |
17334 | 1615 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1616 :group 'custom-buffer) |
17334 | 1617 |
1618 (define-widget 'custom-magic 'default | |
1619 "Show and manipulate state for a customization option." | |
1620 :format "%v" | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1621 :action 'widget-parent-action |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1622 :notify 'ignore |
17334 | 1623 :value-get 'ignore |
1624 :value-create 'custom-magic-value-create | |
1625 :value-delete 'widget-children-value-delete) | |
1626 | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1627 (defun widget-magic-mouse-down-action (widget &optional event) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1628 ;; Non-nil unless hidden. |
25685 | 1629 (not (eq (widget-get (widget-get (widget-get widget :parent) :parent) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1630 :custom-state) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1631 'hidden))) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1632 |
17334 | 1633 (defun custom-magic-value-create (widget) |
28130 | 1634 "Create compact status report for WIDGET." |
17334 | 1635 (let* ((parent (widget-get widget :parent)) |
1636 (state (widget-get parent :custom-state)) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1637 (hidden (eq state 'hidden)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1638 (entry (assq state custom-magic-alist)) |
17334 | 1639 (magic (nth 1 entry)) |
1640 (face (nth 2 entry)) | |
18089 | 1641 (category (widget-get parent :custom-category)) |
1642 (text (or (and (eq category 'group) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1643 (nth 4 entry)) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1644 (nth 3 entry))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1645 (form (widget-get parent :custom-form)) |
17334 | 1646 children) |
18089 | 1647 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text) |
25685 | 1648 (setq text (concat (match-string 1 text) |
18089 | 1649 (symbol-name category) |
1650 (match-string 2 text)))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1651 (when (and custom-magic-show |
18089 | 1652 (or (not hidden) |
1653 (memq category custom-magic-show-hidden))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1654 (insert " ") |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1655 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1656 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1657 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1658 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1659 (widget-get parent :custom-level)))) |
25685 | 1660 (push (widget-create-child-and-convert |
1661 widget 'choice-item | |
18087 | 1662 :help-echo "Change the state of this item." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1663 :format (if hidden "%t" "%[%t%]") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1664 :button-prefix 'widget-push-button-prefix |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1665 :button-suffix 'widget-push-button-suffix |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1666 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1667 :tag "State") |
17334 | 1668 children) |
1669 (insert ": ") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1670 (let ((start (point))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1671 (if (eq custom-magic-show 'long) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1672 (insert text) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1673 (insert (symbol-name state))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1674 (cond ((eq form 'lisp) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1675 (insert " (lisp)")) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1676 ((eq form 'mismatch) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1677 (insert " (mismatch)"))) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1678 (put-text-property start (point) 'face 'custom-state-face)) |
17334 | 1679 (insert "\n")) |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1680 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1681 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1682 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1683 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1684 (widget-get parent :custom-level)))) |
17334 | 1685 (when custom-magic-show-button |
1686 (when custom-magic-show | |
1687 (let ((indent (widget-get parent :indent))) | |
1688 (when indent | |
1689 (insert-char ? indent)))) | |
25685 | 1690 (push (widget-create-child-and-convert |
1691 widget 'choice-item | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1692 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1693 :button-face face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1694 :button-prefix "" |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1695 :button-suffix "" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1696 :help-echo "Change the state." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1697 :format (if hidden "%t" "%[%t%]") |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1698 :tag (if (memq form '(lisp mismatch)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1699 (concat "(" magic ")") |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1700 (concat "[" magic "]"))) |
17334 | 1701 children) |
1702 (insert " ")) | |
1703 (widget-put widget :children children))) | |
1704 | |
1705 (defun custom-magic-reset (widget) | |
1706 "Redraw the :custom-magic property of WIDGET." | |
1707 (let ((magic (widget-get widget :custom-magic))) | |
1708 (widget-value-set magic (widget-value magic)))) | |
1709 | |
1710 ;;; The `custom' Widget. | |
1711 | |
25685 | 1712 (defface custom-button-face |
32883
105ad8d20e29
(custom-button-face, custom-button-pressed-face): Merge x w32 and mac
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1713 '((((type x w32 mac) (class color)) ; Like default modeline |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31744
diff
changeset
|
1714 (:box (:line-width 2 :style released-button) |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31744
diff
changeset
|
1715 :background "lightgrey" :foreground "black")) |
25685 | 1716 (t |
1717 nil)) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1718 "Face used for buttons in customization buffers." |
25685 | 1719 :version "21.1" |
1720 :group 'custom-faces) | |
1721 | |
1722 (defface custom-button-pressed-face | |
32883
105ad8d20e29
(custom-button-face, custom-button-pressed-face): Merge x w32 and mac
Jason Rumney <jasonr@gnu.org>
parents:
32752
diff
changeset
|
1723 '((((type x w32 mac) (class color)) |
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31744
diff
changeset
|
1724 (:box (:line-width 2 :style pressed-button) |
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
31744
diff
changeset
|
1725 :background "lightgrey" :foreground "black")) |
25685 | 1726 (t |
1727 (:inverse-video t))) | |
1728 "Face used for buttons in customization buffers." | |
1729 :version "21.1" | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1730 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1731 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1732 (defface custom-documentation-face nil |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1733 "Face used for documentation strings in customization buffers." |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1734 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1735 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1736 (defface custom-state-face '((((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1737 (background dark)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1738 (:foreground "lime green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1739 (((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1740 (background light)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1741 (:foreground "dark green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1742 (t nil)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1743 "Face used for State descriptions in the customize buffer." |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1744 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1745 |
17334 | 1746 (define-widget 'custom 'default |
1747 "Customize a user option." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1748 :format "%v" |
17334 | 1749 :convert-widget 'custom-convert-widget |
1750 :notify 'custom-notify | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1751 :custom-prefix "" |
17334 | 1752 :custom-level 1 |
1753 :custom-state 'hidden | |
1754 :documentation-property 'widget-subclass-responsibility | |
1755 :value-create 'widget-subclass-responsibility | |
1756 :value-delete 'widget-children-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1757 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1758 :validate 'widget-children-validate |
17334 | 1759 :match (lambda (widget value) (symbolp value))) |
1760 | |
1761 (defun custom-convert-widget (widget) | |
28130 | 1762 "Initialize :value and :tag from :args in WIDGET." |
17334 | 1763 (let ((args (widget-get widget :args))) |
25685 | 1764 (when args |
17334 | 1765 (widget-put widget :value (widget-apply widget |
1766 :value-to-internal (car args))) | |
1767 (widget-put widget :tag (custom-unlispify-tag-name (car args))) | |
1768 (widget-put widget :args nil))) | |
1769 widget) | |
1770 | |
1771 (defun custom-notify (widget &rest args) | |
1772 "Keep track of changes." | |
18090 | 1773 (let ((state (widget-get widget :custom-state))) |
1774 (unless (eq state 'modified) | |
1775 (unless (memq state '(nil unknown hidden)) | |
1776 (widget-put widget :custom-state 'modified)) | |
1777 (custom-magic-reset widget) | |
1778 (apply 'widget-default-notify widget args)))) | |
17334 | 1779 |
1780 (defun custom-redraw (widget) | |
1781 "Redraw WIDGET with current settings." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1782 (let ((line (count-lines (point-min) (point))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1783 (column (current-column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1784 (pos (point)) |
17334 | 1785 (from (marker-position (widget-get widget :from))) |
1786 (to (marker-position (widget-get widget :to)))) | |
1787 (save-excursion | |
1788 (widget-value-set widget (widget-value widget)) | |
1789 (custom-redraw-magic widget)) | |
1790 (when (and (>= pos from) (<= pos to)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1791 (condition-case nil |
25685 | 1792 (progn |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1793 (if (> column 0) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1794 (goto-line line) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1795 (goto-line (1+ line))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1796 (move-to-column column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1797 (error nil))))) |
17334 | 1798 |
1799 (defun custom-redraw-magic (widget) | |
1800 "Redraw WIDGET state with current settings." | |
25685 | 1801 (while widget |
17334 | 1802 (let ((magic (widget-get widget :custom-magic))) |
25685 | 1803 (cond (magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1804 (widget-value-set magic (widget-value magic)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1805 (when (setq widget (widget-get widget :group)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1806 (custom-group-state-update widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1807 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1808 (setq widget nil))))) |
17334 | 1809 (widget-setup)) |
1810 | |
1811 (defun custom-show (widget value) | |
1812 "Non-nil if WIDGET should be shown with VALUE by default." | |
1813 (let ((show (widget-get widget :custom-show))) | |
1814 (cond ((null show) | |
1815 nil) | |
1816 ((eq t show) | |
1817 t) | |
1818 (t | |
1819 (funcall show widget value))))) | |
1820 | |
17415 | 1821 (defvar custom-load-recursion nil |
1822 "Hack to avoid recursive dependencies.") | |
1823 | |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
1824 ;;;###autoload |
17334 | 1825 (defun custom-load-symbol (symbol) |
1826 "Load all dependencies for SYMBOL." | |
17415 | 1827 (unless custom-load-recursion |
25685 | 1828 (let ((custom-load-recursion t) |
17415 | 1829 (loads (get symbol 'custom-loads)) |
1830 load) | |
1831 (while loads | |
1832 (setq load (car loads) | |
1833 loads (cdr loads)) | |
1834 (cond ((symbolp load) | |
1835 (condition-case nil | |
1836 (require load) | |
1837 (error nil))) | |
18059
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1838 ;; Don't reload a file already loaded. |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1839 ((and (boundp 'preloaded-file-list) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1840 (member load preloaded-file-list))) |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1841 ((assoc load load-history)) |
41606
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1842 ;; This was just (assoc (locate-library load) load-history) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1843 ;; but has been optimized not to load locate-library |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1844 ;; if not necessary. |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1845 ((let (found (regexp (regexp-quote load))) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1846 (dolist (loaded load-history) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1847 (and (string-match regexp (car loaded)) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1848 (eq (locate-library load) (car loaded)) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1849 (setq found t))) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1850 found)) |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1851 ;; Without this, we would load cus-edit recursively. |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1852 ;; We are still loading it when we call this, |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1853 ;; and it is not in load-history yet. |
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1854 ((equal load "cus-edit")) |
17415 | 1855 (t |
1856 (condition-case nil | |
41606
e694138746d6
(custom-load-symbol): Don't always load locate-library.
Richard M. Stallman <rms@gnu.org>
parents:
40825
diff
changeset
|
1857 (load-library load) |
17415 | 1858 (error nil)))))))) |
17334 | 1859 |
1860 (defun custom-load-widget (widget) | |
1861 "Load all dependencies for WIDGET." | |
1862 (custom-load-symbol (widget-value widget))) | |
1863 | |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1864 (defun custom-unloaded-symbol-p (symbol) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1865 "Return non-nil if the dependencies of SYMBOL has not yet been loaded." |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1866 (let ((found nil) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1867 (loads (get symbol 'custom-loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1868 load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1869 (while loads |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1870 (setq load (car loads) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1871 loads (cdr loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1872 (cond ((symbolp load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1873 (unless (featurep load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1874 (setq found t))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1875 ((assoc load load-history)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1876 ((assoc (locate-library load) load-history) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1877 (message nil)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1878 (t |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1879 (setq found t)))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1880 found)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1881 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1882 (defun custom-unloaded-widget-p (widget) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1883 "Return non-nil if the dependencies of WIDGET has not yet been loaded." |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1884 (custom-unloaded-symbol-p (widget-value widget))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1885 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1886 (defun custom-toggle-hide (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1887 "Toggle visibility of WIDGET." |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1888 (custom-load-widget widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1889 (let ((state (widget-get widget :custom-state))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1890 (cond ((memq state '(invalid modified)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1891 (error "There are unset changes")) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1892 ((eq state 'hidden) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1893 (widget-put widget :custom-state 'unknown)) |
25685 | 1894 (t |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1895 (widget-put widget :documentation-shown nil) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1896 (widget-put widget :custom-state 'hidden))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1897 (custom-redraw widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1898 (widget-setup))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1899 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1900 (defun custom-toggle-parent (widget &rest ignore) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1901 "Toggle visibility of parent of WIDGET." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1902 (custom-toggle-hide (widget-get widget :parent))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1903 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1904 (defun custom-add-see-also (widget &optional prefix) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1905 "Add `See also ...' to WIDGET if there are any links. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1906 Insert PREFIX first if non-nil." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1907 (let* ((symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1908 (links (get symbol 'custom-links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1909 (many (> (length links) 2)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1910 (buttons (widget-get widget :buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1911 (indent (widget-get widget :indent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1912 (when links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1913 (when indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1914 (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1915 (when prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1916 (insert prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1917 (insert "See also ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1918 (while links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1919 (push (widget-create-child-and-convert widget (car links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1920 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1921 (setq links (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1922 (cond ((null links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1923 (insert ".\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1924 ((null (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1925 (if many |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1926 (insert ", and ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1927 (insert " and "))) |
25685 | 1928 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1929 (insert ", ")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1930 (widget-put widget :buttons buttons)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1931 |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1932 (defun custom-add-parent-links (widget &optional initial-string) |
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1933 "Add \"Parent groups: ...\" to WIDGET if the group has parents. |
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1934 The value if non-nil if any parents were found. |
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1935 If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1936 (let ((name (widget-value widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1937 (type (widget-type widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1938 (buttons (widget-get widget :buttons)) |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1939 (start (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1940 found) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1941 (insert (or initial-string "Parent groups:")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1942 (mapatoms (lambda (symbol) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1943 (let ((entry (assq name (get symbol 'custom-group)))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1944 (when (eq (nth 1 entry) type) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1945 (insert " ") |
25685 | 1946 (push (widget-create-child-and-convert |
1947 widget 'custom-group-link | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1948 :tag (custom-unlispify-tag-name symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1949 symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1950 buttons) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1951 (setq found t))))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1952 (widget-put widget :buttons buttons) |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1953 (if found |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1954 (insert "\n") |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1955 (delete-region start (point))) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1956 found)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1957 |
25685 | 1958 ;;; The `custom-comment' Widget. |
1959 | |
1960 ;; like the editable field | |
1961 (defface custom-comment-face '((((class grayscale color) | |
1962 (background light)) | |
1963 (:background "gray85")) | |
1964 (((class grayscale color) | |
1965 (background dark)) | |
1966 (:background "dim gray")) | |
1967 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1968 (:slant italic))) |
25685 | 1969 "Face used for comments on variables or faces" |
1970 :version "21.1" | |
1971 :group 'custom-faces) | |
1972 | |
1973 ;; like font-lock-comment-face | |
1974 (defface custom-comment-tag-face | |
1975 '((((class color) (background dark)) (:foreground "gray80")) | |
1976 (((class color) (background light)) (:foreground "blue4")) | |
1977 (((class grayscale) (background light)) | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1978 (:foreground "DimGray" :weight bold :slant italic)) |
25685 | 1979 (((class grayscale) (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1980 (:foreground "LightGray" :weight bold :slant italic)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1981 (t (:weight bold))) |
25685 | 1982 "Face used for variables or faces comment tags" |
1983 :group 'custom-faces) | |
1984 | |
1985 (define-widget 'custom-comment 'string | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1986 "User comment." |
25685 | 1987 :tag "Comment" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1988 :help-echo "Edit a comment here." |
25685 | 1989 :sample-face 'custom-comment-tag-face |
1990 :value-face 'custom-comment-face | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1991 :shown nil |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1992 :create 'custom-comment-create) |
25685 | 1993 |
1994 (defun custom-comment-create (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1995 (let* ((null-comment (equal "" (widget-value widget)))) |
25847
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1996 (if (or (widget-get (widget-get widget :parent) :comment-shown) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1997 (not null-comment)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1998 (widget-default-create widget) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1999 ;; `widget-default-delete' expects markers in these slots -- |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2000 ;; maybe it shouldn't. |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2001 (widget-put widget :from (point-marker)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2002 (widget-put widget :to (point-marker))))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2003 |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2004 (defun custom-comment-hide (widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2005 (widget-put (widget-get widget :parent) :comment-shown nil)) |
25685 | 2006 |
2007 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's | |
2008 ;; the global custom one | |
2009 (defun custom-comment-show (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2010 (widget-put widget :comment-shown t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2011 (custom-redraw widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2012 (widget-setup)) |
25685 | 2013 |
2014 (defun custom-comment-invisible-p (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2015 (let ((val (widget-value (widget-get widget :comment-widget)))) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2016 (and (equal "" val) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2017 (not (widget-get widget :comment-shown))))) |
25685 | 2018 |
17334 | 2019 ;;; The `custom-variable' Widget. |
2020 | |
28130 | 2021 ;; When this was underlined blue, users confused it with a |
2022 ;; Mosaic-style hyperlink... | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2023 (defface custom-variable-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2024 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2025 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2026 (:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2027 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2028 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2029 (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2030 (t (:weight bold))) |
17334 | 2031 "Face used for unpushable variable tags." |
17415 | 2032 :group 'custom-faces) |
17334 | 2033 |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2034 (defface custom-variable-button-face '((t (:underline t :weight bold))) |
17334 | 2035 "Face used for pushable variable tags." |
17415 | 2036 :group 'custom-faces) |
17334 | 2037 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2038 (defcustom custom-variable-default-form 'edit |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2039 "Default form of displaying variable values." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2040 :type '(choice (const edit) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2041 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2042 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2043 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2044 |
17334 | 2045 (define-widget 'custom-variable 'custom |
2046 "Customize variable." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2047 :format "%v" |
17334 | 2048 :help-echo "Set or reset this variable." |
2049 :documentation-property 'variable-documentation | |
18089 | 2050 :custom-category 'option |
17334 | 2051 :custom-state nil |
2052 :custom-menu 'custom-variable-menu-create | |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2053 :custom-form nil ; defaults to value of `custom-variable-default-form' |
17334 | 2054 :value-create 'custom-variable-value-create |
2055 :action 'custom-variable-action | |
2056 :custom-set 'custom-variable-set | |
2057 :custom-save 'custom-variable-save | |
2058 :custom-reset-current 'custom-redraw | |
2059 :custom-reset-saved 'custom-variable-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2060 :custom-reset-standard 'custom-variable-reset-standard) |
17334 | 2061 |
17415 | 2062 (defun custom-variable-type (symbol) |
2063 "Return a widget suitable for editing the value of SYMBOL. | |
25685 | 2064 If SYMBOL has a `custom-type' property, use that. |
17415 | 2065 Otherwise, look up symbol in `custom-guess-type-alist'." |
2066 (let* ((type (or (get symbol 'custom-type) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2067 (and (not (get symbol 'standard-value)) |
17415 | 2068 (custom-guess-type symbol)) |
2069 'sexp)) | |
2070 (options (get symbol 'custom-options)) | |
2071 (tmp (if (listp type) | |
17534
a5cf59eee84b
(custom-variable-type): Use copy-sequence, not copy-list.
Richard M. Stallman <rms@gnu.org>
parents:
17521
diff
changeset
|
2072 (copy-sequence type) |
17415 | 2073 (list type)))) |
2074 (when options | |
2075 (widget-put tmp :options options)) | |
2076 tmp)) | |
2077 | |
17334 | 2078 (defun custom-variable-value-create (widget) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2079 "Here is where you edit the variable's value." |
17334 | 2080 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2081 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2082 (widget-put widget :custom-form custom-variable-default-form)) |
17334 | 2083 (let* ((buttons (widget-get widget :buttons)) |
2084 (children (widget-get widget :children)) | |
2085 (form (widget-get widget :custom-form)) | |
2086 (state (widget-get widget :custom-state)) | |
2087 (symbol (widget-get widget :value)) | |
2088 (tag (widget-get widget :tag)) | |
17415 | 2089 (type (custom-variable-type symbol)) |
17334 | 2090 (conv (widget-convert type)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2091 (get (or (get symbol 'custom-get) 'default-value)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2092 (prefix (widget-get widget :custom-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2093 (last (widget-get widget :custom-last)) |
17334 | 2094 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2095 (funcall get symbol) |
17334 | 2096 (widget-get conv :value)))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2097 ;; If the widget is new, the child determines whether it is hidden. |
17334 | 2098 (cond (state) |
2099 ((custom-show type value) | |
2100 (setq state 'unknown)) | |
2101 (t | |
2102 (setq state 'hidden))) | |
2103 ;; If we don't know the state, see if we need to edit it in lisp form. | |
2104 (when (eq state 'unknown) | |
2105 (unless (widget-apply conv :match value) | |
2106 ;; (widget-apply (widget-convert type) :match value) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2107 (setq form 'mismatch))) |
17334 | 2108 ;; Now we can create the child widget. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2109 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2110 (insert prefix (if last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2111 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2112 widget 'custom-browse-variable-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2113 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2114 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2115 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2116 ((eq state 'hidden) |
17334 | 2117 ;; Indicate hidden value. |
25685 | 2118 (push (widget-create-child-and-convert |
17334 | 2119 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2120 :format "%{%t%}: " |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2121 :sample-face 'custom-variable-tag-face |
17334 | 2122 :tag tag |
2123 :parent widget) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2124 buttons) |
25685 | 2125 (push (widget-create-child-and-convert |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2126 widget 'visibility |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2127 :help-echo "Show the value of this option." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2128 :action 'custom-toggle-parent |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2129 nil) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2130 buttons)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2131 ((memq form '(lisp mismatch)) |
17334 | 2132 ;; In lisp mode edit the saved value when possible. |
2133 (let* ((value (cond ((get symbol 'saved-value) | |
2134 (car (get symbol 'saved-value))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2135 ((get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2136 (car (get symbol 'standard-value))) |
17334 | 2137 ((default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2138 (custom-quote (funcall get symbol))) |
17334 | 2139 (t |
2140 (custom-quote (widget-get conv :value)))))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2141 (insert (symbol-name symbol) ": ") |
25685 | 2142 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2143 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2144 :help-echo "Hide the value of this option." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2145 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2146 t) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2147 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2148 (insert " ") |
25685 | 2149 (push (widget-create-child-and-convert |
2150 widget 'sexp | |
17334 | 2151 :button-face 'custom-variable-button-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2152 :format "%v" |
17334 | 2153 :tag (symbol-name symbol) |
2154 :parent widget | |
2155 :value value) | |
2156 children))) | |
2157 (t | |
2158 ;; Edit mode. | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2159 (let* ((format (widget-get type :format)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2160 tag-format value-format) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2161 (unless (string-match ":" format) |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2162 (error "Bad format")) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2163 (setq tag-format (substring format 0 (match-end 0))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2164 (setq value-format (substring format (match-end 0))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2165 (push (widget-create-child-and-convert |
25685 | 2166 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2167 :format tag-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2168 :action 'custom-tag-action |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2169 :help-echo "Change value of this option." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2170 :mouse-down-action 'custom-tag-mouse-down-action |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2171 :button-face 'custom-variable-button-face |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2172 :sample-face 'custom-variable-tag-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2173 tag) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2174 buttons) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2175 (insert " ") |
25685 | 2176 (push (widget-create-child-and-convert |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2177 widget 'visibility |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2178 :help-echo "Hide the value of this option." |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2179 :action 'custom-toggle-parent |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2180 t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2181 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2182 (push (widget-create-child-and-convert |
25685 | 2183 widget type |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2184 :format value-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2185 :value value) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2186 children)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2187 (unless (eq custom-buffer-style 'tree) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2188 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2189 (widget-insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2190 ;; Create the magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2191 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2192 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2193 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2194 (push magic buttons)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2195 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property |
25685 | 2196 ;; before the call to `widget-default-format-handler'. Otherwise, I |
2197 ;; loose my current `buttons'. This function shouldn't be called like | |
2198 ;; this anyway. The doc string widget should be added like the others. | |
2199 ;; --dv | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2200 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2201 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2202 (widget-default-format-handler widget ?h) |
25685 | 2203 |
2204 ;; The comment field | |
2205 (unless (eq state 'hidden) | |
2206 (let* ((comment (get symbol 'variable-comment)) | |
2207 (comment-widget | |
2208 (widget-create-child-and-convert | |
2209 widget 'custom-comment | |
2210 :parent widget | |
2211 :value (or comment "")))) | |
2212 (widget-put widget :comment-widget comment-widget) | |
2213 ;; Don't push it !!! Custom assumes that the first child is the | |
2214 ;; value one. | |
2215 (setq children (append children (list comment-widget))))) | |
2216 ;; Update the rest of the properties properties. | |
2217 (widget-put widget :custom-form form) | |
2218 (widget-put widget :children children) | |
2219 ;; Now update the state. | |
2220 (if (eq state 'hidden) | |
2221 (widget-put widget :custom-state state) | |
2222 (custom-variable-state-set widget)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2223 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2224 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2225 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2226 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2227 (custom-add-see-also widget))))) |
17334 | 2228 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2229 (defun custom-tag-action (widget &rest args) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2230 "Pass :action to first child of WIDGET's parent." |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2231 (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2232 :action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2233 |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2234 (defun custom-tag-mouse-down-action (widget &rest args) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2235 "Pass :mouse-down-action to first child of WIDGET's parent." |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2236 (apply 'widget-apply (car (widget-get (widget-get widget :parent) :children)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2237 :mouse-down-action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2238 |
17334 | 2239 (defun custom-variable-state-set (widget) |
2240 "Set the state of WIDGET." | |
2241 (let* ((symbol (widget-value widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2242 (get (or (get symbol 'custom-get) 'default-value)) |
17334 | 2243 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2244 (funcall get symbol) |
17334 | 2245 (widget-get widget :value))) |
25685 | 2246 (comment (get symbol 'variable-comment)) |
17334 | 2247 tmp |
25685 | 2248 temp |
2249 (state (cond ((progn (setq tmp (get symbol 'customized-value)) | |
2250 (setq temp | |
2251 (get symbol 'customized-variable-comment)) | |
2252 (or tmp temp)) | |
17334 | 2253 (if (condition-case nil |
25685 | 2254 (and (equal value (eval (car tmp))) |
2255 (equal comment temp)) | |
17334 | 2256 (error nil)) |
2257 'set | |
2258 'changed)) | |
25685 | 2259 ((progn (setq tmp (get symbol 'saved-value)) |
2260 (setq temp (get symbol 'saved-variable-comment)) | |
2261 (or tmp temp)) | |
17334 | 2262 (if (condition-case nil |
25685 | 2263 (and (equal value (eval (car tmp))) |
2264 (equal comment temp)) | |
17334 | 2265 (error nil)) |
2266 'saved | |
2267 'changed)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2268 ((setq tmp (get symbol 'standard-value)) |
17334 | 2269 (if (condition-case nil |
25685 | 2270 (and (equal value (eval (car tmp))) |
2271 (equal comment nil)) | |
17334 | 2272 (error nil)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2273 'standard |
17334 | 2274 'changed)) |
2275 (t 'rogue)))) | |
2276 (widget-put widget :custom-state state))) | |
2277 | |
25685 | 2278 (defvar custom-variable-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
2279 '(("Set for Current Session" custom-variable-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2280 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2281 (eq (widget-get widget :custom-state) 'modified))) |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
2282 ("Save for Future Sessions" custom-variable-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2283 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2284 (memq (widget-get widget :custom-state) '(modified set changed rogue)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2285 ("Reset to Current" custom-redraw |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2286 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2287 (and (default-boundp (widget-value widget)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2288 (memq (widget-get widget :custom-state) '(modified changed))))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2289 ("Reset to Saved" custom-variable-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2290 (lambda (widget) |
25685 | 2291 (and (or (get (widget-value widget) 'saved-value) |
2292 (get (widget-value widget) 'saved-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2293 (memq (widget-get widget :custom-state) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2294 '(modified set changed rogue))))) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2295 ("Erase Customization" custom-variable-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2296 (lambda (widget) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2297 (and (get (widget-value widget) 'standard-value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2298 (memq (widget-get widget :custom-state) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2299 '(modified set changed saved rogue))))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2300 ("---" ignore ignore) |
25685 | 2301 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2302 ("---" ignore ignore) | |
2303 ("Don't show as Lisp expression" custom-variable-edit | |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2304 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2305 (eq (widget-get widget :custom-form) 'lisp))) |
19823
0c1b4a44db76
(custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents:
19822
diff
changeset
|
2306 ("Show initial Lisp expression" custom-variable-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2307 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2308 (eq (widget-get widget :custom-form) 'edit)))) |
17334 | 2309 "Alist of actions for the `custom-variable' widget. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2310 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2311 the menu entry, ACTION is the function to call on the widget when the |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2312 menu is selected, and FILTER is a predicate which takes a `custom-variable' |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2313 widget as an argument, and returns non-nil if ACTION is valid on that |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2314 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2315 |
2316 (defun custom-variable-action (widget &optional event) | |
2317 "Show the menu for `custom-variable' WIDGET. | |
2318 Optional EVENT is the location for the menu." | |
2319 (if (eq (widget-get widget :custom-state) 'hidden) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2320 (custom-toggle-hide widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2321 (unless (eq (widget-get widget :custom-state) 'modified) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2322 (custom-variable-state-set widget)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2323 (custom-redraw-magic widget) |
17334 | 2324 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2325 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2326 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2327 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2328 (custom-menu-filter custom-variable-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2329 widget) |
17334 | 2330 event))) |
2331 (if answer | |
2332 (funcall answer widget))))) | |
2333 | |
2334 (defun custom-variable-edit (widget) | |
2335 "Edit value of WIDGET." | |
2336 (widget-put widget :custom-state 'unknown) | |
2337 (widget-put widget :custom-form 'edit) | |
2338 (custom-redraw widget)) | |
2339 | |
2340 (defun custom-variable-edit-lisp (widget) | |
28130 | 2341 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2342 (widget-put widget :custom-state 'unknown) |
2343 (widget-put widget :custom-form 'lisp) | |
2344 (custom-redraw widget)) | |
2345 | |
2346 (defun custom-variable-set (widget) | |
2347 "Set the current value for the variable being edited by WIDGET." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2348 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2349 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2350 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2351 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2352 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2353 (comment-widget (widget-get widget :comment-widget)) |
2354 (comment (widget-value comment-widget)) | |
2355 val) | |
17334 | 2356 (cond ((eq state 'hidden) |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2357 (error "Cannot set hidden variable")) |
17334 | 2358 ((setq val (widget-apply child :validate)) |
2359 (goto-char (widget-get val :from)) | |
2360 (error "%s" (widget-get val :error))) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2361 ((memq form '(lisp mismatch)) |
25685 | 2362 (when (equal comment "") |
2363 (setq comment nil) | |
2364 ;; Make the comment invisible by hand if it's empty | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2365 (custom-comment-hide comment-widget)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2366 (funcall set symbol (eval (setq val (widget-value child)))) |
25685 | 2367 (put symbol 'customized-value (list val)) |
2368 (put symbol 'variable-comment comment) | |
2369 (put symbol 'customized-variable-comment comment)) | |
17334 | 2370 (t |
25685 | 2371 (when (equal comment "") |
2372 (setq comment nil) | |
2373 ;; Make the comment invisible by hand if it's empty | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2374 (custom-comment-hide comment-widget)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2375 (funcall set symbol (setq val (widget-value child))) |
25685 | 2376 (put symbol 'customized-value (list (custom-quote val))) |
2377 (put symbol 'variable-comment comment) | |
2378 (put symbol 'customized-variable-comment comment))) | |
17334 | 2379 (custom-variable-state-set widget) |
2380 (custom-redraw-magic widget))) | |
2381 | |
2382 (defun custom-variable-save (widget) | |
19823
0c1b4a44db76
(custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents:
19822
diff
changeset
|
2383 "Set and save the value for the variable being edited by WIDGET." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2384 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2385 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2386 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2387 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2388 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2389 (comment-widget (widget-get widget :comment-widget)) |
2390 (comment (widget-value comment-widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2391 val) |
17334 | 2392 (cond ((eq state 'hidden) |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2393 (error "Cannot set hidden variable")) |
17334 | 2394 ((setq val (widget-apply child :validate)) |
2395 (goto-char (widget-get val :from)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
2396 (error "Saving %s: %s" symbol (widget-get val :error))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2397 ((memq form '(lisp mismatch)) |
25685 | 2398 (when (equal comment "") |
2399 (setq comment nil) | |
2400 ;; Make the comment invisible by hand if it's empty | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2401 (custom-comment-hide comment-widget)) |
17334 | 2402 (put symbol 'saved-value (list (widget-value child))) |
25685 | 2403 (funcall set symbol (eval (widget-value child))) |
2404 (put symbol 'variable-comment comment) | |
2405 (put symbol 'saved-variable-comment comment)) | |
17334 | 2406 (t |
25685 | 2407 (when (equal comment "") |
2408 (setq comment nil) | |
2409 ;; Make the comment invisible by hand if it's empty | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2410 (custom-comment-hide comment-widget)) |
25685 | 2411 (put symbol 'saved-value |
2412 (list (custom-quote (widget-value child)))) | |
2413 (funcall set symbol (widget-value child)) | |
2414 (put symbol 'variable-comment comment) | |
2415 (put symbol 'saved-variable-comment comment))) | |
17334 | 2416 (put symbol 'customized-value nil) |
25685 | 2417 (put symbol 'customized-variable-comment nil) |
17334 | 2418 (custom-save-all) |
2419 (custom-variable-state-set widget) | |
2420 (custom-redraw-magic widget))) | |
2421 | |
2422 (defun custom-variable-reset-saved (widget) | |
2423 "Restore the saved value for the variable being edited by WIDGET." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2424 (let* ((symbol (widget-value widget)) |
25685 | 2425 (set (or (get symbol 'custom-set) 'set-default)) |
2426 (value (get symbol 'saved-value)) | |
2427 (comment (get symbol 'saved-variable-comment))) | |
2428 (cond ((or value comment) | |
2429 (put symbol 'variable-comment comment) | |
2430 (condition-case nil | |
2431 (funcall set symbol (eval (car value))) | |
2432 (error nil))) | |
2433 (t | |
2434 (error "No saved value for %s" symbol))) | |
17334 | 2435 (put symbol 'customized-value nil) |
25685 | 2436 (put symbol 'customized-variable-comment nil) |
17334 | 2437 (widget-put widget :custom-state 'unknown) |
25685 | 2438 ;; This call will possibly make the comment invisible |
17334 | 2439 (custom-redraw widget))) |
2440 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2441 (defun custom-variable-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2442 "Restore the standard setting for the variable being edited by WIDGET. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2443 This operation eliminates any saved setting for the variable, |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2444 restoring it to the state of a variable that has never been customized." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2445 (let* ((symbol (widget-value widget)) |
30284
7dd010204a23
(custom-variable-reset-saved, custom-variable-reset-standard): Remove
Dave Love <fx@gnu.org>
parents:
30247
diff
changeset
|
2446 (set (or (get symbol 'custom-set) 'set-default))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2447 (if (get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2448 (funcall set symbol (eval (car (get symbol 'standard-value)))) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
2449 (error "No standard setting known for %S" symbol)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2450 (put symbol 'variable-comment nil) |
17334 | 2451 (put symbol 'customized-value nil) |
25685 | 2452 (put symbol 'customized-variable-comment nil) |
2453 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | |
17334 | 2454 (put symbol 'saved-value nil) |
25685 | 2455 (put symbol 'saved-variable-comment nil) |
17334 | 2456 (custom-save-all)) |
2457 (widget-put widget :custom-state 'unknown) | |
25685 | 2458 ;; This call will possibly make the comment invisible |
17334 | 2459 (custom-redraw widget))) |
2460 | |
2461 ;;; The `custom-face-edit' Widget. | |
2462 | |
2463 (define-widget 'custom-face-edit 'checklist | |
2464 "Edit face attributes." | |
2465 :format "%t: %v" | |
2466 :tag "Attributes" | |
2467 :extra-offset 12 | |
25685 | 2468 :button-args '(:help-echo "Control whether this attribute has any effect.") |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2469 :value-to-internal 'custom-face-edit-fix-value |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2470 :match (lambda (widget value) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2471 (widget-checklist-match widget |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2472 (custom-face-edit-fix-value widget value))) |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2473 :convert-widget 'custom-face-edit-convert-widget |
17334 | 2474 :args (mapcar (lambda (att) |
25685 | 2475 (list 'group |
17334 | 2476 :inline t |
2477 :sibling-args (widget-get (nth 1 att) :sibling-args) | |
25685 | 2478 (list 'const :format "" :value (nth 0 att)) |
17334 | 2479 (nth 1 att))) |
2480 custom-face-attributes)) | |
2481 | |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2482 (defun custom-face-edit-fix-value (widget value) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2483 "Ignoring WIDGET, convert :bold and :italic in VALUE to new form." |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2484 (let (result) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2485 (while value |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2486 (let ((key (car value)) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2487 (val (car (cdr value)))) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2488 (cond ((eq key :italic) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2489 (push :slant result) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2490 (push (if val 'italic 'normal) result)) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2491 ((eq key :bold) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2492 (push :weight result) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2493 (push (if val 'bold 'normal) result)) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2494 (t |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2495 (push key result) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2496 (push val result)))) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2497 (setq value (cdr (cdr value)))) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2498 (setq result (nreverse result)) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2499 result)) |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2500 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2501 (defun custom-face-edit-convert-widget (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2502 "Convert :args as widget types in WIDGET." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2503 (widget-put |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2504 widget |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2505 :args (mapcar (lambda (arg) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2506 (widget-convert arg |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2507 :deactivate 'custom-face-edit-deactivate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2508 :activate 'custom-face-edit-activate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2509 :delete 'custom-face-edit-delete)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2510 (widget-get widget :args))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2511 widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2512 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2513 (defun custom-face-edit-deactivate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2514 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2515 (unless (widget-get widget :inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2516 (let ((tag (custom-face-edit-attribute-tag widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2517 (from (copy-marker (widget-get widget :from))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2518 (to (widget-get widget :to)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2519 (value (widget-value widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2520 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2521 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2522 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2523 (goto-char from) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2524 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2525 (insert tag ": *\n") |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2526 (widget-put widget :inactive |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2527 (cons value (cons from (- (point) from)))))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2528 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2529 (defun custom-face-edit-activate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2530 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2531 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2532 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2533 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2534 (when (consp inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2535 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2536 (goto-char (car (cdr inactive))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2537 (delete-region (point) (+ (point) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2538 (widget-put widget :inactive nil) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2539 (widget-apply widget :create) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2540 (widget-value-set widget (car inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2541 (widget-setup))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2542 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2543 (defun custom-face-edit-delete (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2544 "Remove widget from the buffer." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2545 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2546 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2547 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2548 (if (not inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2549 ;; Widget is alive, we don't have to do anything special |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2550 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2551 ;; WIDGET is already deleted because we did so to inactivate it; |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2552 ;; now just get rid of the label we put in its place. |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2553 (delete-region (car (cdr inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2554 (+ (car (cdr inactive)) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2555 (widget-put widget :inactive nil)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2556 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2557 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2558 (defun custom-face-edit-attribute-tag (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2559 "Returns the first :tag property in WIDGET or one of its children." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2560 (let ((tag (widget-get widget :tag))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2561 (or (and (not (equal tag "")) tag) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2562 (let ((children (widget-get widget :children))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2563 (while (and (null tag) children) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2564 (setq tag (custom-face-edit-attribute-tag (pop children)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2565 tag)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2566 |
17334 | 2567 ;;; The `custom-display' Widget. |
2568 | |
2569 (define-widget 'custom-display 'menu-choice | |
2570 "Select a display type." | |
2571 :tag "Display" | |
2572 :value t | |
2573 :help-echo "Specify frames where the face attributes should be used." | |
2574 :args '((const :tag "all" t) | |
2575 (checklist | |
2576 :offset 0 | |
2577 :extra-offset 9 | |
2578 :args ((group :sibling-args (:help-echo "\ | |
2579 Only match the specified window systems.") | |
2580 (const :format "Type: " | |
2581 type) | |
2582 (checklist :inline t | |
2583 :offset 0 | |
2584 (const :format "X " | |
2585 :sibling-args (:help-echo "\ | |
2586 The X11 Window System.") | |
2587 x) | |
2588 (const :format "PM " | |
2589 :sibling-args (:help-echo "\ | |
2590 OS/2 Presentation Manager.") | |
2591 pm) | |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2592 (const :format "W32 " |
17334 | 2593 :sibling-args (:help-echo "\ |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2594 Windows NT/9X.") |
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2595 w32) |
17334 | 2596 (const :format "DOS " |
2597 :sibling-args (:help-echo "\ | |
2598 Plain MS-DOS.") | |
2599 pc) | |
2600 (const :format "TTY%n" | |
2601 :sibling-args (:help-echo "\ | |
2602 Plain text terminals.") | |
2603 tty))) | |
2604 (group :sibling-args (:help-echo "\ | |
2605 Only match the frames with the specified color support.") | |
2606 (const :format "Class: " | |
2607 class) | |
2608 (checklist :inline t | |
2609 :offset 0 | |
2610 (const :format "Color " | |
2611 :sibling-args (:help-echo "\ | |
2612 Match color frames.") | |
2613 color) | |
2614 (const :format "Grayscale " | |
2615 :sibling-args (:help-echo "\ | |
2616 Match grayscale frames.") | |
2617 grayscale) | |
2618 (const :format "Monochrome%n" | |
2619 :sibling-args (:help-echo "\ | |
2620 Match frames with no color support.") | |
2621 mono))) | |
2622 (group :sibling-args (:help-echo "\ | |
2623 Only match frames with the specified intensity.") | |
2624 (const :format "\ | |
2625 Background brightness: " | |
2626 background) | |
2627 (checklist :inline t | |
2628 :offset 0 | |
2629 (const :format "Light " | |
2630 :sibling-args (:help-echo "\ | |
2631 Match frames with light backgrounds.") | |
2632 light) | |
2633 (const :format "Dark\n" | |
2634 :sibling-args (:help-echo "\ | |
2635 Match frames with dark backgrounds.") | |
2636 dark))))))) | |
2637 | |
2638 ;;; The `custom-face' Widget. | |
2639 | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2640 (defface custom-face-tag-face |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2641 `((t (:weight bold :height 1.2 :inherit variable-pitch))) |
17334 | 2642 "Face used for face tags." |
17415 | 2643 :group 'custom-faces) |
17334 | 2644 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2645 (defcustom custom-face-default-form 'selected |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2646 "Default form of displaying face definition." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2647 :type '(choice (const all) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2648 (const selected) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2649 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2650 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2651 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2652 |
17334 | 2653 (define-widget 'custom-face 'custom |
2654 "Customize face." | |
2655 :sample-face 'custom-face-tag-face | |
2656 :help-echo "Set or reset this face." | |
28716
e9fb71a3e51d
(custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28700
diff
changeset
|
2657 :documentation-property #'face-doc-string |
17334 | 2658 :value-create 'custom-face-value-create |
2659 :action 'custom-face-action | |
18089 | 2660 :custom-category 'face |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2661 :custom-form nil ; defaults to value of `custom-face-default-form' |
17334 | 2662 :custom-set 'custom-face-set |
2663 :custom-save 'custom-face-save | |
2664 :custom-reset-current 'custom-redraw | |
2665 :custom-reset-saved 'custom-face-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2666 :custom-reset-standard 'custom-face-reset-standard |
17334 | 2667 :custom-menu 'custom-face-menu-create) |
2668 | |
25685 | 2669 (define-widget 'custom-face-all 'editable-list |
17334 | 2670 "An editable list of display specifications and attributes." |
2671 :entry-format "%i %d %v" | |
2672 :insert-button-args '(:help-echo "Insert new display specification here.") | |
2673 :append-button-args '(:help-echo "Append new display specification here.") | |
2674 :delete-button-args '(:help-echo "Delete this display specification.") | |
2675 :args '((group :format "%v" custom-display custom-face-edit))) | |
2676 | |
2677 (defconst custom-face-all (widget-convert 'custom-face-all) | |
2678 "Converted version of the `custom-face-all' widget.") | |
2679 | |
2680 (define-widget 'custom-display-unselected 'item | |
2681 "A display specification that doesn't match the selected display." | |
2682 :match 'custom-display-unselected-match) | |
2683 | |
2684 (defun custom-display-unselected-match (widget value) | |
2685 "Non-nil if VALUE is an unselected display specification." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2686 (not (face-spec-set-match-display value (selected-frame)))) |
17334 | 2687 |
25685 | 2688 (define-widget 'custom-face-selected 'group |
17334 | 2689 "Edit the attributes of the selected display in a face specification." |
2690 :args '((repeat :format "" | |
2691 :inline t | |
2692 (group custom-display-unselected sexp)) | |
2693 (group (sexp :format "") custom-face-edit) | |
2694 (repeat :format "" | |
2695 :inline t | |
2696 sexp))) | |
2697 | |
2698 (defconst custom-face-selected (widget-convert 'custom-face-selected) | |
2699 "Converted version of the `custom-face-selected' widget.") | |
2700 | |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2701 (defun custom-filter-face-spec (spec filter-index &optional default-filter) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2702 "Return a canonicalized version of SPEC using. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2703 FILTER-INDEX is the index in the entry for each attribute in |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2704 `custom-face-attributes' at which the appropriate filter function can be |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2705 found, and DEFAULT-FILTER is the filter to apply for attributes that |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2706 don't specify one." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2707 (mapcar (lambda (entry) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2708 ;; Filter a single face-spec entry |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2709 (let ((tests (car entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2710 (unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2711 ;; Handle both old- and new-style attribute syntax |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2712 (if (listp (car (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2713 (car (cdr entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2714 (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2715 (filtered-attrs nil)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2716 ;; Filter each face attribute |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2717 (while unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2718 (let* ((attr (pop unfiltered-attrs)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2719 (pre-filtered-value (pop unfiltered-attrs)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2720 (filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2721 (or (nth filter-index (assq attr custom-face-attributes)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2722 default-filter)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2723 (filtered-value |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2724 (if filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2725 (funcall filter pre-filtered-value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2726 pre-filtered-value))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2727 (push filtered-value filtered-attrs) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2728 (push attr filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2729 ;; |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2730 (list tests filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2731 spec)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2732 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2733 (defun custom-pre-filter-face-spec (spec) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2734 "Return SPEC changed as necessary for editing by the face customization widget. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2735 SPEC must be a full face spec." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2736 (custom-filter-face-spec spec 2)) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2737 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2738 (defun custom-post-filter-face-spec (spec) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2739 "Return the customized SPEC in a form suitable for setting the face." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2740 (custom-filter-face-spec spec 3)) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2741 |
17334 | 2742 (defun custom-face-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2743 "Create a list of the display specifications for WIDGET." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2744 (let ((buttons (widget-get widget :buttons)) |
25685 | 2745 children |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2746 (symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2747 (tag (widget-get widget :tag)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2748 (state (widget-get widget :custom-state)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2749 (begin (point)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2750 (is-last (widget-get widget :custom-last)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2751 (prefix (widget-get widget :custom-prefix))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2752 (unless tag |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2753 (setq tag (prin1-to-string symbol))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2754 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2755 (insert prefix (if is-last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2756 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2757 widget 'custom-browse-face-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2758 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2759 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2760 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2761 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2762 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2763 (insert tag) |
34041
40708840c132
(custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents:
33986
diff
changeset
|
2764 (widget-specify-sample widget begin (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2765 (if (eq custom-buffer-style 'face) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2766 (insert " ") |
33024
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2767 (if (string-match "face\\'" tag) |
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2768 (insert ":") |
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2769 (insert " face: "))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2770 ;; Sample. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2771 (push (widget-create-child-and-convert widget 'item |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2772 :format "(%{%t%})" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2773 :sample-face symbol |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2774 :tag "sample") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2775 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2776 ;; Visibility. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2777 (insert " ") |
25685 | 2778 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2779 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2780 :help-echo "Hide or show this face." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2781 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2782 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2783 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2784 ;; Magic. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2785 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2786 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2787 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2788 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2789 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2790 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2791 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2792 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2793 (widget-default-format-handler widget ?h) |
25685 | 2794 ;; The comment field |
2795 (unless (eq state 'hidden) | |
2796 (let* ((comment (get symbol 'face-comment)) | |
2797 (comment-widget | |
2798 (widget-create-child-and-convert | |
2799 widget 'custom-comment | |
2800 :parent widget | |
2801 :value (or comment "")))) | |
2802 (widget-put widget :comment-widget comment-widget) | |
2803 (push comment-widget children))) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2804 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2805 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2806 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2807 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2808 (custom-add-see-also widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2809 ;; Editor. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2810 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2811 (insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2812 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2813 (message "Creating face editor...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2814 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2815 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2816 (widget-put widget :custom-form custom-face-default-form)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2817 (let* ((symbol (widget-value widget)) |
40825
22caa22b7399
2001-11-07 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40801
diff
changeset
|
2818 (spec (or (get symbol 'customized-face) |
22caa22b7399
2001-11-07 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40801
diff
changeset
|
2819 (get symbol 'saved-face) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2820 (get symbol 'face-defface-spec) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2821 ;; Attempt to construct it. |
25685 | 2822 (list (list t (custom-face-attributes-get |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2823 symbol (selected-frame)))))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2824 (form (widget-get widget :custom-form)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2825 (indent (widget-get widget :indent)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2826 edit) |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2827 ;; If the user has changed this face in some other way, |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2828 ;; edit it as the user has specified it. |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2829 (if (not (face-spec-match-p symbol spec (selected-frame))) |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2830 (setq spec (list (list t (face-attr-construct symbol (selected-frame)))))) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2831 (setq spec (custom-pre-filter-face-spec spec)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2832 (setq edit (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2833 widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2834 (cond ((and (eq form 'selected) |
25685 | 2835 (widget-apply custom-face-selected |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2836 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2837 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2838 'custom-face-selected) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2839 ((and (not (eq form 'lisp)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2840 (widget-apply custom-face-all |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2841 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2842 'custom-face-all) |
25685 | 2843 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2844 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2845 'sexp)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2846 :value spec)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2847 (custom-face-state-set widget) |
25685 | 2848 (push edit children) |
2849 (widget-put widget :children children)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2850 (message "Creating face editor...done")))))) |
17334 | 2851 |
25685 | 2852 (defvar custom-face-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
2853 '(("Set for Current Session" custom-face-set) |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2854 ("Save for Future Sessions" custom-face-save-command) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2855 ("Reset to Saved" custom-face-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2856 (lambda (widget) |
25685 | 2857 (or (get (widget-value widget) 'saved-face) |
2858 (get (widget-value widget) 'saved-face-comment)))) | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2859 ("Erase Customization" custom-face-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2860 (lambda (widget) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2861 (get (widget-value widget) 'face-defface-spec))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2862 ("---" ignore ignore) |
25685 | 2863 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2864 ("---" ignore ignore) | |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2865 ("Show all display specs" custom-face-edit-all |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2866 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2867 (not (eq (widget-get widget :custom-form) 'all)))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2868 ("Just current attributes" custom-face-edit-selected |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2869 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2870 (not (eq (widget-get widget :custom-form) 'selected)))) |
40801
f49e883aeab2
Backed out last change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40800
diff
changeset
|
2871 ("Show as Lisp expression" custom-face-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2872 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2873 (not (eq (widget-get widget :custom-form) 'lisp))))) |
17334 | 2874 "Alist of actions for the `custom-face' widget. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2875 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2876 the menu entry, ACTION is the function to call on the widget when the |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2877 menu is selected, and FILTER is a predicate which takes a `custom-face' |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2878 widget as an argument, and returns non-nil if ACTION is valid on that |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2879 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2880 |
2881 (defun custom-face-edit-selected (widget) | |
2882 "Edit selected attributes of the value of WIDGET." | |
2883 (widget-put widget :custom-state 'unknown) | |
2884 (widget-put widget :custom-form 'selected) | |
2885 (custom-redraw widget)) | |
2886 | |
2887 (defun custom-face-edit-all (widget) | |
2888 "Edit all attributes of the value of WIDGET." | |
2889 (widget-put widget :custom-state 'unknown) | |
2890 (widget-put widget :custom-form 'all) | |
2891 (custom-redraw widget)) | |
2892 | |
2893 (defun custom-face-edit-lisp (widget) | |
28130 | 2894 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2895 (widget-put widget :custom-state 'unknown) |
2896 (widget-put widget :custom-form 'lisp) | |
2897 (custom-redraw widget)) | |
2898 | |
2899 (defun custom-face-state-set (widget) | |
2900 "Set the state of WIDGET." | |
25685 | 2901 (let* ((symbol (widget-value widget)) |
2902 (comment (get symbol 'face-comment)) | |
2903 tmp temp) | |
2904 (widget-put widget :custom-state | |
2905 (cond ((progn | |
2906 (setq tmp (get symbol 'customized-face)) | |
2907 (setq temp (get symbol 'customized-face-comment)) | |
2908 (or tmp temp)) | |
2909 (if (equal temp comment) | |
2910 'set | |
2911 'changed)) | |
2912 ((progn | |
2913 (setq tmp (get symbol 'saved-face)) | |
2914 (setq temp (get symbol 'saved-face-comment)) | |
2915 (or tmp temp)) | |
2916 (if (equal temp comment) | |
2917 'saved | |
2918 'changed)) | |
2919 ((get symbol 'face-defface-spec) | |
2920 (if (equal comment nil) | |
2921 'standard | |
2922 'changed)) | |
2923 (t | |
2924 'rogue))))) | |
17334 | 2925 |
2926 (defun custom-face-action (widget &optional event) | |
2927 "Show the menu for `custom-face' WIDGET. | |
2928 Optional EVENT is the location for the menu." | |
2929 (if (eq (widget-get widget :custom-state) 'hidden) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2930 (custom-toggle-hide widget) |
17334 | 2931 (let* ((completion-ignore-case t) |
2932 (symbol (widget-get widget :value)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2933 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2934 (custom-unlispify-tag-name symbol)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2935 (custom-menu-filter custom-face-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2936 widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2937 event))) |
17334 | 2938 (if answer |
2939 (funcall answer widget))))) | |
2940 | |
2941 (defun custom-face-set (widget) | |
2942 "Make the face attributes in WIDGET take effect." | |
2943 (let* ((symbol (widget-value widget)) | |
2944 (child (car (widget-get widget :children))) | |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2945 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 2946 (comment-widget (widget-get widget :comment-widget)) |
2947 (comment (widget-value comment-widget))) | |
2948 (when (equal comment "") | |
2949 (setq comment nil) | |
2950 ;; Make the comment invisible by hand if it's empty | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2951 (custom-comment-hide comment-widget)) |
17334 | 2952 (put symbol 'customized-face value) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2953 (if (face-spec-choose value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2954 (face-spec-set symbol value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2955 ;; face-set-spec ignores empty attribute lists, so just give it |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2956 ;; something harmless instead. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2957 (face-spec-set symbol '((t :foreground unspecified)))) |
25685 | 2958 (put symbol 'customized-face-comment comment) |
2959 (put symbol 'face-comment comment) | |
17334 | 2960 (custom-face-state-set widget) |
2961 (custom-redraw-magic widget))) | |
2962 | |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2963 (defun custom-face-save-command (widget) |
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2964 "Save in `.emacs' the face attributes in WIDGET." |
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2965 (custom-face-save widget) |
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2966 (custom-save-all)) |
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2967 |
17334 | 2968 (defun custom-face-save (widget) |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2969 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'." |
17334 | 2970 (let* ((symbol (widget-value widget)) |
2971 (child (car (widget-get widget :children))) | |
35441
d85fe63db92b
(custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents:
35265
diff
changeset
|
2972 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 2973 (comment-widget (widget-get widget :comment-widget)) |
2974 (comment (widget-value comment-widget))) | |
2975 (when (equal comment "") | |
2976 (setq comment nil) | |
2977 ;; Make the comment invisible by hand if it's empty | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2978 (custom-comment-hide comment-widget)) |
35441
d85fe63db92b
(custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents:
35265
diff
changeset
|
2979 (if (face-spec-choose value) |
d85fe63db92b
(custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents:
35265
diff
changeset
|
2980 (face-spec-set symbol value) |
d85fe63db92b
(custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents:
35265
diff
changeset
|
2981 ;; face-set-spec ignores empty attribute lists, so just give it |
d85fe63db92b
(custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents:
35265
diff
changeset
|
2982 ;; something harmless instead. |
d85fe63db92b
(custom-face-save): Do post-processing on the face's new value like
Miles Bader <miles@gnu.org>
parents:
35265
diff
changeset
|
2983 (face-spec-set symbol '((t :foreground unspecified)))) |
17334 | 2984 (put symbol 'saved-face value) |
2985 (put symbol 'customized-face nil) | |
25685 | 2986 (put symbol 'face-comment comment) |
2987 (put symbol 'customized-face-comment nil) | |
2988 (put symbol 'saved-face-comment comment) | |
20262
c6532008f2a9
(custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents:
20174
diff
changeset
|
2989 (custom-save-all) |
17334 | 2990 (custom-face-state-set widget) |
2991 (custom-redraw-magic widget))) | |
2992 | |
2993 (defun custom-face-reset-saved (widget) | |
2994 "Restore WIDGET to the face's default attributes." | |
2995 (let* ((symbol (widget-value widget)) | |
2996 (child (car (widget-get widget :children))) | |
25685 | 2997 (value (get symbol 'saved-face)) |
2998 (comment (get symbol 'saved-face-comment)) | |
2999 (comment-widget (widget-get widget :comment-widget))) | |
3000 (unless (or value comment) | |
17334 | 3001 (error "No saved value for this face")) |
3002 (put symbol 'customized-face nil) | |
25685 | 3003 (put symbol 'customized-face-comment nil) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3004 (face-spec-set symbol value) |
25685 | 3005 (put symbol 'face-comment comment) |
17334 | 3006 (widget-value-set child value) |
25685 | 3007 ;; This call manages the comment visibility |
3008 (widget-value-set comment-widget (or comment "")) | |
17334 | 3009 (custom-face-state-set widget) |
3010 (custom-redraw-magic widget))) | |
3011 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3012 (defun custom-face-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3013 "Restore WIDGET to the face's standard settings. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3014 This operation eliminates any saved setting for the face, |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3015 restoring it to the state of a face that has never been customized." |
17334 | 3016 (let* ((symbol (widget-value widget)) |
3017 (child (car (widget-get widget :children))) | |
25685 | 3018 (value (get symbol 'face-defface-spec)) |
3019 (comment-widget (widget-get widget :comment-widget))) | |
17334 | 3020 (unless value |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
3021 (error "No standard setting for this face")) |
17334 | 3022 (put symbol 'customized-face nil) |
25685 | 3023 (put symbol 'customized-face-comment nil) |
3024 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | |
17334 | 3025 (put symbol 'saved-face nil) |
25685 | 3026 (put symbol 'saved-face-comment nil) |
17334 | 3027 (custom-save-all)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3028 (face-spec-set symbol value) |
25685 | 3029 (put symbol 'face-comment nil) |
17334 | 3030 (widget-value-set child value) |
25685 | 3031 ;; This call manages the comment visibility |
3032 (widget-value-set comment-widget "") | |
17334 | 3033 (custom-face-state-set widget) |
3034 (custom-redraw-magic widget))) | |
3035 | |
3036 ;;; The `face' Widget. | |
3037 | |
3038 (define-widget 'face 'default | |
3039 "Select and customize a face." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3040 :convert-widget 'widget-value-convert-widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3041 :button-prefix 'widget-push-button-prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3042 :button-suffix 'widget-push-button-suffix |
33986 | 3043 :format "%{%t%}: %[select face%] %v" |
17334 | 3044 :tag "Face" |
3045 :value 'default | |
3046 :value-create 'widget-face-value-create | |
3047 :value-delete 'widget-face-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3048 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3049 :validate 'widget-children-validate |
17334 | 3050 :action 'widget-face-action |
28612
0051d3178111
(custom-face, face): Unquote the lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28568
diff
changeset
|
3051 :match (lambda (widget value) (symbolp value))) |
17334 | 3052 |
3053 (defun widget-face-value-create (widget) | |
28130 | 3054 "Create a `custom-face' child." |
17334 | 3055 (let* ((symbol (widget-value widget)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3056 (custom-buffer-style 'face) |
17334 | 3057 (child (widget-create-child-and-convert |
3058 widget 'custom-face | |
3059 :custom-level nil | |
3060 :value symbol))) | |
3061 (custom-magic-reset child) | |
3062 (setq custom-options (cons child custom-options)) | |
3063 (widget-put widget :children (list child)))) | |
3064 | |
3065 (defun widget-face-value-delete (widget) | |
28130 | 3066 "Remove the child from the options." |
17334 | 3067 (let ((child (car (widget-get widget :children)))) |
3068 (setq custom-options (delq child custom-options)) | |
3069 (widget-children-value-delete widget))) | |
3070 | |
3071 (defvar face-history nil | |
3072 "History of entered face names.") | |
3073 | |
3074 (defun widget-face-action (widget &optional event) | |
3075 "Prompt for a face." | |
3076 (let ((answer (completing-read "Face: " | |
3077 (mapcar (lambda (face) | |
3078 (list (symbol-name face))) | |
3079 (face-list)) | |
25685 | 3080 nil nil nil |
17334 | 3081 'face-history))) |
3082 (unless (zerop (length answer)) | |
3083 (widget-value-set widget (intern answer)) | |
3084 (widget-apply widget :notify widget event) | |
3085 (widget-setup)))) | |
3086 | |
3087 ;;; The `hook' Widget. | |
3088 | |
3089 (define-widget 'hook 'list | |
3090 "A emacs lisp hook" | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3091 :value-to-internal (lambda (widget value) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
3092 (if (and value (symbolp value)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3093 (list value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3094 value)) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3095 :match (lambda (widget value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3096 (or (symbolp value) |
20174
e1ca1fe89e6e
(hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents:
20100
diff
changeset
|
3097 (widget-group-match widget value))) |
28130 | 3098 ;; Avoid adding undefined functions to the hook, especially for |
3099 ;; things like `find-file-hook' or even more basic ones, to avoid | |
3100 ;; chaos. | |
3101 :set (lambda (symbol value) | |
28310
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3102 (dolist (elt value) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3103 (if (fboundp elt) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3104 (add-hook symbol elt)))) |
17334 | 3105 :convert-widget 'custom-hook-convert-widget |
3106 :tag "Hook") | |
3107 | |
3108 (defun custom-hook-convert-widget (widget) | |
27250
807fc106b24c
(custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
26803
diff
changeset
|
3109 ;; Handle `:options'. |
17334 | 3110 (let* ((options (widget-get widget :options)) |
25685 | 3111 (other `(editable-list :inline t |
17334 | 3112 :entry-format "%i %d%v" |
3113 (function :format " %v"))) | |
3114 (args (if options | |
3115 (list `(checklist :inline t | |
3116 ,@(mapcar (lambda (entry) | |
3117 `(function-item ,entry)) | |
3118 options)) | |
3119 other) | |
3120 (list other)))) | |
3121 (widget-put widget :args args) | |
3122 widget)) | |
3123 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3124 ;;; The `custom-group-link' Widget. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3125 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3126 (define-widget 'custom-group-link 'link |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3127 "Show parent in other window when activated." |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3128 :help-echo "Create customization buffer for this group." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3129 :action 'custom-group-link-action) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3130 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3131 (defun custom-group-link-action (widget &rest ignore) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3132 (customize-group (widget-value widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3133 |
17334 | 3134 ;;; The `custom-group' Widget. |
3135 | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3136 (defcustom custom-group-tag-faces nil |
17334 | 3137 ;; In XEmacs, this ought to play games with font size. |
25685 | 3138 ;; Fixme: make it do so in Emacs. |
17334 | 3139 "Face used for group tags. |
3140 The first member is used for level 1 groups, the second for level 2, | |
3141 and so forth. The remaining group tags are shown with | |
3142 `custom-group-tag-face'." | |
3143 :type '(repeat face) | |
17415 | 3144 :group 'custom-faces) |
17334 | 3145 |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3146 (defface custom-group-tag-face-1 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3147 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3148 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3149 (:foreground "pink" :weight bold :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3150 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3151 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3152 (:foreground "red" :weight bold :height 1.2 :inherit variable-pitch)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3153 (t (:weight bold))) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3154 "Face used for group tags." |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3155 :group 'custom-faces) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3156 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3157 (defface custom-group-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3158 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3159 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3160 (:foreground "light blue" :weight bold :height 1.2)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3161 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3162 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3163 (:foreground "blue" :weight bold :height 1.2)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3164 (t (:weight bold))) |
17334 | 3165 "Face used for low level group tags." |
17415 | 3166 :group 'custom-faces) |
17334 | 3167 |
3168 (define-widget 'custom-group 'custom | |
3169 "Customize group." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3170 :format "%v" |
17334 | 3171 :sample-face-get 'custom-group-sample-face-get |
3172 :documentation-property 'group-documentation | |
3173 :help-echo "Set or reset all members of this group." | |
3174 :value-create 'custom-group-value-create | |
3175 :action 'custom-group-action | |
18089 | 3176 :custom-category 'group |
17334 | 3177 :custom-set 'custom-group-set |
3178 :custom-save 'custom-group-save | |
3179 :custom-reset-current 'custom-group-reset-current | |
3180 :custom-reset-saved 'custom-group-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3181 :custom-reset-standard 'custom-group-reset-standard |
17334 | 3182 :custom-menu 'custom-group-menu-create) |
3183 | |
3184 (defun custom-group-sample-face-get (widget) | |
3185 ;; Use :sample-face. | |
3186 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) | |
3187 'custom-group-tag-face)) | |
3188 | |
18430
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3189 (define-widget 'custom-group-visibility 'visibility |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3190 "An indicator and manipulator for hidden group contents." |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3191 :create 'custom-group-visibility-create) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3192 |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3193 (defun custom-group-visibility-create (widget) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3194 (let ((visible (widget-value widget))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3195 (if visible |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3196 (insert "--------"))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3197 (widget-default-create widget)) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3198 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3199 (defun custom-group-members (symbol groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3200 "Return SYMBOL's custom group members. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3201 If GROUPS-ONLY non-nil, return only those members that are groups." |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3202 (if (not groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3203 (get symbol 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3204 (let (members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3205 (dolist (entry (get symbol 'custom-group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3206 (when (eq (nth 1 entry) 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3207 (push entry members))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3208 (nreverse members)))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3209 |
17334 | 3210 (defun custom-group-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3211 "Insert a customize group for WIDGET in the current buffer." |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3212 (let* ((state (widget-get widget :custom-state)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3213 (level (widget-get widget :custom-level)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3214 ;; (indent (widget-get widget :indent)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3215 (prefix (widget-get widget :custom-prefix)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3216 (buttons (widget-get widget :buttons)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3217 (tag (widget-get widget :tag)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3218 (symbol (widget-value widget)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3219 (members (custom-group-members symbol |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3220 (and (eq custom-buffer-style 'tree) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3221 custom-browse-only-groups)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3222 (cond ((and (eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3223 (eq state 'hidden) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3224 (or members (custom-unloaded-widget-p widget))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3225 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3226 (push (widget-create-child-and-convert |
25685 | 3227 widget 'custom-browse-visibility |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3228 ;; :tag-glyph "plus" |
18856
03eeb83520d8
(custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents:
18812
diff
changeset
|
3229 :tag "+") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3230 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3231 (insert "-- ") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3232 ;; (widget-glyph-insert nil "-- " "horizontal") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3233 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3234 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3235 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3236 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3237 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3238 ((and (eq custom-buffer-style 'tree) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3239 (zerop (length members))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3240 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3241 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3242 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3243 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3244 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3245 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3246 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3247 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3248 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3249 ((eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3250 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3251 (custom-load-widget widget) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3252 (if (zerop (length members)) |
25685 | 3253 (progn |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3254 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3255 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3256 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3257 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3258 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3259 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3260 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3261 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3262 (widget-put widget :buttons buttons)) |
25685 | 3263 (push (widget-create-child-and-convert |
3264 widget 'custom-browse-visibility | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3265 ;; :tag-glyph "minus" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3266 :tag "-") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3267 buttons) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3268 (insert "-\\ ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3269 ;; (widget-glyph-insert nil "-\\ " "top") |
25685 | 3270 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3271 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3272 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3273 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3274 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3275 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3276 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3277 custom-browse-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3278 custom-browse-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3279 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3280 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3281 (extra-prefix (if (widget-get widget :custom-last) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3282 " " |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3283 " | ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3284 (prefix (concat prefix extra-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3285 children entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3286 (while members |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3287 (setq entry (car members) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3288 members (cdr members)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3289 (push (widget-create-child-and-convert |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3290 widget (nth 1 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3291 :group widget |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3292 :tag (custom-unlispify-tag-name (nth 0 entry)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3293 :custom-prefixes custom-prefix-list |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3294 :custom-level (1+ level) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3295 :custom-last (null members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3296 :value (nth 0 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3297 :custom-prefix prefix) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3298 children)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3299 (widget-put widget :children (reverse children))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3300 (message "Creating group...done"))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3301 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3302 ((eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3303 ;; Create level indicator. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3304 (unless (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3305 (insert-char ?\ (* custom-buffer-indent (1- level))) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3306 (insert "-- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3307 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3308 (let ((begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3309 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3310 (widget-specify-sample widget begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3311 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3312 ;; Create link/visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3313 (if (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3314 (push (widget-create-child-and-convert |
25685 | 3315 widget 'custom-group-link |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3316 :tag "Go to Group" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3317 symbol) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3318 buttons) |
25685 | 3319 (push (widget-create-child-and-convert |
20100
0db4553d47cc
(custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents:
19886
diff
changeset
|
3320 widget 'custom-group-visibility |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3321 :help-echo "Show members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3322 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3323 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3324 buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3325 (insert " \n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3326 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3327 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3328 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3329 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3330 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3331 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3332 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3333 ;; Insert documentation. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3334 (if (and (eq custom-buffer-style 'links) (> level 1)) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3335 (widget-put widget :documentation-indent 0)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3336 (widget-default-format-handler widget ?h)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3337 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3338 (t ;Visible. |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3339 ;; Add parent groups references above the group. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3340 (if t ;;; This should test that the buffer |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3341 ;;; was made to display a group. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3342 (when (eq level 1) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
3343 (if (custom-add-parent-links widget |
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
3344 "Go to parent group:") |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3345 (insert "\n")))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3346 ;; Create level indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3347 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3348 (insert "/- ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3349 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3350 (let ((start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3351 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3352 (widget-specify-sample widget start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3353 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3354 ;; Create visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3355 (unless (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3356 (insert "--------") |
25685 | 3357 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3358 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3359 :help-echo "Hide members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3360 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3361 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3362 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3363 (insert " ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3364 ;; Create more dashes. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3365 ;; Use 76 instead of 75 to compensate for the temporary "<" |
25685 | 3366 ;; added by `widget-insert'. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3367 (insert-char ?- (- 76 (current-column) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3368 (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3369 (insert "\\\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3370 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3371 (let ((magic (widget-create-child-and-convert |
25685 | 3372 widget 'custom-magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3373 :indent 0 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3374 nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3375 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3376 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3377 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3378 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3379 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3380 (widget-default-format-handler widget ?h) |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3381 ;; Parent groups. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3382 (if nil ;;; This should test that the buffer |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3383 ;;; was not made to display a group. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3384 (when (eq level 1) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3385 (insert-char ?\ custom-buffer-indent) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3386 (custom-add-parent-links widget))) |
25685 | 3387 (custom-add-see-also widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3388 (make-string (* custom-buffer-indent level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3389 ?\ )) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3390 ;; Members. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3391 (message "Creating group...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3392 (custom-load-widget widget) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3393 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3394 custom-buffer-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3395 custom-buffer-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3396 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3397 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3398 (length (length members)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3399 (count 0) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3400 (children (mapcar (lambda (entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3401 (widget-insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3402 (message "\ |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3403 Creating group members... %2d%%" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3404 (/ (* 100.0 count) length)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3405 (setq count (1+ count)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3406 (prog1 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3407 (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3408 widget (nth 1 entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3409 :group widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3410 :tag (custom-unlispify-tag-name |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3411 (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3412 :custom-prefixes custom-prefix-list |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3413 :custom-level (1+ level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3414 :value (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3415 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3416 (widget-insert "\n")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3417 members))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3418 (message "Creating group magic...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3419 (mapc 'custom-magic-reset children) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3420 (message "Creating group state...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3421 (widget-put widget :children children) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3422 (custom-group-state-update widget) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3423 (message "Creating group... done")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3424 ;; End line |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3425 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3426 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3427 (insert "\\- " (widget-get widget :tag) " group end ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3428 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3429 (insert "/\n"))))) |
17334 | 3430 |
25685 | 3431 (defvar custom-group-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3432 '(("Set for Current Session" custom-group-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3433 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3434 (eq (widget-get widget :custom-state) 'modified))) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3435 ("Save for Future Sessions" custom-group-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3436 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3437 (memq (widget-get widget :custom-state) '(modified set)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3438 ("Reset to Current" custom-group-reset-current |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3439 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3440 (memq (widget-get widget :custom-state) '(modified)))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3441 ("Reset to Saved" custom-group-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3442 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3443 (memq (widget-get widget :custom-state) '(modified set)))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3444 ("Reset to standard setting" custom-group-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3445 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3446 (memq (widget-get widget :custom-state) '(modified set saved))))) |
17334 | 3447 "Alist of actions for the `custom-group' widget. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3448 Each entry has the form (NAME ACTION FILTER) where NAME is the name of |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3449 the menu entry, ACTION is the function to call on the widget when the |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3450 menu is selected, and FILTER is a predicate which takes a `custom-group' |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3451 widget as an argument, and returns non-nil if ACTION is valid on that |
25685 | 3452 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3453 |
3454 (defun custom-group-action (widget &optional event) | |
3455 "Show the menu for `custom-group' WIDGET. | |
3456 Optional EVENT is the location for the menu." | |
3457 (if (eq (widget-get widget :custom-state) 'hidden) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3458 (custom-toggle-hide widget) |
17334 | 3459 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3460 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3461 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3462 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3463 (custom-menu-filter custom-group-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3464 widget) |
17334 | 3465 event))) |
3466 (if answer | |
3467 (funcall answer widget))))) | |
3468 | |
3469 (defun custom-group-set (widget) | |
3470 "Set changes in all modified group members." | |
3471 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3472 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3473 (when (eq (widget-get child :custom-state) 'modified) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3474 (widget-apply child :custom-set))) |
17334 | 3475 children ))) |
3476 | |
3477 (defun custom-group-save (widget) | |
3478 "Save all modified group members." | |
3479 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3480 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3481 (when (memq (widget-get child :custom-state) '(modified set)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3482 (widget-apply child :custom-save))) |
17334 | 3483 children ))) |
3484 | |
3485 (defun custom-group-reset-current (widget) | |
3486 "Reset all modified group members." | |
3487 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3488 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3489 (when (eq (widget-get child :custom-state) 'modified) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3490 (widget-apply child :custom-reset-current))) |
17334 | 3491 children ))) |
3492 | |
3493 (defun custom-group-reset-saved (widget) | |
3494 "Reset all modified or set group members." | |
3495 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3496 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3497 (when (memq (widget-get child :custom-state) '(modified set)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3498 (widget-apply child :custom-reset-saved))) |
17334 | 3499 children ))) |
3500 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3501 (defun custom-group-reset-standard (widget) |
17334 | 3502 "Reset all modified, set, or saved group members." |
3503 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3504 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3505 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3506 '(modified set saved)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3507 (widget-apply child :custom-reset-standard))) |
17334 | 3508 children ))) |
3509 | |
3510 (defun custom-group-state-update (widget) | |
3511 "Update magic." | |
3512 (unless (eq (widget-get widget :custom-state) 'hidden) | |
3513 (let* ((children (widget-get widget :children)) | |
3514 (states (mapcar (lambda (child) | |
3515 (widget-get child :custom-state)) | |
3516 children)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3517 (magics custom-magic-alist) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3518 (found 'standard)) |
17334 | 3519 (while magics |
3520 (let ((magic (car (car magics)))) | |
3521 (if (and (not (eq magic 'hidden)) | |
3522 (memq magic states)) | |
3523 (setq found magic | |
3524 magics nil) | |
3525 (setq magics (cdr magics))))) | |
3526 (widget-put widget :custom-state found))) | |
3527 (custom-magic-reset widget)) | |
3528 | |
3529 ;;; The `custom-save-all' Function. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
3530 ;;;###autoload |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3531 (defcustom custom-file nil |
17334 | 3532 "File used for storing customization information. |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3533 The default is nil, which means to use your init file |
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3534 as specified by `user-init-file'. If you specify some other file, |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3535 you need to explicitly load that file for the settings to take effect. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3536 |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3537 When you change this variable, look in the previous custom file |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3538 \(usually your init file) for the forms `(custom-set-variables ...)' |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3539 and `(custom-set-faces ...)', and copy them (whichever ones you find) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3540 to the new custom file. This will preserve your existing customizations." |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3541 :type '(choice (const :tag "Your Emacs init file" nil) file) |
17334 | 3542 :group 'customize) |
3543 | |
20974 | 3544 (defun custom-file () |
3545 "Return the file name for saving customizations." | |
37911
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3546 (setq custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3547 (or custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3548 (let ((user-init-file user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3549 (default-init-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3550 (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3551 (when (null user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3552 (if (or (file-exists-p default-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3553 (and (eq system-type 'windows-nt) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3554 (file-exists-p "~/_emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3555 ;; Started with -q, i.e. the file containing |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3556 ;; Custom settings hasn't been read. Saving |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3557 ;; settings there would overwrite other settings. |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3558 (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3559 (setq user-init-file default-init-file)) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3560 user-init-file)))) |
20974 | 3561 |
17334 | 3562 (defun custom-save-delete (symbol) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3563 "Visit `custom-file' and delete all calls to SYMBOL from it. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3564 Leave point at the old location of the first such call, |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3565 or (if there were none) at the end of the buffer." |
20398
47f326ffb7ba
(custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents:
20397
diff
changeset
|
3566 (let ((default-major-mode)) |
20974 | 3567 (set-buffer (find-file-noselect (custom-file)))) |
17334 | 3568 (goto-char (point-min)) |
25058
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3569 ;; Skip all whitespace and comments. |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3570 (while (forward-comment 1)) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3571 (or (eobp) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3572 (save-excursion (forward-sexp (buffer-size)))) ; Test for scan errors. |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3573 (let (first) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3574 (catch 'found |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3575 (while t ;; We exit this loop only via throw. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3576 ;; Skip all whitespace and comments. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3577 (while (forward-comment 1)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3578 (let ((start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3579 (sexp (condition-case nil |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3580 (read (current-buffer)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3581 (end-of-file (throw 'found nil))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3582 (when (and (listp sexp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3583 (eq (car sexp) symbol)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3584 (delete-region start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3585 (unless first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3586 (setq first (point))))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3587 (if first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3588 (goto-char first) |
36628
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3589 ;; Move in front of local variables, otherwise long Custom |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3590 ;; entries would make them ineffective. |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3591 (let ((pos (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3592 (case-fold-search t)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3593 (save-excursion |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3594 (goto-char (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3595 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3596 'move) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3597 (when (search-forward "Local Variables:" nil t) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3598 (setq pos (line-beginning-position)))) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3599 (goto-char pos))))) |
17334 | 3600 |
3601 (defun custom-save-variables () | |
3602 "Save all customized variables in `custom-file'." | |
3603 (save-excursion | |
3604 (custom-save-delete 'custom-set-variables) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3605 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3606 (saved-list (make-list 1 0)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3607 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3608 ;; First create a sorted list of saved variables. |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3609 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3610 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3611 (if (get symbol 'saved-value) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3612 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3613 (setq saved-list (sort (cdr saved-list) 'string<)) |
17334 | 3614 (unless (bolp) |
3615 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3616 (princ "(custom-set-variables |
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3617 ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! |
34423
dca808278c39
(custom-save-variables, custom-save-faces):
Gerd Moellmann <gerd@gnu.org>
parents:
34041
diff
changeset
|
3618 ;; Your init file should contain only one such instance.\n") |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3619 (mapcar |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3620 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3621 (let ((value (get symbol 'saved-value)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3622 (requests (get symbol 'custom-requests)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3623 (now (not (or (get symbol 'standard-value) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3624 (and (not (boundp symbol)) |
25685 | 3625 (not (get symbol 'force-value)))))) |
3626 (comment (get symbol 'saved-variable-comment)) | |
3627 sep) | |
3628 (when (or value comment) | |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3629 (unless (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3630 (princ "\n")) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3631 (princ " '(") |
25685 | 3632 (prin1 symbol) |
3633 (princ " ") | |
3634 (prin1 (car value)) | |
3635 (cond ((or now requests comment) | |
3636 (princ " ") | |
3637 (if now | |
3638 (princ "t") | |
3639 (princ "nil")) | |
3640 (cond ((or requests comment) | |
3641 (princ " ") | |
3642 (if requests | |
3643 (prin1 requests) | |
3644 (princ "nil")) | |
3645 (cond (comment | |
3646 (princ " ") | |
3647 (prin1 comment) | |
3648 (princ ")")) | |
3649 (t | |
3650 (princ ")")))) | |
3651 (t | |
3652 (princ ")")))) | |
3653 (t | |
3654 (princ ")")))))) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3655 saved-list) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3656 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3657 (princ " ")) |
17334 | 3658 (princ ")") |
3659 (unless (looking-at "\n") | |
3660 (princ "\n"))))) | |
3661 | |
3662 (defun custom-save-faces () | |
3663 "Save all customized faces in `custom-file'." | |
3664 (save-excursion | |
3665 (custom-save-delete 'custom-set-faces) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3666 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3667 (saved-list (make-list 1 0)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3668 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3669 ;; First create a sorted list of saved faces. |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3670 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3671 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3672 (if (get symbol 'saved-face) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3673 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3674 (setq saved-list (sort (cdr saved-list) 'string<)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3675 ;; The default face must be first, since it affects the others. |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3676 (if (memq 'default saved-list) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3677 (setq saved-list (cons 'default (delq 'default saved-list)))) |
17334 | 3678 (unless (bolp) |
3679 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3680 (princ "(custom-set-faces |
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3681 ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! |
34423
dca808278c39
(custom-save-variables, custom-save-faces):
Gerd Moellmann <gerd@gnu.org>
parents:
34041
diff
changeset
|
3682 ;; Your init file should contain only one such instance.\n") |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3683 (mapcar |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3684 (lambda (symbol) |
25685 | 3685 (let ((value (get symbol 'saved-face)) |
3686 (now (not (or (get 'default 'face-defface-spec) | |
3687 (and (not (custom-facep 'default)) | |
3688 (not (get 'default 'force-face)))))) | |
3689 (comment (get 'default 'saved-face-comment))) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3690 (unless (eq symbol 'default)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3691 ;; Don't print default face here. |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3692 (unless (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3693 (princ "\n")) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3694 (princ " '(") |
25685 | 3695 (prin1 symbol) |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3696 (princ " ") |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3697 (prin1 value) |
25685 | 3698 (cond ((or now comment) |
3699 (princ " ") | |
3700 (if now | |
3701 (princ "t") | |
3702 (princ "nil")) | |
3703 (cond (comment | |
3704 (princ " ") | |
3705 (prin1 comment) | |
3706 (princ ")")) | |
3707 (t | |
3708 (princ ")")))) | |
3709 (t | |
3710 (princ ")"))))) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3711 saved-list) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3712 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3713 (princ " ")) |
17334 | 3714 (princ ")") |
3715 (unless (looking-at "\n") | |
3716 (princ "\n"))))) | |
3717 | |
3718 ;;;###autoload | |
18436
2163f03bb88f
(customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents:
18435
diff
changeset
|
3719 (defun customize-save-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3720 "Save all user options which have been set in this session." |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3721 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3722 (mapatoms (lambda (symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3723 (let ((face (get symbol 'customized-face)) |
25685 | 3724 (value (get symbol 'customized-value)) |
3725 (face-comment (get symbol 'customized-face-comment)) | |
3726 (variable-comment | |
3727 (get symbol 'customized-variable-comment))) | |
3728 (when face | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3729 (put symbol 'saved-face face) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3730 (put symbol 'customized-face nil)) |
25685 | 3731 (when value |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3732 (put symbol 'saved-value value) |
25685 | 3733 (put symbol 'customized-value nil)) |
3734 (when variable-comment | |
3735 (put symbol 'saved-variable-comment variable-comment) | |
3736 (put symbol 'customized-variable-comment nil)) | |
3737 (when face-comment | |
3738 (put symbol 'saved-face-comment face-comment) | |
3739 (put symbol 'customized-face-comment nil))))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3740 ;; We really should update all custom buffers here. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3741 (custom-save-all)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3742 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3743 ;;;###autoload |
17334 | 3744 (defun custom-save-all () |
3745 "Save all customizations in `custom-file'." | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3746 (let ((inhibit-read-only t)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3747 (custom-save-variables) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3748 (custom-save-faces) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3749 (save-excursion |
20398
47f326ffb7ba
(custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents:
20397
diff
changeset
|
3750 (let ((default-major-mode nil)) |
20974 | 3751 (set-buffer (find-file-noselect (custom-file)))) |
42930
09e1ef4107e7
(custom-save-all): Bind file-precious-flag to t for saving .emacs.
Richard M. Stallman <rms@gnu.org>
parents:
42451
diff
changeset
|
3752 (let ((file-precious-flag t)) |
09e1ef4107e7
(custom-save-all): Bind file-precious-flag to t for saving .emacs.
Richard M. Stallman <rms@gnu.org>
parents:
42451
diff
changeset
|
3753 (save-buffer))))) |
17334 | 3754 |
43167
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3755 ;;;###autoload |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3756 (defun customize-mark-to-save (symbol) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3757 "Mark SYMBOL for later saving. |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3758 |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3759 If the default value of SYMBOL is different from the standard value, |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3760 set the `saved-value' property to a list whose car evaluates to the |
43167
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3761 default value. Otherwise, set it til nil. |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3762 |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3763 To actually save the value, call `custom-save-all'. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3764 |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3765 Return non-nil iff the `saved-value' property actually changed." |
43167
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3766 (let* ((get (or (get symbol 'custom-get) 'default-value)) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3767 (value (funcall get symbol)) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3768 (saved (get symbol 'saved-value)) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3769 (standard (get symbol 'standard-value)) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3770 (comment (get symbol 'customized-variable-comment))) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3771 ;; Save default value iff different from standard value. |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3772 (if (or (null standard) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3773 (not (equal value (condition-case nil |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3774 (eval (car standard)) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3775 (error nil))))) |
43167
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3776 (put symbol 'saved-value (list (custom-quote value))) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3777 (put symbol 'saved-value nil)) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3778 ;; Clear customized information (set, but not saved). |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3779 (put symbol 'customized-value nil) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3780 ;; Save any comment that might have been set. |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3781 (when comment |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3782 (put symbol 'saved-variable-comment comment)) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3783 (not (equal saved (get symbol 'saved-value))))) |
6dab4dad0093
2002-02-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43063
diff
changeset
|
3784 |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3785 ;;;###autoload |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3786 (defun customize-mark-as-set (symbol) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3787 "Mark current value of SYMBOL as being set from customize. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3788 |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3789 If the default value of SYMBOL is different from the saved value if any, |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3790 or else if it is different from the standard value, set the |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3791 `customized-value' property to a list whose car evaluates to the |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3792 default value. Otherwise, set it til nil. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3793 |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3794 Return non-nil iff the `customized-value' property actually changed." |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3795 (let* ((get (or (get symbol 'custom-get) 'default-value)) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3796 (value (funcall get symbol)) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3797 (customized (get symbol 'customized-value)) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3798 (old (or (get symbol 'saved-value) (get symbol 'standard-value)))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3799 ;; Mark default value as set iff different from old value. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3800 (if (or (null old) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3801 (not (equal value (condition-case nil |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3802 (eval (car old)) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3803 (error nil))))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3804 (put symbol 'customized-value (list (custom-quote value))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3805 (put symbol 'customized-value nil)) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3806 ;; Changed? |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3807 (not (equal customized (get symbol 'customized-value))))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
3808 |
17334 | 3809 ;;; The Customize Menu. |
3810 | |
17415 | 3811 ;;; Menu support |
3812 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3813 (defcustom custom-menu-nesting 2 |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3814 "Maximum nesting in custom menus." |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3815 :type 'integer |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3816 :group 'custom-menu) |
17334 | 3817 |
3818 (defun custom-face-menu-create (widget symbol) | |
3819 "Ignoring WIDGET, create a menu entry for customization face SYMBOL." | |
3820 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3821 `(customize-face ',symbol) |
17334 | 3822 t)) |
3823 | |
3824 (defun custom-variable-menu-create (widget symbol) | |
3825 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL." | |
3826 (let ((type (get symbol 'custom-type))) | |
3827 (unless (listp type) | |
3828 (setq type (list type))) | |
3829 (if (and type (widget-get type :custom-menu)) | |
3830 (widget-apply type :custom-menu symbol) | |
3831 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3832 `(customize-variable ',symbol) |
17334 | 3833 t)))) |
3834 | |
17415 | 3835 ;; Add checkboxes to boolean variable entries. |
17334 | 3836 (widget-put (get 'boolean 'widget-type) |
3837 :custom-menu (lambda (widget symbol) | |
3838 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3839 `(customize-variable ',symbol) |
17334 | 3840 ':style 'toggle |
3841 ':selected symbol))) | |
3842 | |
30184
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3843 (defun custom-group-menu-create (widget symbol) |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3844 "Ignoring WIDGET, create a menu entry for customization group SYMBOL." |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3845 `( ,(custom-unlispify-menu-entry symbol t) |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3846 :filter (lambda (&rest junk) |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3847 (cdr (custom-menu-create ',symbol))))) |
17334 | 3848 |
17415 | 3849 ;;;###autoload |
3850 (defun custom-menu-create (symbol) | |
17334 | 3851 "Create menu for customization group SYMBOL. |
3852 The menu is in a format applicable to `easy-menu-define'." | |
17415 | 3853 (let* ((item (vector (custom-unlispify-menu-entry symbol) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3854 `(customize-group ',symbol) |
17415 | 3855 t))) |
3856 (if (and (or (not (boundp 'custom-menu-nesting)) | |
3857 (>= custom-menu-nesting 0)) | |
17334 | 3858 (< (length (get symbol 'custom-group)) widget-menu-max-size)) |
3859 (let ((custom-prefix-list (custom-prefix-add symbol | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3860 custom-prefix-list)) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3861 (members (custom-sort-items (get symbol 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3862 custom-menu-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3863 custom-menu-order-groups))) |
17334 | 3864 (custom-load-symbol symbol) |
3865 `(,(custom-unlispify-menu-entry symbol t) | |
3866 ,item | |
3867 "--" | |
3868 ,@(mapcar (lambda (entry) | |
3869 (widget-apply (if (listp (nth 1 entry)) | |
3870 (nth 1 entry) | |
3871 (list (nth 1 entry))) | |
3872 :custom-menu (nth 0 entry))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3873 members))) |
17334 | 3874 item))) |
3875 | |
3876 ;;;###autoload | |
17415 | 3877 (defun customize-menu-create (symbol &optional name) |
3878 "Return a customize menu for customization group SYMBOL. | |
25685 | 3879 If optional NAME is given, use that as the name of the menu. |
17415 | 3880 Otherwise the menu will be named `Customize'. |
3881 The format is suitable for use with `easy-menu-define'." | |
3882 (unless name | |
3883 (setq name "Customize")) | |
30184
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3884 `(,name |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3885 :filter (lambda (&rest junk) |
35265
71b043afa1da
(customize-menu-create): Fix the :filter.
Dave Love <fx@gnu.org>
parents:
34423
diff
changeset
|
3886 (custom-menu-create ',symbol)))) |
17334 | 3887 |
17415 | 3888 ;;; The Custom Mode. |
3889 | |
3890 (defvar custom-mode-map nil | |
3891 "Keymap for `custom-mode'.") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3892 |
17415 | 3893 (unless custom-mode-map |
33110
10379d59910e
(custom-mode-map): Switch back to a sparse keymap.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33024
diff
changeset
|
3894 ;; This keymap should be dense, but a dense keymap would prevent inheriting |
10379d59910e
(custom-mode-map): Switch back to a sparse keymap.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33024
diff
changeset
|
3895 ;; "\r" bindings from the parent map. |
10379d59910e
(custom-mode-map): Switch back to a sparse keymap.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33024
diff
changeset
|
3896 (setq custom-mode-map (make-sparse-keymap)) |
17415 | 3897 (set-keymap-parent custom-mode-map widget-keymap) |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
3898 (suppress-keymap custom-mode-map) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3899 (define-key custom-mode-map " " 'scroll-up) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3900 (define-key custom-mode-map "\177" 'scroll-down) |
25685 | 3901 (define-key custom-mode-map "q" 'Custom-buffer-done) |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3902 (define-key custom-mode-map "u" 'Custom-goto-parent) |
18609
242173dd0e67
(custom-mode-map): Bind n and p.
Richard M. Stallman <rms@gnu.org>
parents:
18606
diff
changeset
|
3903 (define-key custom-mode-map "n" 'widget-forward) |
242173dd0e67
(custom-mode-map): Bind n and p.
Richard M. Stallman <rms@gnu.org>
parents:
18606
diff
changeset
|
3904 (define-key custom-mode-map "p" 'widget-backward) |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3905 (define-key custom-mode-map [mouse-1] 'Custom-move-and-invoke)) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3906 |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3907 (defun Custom-move-and-invoke (event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3908 "Move to where you click, and if it is an active field, invoke it." |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3909 (interactive "e") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3910 (mouse-set-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3911 (if (widget-event-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3912 (let* ((pos (widget-event-point event)) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3913 (button (get-char-property pos 'button))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3914 (if button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3915 (widget-button-click event))))) |
17415 | 3916 |
25685 | 3917 (easy-menu-define Custom-mode-menu |
17415 | 3918 custom-mode-map |
3919 "Menu used in customization buffers." | |
3920 `("Custom" | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3921 ,(customize-menu-create 'customize) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3922 ["Set" Custom-set t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3923 ["Save" Custom-save t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3924 ["Reset to Current" Custom-reset-current t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3925 ["Reset to Saved" Custom-reset-saved t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3926 ["Reset to Standard Settings" Custom-reset-standard t] |
23357
856a82c440fa
(Custom-mode-menu): Fix info node name.
Karl Heuer <kwzh@gnu.org>
parents:
23223
diff
changeset
|
3927 ["Info" (Info-goto-node "(emacs)Easy Customization") t])) |
17415 | 3928 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3929 (defun Custom-goto-parent () |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3930 "Go to the parent group listed at the top of this buffer. |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3931 If several parents are listed, go to the first of them." |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3932 (interactive) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3933 (save-excursion |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3934 (goto-char (point-min)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3935 (if (search-forward "\nGo to parent group: " nil t) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3936 (let* ((button (get-char-property (point) 'button)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3937 (parent (downcase (widget-get button :tag)))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3938 (customize-group parent))))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3939 |
17415 | 3940 (defcustom custom-mode-hook nil |
25685 | 3941 "Hook called when entering Custom mode." |
17415 | 3942 :type 'hook |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3943 :group 'custom-buffer ) |
17415 | 3944 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3945 (defun custom-state-buffer-message (widget) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3946 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3947 (message "To install your edits, invoke [State] and choose the Set operation"))) |
18430
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3948 |
17415 | 3949 (defun custom-mode () |
3950 "Major mode for editing customization buffers. | |
3951 | |
3952 The following commands are available: | |
3953 | |
3954 Move to next button or editable field. \\[widget-forward] | |
3955 Move to previous button or editable field. \\[widget-backward] | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3956 \\<widget-field-keymap>\ |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3957 Complete content of editable text field. \\[widget-complete] |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3958 \\<custom-mode-map>\ |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3959 Invoke button under the mouse pointer. \\[Custom-move-and-invoke] |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3960 Invoke button under point. \\[widget-button-press] |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3961 Set all modifications. \\[Custom-set] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3962 Make all modifications default. \\[Custom-save] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3963 Reset all modified options. \\[Custom-reset-current] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3964 Reset all modified or set options. \\[Custom-reset-saved] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3965 Reset all options. \\[Custom-reset-standard] |
17415 | 3966 |
3967 Entry to this mode calls the value of `custom-mode-hook' | |
3968 if that value is non-nil." | |
3969 (kill-all-local-variables) | |
3970 (setq major-mode 'custom-mode | |
3971 mode-name "Custom") | |
3972 (use-local-map custom-mode-map) | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3973 (easy-menu-add Custom-mode-menu) |
17415 | 3974 (make-local-variable 'custom-options) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3975 (make-local-variable 'widget-documentation-face) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3976 (setq widget-documentation-face 'custom-documentation-face) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3977 (make-local-variable 'widget-button-face) |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3978 (setq widget-button-face 'custom-button-face) |
25685 | 3979 (set (make-local-variable 'widget-button-pressed-face) |
3980 'custom-button-pressed-face) | |
3981 (set (make-local-variable 'widget-mouse-face) | |
3982 'custom-button-pressed-face) ; buttons `depress' when moused | |
3983 ;; When possible, use relief for buttons, not bracketing. This test | |
3984 ;; may not be optimal. | |
3985 (when custom-raised-buttons | |
3986 (set (make-local-variable 'widget-push-button-prefix) "") | |
3987 (set (make-local-variable 'widget-push-button-suffix) "") | |
3988 (set (make-local-variable 'widget-link-prefix) "") | |
3989 (set (make-local-variable 'widget-link-suffix) "")) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3990 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t) |
17415 | 3991 (run-hooks 'custom-mode-hook)) |
17334 | 3992 |
32904
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
3993 (put 'custom-mode 'mode-class 'special) |
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
3994 |
28130 | 3995 (add-to-list |
3996 'debug-ignored-errors | |
3997 "^No user options have changed defaults in recent Emacs versions$") | |
3998 | |
17334 | 3999 ;;; The End. |
4000 | |
4001 (provide 'cus-edit) | |
4002 | |
25685 | 4003 ;;; cus-edit.el ends here |