Mercurial > emacs
annotate lisp/cus-edit.el @ 37662:cb20d33bef50
(eshell-lisp-command): Don't perform numeric conversions if a Lisp
function has the property `eshell-no-numeric-conversions' set to a
non-nil value.
author | John Wiegley <johnw@newartisans.com> |
---|---|
date | Thu, 10 May 2001 03:47:48 +0000 |
parents | bd93cba9ef3e |
children | 45147f063e6b |
rev | line source |
---|---|
28130 | 1 ;;; cus-edit.el --- Tools for customizing Emacs and Lisp packages. |
17334 | 2 ;; |
36628
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1999, 2000, 2001 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) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
751 "Set VARIABLE to VALUE. VALUE is a Lisp object. |
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 (set var val) |
765 (cond ((string= comment "") | |
766 (put var 'variable-comment nil)) | |
767 (comment | |
768 (put var 'variable-comment comment)))) | |
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) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
772 "Set the default for VARIABLE to VALUE. VALUE is a Lisp object. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
773 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
774 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
|
775 VARIABLE, otherwise `set-default' is used. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
776 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
777 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
|
778 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
|
779 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
780 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
|
781 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
|
782 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
783 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 784 `:prompt-value' property of that widget will be used for reading the value. |
785 | |
786 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
|
787 (interactive (custom-prompt-variable "Set variable: " |
25685 | 788 "Set customized value for %s to: " |
789 current-prefix-arg)) | |
28130 | 790 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
791 (put variable 'customized-value (list (custom-quote value))) | |
25685 | 792 (cond ((string= comment "") |
28130 | 793 (put variable 'variable-comment nil) |
794 (put variable 'customized-variable-comment nil)) | |
25685 | 795 (comment |
28130 | 796 (put variable 'variable-comment comment) |
797 (put variable 'customized-variable-comment comment)))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
798 |
17334 | 799 ;;;###autoload |
28130 | 800 (defun customize-save-variable (var value &optional comment) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
801 "Set the default for VARIABLE to VALUE, and save it for future sessions. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
802 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
|
803 VARIABLE, otherwise `set-default' is used. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
804 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
805 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
|
806 with a quoted VALUE as its sole list member. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
807 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
808 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
|
809 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
|
810 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
811 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 812 `:prompt-value' property of that widget will be used for reading the value. |
813 | |
814 If given a prefix (or a COMMENT argument), also prompt for a comment." | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
815 (interactive (custom-prompt-variable "Set and ave variable: " |
25685 | 816 "Set and save value for %s as: " |
817 current-prefix-arg)) | |
28130 | 818 (funcall (or (get var 'custom-set) 'set-default) var value) |
819 (put var 'saved-value (list (custom-quote value))) | |
25685 | 820 (cond ((string= comment "") |
821 (put var 'variable-comment nil) | |
822 (put var 'saved-variable-comment nil)) | |
823 (comment | |
824 (put var 'variable-comment comment) | |
825 (put var 'saved-variable-comment comment))) | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
826 (custom-save-all)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
827 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
828 ;;;###autoload |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
829 (defun customize () |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
830 "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
|
831 User options are structured into \"groups\". |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
832 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
|
833 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
|
834 (interactive) |
17703 | 835 (customize-group 'emacs)) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
836 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
837 ;;;###autoload |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
838 (defun customize-group (group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
839 "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
|
840 (interactive (list (let ((completion-ignore-case t)) |
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
841 (completing-read "Customize group: (default emacs) " |
25685 | 842 obarray |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
843 (lambda (symbol) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
844 (or (get symbol 'custom-loads) |
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
845 (get symbol 'custom-group))) |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
846 t)))) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
847 (when (stringp group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
848 (if (string-equal "" group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
849 (setq group 'emacs) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
850 (setq group (intern group)))) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
851 (or (get group 'custom-group) |
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
852 (custom-load-symbol group)) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
853 (let ((name (format "*Customize Group: %s*" |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
854 (custom-unlispify-tag-name group)))) |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
855 (if (get-buffer name) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
856 (pop-to-buffer name) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
857 (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
|
858 name |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
859 (concat " for group " |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
860 (custom-unlispify-tag-name group)))))) |
17334 | 861 |
862 ;;;###autoload | |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
863 (defun customize-group-other-window (group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
864 "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
|
865 (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
|
866 (completing-read "Customize group: (default emacs) " |
25685 | 867 obarray |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
868 (lambda (symbol) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
869 (or (get symbol 'custom-loads) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
870 (get symbol 'custom-group))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
871 t)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
872 (when (stringp group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
873 (if (string-equal "" group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
874 (setq group 'emacs) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
875 (setq group (intern group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
876 (or (get group 'custom-group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
877 (custom-load-symbol group)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
878 (let ((name (format "*Customize Group: %s*" |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
879 (custom-unlispify-tag-name group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
880 (if (get-buffer name) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
881 (let ((window (selected-window))) |
22348
86cb09249796
(customize-group-other-window): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents:
22332
diff
changeset
|
882 (pop-to-buffer name) |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
883 (select-window window)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
884 (custom-buffer-create-other-window |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
885 (list (list group 'custom-group)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
886 name |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
887 (concat " for group " |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
888 (custom-unlispify-tag-name group)))))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
889 |
18089 | 890 ;;;###autoload |
891 (defalias 'customize-variable 'customize-option) | |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
892 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
893 ;;;###autoload |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
894 (defun customize-option (symbol) |
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
895 "Customize SYMBOL, which must be a user option variable." |
17415 | 896 (interactive (custom-variable-prompt)) |
23190
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
897 ;; 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
|
898 ;; try to load it. |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
899 (unless (get symbol 'custom-type) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
900 (let ((loaddefs-file (locate-library "loaddefs.el" t)) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
901 file) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
902 ;; See if it is autoloaded from some library. |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
903 (when loaddefs-file |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
904 (with-temp-buffer |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
905 (insert-file-contents loaddefs-file) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
906 (when (re-search-forward (concat "^(defvar " (symbol-name symbol)) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
907 nil t) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
908 (search-backward "\n;;; Generated autoloads from ") |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
909 (goto-char (match-end 0)) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
910 (setq file (buffer-substring (point) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
911 (progn (end-of-line) (point))))))) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
912 ;; If it is, load that library. |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
913 (when file |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
914 (when (string-match "\\.el\\'" file) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
915 (setq file (substring file 0 (match-beginning 0)))) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
916 (load file)))) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
917 (unless (get symbol 'custom-type) |
0fe0fe296153
(customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents:
23105
diff
changeset
|
918 (error "Variable %s cannot be customized" symbol)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
919 (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
|
920 (format "*Customize Option: %s*" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
921 (custom-unlispify-tag-name symbol)))) |
17334 | 922 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
923 (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
|
924 "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
|
925 |
17334 | 926 ;;;###autoload |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
927 (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
|
928 "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
|
929 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
|
930 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
|
931 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
|
932 |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
933 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
|
934 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
|
935 version." |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
936 |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
937 (interactive "sCustomize options changed, since version (default all versions): ") |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
938 (if (equal since-version "") |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
939 (setq since-version nil) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
940 (unless (condition-case nil |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
941 (numberp (read since-version)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
942 (error nil)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
943 (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
|
944 (unless since-version |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
945 (setq since-version customize-changed-options-previous-release)) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
946 (let ((found nil) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
947 (versions nil)) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
948 (mapatoms (lambda (symbol) |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
949 (and (or (boundp symbol) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
950 ;; For variables not yet loaded. |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
951 (get symbol 'standard-value) |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
952 ;; For groups the previous test fails, this one |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
953 ;; could be used to determine if symbol is a |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
954 ;; group. Is there a better way for this? |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
955 (get symbol 'group-documentation)) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
956 (let ((version (get symbol 'custom-version))) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
957 (and version |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
958 (or (null since-version) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
959 (customize-version-lessp since-version version)) |
25685 | 960 (if (member version versions) |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
961 t |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
962 ;;; Collect all versions that we use. |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
963 (push version versions)))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
964 (setq found |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
965 ;; We have to set the right thing here, |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
966 ;; depending if we have a group or a |
25685 | 967 ;; variable. |
21649
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
968 (if (get symbol 'group-documentation) |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
969 (cons (list symbol 'custom-group) found) |
840699d18eab
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20974
diff
changeset
|
970 (cons (list symbol 'custom-variable) found)))))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
971 (if (not found) |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
972 (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
|
973 since-version) |
22667
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
974 (let ((flist nil)) |
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
975 (while versions |
25685 | 976 (push (copy-sequence |
22667
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
977 (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
|
978 flist) |
8e8001567771
(customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22600
diff
changeset
|
979 (setq versions (cdr versions))) |
25685 | 980 (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
|
981 ;; 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
|
982 ;; VERSIONS list. This could use some simplification. |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
983 (apply 'nconc flist))) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
984 ;; 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
|
985 ;; `custom-loads' property to `custom-versions-load-alist' this |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
986 ;; call will actually load them. |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
987 (custom-load-symbol 'custom-versions-load-alist) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
988 ;; Clean up |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
989 (put 'custom-versions-load-alist 'custom-loads nil) |
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
990 (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
|
991 "*Customize Changed Options*")))) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
992 |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
993 (defun customize-version-lessp (version1 version2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
994 ;; 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
|
995 ;; 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
|
996 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
997 ;; 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
|
998 ;; in the :version value. |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
999 (if (numberp version2) |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1000 (setq version2 (prin1-to-string version2))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1001 (let (major1 major2 minor1 minor2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1002 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1003 (setq major1 (read (or (match-string 1 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1004 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1005 (setq minor1 (read (or (match-string 3 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1006 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1007 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1008 (setq major2 (read (or (match-string 1 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1009 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1010 (setq minor2 (read (or (match-string 3 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1011 "0"))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1012 (or (< major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1013 (and (= major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1014 (< minor1 minor2))))) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1015 |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1016 ;;;###autoload |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1017 (defalias 'customize-variable-other-window 'customize-option-other-window) |
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1018 |
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1019 ;;;###autoload |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1020 (defun customize-option-other-window (symbol) |
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1021 "Customize SYMBOL, which must be a user option variable. |
17415 | 1022 Show the buffer in another window, but don't select it." |
1023 (interactive (custom-variable-prompt)) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1024 (custom-buffer-create-other-window |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1025 (list (list symbol 'custom-variable)) |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1026 (format "*Customize Option: %s*" (custom-unlispify-tag-name symbol)))) |
17415 | 1027 |
1028 ;;;###autoload | |
17334 | 1029 (defun customize-face (&optional symbol) |
1030 "Customize SYMBOL, which should be a face name or nil. | |
1031 If SYMBOL is nil, customize all faces." | |
25685 | 1032 (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
|
1033 obarray 'custom-facep t))) |
17334 | 1034 (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
|
1035 (custom-buffer-create (custom-sort-items |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1036 (mapcar (lambda (symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1037 (list symbol 'custom-face)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1038 (face-list)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1039 t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1040 "*Customize Faces*") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1041 (when (stringp symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1042 (setq symbol (intern symbol))) |
17334 | 1043 (unless (symbolp symbol) |
1044 (error "Should be a symbol %S" symbol)) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1045 (custom-buffer-create (list (list symbol 'custom-face)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1046 (format "*Customize Face: %s*" |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1047 (custom-unlispify-tag-name symbol))))) |
17334 | 1048 |
1049 ;;;###autoload | |
17415 | 1050 (defun customize-face-other-window (&optional symbol) |
28130 | 1051 "Show customization buffer for face SYMBOL in other window." |
25685 | 1052 (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
|
1053 obarray 'custom-facep t))) |
17415 | 1054 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol)))) |
1055 () | |
1056 (if (stringp symbol) | |
1057 (setq symbol (intern symbol))) | |
1058 (unless (symbolp symbol) | |
1059 (error "Should be a symbol %S" symbol)) | |
25685 | 1060 (custom-buffer-create-other-window |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1061 (list (list symbol 'custom-face)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1062 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol))))) |
17415 | 1063 |
1064 ;;;###autoload | |
17334 | 1065 (defun customize-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1066 "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
|
1067 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1068 (let ((found nil)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1069 (mapatoms (lambda (symbol) |
25685 | 1070 (and (or (get symbol 'customized-face) |
1071 (get symbol 'customized-face-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1072 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1073 (push (list symbol 'custom-face) found)) |
25685 | 1074 (and (or (get symbol 'customized-value) |
1075 (get symbol 'customized-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1076 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1077 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1078 (if (not found) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1079 (error "No customized user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1080 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1081 "*Customize Customized*")))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1082 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1083 ;;;###autoload |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1084 (defun customize-saved () |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1085 "Customize all already saved user options." |
17334 | 1086 (interactive) |
1087 (let ((found nil)) | |
1088 (mapatoms (lambda (symbol) | |
25685 | 1089 (and (or (get symbol 'saved-face) |
1090 (get symbol 'saved-face-comment)) | |
17334 | 1091 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1092 (push (list symbol 'custom-face) found)) |
25685 | 1093 (and (or (get symbol 'saved-value) |
1094 (get symbol 'saved-variable-comment)) | |
17334 | 1095 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1096 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1097 (if (not found ) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1098 (error "No saved user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1099 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1100 "*Customize Saved*")))) |
17334 | 1101 |
1102 ;;;###autoload | |
1103 (defun customize-apropos (regexp &optional all) | |
1104 "Customize all user options matching REGEXP. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1105 If ALL is `options', include only options. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1106 If ALL is `faces', include only faces. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1107 If ALL is `groups', include only groups. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1108 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
|
1109 user-settable, as well as faces and groups." |
17334 | 1110 (interactive "sCustomize regexp: \nP") |
1111 (let ((found nil)) | |
1112 (mapatoms (lambda (symbol) | |
1113 (when (string-match regexp (symbol-name symbol)) | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1114 (when (and (not (memq all '(faces options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1115 (get symbol 'custom-group)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1116 (push (list symbol 'custom-group) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1117 (when (and (not (memq all '(options groups))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1118 (custom-facep symbol)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1119 (push (list symbol 'custom-face) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1120 (when (and (not (memq all '(groups faces))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1121 (boundp symbol) |
17334 | 1122 (or (get symbol 'saved-value) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1123 (get symbol 'standard-value) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1124 (if (memq all '(nil options)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1125 (user-variable-p symbol) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1126 (get symbol 'variable-documentation)))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1127 (push (list symbol 'custom-variable) found))))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1128 (if (not found) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1129 (error "No matches") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1130 (custom-buffer-create (custom-sort-items found t |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1131 custom-buffer-order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1132 "*Customize Apropos*")))) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1133 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1134 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1135 (defun customize-apropos-options (regexp &optional arg) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1136 "Customize all user options matching REGEXP. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1137 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
|
1138 (interactive "sCustomize regexp: \nP") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1139 (customize-apropos regexp (or arg 'options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1140 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1141 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1142 (defun customize-apropos-faces (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1143 "Customize all user faces matching REGEXP." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1144 (interactive "sCustomize regexp: \n") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1145 (customize-apropos regexp 'faces)) |
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-groups (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1149 "Customize all user groups 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 'groups)) |
17334 | 1152 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1153 ;;; Buffer. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1154 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1155 (defcustom custom-buffer-style 'links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1156 "Control the presentation style for customization buffers. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1157 The value should be a symbol, one of: |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1158 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1159 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
|
1160 links: groups have links to subgroups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1161 :type '(radio (const brackets) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1162 (const links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1163 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1164 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1165 ;; 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
|
1166 ;; the window. |
25840
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1167 (defun custom-bury-buffer (buffer) |
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1168 (bury-buffer)) |
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1169 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1170 (defcustom custom-buffer-done-function 'custom-bury-buffer |
25685 | 1171 "*Function called to remove a Custom buffer when the user is done with it. |
1172 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
|
1173 :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
|
1174 (function-item :tag "Kill buffer" kill-buffer) |
25685 | 1175 (function :tag "Other")) |
1176 :version "21.1" | |
1177 :group 'custom-buffer) | |
1178 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1179 (defcustom custom-buffer-indent 3 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1180 "Number of spaces to indent nested groups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1181 :type 'integer |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1182 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1183 |
17334 | 1184 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1185 (defun custom-buffer-create (options &optional name description) |
17334 | 1186 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1187 Optional NAME is the name of the buffer. |
17334 | 1188 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1189 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1190 that option." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1191 (unless name (setq name "*Customization*")) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1192 (kill-buffer (get-buffer-create name)) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1193 (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
|
1194 (custom-buffer-create-internal options description)) |
17415 | 1195 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1196 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1197 (defun custom-buffer-create-other-window (options &optional name description) |
17415 | 1198 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1199 Optional NAME is the name of the buffer. |
17415 | 1200 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1201 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1202 that option." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1203 (unless name (setq name "*Customization*")) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1204 (kill-buffer (get-buffer-create name)) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1205 (let ((window (selected-window)) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1206 (pop-up-windows t) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1207 (special-display-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1208 (special-display-regexps nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1209 (same-window-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1210 (same-window-regexps nil)) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1211 (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
|
1212 (custom-buffer-create-internal options description) |
17415 | 1213 (select-window window))) |
18089 | 1214 |
1215 (defcustom custom-reset-button-menu nil | |
1216 "If non-nil, only show a single reset button in customize buffers. | |
1217 This button will have a menu with all three reset operations." | |
1218 :type 'boolean | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1219 :group 'custom-buffer) |
17415 | 1220 |
25685 | 1221 (defun Custom-buffer-done (&rest ignore) |
1222 "Remove current buffer by calling `custom-buffer-done-function'." | |
1223 (interactive) | |
1224 (funcall custom-buffer-done-function (current-buffer))) | |
1225 | |
1226 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box) | |
1227 '(("unspecified" . unspecified)))) | |
1228 "If non-nil, indicate active buttons in a `raised-button' style. | |
1229 Otherwise use brackets." | |
1230 :type 'boolean | |
1231 :version "21.1" | |
1232 :group 'custom-buffer) | |
1233 | |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1234 (defun custom-buffer-create-internal (options &optional description) |
17415 | 1235 (message "Creating customization buffer...") |
17334 | 1236 (custom-mode) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1237 (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
|
1238 (if description |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1239 (widget-insert description)) |
25685 | 1240 (widget-insert (format ". |
1241 %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
|
1242 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
|
1243 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
|
1244 choose the Set operation to set the option value. |
25685 | 1245 Invoke " (if custom-raised-buttons |
1246 "`Raised' buttons" | |
1247 "Square brackets"))) | |
1248 (widget-create 'info-link | |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1249 :tag "Help" |
17334 | 1250 :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
|
1251 "(emacs)Easy Customization") |
17334 | 1252 (widget-insert " for more information.\n\n") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1253 (message "Creating customization buttons...") |
18373
45ef45c34aa4
(custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents:
18371
diff
changeset
|
1254 (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
|
1255 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1256 :tag "Set for Current Session" |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1257 :help-echo "\ |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1258 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
|
1259 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1260 (Custom-set))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1261 (widget-insert " ") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1262 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1263 :tag "Save for Future Sessions" |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1264 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1265 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
|
1266 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1267 (Custom-save))) |
18089 | 1268 (if custom-reset-button-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1269 (progn |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1270 (widget-insert " ") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1271 (widget-create 'push-button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1272 :tag "Reset" |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1273 :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
|
1274 :mouse-down-action (lambda (&rest junk) t) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1275 :action (lambda (widget &optional event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1276 (custom-reset event)))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1277 (widget-insert "\n ") |
18089 | 1278 (widget-create 'push-button |
1279 :tag "Reset" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1280 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1281 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
|
1282 :action 'Custom-reset-current) |
18089 | 1283 (widget-insert " ") |
1284 (widget-create 'push-button | |
1285 :tag "Reset to Saved" | |
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 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
|
1288 :action 'Custom-reset-saved) |
18089 | 1289 (widget-insert " ") |
1290 (widget-create 'push-button | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1291 :tag "Erase Customization" |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1292 :help-echo "\ |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1293 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
|
1294 :action 'Custom-reset-standard)) |
18373
45ef45c34aa4
(custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents:
18371
diff
changeset
|
1295 (widget-insert " ") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1296 (widget-create 'push-button |
25685 | 1297 :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
|
1298 :help-echo |
80383e9be1e2
(custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents:
30184
diff
changeset
|
1299 (lambda (&rest ignore) |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1300 (cond |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1301 ((eq custom-buffer-done-function |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1302 'custom-bury-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1303 "Bury this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1304 ((eq custom-buffer-done-function 'kill-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1305 "Kill this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1306 (t "Finish with this buffer"))) |
25685 | 1307 :action #'Custom-buffer-done) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1308 (widget-insert "\n\n") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1309 (message "Creating customization items...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1310 (buffer-disable-undo) |
25685 | 1311 (setq custom-options |
17334 | 1312 (if (= (length options) 1) |
1313 (mapcar (lambda (entry) | |
1314 (widget-create (nth 1 entry) | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1315 :documentation-shown t |
17334 | 1316 :custom-state 'unknown |
1317 :tag (custom-unlispify-tag-name | |
1318 (nth 0 entry)) | |
1319 :value (nth 0 entry))) | |
1320 options) | |
1321 (let ((count 0) | |
1322 (length (length options))) | |
1323 (mapcar (lambda (entry) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1324 (prog2 |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1325 (message "Creating customization items ...%2d%%" |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1326 (/ (* 100.0 count) length)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1327 (widget-create (nth 1 entry) |
17334 | 1328 :tag (custom-unlispify-tag-name |
1329 (nth 0 entry)) | |
1330 :value (nth 0 entry)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1331 (setq count (1+ count)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1332 (unless (eq (preceding-char) ?\n) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1333 (widget-insert "\n")) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1334 (widget-insert "\n"))) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1335 options)))) |
17334 | 1336 (unless (eq (preceding-char) ?\n) |
1337 (widget-insert "\n")) | |
22538
2649d061d370
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
22348
diff
changeset
|
1338 (message "Creating customization items ...%2d%%done" 100) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1339 (unless (eq custom-buffer-style 'tree) |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1340 (mapc 'custom-magic-reset custom-options)) |
17334 | 1341 (message "Creating customization setup...") |
1342 (widget-setup) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1343 (buffer-enable-undo) |
17334 | 1344 (goto-char (point-min)) |
1345 (message "Creating customization buffer...done")) | |
1346 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1347 ;;; The Tree Browser. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1348 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1349 ;;;###autoload |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1350 (defun customize-browse (&optional group) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1351 "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
|
1352 (interactive) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1353 (unless group |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1354 (setq group 'emacs)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1355 (let ((name "*Customize Browser*")) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1356 (kill-buffer (get-buffer-create name)) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1357 (pop-to-buffer (get-buffer-create name))) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1358 (custom-mode) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1359 (widget-insert "\ |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
1360 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
|
1361 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
|
1362 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
|
1363 (if custom-browse-only-groups |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1364 (widget-insert "\ |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1365 Invoke the [Group] button below to edit that item in another window.\n\n") |
25685 | 1366 (widget-insert "Invoke the ") |
1367 (widget-create 'item | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1368 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1369 :tag "[Group]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1370 :tag-glyph "folder") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1371 (widget-insert ", ") |
25685 | 1372 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1373 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1374 :tag "[Face]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1375 :tag-glyph "face") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1376 (widget-insert ", and ") |
25685 | 1377 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1378 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1379 :tag "[Option]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1380 :tag-glyph "option") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1381 (widget-insert " buttons below to edit that |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1382 item in another window.\n\n")) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1383 (let ((custom-buffer-style 'tree)) |
25685 | 1384 (widget-create 'custom-group |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1385 :custom-last t |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1386 :custom-state 'unknown |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1387 :tag (custom-unlispify-tag-name group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1388 :value group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1389 (goto-char (point-min))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1390 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1391 (define-widget 'custom-browse-visibility 'item |
20600
323f33e3e92c
(custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
20562
diff
changeset
|
1392 "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
|
1393 :format "%[[%t]%]" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1394 :action 'custom-browse-visibility-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1395 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1396 (defun custom-browse-visibility-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1397 (let ((custom-buffer-style 'tree)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1398 (custom-toggle-parent widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1399 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1400 (define-widget 'custom-browse-group-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1401 "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
|
1402 :tag "Group" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1403 :tag-glyph "folder" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1404 :action 'custom-browse-group-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1405 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1406 (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
|
1407 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1408 (customize-group-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1409 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1410 (define-widget 'custom-browse-variable-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1411 "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
|
1412 :tag "Option" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1413 :tag-glyph "option" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1414 :action 'custom-browse-variable-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1415 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1416 (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
|
1417 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1418 (customize-variable-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1419 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1420 (define-widget 'custom-browse-face-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1421 "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
|
1422 :tag "Face" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1423 :tag-glyph "face" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1424 :action 'custom-browse-face-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1425 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1426 (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
|
1427 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1428 (customize-face-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1429 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1430 (defconst custom-browse-alist '((" " "space") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1431 (" | " "vertical") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1432 ("-\\ " "top") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1433 (" |-" "middle") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1434 (" `-" "bottom"))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1435 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1436 (defun custom-browse-insert-prefix (prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1437 "Insert PREFIX. On XEmacs convert it to line graphics." |
25685 | 1438 ;; Fixme: do graphics. |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1439 (if nil ; (string-match "XEmacs" emacs-version) |
25685 | 1440 (progn |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1441 (insert "*") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1442 (while (not (string-equal prefix "")) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1443 (let ((entry (substring prefix 0 3))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1444 (setq prefix (substring prefix 3)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1445 (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
|
1446 (name (nth 1 (assoc entry custom-browse-alist)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1447 (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
|
1448 (overlay-put overlay 'start-open t) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1449 (overlay-put overlay 'end-open t))))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1450 (insert prefix))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1451 |
17334 | 1452 ;;; Modification of Basic Widgets. |
1453 ;; | |
1454 ;; We add extra properties to the basic widgets needed here. This is | |
1455 ;; fine, as long as we are careful to stay within out own namespace. | |
1456 ;; | |
1457 ;; We want simple widgets to be displayed by default, but complex | |
1458 ;; widgets to be hidden. | |
1459 | |
1460 (widget-put (get 'item 'widget-type) :custom-show t) | |
1461 (widget-put (get 'editable-field 'widget-type) | |
1462 :custom-show (lambda (widget value) | |
1463 (let ((pp (pp-to-string value))) | |
1464 (cond ((string-match "\n" pp) | |
1465 nil) | |
1466 ((> (length pp) 40) | |
1467 nil) | |
1468 (t t))))) | |
1469 (widget-put (get 'menu-choice 'widget-type) :custom-show t) | |
1470 | |
1471 ;;; The `custom-manual' Widget. | |
1472 | |
1473 (define-widget 'custom-manual 'info-link | |
1474 "Link to the manual entry for this customization option." | |
1475 :help-echo "Read the manual entry for this option." | |
1476 :tag "Manual") | |
1477 | |
1478 ;;; The `custom-magic' Widget. | |
1479 | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1480 (defgroup custom-magic-faces nil |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1481 "Faces used by the magic button." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1482 :group 'custom-faces |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1483 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1484 |
17334 | 1485 (defface custom-invalid-face '((((class color)) |
1486 (:foreground "yellow" :background "red")) | |
1487 (t | |
1488 (:bold t :italic t :underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1489 "Face used when the customize item is invalid." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1490 :group 'custom-magic-faces) |
17334 | 1491 |
1492 (defface custom-rogue-face '((((class color)) | |
1493 (:foreground "pink" :background "black")) | |
1494 (t | |
1495 (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1496 "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
|
1497 :group 'custom-magic-faces) |
17334 | 1498 |
25685 | 1499 (defface custom-modified-face '((((class color)) |
17334 | 1500 (:foreground "white" :background "blue")) |
1501 (t | |
1502 (:italic t :bold))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1503 "Face used when the customize item has been modified." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1504 :group 'custom-magic-faces) |
17334 | 1505 |
25685 | 1506 (defface custom-set-face '((((class color)) |
17334 | 1507 (:foreground "blue" :background "white")) |
1508 (t | |
1509 (:italic t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1510 "Face used when the customize item has been set." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1511 :group 'custom-magic-faces) |
17334 | 1512 |
25685 | 1513 (defface custom-changed-face '((((class color)) |
17334 | 1514 (:foreground "white" :background "blue")) |
1515 (t | |
1516 (:italic t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1517 "Face used when the customize item has been changed." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1518 :group 'custom-magic-faces) |
17334 | 1519 |
1520 (defface custom-saved-face '((t (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1521 "Face used when the customize item has been saved." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1522 :group 'custom-magic-faces) |
17334 | 1523 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1524 (defconst custom-magic-alist '((nil "#" underline "\ |
17334 | 1525 uninitialized, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1526 (unknown "?" italic "\ |
17334 | 1527 unknown, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1528 (hidden "-" default "\ |
18362
4655515f51cc
(custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents:
18360
diff
changeset
|
1529 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
|
1530 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
|
1531 (invalid "x" custom-invalid-face "\ |
18089 | 1532 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
|
1533 (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
|
1534 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
|
1535 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
|
1536 (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
|
1537 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
|
1538 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
|
1539 (changed ":" custom-changed-face "\ |
18089 | 1540 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
|
1541 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
|
1542 (saved "!" custom-saved-face "\ |
18089 | 1543 this %c has been set and saved." "\ |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1544 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
|
1545 (rogue "@" custom-rogue-face "\ |
18089 | 1546 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
|
1547 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
|
1548 (standard " " nil "\ |
18089 | 1549 this %c is unchanged from its standard setting." "\ |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1550 visible group members are all at standard settings.")) |
17334 | 1551 "Alist of customize option states. |
25685 | 1552 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where |
17334 | 1553 |
1554 STATE is one of the following symbols: | |
1555 | |
1556 `nil' | |
1557 For internal use, should never occur. | |
1558 `unknown' | |
1559 For internal use, should never occur. | |
1560 `hidden' | |
25685 | 1561 This item is not being displayed. |
17334 | 1562 `invalid' |
1563 This item is modified, but has an invalid form. | |
1564 `modified' | |
1565 This item is modified, and has a valid form. | |
1566 `set' | |
1567 This item has been set but not saved. | |
1568 `changed' | |
1569 The current value of this item has been changed temporarily. | |
1570 `saved' | |
1571 This item is marked for saving. | |
1572 `rogue' | |
1573 This item has no customization information. | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1574 `standard' |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1575 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
|
1576 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1577 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
|
1578 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1579 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
|
1580 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1581 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
|
1582 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1583 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
|
1584 left out, ITEM-DESC will be used. |
17334 | 1585 |
18089 | 1586 The string %c in either description will be replaced with the |
1587 category of the item. These are `group'. `option', and `face'. | |
1588 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1589 The list should be sorted most significant first.") |
17334 | 1590 |
1591 (defcustom custom-magic-show 'long | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1592 "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
|
1593 If `long', show a full-line description, not just one word." |
17334 | 1594 :type '(choice (const :tag "no" nil) |
22600
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1595 (const long) |
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1596 (other :tag "short" short)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1597 :group 'custom-buffer) |
17334 | 1598 |
18089 | 1599 (defcustom custom-magic-show-hidden '(option face) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1600 "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
|
1601 The value should be a list with the custom categories where the State |
18089 | 1602 button should be visible. Possible categories are `group', `option', |
1603 and `face'." | |
1604 :type '(set (const group) (const option) (const face)) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1605 :group 'custom-buffer) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1606 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1607 (defcustom custom-magic-show-button nil |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1608 "Show a \"magic\" button indicating the state of each customization option." |
17334 | 1609 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1610 :group 'custom-buffer) |
17334 | 1611 |
1612 (define-widget 'custom-magic 'default | |
1613 "Show and manipulate state for a customization option." | |
1614 :format "%v" | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1615 :action 'widget-parent-action |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1616 :notify 'ignore |
17334 | 1617 :value-get 'ignore |
1618 :value-create 'custom-magic-value-create | |
1619 :value-delete 'widget-children-value-delete) | |
1620 | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1621 (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
|
1622 ;; Non-nil unless hidden. |
25685 | 1623 (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
|
1624 :custom-state) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1625 'hidden))) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1626 |
17334 | 1627 (defun custom-magic-value-create (widget) |
28130 | 1628 "Create compact status report for WIDGET." |
17334 | 1629 (let* ((parent (widget-get widget :parent)) |
1630 (state (widget-get parent :custom-state)) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1631 (hidden (eq state 'hidden)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1632 (entry (assq state custom-magic-alist)) |
17334 | 1633 (magic (nth 1 entry)) |
1634 (face (nth 2 entry)) | |
18089 | 1635 (category (widget-get parent :custom-category)) |
1636 (text (or (and (eq category 'group) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1637 (nth 4 entry)) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1638 (nth 3 entry))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1639 (form (widget-get parent :custom-form)) |
17334 | 1640 children) |
18089 | 1641 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text) |
25685 | 1642 (setq text (concat (match-string 1 text) |
18089 | 1643 (symbol-name category) |
1644 (match-string 2 text)))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1645 (when (and custom-magic-show |
18089 | 1646 (or (not hidden) |
1647 (memq category custom-magic-show-hidden))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1648 (insert " ") |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1649 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1650 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1651 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1652 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1653 (widget-get parent :custom-level)))) |
25685 | 1654 (push (widget-create-child-and-convert |
1655 widget 'choice-item | |
18087 | 1656 :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
|
1657 :format (if hidden "%t" "%[%t%]") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1658 :button-prefix 'widget-push-button-prefix |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1659 :button-suffix 'widget-push-button-suffix |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1660 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1661 :tag "State") |
17334 | 1662 children) |
1663 (insert ": ") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1664 (let ((start (point))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1665 (if (eq custom-magic-show 'long) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1666 (insert text) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1667 (insert (symbol-name state))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1668 (cond ((eq form 'lisp) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1669 (insert " (lisp)")) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1670 ((eq form 'mismatch) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1671 (insert " (mismatch)"))) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1672 (put-text-property start (point) 'face 'custom-state-face)) |
17334 | 1673 (insert "\n")) |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1674 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1675 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1676 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1677 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1678 (widget-get parent :custom-level)))) |
17334 | 1679 (when custom-magic-show-button |
1680 (when custom-magic-show | |
1681 (let ((indent (widget-get parent :indent))) | |
1682 (when indent | |
1683 (insert-char ? indent)))) | |
25685 | 1684 (push (widget-create-child-and-convert |
1685 widget 'choice-item | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1686 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1687 :button-face face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1688 :button-prefix "" |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1689 :button-suffix "" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1690 :help-echo "Change the state." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1691 :format (if hidden "%t" "%[%t%]") |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1692 :tag (if (memq form '(lisp mismatch)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1693 (concat "(" magic ")") |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1694 (concat "[" magic "]"))) |
17334 | 1695 children) |
1696 (insert " ")) | |
1697 (widget-put widget :children children))) | |
1698 | |
1699 (defun custom-magic-reset (widget) | |
1700 "Redraw the :custom-magic property of WIDGET." | |
1701 (let ((magic (widget-get widget :custom-magic))) | |
1702 (widget-value-set magic (widget-value magic)))) | |
1703 | |
1704 ;;; The `custom' Widget. | |
1705 | |
25685 | 1706 (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
|
1707 '((((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
|
1708 (: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
|
1709 :background "lightgrey" :foreground "black")) |
25685 | 1710 (t |
1711 nil)) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1712 "Face used for buttons in customization buffers." |
25685 | 1713 :version "21.1" |
1714 :group 'custom-faces) | |
1715 | |
1716 (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
|
1717 '((((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
|
1718 (: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
|
1719 :background "lightgrey" :foreground "black")) |
25685 | 1720 (t |
1721 (:inverse-video t))) | |
1722 "Face used for buttons in customization buffers." | |
1723 :version "21.1" | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1724 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1725 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1726 (defface custom-documentation-face nil |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1727 "Face used for documentation strings in customization buffers." |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1728 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1729 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1730 (defface custom-state-face '((((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1731 (background dark)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1732 (:foreground "lime green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1733 (((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1734 (background light)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1735 (:foreground "dark green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1736 (t nil)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1737 "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
|
1738 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1739 |
17334 | 1740 (define-widget 'custom 'default |
1741 "Customize a user option." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1742 :format "%v" |
17334 | 1743 :convert-widget 'custom-convert-widget |
1744 :notify 'custom-notify | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1745 :custom-prefix "" |
17334 | 1746 :custom-level 1 |
1747 :custom-state 'hidden | |
1748 :documentation-property 'widget-subclass-responsibility | |
1749 :value-create 'widget-subclass-responsibility | |
1750 :value-delete 'widget-children-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1751 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1752 :validate 'widget-children-validate |
17334 | 1753 :match (lambda (widget value) (symbolp value))) |
1754 | |
1755 (defun custom-convert-widget (widget) | |
28130 | 1756 "Initialize :value and :tag from :args in WIDGET." |
17334 | 1757 (let ((args (widget-get widget :args))) |
25685 | 1758 (when args |
17334 | 1759 (widget-put widget :value (widget-apply widget |
1760 :value-to-internal (car args))) | |
1761 (widget-put widget :tag (custom-unlispify-tag-name (car args))) | |
1762 (widget-put widget :args nil))) | |
1763 widget) | |
1764 | |
1765 (defun custom-notify (widget &rest args) | |
1766 "Keep track of changes." | |
18090 | 1767 (let ((state (widget-get widget :custom-state))) |
1768 (unless (eq state 'modified) | |
1769 (unless (memq state '(nil unknown hidden)) | |
1770 (widget-put widget :custom-state 'modified)) | |
1771 (custom-magic-reset widget) | |
1772 (apply 'widget-default-notify widget args)))) | |
17334 | 1773 |
1774 (defun custom-redraw (widget) | |
1775 "Redraw WIDGET with current settings." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1776 (let ((line (count-lines (point-min) (point))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1777 (column (current-column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1778 (pos (point)) |
17334 | 1779 (from (marker-position (widget-get widget :from))) |
1780 (to (marker-position (widget-get widget :to)))) | |
1781 (save-excursion | |
1782 (widget-value-set widget (widget-value widget)) | |
1783 (custom-redraw-magic widget)) | |
1784 (when (and (>= pos from) (<= pos to)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1785 (condition-case nil |
25685 | 1786 (progn |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1787 (if (> column 0) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1788 (goto-line line) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1789 (goto-line (1+ line))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1790 (move-to-column column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1791 (error nil))))) |
17334 | 1792 |
1793 (defun custom-redraw-magic (widget) | |
1794 "Redraw WIDGET state with current settings." | |
25685 | 1795 (while widget |
17334 | 1796 (let ((magic (widget-get widget :custom-magic))) |
25685 | 1797 (cond (magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1798 (widget-value-set magic (widget-value magic)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1799 (when (setq widget (widget-get widget :group)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1800 (custom-group-state-update widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1801 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1802 (setq widget nil))))) |
17334 | 1803 (widget-setup)) |
1804 | |
1805 (defun custom-show (widget value) | |
1806 "Non-nil if WIDGET should be shown with VALUE by default." | |
1807 (let ((show (widget-get widget :custom-show))) | |
1808 (cond ((null show) | |
1809 nil) | |
1810 ((eq t show) | |
1811 t) | |
1812 (t | |
1813 (funcall show widget value))))) | |
1814 | |
17415 | 1815 (defvar custom-load-recursion nil |
1816 "Hack to avoid recursive dependencies.") | |
1817 | |
17334 | 1818 (defun custom-load-symbol (symbol) |
1819 "Load all dependencies for SYMBOL." | |
17415 | 1820 (unless custom-load-recursion |
25685 | 1821 (let ((custom-load-recursion t) |
17415 | 1822 (loads (get symbol 'custom-loads)) |
1823 load) | |
1824 (while loads | |
1825 (setq load (car loads) | |
1826 loads (cdr loads)) | |
1827 (cond ((symbolp load) | |
1828 (condition-case nil | |
1829 (require load) | |
1830 (error nil))) | |
18059
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1831 ;; Don't reload a file already loaded. |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1832 ((and (boundp 'preloaded-file-list) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1833 (member load preloaded-file-list))) |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
1834 ((assoc load load-history)) |
18059
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1835 ((assoc (locate-library load) load-history)) |
17415 | 1836 (t |
1837 (condition-case nil | |
18059
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1838 ;; Without this, we would load cus-edit recursively. |
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1839 ;; We are still loading it when we call this, |
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1840 ;; and it is not in load-history yet. |
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1841 (or (equal load "cus-edit") |
fef9a6fc0655
(custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18053
diff
changeset
|
1842 (load-library load)) |
17415 | 1843 (error nil)))))))) |
17334 | 1844 |
1845 (defun custom-load-widget (widget) | |
1846 "Load all dependencies for WIDGET." | |
1847 (custom-load-symbol (widget-value widget))) | |
1848 | |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1849 (defun custom-unloaded-symbol-p (symbol) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1850 "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
|
1851 (let ((found nil) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1852 (loads (get symbol 'custom-loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1853 load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1854 (while loads |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1855 (setq load (car loads) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1856 loads (cdr loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1857 (cond ((symbolp load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1858 (unless (featurep load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1859 (setq found t))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1860 ((assoc load load-history)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1861 ((assoc (locate-library load) load-history) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1862 (message nil)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1863 (t |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1864 (setq found t)))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1865 found)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1866 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1867 (defun custom-unloaded-widget-p (widget) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1868 "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
|
1869 (custom-unloaded-symbol-p (widget-value widget))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1870 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1871 (defun custom-toggle-hide (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1872 "Toggle visibility of WIDGET." |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1873 (custom-load-widget widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1874 (let ((state (widget-get widget :custom-state))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1875 (cond ((memq state '(invalid modified)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1876 (error "There are unset changes")) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1877 ((eq state 'hidden) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1878 (widget-put widget :custom-state 'unknown)) |
25685 | 1879 (t |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1880 (widget-put widget :documentation-shown nil) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1881 (widget-put widget :custom-state 'hidden))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1882 (custom-redraw widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1883 (widget-setup))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1884 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1885 (defun custom-toggle-parent (widget &rest ignore) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1886 "Toggle visibility of parent of WIDGET." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1887 (custom-toggle-hide (widget-get widget :parent))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1888 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1889 (defun custom-add-see-also (widget &optional prefix) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1890 "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
|
1891 Insert PREFIX first if non-nil." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1892 (let* ((symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1893 (links (get symbol 'custom-links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1894 (many (> (length links) 2)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1895 (buttons (widget-get widget :buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1896 (indent (widget-get widget :indent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1897 (when links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1898 (when indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1899 (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1900 (when prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1901 (insert prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1902 (insert "See also ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1903 (while links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1904 (push (widget-create-child-and-convert widget (car links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1905 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1906 (setq links (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1907 (cond ((null links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1908 (insert ".\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1909 ((null (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1910 (if many |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1911 (insert ", and ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1912 (insert " and "))) |
25685 | 1913 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1914 (insert ", ")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1915 (widget-put widget :buttons buttons)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1916 |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1917 (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
|
1918 "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
|
1919 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
|
1920 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
|
1921 (let ((name (widget-value widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1922 (type (widget-type widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1923 (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
|
1924 (start (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1925 found) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1926 (insert (or initial-string "Parent groups:")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1927 (mapatoms (lambda (symbol) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1928 (let ((entry (assq name (get symbol 'custom-group)))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1929 (when (eq (nth 1 entry) type) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1930 (insert " ") |
25685 | 1931 (push (widget-create-child-and-convert |
1932 widget 'custom-group-link | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1933 :tag (custom-unlispify-tag-name symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1934 symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1935 buttons) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1936 (setq found t))))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1937 (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
|
1938 (if found |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1939 (insert "\n") |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1940 (delete-region start (point))) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1941 found)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1942 |
25685 | 1943 ;;; The `custom-comment' Widget. |
1944 | |
1945 ;; like the editable field | |
1946 (defface custom-comment-face '((((class grayscale color) | |
1947 (background light)) | |
1948 (:background "gray85")) | |
1949 (((class grayscale color) | |
1950 (background dark)) | |
1951 (:background "dim gray")) | |
1952 (t | |
1953 (:italic t))) | |
1954 "Face used for comments on variables or faces" | |
1955 :version "21.1" | |
1956 :group 'custom-faces) | |
1957 | |
1958 ;; like font-lock-comment-face | |
1959 (defface custom-comment-tag-face | |
1960 '((((class color) (background dark)) (:foreground "gray80")) | |
1961 (((class color) (background light)) (:foreground "blue4")) | |
1962 (((class grayscale) (background light)) | |
1963 (:foreground "DimGray" :bold t :italic t)) | |
1964 (((class grayscale) (background dark)) | |
1965 (:foreground "LightGray" :bold t :italic t)) | |
1966 (t (:bold t))) | |
1967 "Face used for variables or faces comment tags" | |
1968 :group 'custom-faces) | |
1969 | |
1970 (define-widget 'custom-comment 'string | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1971 "User comment." |
25685 | 1972 :tag "Comment" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1973 :help-echo "Edit a comment here." |
25685 | 1974 :sample-face 'custom-comment-tag-face |
1975 :value-face 'custom-comment-face | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1976 :shown nil |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1977 :create 'custom-comment-create) |
25685 | 1978 |
1979 (defun custom-comment-create (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1980 (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
|
1981 (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
|
1982 (not null-comment)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1983 (widget-default-create widget) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1984 ;; `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
|
1985 ;; maybe it shouldn't. |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1986 (widget-put widget :from (point-marker)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
1987 (widget-put widget :to (point-marker))))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1988 |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1989 (defun custom-comment-hide (widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1990 (widget-put (widget-get widget :parent) :comment-shown nil)) |
25685 | 1991 |
1992 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's | |
1993 ;; the global custom one | |
1994 (defun custom-comment-show (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1995 (widget-put widget :comment-shown t) |
37604
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
1996 (trace-to-stderr (format "1: %s\n" (widget-value widget))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1997 (custom-redraw widget) |
37604
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
1998 (trace-to-stderr (format "2: %s\n" (widget-value widget))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
1999 (widget-setup)) |
25685 | 2000 |
2001 (defun custom-comment-invisible-p (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2002 (let ((val (widget-value (widget-get widget :comment-widget)))) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2003 (and (equal "" val) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2004 (not (widget-get widget :comment-shown))))) |
25685 | 2005 |
17334 | 2006 ;;; The `custom-variable' Widget. |
2007 | |
28130 | 2008 ;; When this was underlined blue, users confused it with a |
2009 ;; Mosaic-style hyperlink... | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2010 (defface custom-variable-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2011 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2012 (background dark)) |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
2013 (:foreground "light blue" :bold t :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2014 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2015 (background light)) |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
2016 (:foreground "blue" :bold t :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2017 (t (:bold t))) |
17334 | 2018 "Face used for unpushable variable tags." |
17415 | 2019 :group 'custom-faces) |
17334 | 2020 |
2021 (defface custom-variable-button-face '((t (:underline t :bold t))) | |
2022 "Face used for pushable variable tags." | |
17415 | 2023 :group 'custom-faces) |
17334 | 2024 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2025 (defcustom custom-variable-default-form 'edit |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2026 "Default form of displaying variable values." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2027 :type '(choice (const edit) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2028 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2029 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2030 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2031 |
17334 | 2032 (define-widget 'custom-variable 'custom |
2033 "Customize variable." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2034 :format "%v" |
17334 | 2035 :help-echo "Set or reset this variable." |
2036 :documentation-property 'variable-documentation | |
18089 | 2037 :custom-category 'option |
17334 | 2038 :custom-state nil |
2039 :custom-menu 'custom-variable-menu-create | |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2040 :custom-form nil ; defaults to value of `custom-variable-default-form' |
17334 | 2041 :value-create 'custom-variable-value-create |
2042 :action 'custom-variable-action | |
2043 :custom-set 'custom-variable-set | |
2044 :custom-save 'custom-variable-save | |
2045 :custom-reset-current 'custom-redraw | |
2046 :custom-reset-saved 'custom-variable-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2047 :custom-reset-standard 'custom-variable-reset-standard) |
17334 | 2048 |
17415 | 2049 (defun custom-variable-type (symbol) |
2050 "Return a widget suitable for editing the value of SYMBOL. | |
25685 | 2051 If SYMBOL has a `custom-type' property, use that. |
17415 | 2052 Otherwise, look up symbol in `custom-guess-type-alist'." |
2053 (let* ((type (or (get symbol 'custom-type) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2054 (and (not (get symbol 'standard-value)) |
17415 | 2055 (custom-guess-type symbol)) |
2056 'sexp)) | |
2057 (options (get symbol 'custom-options)) | |
2058 (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
|
2059 (copy-sequence type) |
17415 | 2060 (list type)))) |
2061 (when options | |
2062 (widget-put tmp :options options)) | |
2063 tmp)) | |
2064 | |
17334 | 2065 (defun custom-variable-value-create (widget) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2066 "Here is where you edit the variable's value." |
17334 | 2067 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2068 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2069 (widget-put widget :custom-form custom-variable-default-form)) |
17334 | 2070 (let* ((buttons (widget-get widget :buttons)) |
2071 (children (widget-get widget :children)) | |
2072 (form (widget-get widget :custom-form)) | |
2073 (state (widget-get widget :custom-state)) | |
2074 (symbol (widget-get widget :value)) | |
2075 (tag (widget-get widget :tag)) | |
17415 | 2076 (type (custom-variable-type symbol)) |
17334 | 2077 (conv (widget-convert type)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2078 (get (or (get symbol 'custom-get) 'default-value)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2079 (prefix (widget-get widget :custom-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2080 (last (widget-get widget :custom-last)) |
17334 | 2081 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2082 (funcall get symbol) |
17334 | 2083 (widget-get conv :value)))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2084 ;; If the widget is new, the child determines whether it is hidden. |
17334 | 2085 (cond (state) |
2086 ((custom-show type value) | |
2087 (setq state 'unknown)) | |
2088 (t | |
2089 (setq state 'hidden))) | |
2090 ;; If we don't know the state, see if we need to edit it in lisp form. | |
2091 (when (eq state 'unknown) | |
2092 (unless (widget-apply conv :match value) | |
2093 ;; (widget-apply (widget-convert type) :match value) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2094 (setq form 'mismatch))) |
17334 | 2095 ;; Now we can create the child widget. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2096 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2097 (insert prefix (if last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2098 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2099 widget 'custom-browse-variable-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2100 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2101 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2102 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2103 ((eq state 'hidden) |
17334 | 2104 ;; Indicate hidden value. |
25685 | 2105 (push (widget-create-child-and-convert |
17334 | 2106 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2107 :format "%{%t%}: " |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2108 :sample-face 'custom-variable-tag-face |
17334 | 2109 :tag tag |
2110 :parent widget) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2111 buttons) |
25685 | 2112 (push (widget-create-child-and-convert |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2113 widget 'visibility |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2114 :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
|
2115 :action 'custom-toggle-parent |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2116 nil) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2117 buttons)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2118 ((memq form '(lisp mismatch)) |
17334 | 2119 ;; In lisp mode edit the saved value when possible. |
2120 (let* ((value (cond ((get symbol 'saved-value) | |
2121 (car (get symbol 'saved-value))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2122 ((get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2123 (car (get symbol 'standard-value))) |
17334 | 2124 ((default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2125 (custom-quote (funcall get symbol))) |
17334 | 2126 (t |
2127 (custom-quote (widget-get conv :value)))))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2128 (insert (symbol-name symbol) ": ") |
25685 | 2129 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2130 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2131 :help-echo "Hide the value of this option." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2132 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2133 t) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2134 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2135 (insert " ") |
25685 | 2136 (push (widget-create-child-and-convert |
2137 widget 'sexp | |
17334 | 2138 :button-face 'custom-variable-button-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2139 :format "%v" |
17334 | 2140 :tag (symbol-name symbol) |
2141 :parent widget | |
2142 :value value) | |
2143 children))) | |
2144 (t | |
2145 ;; Edit mode. | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2146 (let* ((format (widget-get type :format)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2147 tag-format value-format) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2148 (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
|
2149 (error "Bad format")) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2150 (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
|
2151 (setq value-format (substring format (match-end 0))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2152 (push (widget-create-child-and-convert |
25685 | 2153 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2154 :format tag-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2155 :action 'custom-tag-action |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2156 :help-echo "Change value of this option." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2157 :mouse-down-action 'custom-tag-mouse-down-action |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2158 :button-face 'custom-variable-button-face |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2159 :sample-face 'custom-variable-tag-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2160 tag) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2161 buttons) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2162 (insert " ") |
25685 | 2163 (push (widget-create-child-and-convert |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2164 widget 'visibility |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2165 :help-echo "Hide the value of this option." |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2166 :action 'custom-toggle-parent |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2167 t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2168 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2169 (push (widget-create-child-and-convert |
25685 | 2170 widget type |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2171 :format value-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2172 :value value) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2173 children)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2174 (unless (eq custom-buffer-style 'tree) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2175 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2176 (widget-insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2177 ;; Create the magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2178 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2179 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2180 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2181 (push magic buttons)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2182 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property |
25685 | 2183 ;; before the call to `widget-default-format-handler'. Otherwise, I |
2184 ;; loose my current `buttons'. This function shouldn't be called like | |
2185 ;; this anyway. The doc string widget should be added like the others. | |
2186 ;; --dv | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2187 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2188 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2189 (widget-default-format-handler widget ?h) |
25685 | 2190 |
2191 ;; The comment field | |
2192 (unless (eq state 'hidden) | |
2193 (let* ((comment (get symbol 'variable-comment)) | |
2194 (comment-widget | |
2195 (widget-create-child-and-convert | |
2196 widget 'custom-comment | |
2197 :parent widget | |
2198 :value (or comment "")))) | |
2199 (widget-put widget :comment-widget comment-widget) | |
2200 ;; Don't push it !!! Custom assumes that the first child is the | |
2201 ;; value one. | |
2202 (setq children (append children (list comment-widget))))) | |
2203 ;; Update the rest of the properties properties. | |
2204 (widget-put widget :custom-form form) | |
2205 (widget-put widget :children children) | |
2206 ;; Now update the state. | |
2207 (if (eq state 'hidden) | |
2208 (widget-put widget :custom-state state) | |
2209 (custom-variable-state-set widget)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2210 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2211 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2212 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2213 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2214 (custom-add-see-also widget))))) |
17334 | 2215 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2216 (defun custom-tag-action (widget &rest args) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2217 "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
|
2218 (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
|
2219 :action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2220 |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2221 (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
|
2222 "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
|
2223 (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
|
2224 :mouse-down-action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2225 |
17334 | 2226 (defun custom-variable-state-set (widget) |
2227 "Set the state of WIDGET." | |
2228 (let* ((symbol (widget-value widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2229 (get (or (get symbol 'custom-get) 'default-value)) |
17334 | 2230 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2231 (funcall get symbol) |
17334 | 2232 (widget-get widget :value))) |
25685 | 2233 (comment (get symbol 'variable-comment)) |
17334 | 2234 tmp |
25685 | 2235 temp |
2236 (state (cond ((progn (setq tmp (get symbol 'customized-value)) | |
2237 (setq temp | |
2238 (get symbol 'customized-variable-comment)) | |
2239 (or tmp temp)) | |
17334 | 2240 (if (condition-case nil |
25685 | 2241 (and (equal value (eval (car tmp))) |
2242 (equal comment temp)) | |
17334 | 2243 (error nil)) |
2244 'set | |
2245 'changed)) | |
25685 | 2246 ((progn (setq tmp (get symbol 'saved-value)) |
2247 (setq temp (get symbol 'saved-variable-comment)) | |
2248 (or tmp temp)) | |
17334 | 2249 (if (condition-case nil |
25685 | 2250 (and (equal value (eval (car tmp))) |
2251 (equal comment temp)) | |
17334 | 2252 (error nil)) |
2253 'saved | |
2254 'changed)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2255 ((setq tmp (get symbol 'standard-value)) |
17334 | 2256 (if (condition-case nil |
25685 | 2257 (and (equal value (eval (car tmp))) |
2258 (equal comment nil)) | |
17334 | 2259 (error nil)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2260 'standard |
17334 | 2261 'changed)) |
2262 (t 'rogue)))) | |
2263 (widget-put widget :custom-state state))) | |
2264 | |
25685 | 2265 (defvar custom-variable-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
2266 '(("Set for Current Session" custom-variable-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2267 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2268 (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
|
2269 ("Save for Future Sessions" custom-variable-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2270 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2271 (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
|
2272 ("Reset to Current" custom-redraw |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2273 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2274 (and (default-boundp (widget-value widget)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2275 (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
|
2276 ("Reset to Saved" custom-variable-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2277 (lambda (widget) |
25685 | 2278 (and (or (get (widget-value widget) 'saved-value) |
2279 (get (widget-value widget) 'saved-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2280 (memq (widget-get widget :custom-state) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2281 '(modified set changed rogue))))) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2282 ("Erase Customization" custom-variable-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2283 (lambda (widget) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2284 (and (get (widget-value widget) 'standard-value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2285 (memq (widget-get widget :custom-state) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2286 '(modified set changed saved rogue))))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2287 ("---" ignore ignore) |
25685 | 2288 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2289 ("---" ignore ignore) | |
2290 ("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
|
2291 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2292 (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
|
2293 ("Show initial Lisp expression" custom-variable-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2294 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2295 (eq (widget-get widget :custom-form) 'edit)))) |
17334 | 2296 "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
|
2297 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
|
2298 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
|
2299 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
|
2300 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
|
2301 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2302 |
2303 (defun custom-variable-action (widget &optional event) | |
2304 "Show the menu for `custom-variable' WIDGET. | |
2305 Optional EVENT is the location for the menu." | |
2306 (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
|
2307 (custom-toggle-hide widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2308 (unless (eq (widget-get widget :custom-state) 'modified) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2309 (custom-variable-state-set widget)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2310 (custom-redraw-magic widget) |
17334 | 2311 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2312 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2313 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2314 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2315 (custom-menu-filter custom-variable-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2316 widget) |
17334 | 2317 event))) |
2318 (if answer | |
2319 (funcall answer widget))))) | |
2320 | |
2321 (defun custom-variable-edit (widget) | |
2322 "Edit value of WIDGET." | |
2323 (widget-put widget :custom-state 'unknown) | |
2324 (widget-put widget :custom-form 'edit) | |
2325 (custom-redraw widget)) | |
2326 | |
2327 (defun custom-variable-edit-lisp (widget) | |
28130 | 2328 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2329 (widget-put widget :custom-state 'unknown) |
2330 (widget-put widget :custom-form 'lisp) | |
2331 (custom-redraw widget)) | |
2332 | |
2333 (defun custom-variable-set (widget) | |
2334 "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
|
2335 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2336 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2337 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2338 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2339 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2340 (comment-widget (widget-get widget :comment-widget)) |
2341 (comment (widget-value comment-widget)) | |
2342 val) | |
17334 | 2343 (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
|
2344 (error "Cannot set hidden variable")) |
17334 | 2345 ((setq val (widget-apply child :validate)) |
2346 (goto-char (widget-get val :from)) | |
2347 (error "%s" (widget-get val :error))) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2348 ((memq form '(lisp mismatch)) |
25685 | 2349 (when (equal comment "") |
2350 (setq comment nil) | |
2351 ;; 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
|
2352 (custom-comment-hide comment-widget)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2353 (funcall set symbol (eval (setq val (widget-value child)))) |
25685 | 2354 (put symbol 'customized-value (list val)) |
2355 (put symbol 'variable-comment comment) | |
2356 (put symbol 'customized-variable-comment comment)) | |
17334 | 2357 (t |
25685 | 2358 (when (equal comment "") |
2359 (setq comment nil) | |
2360 ;; 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
|
2361 (custom-comment-hide comment-widget)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2362 (funcall set symbol (setq val (widget-value child))) |
25685 | 2363 (put symbol 'customized-value (list (custom-quote val))) |
2364 (put symbol 'variable-comment comment) | |
2365 (put symbol 'customized-variable-comment comment))) | |
17334 | 2366 (custom-variable-state-set widget) |
2367 (custom-redraw-magic widget))) | |
2368 | |
2369 (defun custom-variable-save (widget) | |
19823
0c1b4a44db76
(custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents:
19822
diff
changeset
|
2370 "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
|
2371 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2372 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2373 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2374 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2375 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2376 (comment-widget (widget-get widget :comment-widget)) |
2377 (comment (widget-value comment-widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2378 val) |
17334 | 2379 (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
|
2380 (error "Cannot set hidden variable")) |
17334 | 2381 ((setq val (widget-apply child :validate)) |
2382 (goto-char (widget-get val :from)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
2383 (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
|
2384 ((memq form '(lisp mismatch)) |
25685 | 2385 (when (equal comment "") |
2386 (setq comment nil) | |
2387 ;; 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
|
2388 (custom-comment-hide comment-widget)) |
17334 | 2389 (put symbol 'saved-value (list (widget-value child))) |
25685 | 2390 (funcall set symbol (eval (widget-value child))) |
2391 (put symbol 'variable-comment comment) | |
2392 (put symbol 'saved-variable-comment comment)) | |
17334 | 2393 (t |
25685 | 2394 (when (equal comment "") |
2395 (setq comment nil) | |
2396 ;; 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
|
2397 (custom-comment-hide comment-widget)) |
25685 | 2398 (put symbol 'saved-value |
2399 (list (custom-quote (widget-value child)))) | |
2400 (funcall set symbol (widget-value child)) | |
2401 (put symbol 'variable-comment comment) | |
2402 (put symbol 'saved-variable-comment comment))) | |
17334 | 2403 (put symbol 'customized-value nil) |
25685 | 2404 (put symbol 'customized-variable-comment nil) |
17334 | 2405 (custom-save-all) |
2406 (custom-variable-state-set widget) | |
2407 (custom-redraw-magic widget))) | |
2408 | |
2409 (defun custom-variable-reset-saved (widget) | |
2410 "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
|
2411 (let* ((symbol (widget-value widget)) |
25685 | 2412 (set (or (get symbol 'custom-set) 'set-default)) |
2413 (value (get symbol 'saved-value)) | |
2414 (comment (get symbol 'saved-variable-comment))) | |
2415 (cond ((or value comment) | |
2416 (put symbol 'variable-comment comment) | |
2417 (condition-case nil | |
2418 (funcall set symbol (eval (car value))) | |
2419 (error nil))) | |
2420 (t | |
2421 (error "No saved value for %s" symbol))) | |
17334 | 2422 (put symbol 'customized-value nil) |
25685 | 2423 (put symbol 'customized-variable-comment nil) |
17334 | 2424 (widget-put widget :custom-state 'unknown) |
25685 | 2425 ;; This call will possibly make the comment invisible |
17334 | 2426 (custom-redraw widget))) |
2427 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2428 (defun custom-variable-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2429 "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
|
2430 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
|
2431 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
|
2432 (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
|
2433 (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
|
2434 (if (get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2435 (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
|
2436 (error "No standard setting known for %S" symbol)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2437 (put symbol 'variable-comment nil) |
17334 | 2438 (put symbol 'customized-value nil) |
25685 | 2439 (put symbol 'customized-variable-comment nil) |
2440 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | |
17334 | 2441 (put symbol 'saved-value nil) |
25685 | 2442 (put symbol 'saved-variable-comment nil) |
17334 | 2443 (custom-save-all)) |
2444 (widget-put widget :custom-state 'unknown) | |
25685 | 2445 ;; This call will possibly make the comment invisible |
17334 | 2446 (custom-redraw widget))) |
2447 | |
2448 ;;; The `custom-face-edit' Widget. | |
2449 | |
2450 (define-widget 'custom-face-edit 'checklist | |
2451 "Edit face attributes." | |
2452 :format "%t: %v" | |
2453 :tag "Attributes" | |
2454 :extra-offset 12 | |
25685 | 2455 :button-args '(:help-echo "Control whether this attribute has any effect.") |
17334 | 2456 :args (mapcar (lambda (att) |
25685 | 2457 (list 'group |
17334 | 2458 :inline t |
2459 :sibling-args (widget-get (nth 1 att) :sibling-args) | |
25685 | 2460 (list 'const :format "" :value (nth 0 att)) |
17334 | 2461 (nth 1 att))) |
2462 custom-face-attributes)) | |
2463 | |
2464 ;;; The `custom-display' Widget. | |
2465 | |
2466 (define-widget 'custom-display 'menu-choice | |
2467 "Select a display type." | |
2468 :tag "Display" | |
2469 :value t | |
2470 :help-echo "Specify frames where the face attributes should be used." | |
2471 :args '((const :tag "all" t) | |
2472 (checklist | |
2473 :offset 0 | |
2474 :extra-offset 9 | |
2475 :args ((group :sibling-args (:help-echo "\ | |
2476 Only match the specified window systems.") | |
2477 (const :format "Type: " | |
2478 type) | |
2479 (checklist :inline t | |
2480 :offset 0 | |
2481 (const :format "X " | |
2482 :sibling-args (:help-echo "\ | |
2483 The X11 Window System.") | |
2484 x) | |
2485 (const :format "PM " | |
2486 :sibling-args (:help-echo "\ | |
2487 OS/2 Presentation Manager.") | |
2488 pm) | |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2489 (const :format "W32 " |
17334 | 2490 :sibling-args (:help-echo "\ |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2491 Windows NT/9X.") |
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2492 w32) |
17334 | 2493 (const :format "DOS " |
2494 :sibling-args (:help-echo "\ | |
2495 Plain MS-DOS.") | |
2496 pc) | |
2497 (const :format "TTY%n" | |
2498 :sibling-args (:help-echo "\ | |
2499 Plain text terminals.") | |
2500 tty))) | |
2501 (group :sibling-args (:help-echo "\ | |
2502 Only match the frames with the specified color support.") | |
2503 (const :format "Class: " | |
2504 class) | |
2505 (checklist :inline t | |
2506 :offset 0 | |
2507 (const :format "Color " | |
2508 :sibling-args (:help-echo "\ | |
2509 Match color frames.") | |
2510 color) | |
2511 (const :format "Grayscale " | |
2512 :sibling-args (:help-echo "\ | |
2513 Match grayscale frames.") | |
2514 grayscale) | |
2515 (const :format "Monochrome%n" | |
2516 :sibling-args (:help-echo "\ | |
2517 Match frames with no color support.") | |
2518 mono))) | |
2519 (group :sibling-args (:help-echo "\ | |
2520 Only match frames with the specified intensity.") | |
2521 (const :format "\ | |
2522 Background brightness: " | |
2523 background) | |
2524 (checklist :inline t | |
2525 :offset 0 | |
2526 (const :format "Light " | |
2527 :sibling-args (:help-echo "\ | |
2528 Match frames with light backgrounds.") | |
2529 light) | |
2530 (const :format "Dark\n" | |
2531 :sibling-args (:help-echo "\ | |
2532 Match frames with dark backgrounds.") | |
2533 dark))))))) | |
2534 | |
2535 ;;; The `custom-face' Widget. | |
2536 | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2537 (defface custom-face-tag-face |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
2538 `((t (:bold t :height 1.2 :inherit variable-pitch))) |
17334 | 2539 "Face used for face tags." |
17415 | 2540 :group 'custom-faces) |
17334 | 2541 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2542 (defcustom custom-face-default-form 'selected |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2543 "Default form of displaying face definition." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2544 :type '(choice (const all) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2545 (const selected) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2546 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2547 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2548 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2549 |
17334 | 2550 (define-widget 'custom-face 'custom |
2551 "Customize face." | |
2552 :sample-face 'custom-face-tag-face | |
2553 :help-echo "Set or reset this face." | |
28716
e9fb71a3e51d
(custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28700
diff
changeset
|
2554 :documentation-property #'face-doc-string |
17334 | 2555 :value-create 'custom-face-value-create |
2556 :action 'custom-face-action | |
18089 | 2557 :custom-category 'face |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2558 :custom-form nil ; defaults to value of `custom-face-default-form' |
17334 | 2559 :custom-set 'custom-face-set |
2560 :custom-save 'custom-face-save | |
2561 :custom-reset-current 'custom-redraw | |
2562 :custom-reset-saved 'custom-face-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2563 :custom-reset-standard 'custom-face-reset-standard |
17334 | 2564 :custom-menu 'custom-face-menu-create) |
2565 | |
25685 | 2566 (define-widget 'custom-face-all 'editable-list |
17334 | 2567 "An editable list of display specifications and attributes." |
2568 :entry-format "%i %d %v" | |
2569 :insert-button-args '(:help-echo "Insert new display specification here.") | |
2570 :append-button-args '(:help-echo "Append new display specification here.") | |
2571 :delete-button-args '(:help-echo "Delete this display specification.") | |
2572 :args '((group :format "%v" custom-display custom-face-edit))) | |
2573 | |
2574 (defconst custom-face-all (widget-convert 'custom-face-all) | |
2575 "Converted version of the `custom-face-all' widget.") | |
2576 | |
2577 (define-widget 'custom-display-unselected 'item | |
2578 "A display specification that doesn't match the selected display." | |
2579 :match 'custom-display-unselected-match) | |
2580 | |
2581 (defun custom-display-unselected-match (widget value) | |
2582 "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
|
2583 (not (face-spec-set-match-display value (selected-frame)))) |
17334 | 2584 |
25685 | 2585 (define-widget 'custom-face-selected 'group |
17334 | 2586 "Edit the attributes of the selected display in a face specification." |
2587 :args '((repeat :format "" | |
2588 :inline t | |
2589 (group custom-display-unselected sexp)) | |
2590 (group (sexp :format "") custom-face-edit) | |
2591 (repeat :format "" | |
2592 :inline t | |
2593 sexp))) | |
2594 | |
2595 (defconst custom-face-selected (widget-convert 'custom-face-selected) | |
2596 "Converted version of the `custom-face-selected' widget.") | |
2597 | |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2598 (defun custom-filter-face-spec (spec filter-index default-filter) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2599 "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
|
2600 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
|
2601 `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
|
2602 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
|
2603 don't specify one." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2604 (mapcar (lambda (entry) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2605 ;; 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
|
2606 (let ((tests (car entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2607 (unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2608 ;; 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
|
2609 (if (listp (car (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2610 (car (cdr entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2611 (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2612 (filtered-attrs nil)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2613 ;; Filter each face attribute |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2614 (while unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2615 (let* ((attr (pop unfiltered-attrs)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2616 (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
|
2617 (filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2618 (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
|
2619 default-filter)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2620 (filtered-value |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2621 (if filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2622 (funcall filter pre-filtered-value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2623 pre-filtered-value))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2624 (push filtered-value filtered-attrs) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2625 (push attr filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2626 ;; |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2627 (list tests filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2628 spec)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2629 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2630 (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
|
2631 "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
|
2632 SPEC must be a full face spec." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2633 (custom-filter-face-spec |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2634 spec 2 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2635 (lambda (value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2636 (cond ((eq value 'unspecified) nil) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2637 ((eq value nil) 'off) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2638 (t value))))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2639 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2640 (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
|
2641 "Return the customized SPEC in a form suitable for setting the face." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2642 (custom-filter-face-spec |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2643 spec 3 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2644 (lambda (value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2645 (cond ((eq value nil) 'unspecified) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2646 ((eq value 'off) nil) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2647 (t value))))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2648 |
17334 | 2649 (defun custom-face-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2650 "Create a list of the display specifications for WIDGET." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2651 (let ((buttons (widget-get widget :buttons)) |
25685 | 2652 children |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2653 (symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2654 (tag (widget-get widget :tag)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2655 (state (widget-get widget :custom-state)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2656 (begin (point)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2657 (is-last (widget-get widget :custom-last)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2658 (prefix (widget-get widget :custom-prefix))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2659 (unless tag |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2660 (setq tag (prin1-to-string symbol))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2661 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2662 (insert prefix (if is-last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2663 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2664 widget 'custom-browse-face-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2665 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2666 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2667 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2668 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2669 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2670 (insert tag) |
34041
40708840c132
(custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents:
33986
diff
changeset
|
2671 (widget-specify-sample widget begin (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2672 (if (eq custom-buffer-style 'face) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2673 (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
|
2674 (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
|
2675 (insert ":") |
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2676 (insert " face: "))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2677 ;; Sample. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2678 (push (widget-create-child-and-convert widget 'item |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2679 :format "(%{%t%})" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2680 :sample-face symbol |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2681 :tag "sample") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2682 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2683 ;; Visibility. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2684 (insert " ") |
25685 | 2685 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2686 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2687 :help-echo "Hide or show this face." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2688 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2689 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2690 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2691 ;; Magic. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2692 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2693 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2694 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2695 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2696 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2697 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2698 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2699 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2700 (widget-default-format-handler widget ?h) |
25685 | 2701 ;; The comment field |
2702 (unless (eq state 'hidden) | |
2703 (let* ((comment (get symbol 'face-comment)) | |
2704 (comment-widget | |
2705 (widget-create-child-and-convert | |
2706 widget 'custom-comment | |
2707 :parent widget | |
2708 :value (or comment "")))) | |
2709 (widget-put widget :comment-widget comment-widget) | |
2710 (push comment-widget children))) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2711 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2712 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2713 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2714 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2715 (custom-add-see-also widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2716 ;; Editor. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2717 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2718 (insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2719 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2720 (message "Creating face editor...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2721 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2722 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2723 (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
|
2724 (let* ((symbol (widget-value widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2725 (spec (or (get symbol 'saved-face) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2726 (get symbol 'face-defface-spec) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2727 ;; Attempt to construct it. |
25685 | 2728 (list (list t (custom-face-attributes-get |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2729 symbol (selected-frame)))))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2730 (form (widget-get widget :custom-form)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2731 (indent (widget-get widget :indent)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2732 edit) |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2733 ;; 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
|
2734 ;; 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
|
2735 (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
|
2736 (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
|
2737 (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
|
2738 (setq edit (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2739 widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2740 (cond ((and (eq form 'selected) |
25685 | 2741 (widget-apply custom-face-selected |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2742 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2743 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2744 'custom-face-selected) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2745 ((and (not (eq form 'lisp)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2746 (widget-apply custom-face-all |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2747 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2748 'custom-face-all) |
25685 | 2749 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2750 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2751 'sexp)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2752 :value spec)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2753 (custom-face-state-set widget) |
25685 | 2754 (push edit children) |
2755 (widget-put widget :children children)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2756 (message "Creating face editor...done")))))) |
17334 | 2757 |
25685 | 2758 (defvar custom-face-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
2759 '(("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
|
2760 ("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
|
2761 ("Reset to Saved" custom-face-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2762 (lambda (widget) |
25685 | 2763 (or (get (widget-value widget) 'saved-face) |
2764 (get (widget-value widget) 'saved-face-comment)))) | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2765 ("Erase Customization" custom-face-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2766 (lambda (widget) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2767 (get (widget-value widget) 'face-defface-spec))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2768 ("---" ignore ignore) |
25685 | 2769 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2770 ("---" ignore ignore) | |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2771 ("Show all display specs" custom-face-edit-all |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2772 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2773 (not (eq (widget-get widget :custom-form) 'all)))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2774 ("Just current attributes" custom-face-edit-selected |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2775 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2776 (not (eq (widget-get widget :custom-form) 'selected)))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2777 ("Show as Lisp expression" custom-face-edit-lisp |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2778 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2779 (not (eq (widget-get widget :custom-form) 'lisp))))) |
17334 | 2780 "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
|
2781 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
|
2782 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
|
2783 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
|
2784 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
|
2785 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2786 |
2787 (defun custom-face-edit-selected (widget) | |
2788 "Edit selected attributes of the value of WIDGET." | |
2789 (widget-put widget :custom-state 'unknown) | |
2790 (widget-put widget :custom-form 'selected) | |
2791 (custom-redraw widget)) | |
2792 | |
2793 (defun custom-face-edit-all (widget) | |
2794 "Edit all attributes of the value of WIDGET." | |
2795 (widget-put widget :custom-state 'unknown) | |
2796 (widget-put widget :custom-form 'all) | |
2797 (custom-redraw widget)) | |
2798 | |
2799 (defun custom-face-edit-lisp (widget) | |
28130 | 2800 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2801 (widget-put widget :custom-state 'unknown) |
2802 (widget-put widget :custom-form 'lisp) | |
2803 (custom-redraw widget)) | |
2804 | |
2805 (defun custom-face-state-set (widget) | |
2806 "Set the state of WIDGET." | |
25685 | 2807 (let* ((symbol (widget-value widget)) |
2808 (comment (get symbol 'face-comment)) | |
2809 tmp temp) | |
2810 (widget-put widget :custom-state | |
2811 (cond ((progn | |
2812 (setq tmp (get symbol 'customized-face)) | |
2813 (setq temp (get symbol 'customized-face-comment)) | |
2814 (or tmp temp)) | |
2815 (if (equal temp comment) | |
2816 'set | |
2817 'changed)) | |
2818 ((progn | |
2819 (setq tmp (get symbol 'saved-face)) | |
2820 (setq temp (get symbol 'saved-face-comment)) | |
2821 (or tmp temp)) | |
2822 (if (equal temp comment) | |
2823 'saved | |
2824 'changed)) | |
2825 ((get symbol 'face-defface-spec) | |
2826 (if (equal comment nil) | |
2827 'standard | |
2828 'changed)) | |
2829 (t | |
2830 'rogue))))) | |
17334 | 2831 |
2832 (defun custom-face-action (widget &optional event) | |
2833 "Show the menu for `custom-face' WIDGET. | |
2834 Optional EVENT is the location for the menu." | |
2835 (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
|
2836 (custom-toggle-hide widget) |
17334 | 2837 (let* ((completion-ignore-case t) |
2838 (symbol (widget-get widget :value)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2839 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2840 (custom-unlispify-tag-name symbol)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2841 (custom-menu-filter custom-face-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2842 widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2843 event))) |
17334 | 2844 (if answer |
2845 (funcall answer widget))))) | |
2846 | |
2847 (defun custom-face-set (widget) | |
2848 "Make the face attributes in WIDGET take effect." | |
2849 (let* ((symbol (widget-value widget)) | |
2850 (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
|
2851 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 2852 (comment-widget (widget-get widget :comment-widget)) |
2853 (comment (widget-value comment-widget))) | |
2854 (when (equal comment "") | |
2855 (setq comment nil) | |
2856 ;; 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
|
2857 (custom-comment-hide comment-widget)) |
17334 | 2858 (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
|
2859 (if (face-spec-choose value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2860 (face-spec-set symbol value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2861 ;; 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
|
2862 ;; something harmless instead. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2863 (face-spec-set symbol '((t :foreground unspecified)))) |
25685 | 2864 (put symbol 'customized-face-comment comment) |
2865 (put symbol 'face-comment comment) | |
17334 | 2866 (custom-face-state-set widget) |
2867 (custom-redraw-magic widget))) | |
2868 | |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
2869 (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
|
2870 "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
|
2871 (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
|
2872 (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
|
2873 |
17334 | 2874 (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
|
2875 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'." |
17334 | 2876 (let* ((symbol (widget-value widget)) |
2877 (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
|
2878 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 2879 (comment-widget (widget-get widget :comment-widget)) |
2880 (comment (widget-value comment-widget))) | |
2881 (when (equal comment "") | |
2882 (setq comment nil) | |
2883 ;; 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
|
2884 (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
|
2885 (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
|
2886 (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
|
2887 ;; 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
|
2888 ;; 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
|
2889 (face-spec-set symbol '((t :foreground unspecified)))) |
17334 | 2890 (put symbol 'saved-face value) |
2891 (put symbol 'customized-face nil) | |
25685 | 2892 (put symbol 'face-comment comment) |
2893 (put symbol 'customized-face-comment nil) | |
2894 (put symbol 'saved-face-comment comment) | |
20262
c6532008f2a9
(custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents:
20174
diff
changeset
|
2895 (custom-save-all) |
17334 | 2896 (custom-face-state-set widget) |
2897 (custom-redraw-magic widget))) | |
2898 | |
2899 (defun custom-face-reset-saved (widget) | |
2900 "Restore WIDGET to the face's default attributes." | |
2901 (let* ((symbol (widget-value widget)) | |
2902 (child (car (widget-get widget :children))) | |
25685 | 2903 (value (get symbol 'saved-face)) |
2904 (comment (get symbol 'saved-face-comment)) | |
2905 (comment-widget (widget-get widget :comment-widget))) | |
2906 (unless (or value comment) | |
17334 | 2907 (error "No saved value for this face")) |
2908 (put symbol 'customized-face nil) | |
25685 | 2909 (put symbol 'customized-face-comment nil) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2910 (face-spec-set symbol value) |
25685 | 2911 (put symbol 'face-comment comment) |
17334 | 2912 (widget-value-set child value) |
25685 | 2913 ;; This call manages the comment visibility |
2914 (widget-value-set comment-widget (or comment "")) | |
17334 | 2915 (custom-face-state-set widget) |
2916 (custom-redraw-magic widget))) | |
2917 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2918 (defun custom-face-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2919 "Restore WIDGET to the face's standard settings. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2920 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
|
2921 restoring it to the state of a face that has never been customized." |
17334 | 2922 (let* ((symbol (widget-value widget)) |
2923 (child (car (widget-get widget :children))) | |
25685 | 2924 (value (get symbol 'face-defface-spec)) |
2925 (comment-widget (widget-get widget :comment-widget))) | |
17334 | 2926 (unless value |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
2927 (error "No standard setting for this face")) |
17334 | 2928 (put symbol 'customized-face nil) |
25685 | 2929 (put symbol 'customized-face-comment nil) |
2930 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | |
17334 | 2931 (put symbol 'saved-face nil) |
25685 | 2932 (put symbol 'saved-face-comment nil) |
17334 | 2933 (custom-save-all)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2934 (face-spec-set symbol value) |
25685 | 2935 (put symbol 'face-comment nil) |
17334 | 2936 (widget-value-set child value) |
25685 | 2937 ;; This call manages the comment visibility |
2938 (widget-value-set comment-widget "") | |
17334 | 2939 (custom-face-state-set widget) |
2940 (custom-redraw-magic widget))) | |
2941 | |
2942 ;;; The `face' Widget. | |
2943 | |
2944 (define-widget 'face 'default | |
2945 "Select and customize a face." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2946 :convert-widget 'widget-value-convert-widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2947 :button-prefix 'widget-push-button-prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2948 :button-suffix 'widget-push-button-suffix |
33986 | 2949 :format "%{%t%}: %[select face%] %v" |
17334 | 2950 :tag "Face" |
2951 :value 'default | |
2952 :value-create 'widget-face-value-create | |
2953 :value-delete 'widget-face-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2954 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2955 :validate 'widget-children-validate |
17334 | 2956 :action 'widget-face-action |
28612
0051d3178111
(custom-face, face): Unquote the lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28568
diff
changeset
|
2957 :match (lambda (widget value) (symbolp value))) |
17334 | 2958 |
2959 (defun widget-face-value-create (widget) | |
28130 | 2960 "Create a `custom-face' child." |
17334 | 2961 (let* ((symbol (widget-value widget)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2962 (custom-buffer-style 'face) |
17334 | 2963 (child (widget-create-child-and-convert |
2964 widget 'custom-face | |
2965 :custom-level nil | |
2966 :value symbol))) | |
2967 (custom-magic-reset child) | |
2968 (setq custom-options (cons child custom-options)) | |
2969 (widget-put widget :children (list child)))) | |
2970 | |
2971 (defun widget-face-value-delete (widget) | |
28130 | 2972 "Remove the child from the options." |
17334 | 2973 (let ((child (car (widget-get widget :children)))) |
2974 (setq custom-options (delq child custom-options)) | |
2975 (widget-children-value-delete widget))) | |
2976 | |
2977 (defvar face-history nil | |
2978 "History of entered face names.") | |
2979 | |
2980 (defun widget-face-action (widget &optional event) | |
2981 "Prompt for a face." | |
2982 (let ((answer (completing-read "Face: " | |
2983 (mapcar (lambda (face) | |
2984 (list (symbol-name face))) | |
2985 (face-list)) | |
25685 | 2986 nil nil nil |
17334 | 2987 'face-history))) |
2988 (unless (zerop (length answer)) | |
2989 (widget-value-set widget (intern answer)) | |
2990 (widget-apply widget :notify widget event) | |
2991 (widget-setup)))) | |
2992 | |
2993 ;;; The `hook' Widget. | |
2994 | |
2995 (define-widget 'hook 'list | |
2996 "A emacs lisp hook" | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2997 :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
|
2998 (if (and value (symbolp value)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2999 (list value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3000 value)) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3001 :match (lambda (widget value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3002 (or (symbolp value) |
20174
e1ca1fe89e6e
(hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents:
20100
diff
changeset
|
3003 (widget-group-match widget value))) |
28130 | 3004 ;; Avoid adding undefined functions to the hook, especially for |
3005 ;; things like `find-file-hook' or even more basic ones, to avoid | |
3006 ;; chaos. | |
3007 :set (lambda (symbol value) | |
28310
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3008 (dolist (elt value) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3009 (if (fboundp elt) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3010 (add-hook symbol elt)))) |
17334 | 3011 :convert-widget 'custom-hook-convert-widget |
3012 :tag "Hook") | |
3013 | |
3014 (defun custom-hook-convert-widget (widget) | |
27250
807fc106b24c
(custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
26803
diff
changeset
|
3015 ;; Handle `:options'. |
17334 | 3016 (let* ((options (widget-get widget :options)) |
25685 | 3017 (other `(editable-list :inline t |
17334 | 3018 :entry-format "%i %d%v" |
3019 (function :format " %v"))) | |
3020 (args (if options | |
3021 (list `(checklist :inline t | |
3022 ,@(mapcar (lambda (entry) | |
3023 `(function-item ,entry)) | |
3024 options)) | |
3025 other) | |
3026 (list other)))) | |
3027 (widget-put widget :args args) | |
3028 widget)) | |
3029 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3030 ;;; The `custom-group-link' Widget. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3031 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3032 (define-widget 'custom-group-link 'link |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3033 "Show parent in other window when activated." |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3034 :help-echo "Create customization buffer for this group." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3035 :action 'custom-group-link-action) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3036 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3037 (defun custom-group-link-action (widget &rest ignore) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3038 (customize-group (widget-value widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3039 |
17334 | 3040 ;;; The `custom-group' Widget. |
3041 | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3042 (defcustom custom-group-tag-faces nil |
17334 | 3043 ;; In XEmacs, this ought to play games with font size. |
25685 | 3044 ;; Fixme: make it do so in Emacs. |
17334 | 3045 "Face used for group tags. |
3046 The first member is used for level 1 groups, the second for level 2, | |
3047 and so forth. The remaining group tags are shown with | |
3048 `custom-group-tag-face'." | |
3049 :type '(repeat face) | |
17415 | 3050 :group 'custom-faces) |
17334 | 3051 |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3052 (defface custom-group-tag-face-1 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3053 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3054 (background dark)) |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
3055 (:foreground "pink" :bold t :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3056 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3057 (background light)) |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
3058 (:foreground "red" :bold t :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3059 (t (:bold t))) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3060 "Face used for group tags." |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3061 :group 'custom-faces) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3062 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3063 (defface custom-group-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3064 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3065 (background dark)) |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
3066 (:foreground "light blue" :bold t :height 1.2)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3067 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3068 (background light)) |
31744
617f41808ff6
(custom-face-tag-face, custom-group-tag-face-1)
Miles Bader <miles@gnu.org>
parents:
30284
diff
changeset
|
3069 (:foreground "blue" :bold t :height 1.2)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3070 (t (:bold t))) |
17334 | 3071 "Face used for low level group tags." |
17415 | 3072 :group 'custom-faces) |
17334 | 3073 |
3074 (define-widget 'custom-group 'custom | |
3075 "Customize group." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3076 :format "%v" |
17334 | 3077 :sample-face-get 'custom-group-sample-face-get |
3078 :documentation-property 'group-documentation | |
3079 :help-echo "Set or reset all members of this group." | |
3080 :value-create 'custom-group-value-create | |
3081 :action 'custom-group-action | |
18089 | 3082 :custom-category 'group |
17334 | 3083 :custom-set 'custom-group-set |
3084 :custom-save 'custom-group-save | |
3085 :custom-reset-current 'custom-group-reset-current | |
3086 :custom-reset-saved 'custom-group-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3087 :custom-reset-standard 'custom-group-reset-standard |
17334 | 3088 :custom-menu 'custom-group-menu-create) |
3089 | |
3090 (defun custom-group-sample-face-get (widget) | |
3091 ;; Use :sample-face. | |
3092 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) | |
3093 'custom-group-tag-face)) | |
3094 | |
18430
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3095 (define-widget 'custom-group-visibility 'visibility |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3096 "An indicator and manipulator for hidden group contents." |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3097 :create 'custom-group-visibility-create) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3098 |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3099 (defun custom-group-visibility-create (widget) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3100 (let ((visible (widget-value widget))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3101 (if visible |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3102 (insert "--------"))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3103 (widget-default-create widget)) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3104 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3105 (defun custom-group-members (symbol groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3106 "Return SYMBOL's custom group members. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3107 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
|
3108 (if (not groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3109 (get symbol 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3110 (let (members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3111 (dolist (entry (get symbol 'custom-group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3112 (when (eq (nth 1 entry) 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3113 (push entry members))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3114 (nreverse members)))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3115 |
17334 | 3116 (defun custom-group-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3117 "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
|
3118 (let* ((state (widget-get widget :custom-state)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3119 (level (widget-get widget :custom-level)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3120 ;; (indent (widget-get widget :indent)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3121 (prefix (widget-get widget :custom-prefix)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3122 (buttons (widget-get widget :buttons)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3123 (tag (widget-get widget :tag)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3124 (symbol (widget-value widget)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3125 (members (custom-group-members symbol |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3126 (and (eq custom-buffer-style 'tree) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3127 custom-browse-only-groups)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3128 (cond ((and (eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3129 (eq state 'hidden) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3130 (or members (custom-unloaded-widget-p widget))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3131 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3132 (push (widget-create-child-and-convert |
25685 | 3133 widget 'custom-browse-visibility |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3134 ;; :tag-glyph "plus" |
18856
03eeb83520d8
(custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents:
18812
diff
changeset
|
3135 :tag "+") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3136 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3137 (insert "-- ") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3138 ;; (widget-glyph-insert nil "-- " "horizontal") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3139 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3140 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3141 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3142 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3143 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3144 ((and (eq custom-buffer-style 'tree) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3145 (zerop (length members))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3146 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3147 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3148 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3149 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3150 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3151 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3152 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3153 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3154 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3155 ((eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3156 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3157 (custom-load-widget widget) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3158 (if (zerop (length members)) |
25685 | 3159 (progn |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3160 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3161 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3162 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3163 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3164 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3165 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3166 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3167 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3168 (widget-put widget :buttons buttons)) |
25685 | 3169 (push (widget-create-child-and-convert |
3170 widget 'custom-browse-visibility | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3171 ;; :tag-glyph "minus" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3172 :tag "-") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3173 buttons) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3174 (insert "-\\ ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3175 ;; (widget-glyph-insert nil "-\\ " "top") |
25685 | 3176 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3177 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3178 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3179 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3180 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3181 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3182 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3183 custom-browse-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3184 custom-browse-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3185 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3186 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3187 (extra-prefix (if (widget-get widget :custom-last) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3188 " " |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3189 " | ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3190 (prefix (concat prefix extra-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3191 children entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3192 (while members |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3193 (setq entry (car members) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3194 members (cdr members)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3195 (push (widget-create-child-and-convert |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3196 widget (nth 1 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3197 :group widget |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3198 :tag (custom-unlispify-tag-name (nth 0 entry)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3199 :custom-prefixes custom-prefix-list |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3200 :custom-level (1+ level) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3201 :custom-last (null members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3202 :value (nth 0 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3203 :custom-prefix prefix) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3204 children)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3205 (widget-put widget :children (reverse children))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3206 (message "Creating group...done"))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3207 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3208 ((eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3209 ;; Create level indicator. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3210 (unless (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3211 (insert-char ?\ (* custom-buffer-indent (1- level))) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3212 (insert "-- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3213 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3214 (let ((begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3215 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3216 (widget-specify-sample widget begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3217 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3218 ;; Create link/visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3219 (if (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3220 (push (widget-create-child-and-convert |
25685 | 3221 widget 'custom-group-link |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3222 :tag "Go to Group" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3223 symbol) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3224 buttons) |
25685 | 3225 (push (widget-create-child-and-convert |
20100
0db4553d47cc
(custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents:
19886
diff
changeset
|
3226 widget 'custom-group-visibility |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3227 :help-echo "Show members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3228 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3229 (not (eq state 'hidden))) |
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 " \n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3232 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3233 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3234 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3235 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3236 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3237 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3238 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3239 ;; Insert documentation. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3240 (if (and (eq custom-buffer-style 'links) (> level 1)) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3241 (widget-put widget :documentation-indent 0)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3242 (widget-default-format-handler widget ?h)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3243 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3244 (t ;Visible. |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3245 ;; 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
|
3246 (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
|
3247 ;;; 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
|
3248 (when (eq level 1) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
3249 (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
|
3250 "Go to parent group:") |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3251 (insert "\n")))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3252 ;; Create level indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3253 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3254 (insert "/- ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3255 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3256 (let ((start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3257 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3258 (widget-specify-sample widget start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3259 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3260 ;; Create visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3261 (unless (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3262 (insert "--------") |
25685 | 3263 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3264 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3265 :help-echo "Hide members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3266 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3267 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3268 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3269 (insert " ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3270 ;; Create more dashes. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3271 ;; Use 76 instead of 75 to compensate for the temporary "<" |
25685 | 3272 ;; added by `widget-insert'. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3273 (insert-char ?- (- 76 (current-column) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3274 (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3275 (insert "\\\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3276 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3277 (let ((magic (widget-create-child-and-convert |
25685 | 3278 widget 'custom-magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3279 :indent 0 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3280 nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3281 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3282 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3283 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3284 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3285 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3286 (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
|
3287 ;; Parent groups. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3288 (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
|
3289 ;;; 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
|
3290 (when (eq level 1) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3291 (insert-char ?\ custom-buffer-indent) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3292 (custom-add-parent-links widget))) |
25685 | 3293 (custom-add-see-also widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3294 (make-string (* custom-buffer-indent level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3295 ?\ )) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3296 ;; Members. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3297 (message "Creating group...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3298 (custom-load-widget widget) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3299 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3300 custom-buffer-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3301 custom-buffer-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3302 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3303 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3304 (length (length members)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3305 (count 0) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3306 (children (mapcar (lambda (entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3307 (widget-insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3308 (message "\ |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3309 Creating group members... %2d%%" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3310 (/ (* 100.0 count) length)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3311 (setq count (1+ count)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3312 (prog1 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3313 (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3314 widget (nth 1 entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3315 :group widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3316 :tag (custom-unlispify-tag-name |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3317 (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3318 :custom-prefixes custom-prefix-list |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3319 :custom-level (1+ level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3320 :value (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3321 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3322 (widget-insert "\n")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3323 members))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3324 (message "Creating group magic...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3325 (mapc 'custom-magic-reset children) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3326 (message "Creating group state...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3327 (widget-put widget :children children) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3328 (custom-group-state-update widget) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3329 (message "Creating group... done")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3330 ;; End line |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3331 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3332 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3333 (insert "\\- " (widget-get widget :tag) " group end ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3334 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3335 (insert "/\n"))))) |
17334 | 3336 |
25685 | 3337 (defvar custom-group-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3338 '(("Set for Current Session" custom-group-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3339 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3340 (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
|
3341 ("Save for Future Sessions" custom-group-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3342 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3343 (memq (widget-get widget :custom-state) '(modified set)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3344 ("Reset to Current" custom-group-reset-current |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3345 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3346 (memq (widget-get widget :custom-state) '(modified)))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3347 ("Reset to Saved" custom-group-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3348 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3349 (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
|
3350 ("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
|
3351 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3352 (memq (widget-get widget :custom-state) '(modified set saved))))) |
17334 | 3353 "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
|
3354 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
|
3355 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
|
3356 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
|
3357 widget as an argument, and returns non-nil if ACTION is valid on that |
25685 | 3358 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3359 |
3360 (defun custom-group-action (widget &optional event) | |
3361 "Show the menu for `custom-group' WIDGET. | |
3362 Optional EVENT is the location for the menu." | |
3363 (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
|
3364 (custom-toggle-hide widget) |
17334 | 3365 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3366 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3367 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3368 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3369 (custom-menu-filter custom-group-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3370 widget) |
17334 | 3371 event))) |
3372 (if answer | |
3373 (funcall answer widget))))) | |
3374 | |
3375 (defun custom-group-set (widget) | |
3376 "Set changes in all modified group members." | |
3377 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3378 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3379 (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
|
3380 (widget-apply child :custom-set))) |
17334 | 3381 children ))) |
3382 | |
3383 (defun custom-group-save (widget) | |
3384 "Save all modified group members." | |
3385 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3386 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3387 (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
|
3388 (widget-apply child :custom-save))) |
17334 | 3389 children ))) |
3390 | |
3391 (defun custom-group-reset-current (widget) | |
3392 "Reset all modified group members." | |
3393 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3394 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3395 (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
|
3396 (widget-apply child :custom-reset-current))) |
17334 | 3397 children ))) |
3398 | |
3399 (defun custom-group-reset-saved (widget) | |
3400 "Reset all modified or set group members." | |
3401 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3402 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3403 (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
|
3404 (widget-apply child :custom-reset-saved))) |
17334 | 3405 children ))) |
3406 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3407 (defun custom-group-reset-standard (widget) |
17334 | 3408 "Reset all modified, set, or saved group members." |
3409 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3410 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3411 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3412 '(modified set saved)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3413 (widget-apply child :custom-reset-standard))) |
17334 | 3414 children ))) |
3415 | |
3416 (defun custom-group-state-update (widget) | |
3417 "Update magic." | |
3418 (unless (eq (widget-get widget :custom-state) 'hidden) | |
3419 (let* ((children (widget-get widget :children)) | |
3420 (states (mapcar (lambda (child) | |
3421 (widget-get child :custom-state)) | |
3422 children)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3423 (magics custom-magic-alist) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3424 (found 'standard)) |
17334 | 3425 (while magics |
3426 (let ((magic (car (car magics)))) | |
3427 (if (and (not (eq magic 'hidden)) | |
3428 (memq magic states)) | |
3429 (setq found magic | |
3430 magics nil) | |
3431 (setq magics (cdr magics))))) | |
3432 (widget-put widget :custom-state found))) | |
3433 (custom-magic-reset widget)) | |
3434 | |
3435 ;;; The `custom-save-all' Function. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
3436 ;;;###autoload |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3437 (defcustom custom-file nil |
17334 | 3438 "File used for storing customization information. |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3439 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
|
3440 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
|
3441 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
|
3442 |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3443 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
|
3444 \(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
|
3445 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
|
3446 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
|
3447 :type '(choice (const :tag "Your Emacs init file" nil) file) |
17334 | 3448 :group 'customize) |
3449 | |
20974 | 3450 (defun custom-file () |
3451 "Return the file name for saving customizations." | |
37604
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
3452 (if (null user-init-file) |
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
3453 ;; Started with -q, i.e. the file containing Custom settings |
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
3454 ;; hasn't been read. Saving settings there would overwrite |
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
3455 ;; other settings. |
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
3456 (error "Saving settings when running -q would overwrite existing settings") |
bd93cba9ef3e
(custom-file): Signal an error if user-init-file is
Gerd Moellmann <gerd@gnu.org>
parents:
36628
diff
changeset
|
3457 (setq custom-file (or custom-file user-init-file)))) |
20974 | 3458 |
17334 | 3459 (defun custom-save-delete (symbol) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3460 "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
|
3461 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
|
3462 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
|
3463 (let ((default-major-mode)) |
20974 | 3464 (set-buffer (find-file-noselect (custom-file)))) |
17334 | 3465 (goto-char (point-min)) |
25058
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3466 ;; Skip all whitespace and comments. |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3467 (while (forward-comment 1)) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3468 (or (eobp) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3469 (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
|
3470 (let (first) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3471 (catch 'found |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3472 (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
|
3473 ;; Skip all whitespace and comments. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3474 (while (forward-comment 1)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3475 (let ((start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3476 (sexp (condition-case nil |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3477 (read (current-buffer)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3478 (end-of-file (throw 'found nil))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3479 (when (and (listp sexp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3480 (eq (car sexp) symbol)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3481 (delete-region start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3482 (unless first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3483 (setq first (point))))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3484 (if first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3485 (goto-char first) |
36628
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3486 ;; 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
|
3487 ;; entries would make them ineffective. |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3488 (let ((pos (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3489 (case-fold-search t)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3490 (save-excursion |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3491 (goto-char (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3492 (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
|
3493 'move) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3494 (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
|
3495 (setq pos (line-beginning-position)))) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3496 (goto-char pos))))) |
17334 | 3497 |
3498 (defun custom-save-variables () | |
3499 "Save all customized variables in `custom-file'." | |
3500 (save-excursion | |
3501 (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
|
3502 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3503 (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
|
3504 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3505 ;; 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
|
3506 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3507 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3508 (if (get symbol 'saved-value) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3509 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3510 (setq saved-list (sort (cdr saved-list) 'string<)) |
17334 | 3511 (unless (bolp) |
3512 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3513 (princ "(custom-set-variables |
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3514 ;; 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
|
3515 ;; 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
|
3516 (mapcar |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3517 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3518 (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
|
3519 (requests (get symbol 'custom-requests)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3520 (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
|
3521 (and (not (boundp symbol)) |
25685 | 3522 (not (get symbol 'force-value)))))) |
3523 (comment (get symbol 'saved-variable-comment)) | |
3524 sep) | |
3525 (when (or value comment) | |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3526 (unless (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3527 (princ "\n")) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3528 (princ " '(") |
25685 | 3529 (prin1 symbol) |
3530 (princ " ") | |
3531 (prin1 (car value)) | |
3532 (cond ((or now requests comment) | |
3533 (princ " ") | |
3534 (if now | |
3535 (princ "t") | |
3536 (princ "nil")) | |
3537 (cond ((or requests comment) | |
3538 (princ " ") | |
3539 (if requests | |
3540 (prin1 requests) | |
3541 (princ "nil")) | |
3542 (cond (comment | |
3543 (princ " ") | |
3544 (prin1 comment) | |
3545 (princ ")")) | |
3546 (t | |
3547 (princ ")")))) | |
3548 (t | |
3549 (princ ")")))) | |
3550 (t | |
3551 (princ ")")))))) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3552 saved-list) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3553 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3554 (princ " ")) |
17334 | 3555 (princ ")") |
3556 (unless (looking-at "\n") | |
3557 (princ "\n"))))) | |
3558 | |
3559 (defun custom-save-faces () | |
3560 "Save all customized faces in `custom-file'." | |
3561 (save-excursion | |
3562 (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
|
3563 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3564 (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
|
3565 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3566 ;; 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
|
3567 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3568 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3569 (if (get symbol 'saved-face) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3570 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3571 (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
|
3572 ;; 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
|
3573 (if (memq 'default saved-list) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3574 (setq saved-list (cons 'default (delq 'default saved-list)))) |
17334 | 3575 (unless (bolp) |
3576 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3577 (princ "(custom-set-faces |
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3578 ;; 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
|
3579 ;; 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
|
3580 (mapcar |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3581 (lambda (symbol) |
25685 | 3582 (let ((value (get symbol 'saved-face)) |
3583 (now (not (or (get 'default 'face-defface-spec) | |
3584 (and (not (custom-facep 'default)) | |
3585 (not (get 'default 'force-face)))))) | |
3586 (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
|
3587 (unless (eq symbol 'default)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3588 ;; Don't print default face here. |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3589 (unless (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3590 (princ "\n")) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3591 (princ " '(") |
25685 | 3592 (prin1 symbol) |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3593 (princ " ") |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3594 (prin1 value) |
25685 | 3595 (cond ((or now comment) |
3596 (princ " ") | |
3597 (if now | |
3598 (princ "t") | |
3599 (princ "nil")) | |
3600 (cond (comment | |
3601 (princ " ") | |
3602 (prin1 comment) | |
3603 (princ ")")) | |
3604 (t | |
3605 (princ ")")))) | |
3606 (t | |
3607 (princ ")"))))) | |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3608 saved-list) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3609 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3610 (princ " ")) |
17334 | 3611 (princ ")") |
3612 (unless (looking-at "\n") | |
3613 (princ "\n"))))) | |
3614 | |
3615 ;;;###autoload | |
18436
2163f03bb88f
(customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents:
18435
diff
changeset
|
3616 (defun customize-save-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3617 "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
|
3618 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3619 (mapatoms (lambda (symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3620 (let ((face (get symbol 'customized-face)) |
25685 | 3621 (value (get symbol 'customized-value)) |
3622 (face-comment (get symbol 'customized-face-comment)) | |
3623 (variable-comment | |
3624 (get symbol 'customized-variable-comment))) | |
3625 (when face | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3626 (put symbol 'saved-face face) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3627 (put symbol 'customized-face nil)) |
25685 | 3628 (when value |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3629 (put symbol 'saved-value value) |
25685 | 3630 (put symbol 'customized-value nil)) |
3631 (when variable-comment | |
3632 (put symbol 'saved-variable-comment variable-comment) | |
3633 (put symbol 'customized-variable-comment nil)) | |
3634 (when face-comment | |
3635 (put symbol 'saved-face-comment face-comment) | |
3636 (put symbol 'customized-face-comment nil))))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3637 ;; We really should update all custom buffers here. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3638 (custom-save-all)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3639 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3640 ;;;###autoload |
17334 | 3641 (defun custom-save-all () |
3642 "Save all customizations in `custom-file'." | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3643 (let ((inhibit-read-only t)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3644 (custom-save-variables) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3645 (custom-save-faces) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3646 (save-excursion |
20398
47f326ffb7ba
(custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents:
20397
diff
changeset
|
3647 (let ((default-major-mode nil)) |
20974 | 3648 (set-buffer (find-file-noselect (custom-file)))) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3649 (save-buffer)))) |
17334 | 3650 |
3651 ;;; The Customize Menu. | |
3652 | |
17415 | 3653 ;;; Menu support |
3654 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3655 (defcustom custom-menu-nesting 2 |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3656 "Maximum nesting in custom menus." |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3657 :type 'integer |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3658 :group 'custom-menu) |
17334 | 3659 |
3660 (defun custom-face-menu-create (widget symbol) | |
3661 "Ignoring WIDGET, create a menu entry for customization face SYMBOL." | |
3662 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3663 `(customize-face ',symbol) |
17334 | 3664 t)) |
3665 | |
3666 (defun custom-variable-menu-create (widget symbol) | |
3667 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL." | |
3668 (let ((type (get symbol 'custom-type))) | |
3669 (unless (listp type) | |
3670 (setq type (list type))) | |
3671 (if (and type (widget-get type :custom-menu)) | |
3672 (widget-apply type :custom-menu symbol) | |
3673 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3674 `(customize-variable ',symbol) |
17334 | 3675 t)))) |
3676 | |
17415 | 3677 ;; Add checkboxes to boolean variable entries. |
17334 | 3678 (widget-put (get 'boolean 'widget-type) |
3679 :custom-menu (lambda (widget symbol) | |
3680 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3681 `(customize-variable ',symbol) |
17334 | 3682 ':style 'toggle |
3683 ':selected symbol))) | |
3684 | |
30184
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3685 (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
|
3686 "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
|
3687 `( ,(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
|
3688 :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
|
3689 (cdr (custom-menu-create ',symbol))))) |
17334 | 3690 |
17415 | 3691 ;;;###autoload |
3692 (defun custom-menu-create (symbol) | |
17334 | 3693 "Create menu for customization group SYMBOL. |
3694 The menu is in a format applicable to `easy-menu-define'." | |
17415 | 3695 (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
|
3696 `(customize-group ',symbol) |
17415 | 3697 t))) |
3698 (if (and (or (not (boundp 'custom-menu-nesting)) | |
3699 (>= custom-menu-nesting 0)) | |
17334 | 3700 (< (length (get symbol 'custom-group)) widget-menu-max-size)) |
3701 (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
|
3702 custom-prefix-list)) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3703 (members (custom-sort-items (get symbol 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3704 custom-menu-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3705 custom-menu-order-groups))) |
17334 | 3706 (custom-load-symbol symbol) |
3707 `(,(custom-unlispify-menu-entry symbol t) | |
3708 ,item | |
3709 "--" | |
3710 ,@(mapcar (lambda (entry) | |
3711 (widget-apply (if (listp (nth 1 entry)) | |
3712 (nth 1 entry) | |
3713 (list (nth 1 entry))) | |
3714 :custom-menu (nth 0 entry))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3715 members))) |
17334 | 3716 item))) |
3717 | |
3718 ;;;###autoload | |
17415 | 3719 (defun customize-menu-create (symbol &optional name) |
3720 "Return a customize menu for customization group SYMBOL. | |
25685 | 3721 If optional NAME is given, use that as the name of the menu. |
17415 | 3722 Otherwise the menu will be named `Customize'. |
3723 The format is suitable for use with `easy-menu-define'." | |
3724 (unless name | |
3725 (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
|
3726 `(,name |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3727 :filter (lambda (&rest junk) |
35265
71b043afa1da
(customize-menu-create): Fix the :filter.
Dave Love <fx@gnu.org>
parents:
34423
diff
changeset
|
3728 (custom-menu-create ',symbol)))) |
17334 | 3729 |
17415 | 3730 ;;; The Custom Mode. |
3731 | |
3732 (defvar custom-mode-map nil | |
3733 "Keymap for `custom-mode'.") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3734 |
17415 | 3735 (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
|
3736 ;; 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
|
3737 ;; "\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
|
3738 (setq custom-mode-map (make-sparse-keymap)) |
17415 | 3739 (set-keymap-parent custom-mode-map widget-keymap) |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
3740 (suppress-keymap custom-mode-map) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3741 (define-key custom-mode-map " " 'scroll-up) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3742 (define-key custom-mode-map "\177" 'scroll-down) |
25685 | 3743 (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
|
3744 (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
|
3745 (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
|
3746 (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
|
3747 (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
|
3748 |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3749 (defun Custom-move-and-invoke (event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3750 "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
|
3751 (interactive "e") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3752 (mouse-set-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3753 (if (widget-event-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3754 (let* ((pos (widget-event-point event)) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3755 (button (get-char-property pos 'button))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3756 (if button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3757 (widget-button-click event))))) |
17415 | 3758 |
25685 | 3759 (easy-menu-define Custom-mode-menu |
17415 | 3760 custom-mode-map |
3761 "Menu used in customization buffers." | |
3762 `("Custom" | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3763 ,(customize-menu-create 'customize) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3764 ["Set" Custom-set t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3765 ["Save" Custom-save t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3766 ["Reset to Current" Custom-reset-current t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3767 ["Reset to Saved" Custom-reset-saved t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3768 ["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
|
3769 ["Info" (Info-goto-node "(emacs)Easy Customization") t])) |
17415 | 3770 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3771 (defun Custom-goto-parent () |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3772 "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
|
3773 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
|
3774 (interactive) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3775 (save-excursion |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3776 (goto-char (point-min)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3777 (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
|
3778 (let* ((button (get-char-property (point) 'button)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3779 (parent (downcase (widget-get button :tag)))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3780 (customize-group parent))))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3781 |
17415 | 3782 (defcustom custom-mode-hook nil |
25685 | 3783 "Hook called when entering Custom mode." |
17415 | 3784 :type 'hook |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3785 :group 'custom-buffer ) |
17415 | 3786 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3787 (defun custom-state-buffer-message (widget) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3788 (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
|
3789 (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
|
3790 |
17415 | 3791 (defun custom-mode () |
3792 "Major mode for editing customization buffers. | |
3793 | |
3794 The following commands are available: | |
3795 | |
3796 Move to next button or editable field. \\[widget-forward] | |
3797 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
|
3798 \\<widget-field-keymap>\ |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3799 Complete content of editable text field. \\[widget-complete] |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3800 \\<custom-mode-map>\ |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
3801 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
|
3802 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
|
3803 Set all modifications. \\[Custom-set] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3804 Make all modifications default. \\[Custom-save] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3805 Reset all modified options. \\[Custom-reset-current] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3806 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
|
3807 Reset all options. \\[Custom-reset-standard] |
17415 | 3808 |
3809 Entry to this mode calls the value of `custom-mode-hook' | |
3810 if that value is non-nil." | |
3811 (kill-all-local-variables) | |
3812 (setq major-mode 'custom-mode | |
3813 mode-name "Custom") | |
3814 (use-local-map custom-mode-map) | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
3815 (easy-menu-add Custom-mode-menu) |
17415 | 3816 (make-local-variable 'custom-options) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3817 (make-local-variable 'widget-documentation-face) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3818 (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
|
3819 (make-local-variable 'widget-button-face) |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3820 (setq widget-button-face 'custom-button-face) |
25685 | 3821 (set (make-local-variable 'widget-button-pressed-face) |
3822 'custom-button-pressed-face) | |
3823 (set (make-local-variable 'widget-mouse-face) | |
3824 'custom-button-pressed-face) ; buttons `depress' when moused | |
3825 ;; When possible, use relief for buttons, not bracketing. This test | |
3826 ;; may not be optimal. | |
3827 (when custom-raised-buttons | |
3828 (set (make-local-variable 'widget-push-button-prefix) "") | |
3829 (set (make-local-variable 'widget-push-button-suffix) "") | |
3830 (set (make-local-variable 'widget-link-prefix) "") | |
3831 (set (make-local-variable 'widget-link-suffix) "")) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3832 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t) |
17415 | 3833 (run-hooks 'custom-mode-hook)) |
17334 | 3834 |
32904
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
3835 (put 'custom-mode 'mode-class 'special) |
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
3836 |
28130 | 3837 (add-to-list |
3838 'debug-ignored-errors | |
3839 "^No user options have changed defaults in recent Emacs versions$") | |
3840 | |
17334 | 3841 ;;; The End. |
3842 | |
3843 (provide 'cus-edit) | |
3844 | |
25685 | 3845 ;;; cus-edit.el ends here |