Mercurial > emacs
annotate lisp/cus-edit.el @ 52805:c0068a71bb2e
Split to make current ChangeLog smaller.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Tue, 07 Oct 2003 21:27:52 +0000 |
parents | 695cf19ef79e |
children | 1fa5a4fc03e5 375f2633d815 |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37911
diff
changeset
|
1 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages |
17334 | 2 ;; |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
3 ;; Copyright (C) 1996,97,1999,2000,01,02,2003 Free Software Foundation, Inc. |
17334 | 4 ;; |
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
6 ;; Maintainer: FSF |
17334 | 7 ;; Keywords: help, faces |
8 | |
17521
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
9 ;; 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
|
10 |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
11 ;; 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
|
12 ;; 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
|
13 ;; 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
|
14 ;; any later version. |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
15 |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
16 ;; 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
|
17 ;; 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
|
18 ;; 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
|
19 ;; 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
|
20 |
ddce9ecc6f6a
(custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents:
17415
diff
changeset
|
21 ;; 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
|
22 ;; 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
|
23 ;; 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
|
24 ;; 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
|
25 |
17334 | 26 ;;; Commentary: |
27 ;; | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
28 ;; This file implements the code to create and edit customize buffers. |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
29 ;; |
17334 | 30 ;; See `custom.el'. |
31 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
32 ;; 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
|
33 ;; 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
|
34 ;; 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
|
35 |
17334 | 36 ;;; Code: |
37 | |
38 (require 'cus-face) | |
39 (require 'wid-edit) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
40 (eval-when-compile |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
41 (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
|
42 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
43 (condition-case nil |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
44 (require 'cus-load) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
45 (error nil)) |
17334 | 46 |
18089 | 47 (condition-case nil |
48 (require 'cus-start) | |
49 (error nil)) | |
50 | |
17415 | 51 (put 'custom-define-hook 'custom-type 'hook) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
52 (put 'custom-define-hook 'standard-value '(nil)) |
17415 | 53 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable) |
54 | |
17334 | 55 ;;; Customization Groups. |
56 | |
57 (defgroup emacs nil | |
58 "Customization of the One True Editor." | |
59 :link '(custom-manual "(emacs)Top")) | |
60 | |
61 ;; Most of these groups are stolen from `finder.el', | |
62 (defgroup editing nil | |
63 "Basic text editing facilities." | |
64 :group 'emacs) | |
65 | |
66 (defgroup abbrev nil | |
67 "Abbreviation handling, typing shortcuts, macros." | |
68 :tag "Abbreviations" | |
69 :group 'editing) | |
70 | |
71 (defgroup matching nil | |
72 "Various sorts of searching and matching." | |
73 :group 'editing) | |
74 | |
75 (defgroup emulations nil | |
76 "Emulations of other editors." | |
52281 | 77 :link '(custom-manual "(emacs)Emulation") |
17334 | 78 :group 'editing) |
79 | |
80 (defgroup mouse nil | |
81 "Mouse support." | |
82 :group 'editing) | |
83 | |
84 (defgroup outlines nil | |
85 "Support for hierarchical outlining." | |
86 :group 'editing) | |
87 | |
88 (defgroup external nil | |
89 "Interfacing to external utilities." | |
90 :group 'emacs) | |
91 | |
92 (defgroup processes nil | |
93 "Process, subshell, compilation, and job control support." | |
94 :group 'external | |
95 :group 'development) | |
96 | |
22068
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
97 (defgroup convenience nil |
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
98 "Convenience features for faster editing." |
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
99 :group 'emacs) |
82db88d21acd
(convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents:
22001
diff
changeset
|
100 |
17334 | 101 (defgroup programming nil |
102 "Support for programming in other languages." | |
103 :group 'emacs) | |
104 | |
105 (defgroup languages nil | |
106 "Specialized modes for editing programming languages." | |
107 :group 'programming) | |
108 | |
109 (defgroup lisp nil | |
110 "Lisp support, including Emacs Lisp." | |
111 :group 'languages | |
112 :group 'development) | |
113 | |
114 (defgroup c nil | |
115 "Support for the C language and related languages." | |
52281 | 116 :link '(custom-manual "(ccmode)") |
17334 | 117 :group 'languages) |
118 | |
119 (defgroup tools nil | |
120 "Programming tools." | |
121 :group 'programming) | |
122 | |
123 (defgroup oop nil | |
124 "Support for object-oriented programming." | |
125 :group 'programming) | |
126 | |
127 (defgroup applications nil | |
128 "Applications written in Emacs." | |
129 :group 'emacs) | |
130 | |
131 (defgroup calendar nil | |
132 "Calendar and time management support." | |
133 :group 'applications) | |
134 | |
135 (defgroup mail nil | |
136 "Modes for electronic-mail handling." | |
137 :group 'applications) | |
138 | |
139 (defgroup news nil | |
140 "Support for netnews reading and posting." | |
52281 | 141 :link '(custom-manual "(gnus)") |
17334 | 142 :group 'applications) |
143 | |
144 (defgroup games nil | |
145 "Games, jokes and amusements." | |
146 :group 'applications) | |
147 | |
148 (defgroup development nil | |
149 "Support for further development of Emacs." | |
150 :group 'emacs) | |
151 | |
152 (defgroup docs nil | |
153 "Support for Emacs documentation." | |
154 :group 'development) | |
155 | |
156 (defgroup extensions nil | |
157 "Emacs Lisp language extensions." | |
158 :group 'development) | |
159 | |
160 (defgroup internal nil | |
161 "Code for Emacs internals, build process, defaults." | |
162 :group 'development) | |
163 | |
164 (defgroup maint nil | |
165 "Maintenance aids for the Emacs development group." | |
166 :tag "Maintenance" | |
167 :group 'development) | |
168 | |
169 (defgroup environment nil | |
170 "Fitting Emacs with its environment." | |
171 :group 'emacs) | |
172 | |
173 (defgroup comm nil | |
174 "Communications, networking, remote access to files." | |
175 :tag "Communication" | |
176 :group 'environment) | |
177 | |
178 (defgroup hardware nil | |
179 "Support for interfacing with exotic hardware." | |
180 :group 'environment) | |
181 | |
182 (defgroup terminals nil | |
183 "Support for terminal types." | |
184 :group 'environment) | |
185 | |
186 (defgroup unix nil | |
187 "Front-ends/assistants for, or emulators of, UNIX features." | |
188 :group 'environment) | |
189 | |
190 (defgroup vms nil | |
191 "Support code for vms." | |
192 :group 'environment) | |
193 | |
194 (defgroup i18n nil | |
195 "Internationalization and alternate character-set support." | |
52281 | 196 :link '(custom-manual "(emacs)International") |
17334 | 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") |
17334 | 247 :prefix "custom-" |
17415 | 248 :group 'help) |
249 | |
250 (defgroup custom-faces nil | |
251 "Faces used by customize." | |
252 :group 'customize | |
17334 | 253 :group 'faces) |
254 | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
255 (defgroup custom-browse nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
256 "Control customize browser." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
257 :prefix "custom-" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
258 :group 'customize) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
259 |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
260 (defgroup custom-buffer nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
261 "Control customize buffers." |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
262 :prefix "custom-" |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
263 :group 'customize) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
264 |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
265 (defgroup custom-menu nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
266 "Control customize menus." |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
267 :prefix "custom-" |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
268 :group 'customize) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
269 |
17415 | 270 (defgroup abbrev-mode nil |
271 "Word abbreviations mode." | |
52281 | 272 :link '(custom-manual "(emacs)Abbrevs") |
17415 | 273 :group 'abbrev) |
274 | |
275 (defgroup alloc nil | |
276 "Storage allocation and gc for GNU Emacs Lisp interpreter." | |
277 :tag "Storage Allocation" | |
278 :group 'internal) | |
279 | |
280 (defgroup undo nil | |
281 "Undoing changes in buffers." | |
52281 | 282 :link '(custom-manual "(emacs)Undo") |
17415 | 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." | |
52281 | 291 :link '(custom-manual "(emacs)Filling Text") |
17415 | 292 :group 'editing) |
293 | |
294 (defgroup editing-basics nil | |
295 "Most basic editing facilities." | |
296 :group 'editing) | |
297 | |
298 (defgroup display nil | |
299 "How characters are displayed in buffers." | |
300 :group 'environment) | |
301 | |
302 (defgroup execute nil | |
303 "Executing external commands." | |
304 :group 'processes) | |
305 | |
306 (defgroup installation nil | |
307 "The Emacs installation." | |
308 :group 'environment) | |
309 | |
310 (defgroup dired nil | |
311 "Directory editing." | |
312 :group 'environment) | |
313 | |
314 (defgroup limits nil | |
315 "Internal Emacs limits." | |
316 :group 'internal) | |
317 | |
318 (defgroup debug nil | |
319 "Debugging Emacs itself." | |
320 :group 'development) | |
321 | |
322 (defgroup minibuffer nil | |
323 "Controling the behaviour of the minibuffer." | |
52281 | 324 :link '(custom-manual "(emacs)Minibuffer") |
17415 | 325 :group 'environment) |
326 | |
327 (defgroup keyboard nil | |
328 "Input from the keyboard." | |
329 :group 'environment) | |
330 | |
331 (defgroup mouse nil | |
332 "Input from the mouse." | |
333 :group 'environment) | |
334 | |
335 (defgroup menu nil | |
336 "Input from the menus." | |
337 :group 'environment) | |
338 | |
339 (defgroup auto-save nil | |
340 "Preventing accidential loss of data." | |
18320
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
341 :group 'files) |
17415 | 342 |
343 (defgroup processes-basics nil | |
344 "Basic stuff dealing with processes." | |
345 :group 'processes) | |
346 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
347 (defgroup mule nil |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
348 "MULE Emacs internationalization." |
18053
941f5d1a241e
(cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
349 :group 'i18n) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
350 |
17415 | 351 (defgroup windows nil |
352 "Windows within a frame." | |
52281 | 353 :link '(custom-manual "(emacs)Windows") |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
354 :group 'environment) |
17415 | 355 |
17334 | 356 ;;; Utilities. |
357 | |
358 (defun custom-quote (sexp) | |
359 "Quote SEXP iff it is not self quoting." | |
360 (if (or (memq sexp '(t nil)) | |
28130 | 361 (keywordp sexp) |
17334 | 362 (and (listp sexp) |
363 (memq (car sexp) '(lambda))) | |
364 (stringp sexp) | |
365 (numberp sexp) | |
25685 | 366 (vectorp sexp) |
367 ;;; (and (fboundp 'characterp) | |
368 ;;; (characterp sexp)) | |
369 ) | |
17334 | 370 sexp |
371 (list 'quote sexp))) | |
372 | |
373 (defun custom-split-regexp-maybe (regexp) | |
374 "If REGEXP is a string, split it to a list at `\\|'. | |
25685 | 375 You can get the original back with from the result with: |
17334 | 376 (mapconcat 'identity result \"\\|\") |
377 | |
378 IF REGEXP is not a string, return it unchanged." | |
379 (if (stringp regexp) | |
380 (let ((start 0) | |
381 all) | |
382 (while (string-match "\\\\|" regexp start) | |
383 (setq all (cons (substring regexp start (match-beginning 0)) all) | |
384 start (match-end 0))) | |
385 (nreverse (cons (substring regexp start) all))) | |
386 regexp)) | |
387 | |
17415 | 388 (defun custom-variable-prompt () |
49104
b74a6560ecbb
(custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49013
diff
changeset
|
389 "Prompt for a custom variable, defaulting to the variable at point. |
17415 | 390 Return a list suitable for use in `interactive'." |
391 (let ((v (variable-at-point)) | |
392 (enable-recursive-minibuffers t) | |
393 val) | |
25685 | 394 (setq val (completing-read |
49104
b74a6560ecbb
(custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49013
diff
changeset
|
395 (if (and (symbolp v) (custom-variable-p v)) |
18131
5711f2e5a643
(custom-variable-prompt): Change prompt.
Richard M. Stallman <rms@gnu.org>
parents:
18090
diff
changeset
|
396 (format "Customize option: (default %s) " v) |
49104
b74a6560ecbb
(custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49013
diff
changeset
|
397 "Customize option: ") |
b74a6560ecbb
(custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49013
diff
changeset
|
398 obarray 'custom-variable-p t)) |
17415 | 399 (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
|
400 (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
|
401 (intern val))))) |
17415 | 402 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
403 (defun custom-menu-filter (menu widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
404 "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
|
405 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
|
406 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
|
407 (let ((result nil) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
408 current name action filter) |
25685 | 409 (while menu |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
410 (setq current (car menu) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
411 name (nth 0 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
412 action (nth 1 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
413 filter (nth 2 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
414 menu (cdr menu)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
415 (if (or (null filter) (funcall filter widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
416 (push (cons name action) result) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
417 (push name result))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
418 (nreverse result))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
419 |
17415 | 420 ;;; Unlispify. |
421 | |
17334 | 422 (defvar custom-prefix-list nil |
28130 | 423 "List of prefixes that should be ignored by `custom-unlispify'.") |
17334 | 424 |
425 (defcustom custom-unlispify-menu-entries t | |
426 "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
|
427 :group 'custom-menu |
17334 | 428 :type 'boolean) |
429 | |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
430 (defcustom custom-unlispify-remove-prefixes nil |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
431 "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
|
432 :group 'custom-menu |
43508
c092c3c65251
2002-02-24 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43246
diff
changeset
|
433 :group 'custom-buffer |
18812
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 | |
49556
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
445 (with-current-buffer (get-buffer-create " *Custom-Work*") |
17334 | 446 (erase-buffer) |
447 (princ symbol (current-buffer)) | |
448 (goto-char (point-min)) | |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
449 ;; FIXME: Boolean variables are not predicates, so they shouldn't |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
450 ;; end with `-p'. -stef |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
451 ;; (when (and (eq (get symbol 'custom-type) 'boolean) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
452 ;; (re-search-forward "-p\\'" nil t)) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
453 ;; (replace-match "" t t) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
454 ;; (goto-char (point-min))) |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
455 (if custom-unlispify-remove-prefixes |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
456 (let ((prefixes custom-prefix-list) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
457 prefix) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
458 (while prefixes |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
459 (setq prefix (car prefixes)) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
460 (if (search-forward prefix (+ (point) (length prefix)) t) |
25685 | 461 (progn |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
462 (setq prefixes nil) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
463 (delete-region (point-min) (point))) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
464 (setq prefixes (cdr prefixes)))))) |
17334 | 465 (subst-char-in-region (point-min) (point-max) ?- ?\ t) |
466 (capitalize-region (point-min) (point-max)) | |
25685 | 467 (unless no-suffix |
17334 | 468 (goto-char (point-max)) |
469 (insert "...")) | |
470 (buffer-string))))) | |
471 | |
472 (defcustom custom-unlispify-tag-names t | |
473 "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
|
474 :group 'custom-buffer |
17334 | 475 :type 'boolean) |
476 | |
477 (defun custom-unlispify-tag-name (symbol) | |
28130 | 478 "Convert SYMBOL into a menu entry." |
17334 | 479 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names)) |
480 (custom-unlispify-menu-entry symbol t))) | |
481 | |
482 (defun custom-prefix-add (symbol prefixes) | |
28130 | 483 "Add SYMBOL to list of ignored PREFIXES." |
17334 | 484 (cons (or (get symbol 'custom-prefix) |
485 (concat (symbol-name symbol) "-")) | |
486 prefixes)) | |
487 | |
17415 | 488 ;;; Guess. |
489 | |
490 (defcustom custom-guess-name-alist | |
491 '(("-p\\'" boolean) | |
492 ("-hook\\'" hook) | |
493 ("-face\\'" face) | |
494 ("-file\\'" file) | |
495 ("-function\\'" function) | |
496 ("-functions\\'" (repeat function)) | |
497 ("-list\\'" (repeat sexp)) | |
498 ("-alist\\'" (repeat (cons sexp sexp)))) | |
499 "Alist of (MATCH TYPE). | |
500 | |
25685 | 501 MATCH should be a regexp matching the name of a symbol, and TYPE should |
17415 | 502 be a widget suitable for editing the value of that symbol. The TYPE |
503 of the first entry where MATCH matches the name of the symbol will be | |
25685 | 504 used. |
17415 | 505 |
506 This is used for guessing the type of variables not declared with | |
507 customize." | |
508 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) | |
509 :group 'customize) | |
510 | |
511 (defcustom custom-guess-doc-alist | |
512 '(("\\`\\*?Non-nil " boolean)) | |
513 "Alist of (MATCH TYPE). | |
514 | |
515 MATCH should be a regexp matching a documentation string, and TYPE | |
516 should be a widget suitable for editing the value of a variable with | |
517 that documentation string. The TYPE of the first entry where MATCH | |
518 matches the name of the symbol will be used. | |
519 | |
520 This is used for guessing the type of variables not declared with | |
521 customize." | |
522 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) | |
523 :group 'customize) | |
524 | |
525 (defun custom-guess-type (symbol) | |
526 "Guess a widget suitable for editing the value of SYMBOL. | |
25685 | 527 This is done by matching SYMBOL with `custom-guess-name-alist' and |
17415 | 528 if that fails, the doc string with `custom-guess-doc-alist'." |
529 (let ((name (symbol-name symbol)) | |
530 (names custom-guess-name-alist) | |
531 current found) | |
532 (while names | |
533 (setq current (car names) | |
534 names (cdr names)) | |
535 (when (string-match (nth 0 current) name) | |
536 (setq found (nth 1 current) | |
537 names nil))) | |
538 (unless found | |
539 (let ((doc (documentation-property symbol 'variable-documentation)) | |
540 (docs custom-guess-doc-alist)) | |
25685 | 541 (when doc |
17415 | 542 (while docs |
543 (setq current (car docs) | |
544 docs (cdr docs)) | |
545 (when (string-match (nth 0 current) doc) | |
546 (setq found (nth 1 current) | |
547 docs nil)))))) | |
548 found)) | |
549 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
550 ;;; Sorting. |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
551 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
552 (defcustom custom-browse-sort-alphabetically nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
553 "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
|
554 :type 'boolean |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
555 :group 'custom-browse) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
556 |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
557 (defcustom custom-browse-order-groups nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
558 "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
|
559 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
560 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
561 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
562 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
563 (const :tag "none" nil)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
564 :group 'custom-browse) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
565 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
566 (defcustom custom-browse-only-groups nil |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
567 "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
|
568 :type 'boolean |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
569 :group 'custom-browse) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
570 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
571 (defcustom custom-buffer-sort-alphabetically nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
572 "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
|
573 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
574 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
575 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
576 (defcustom custom-buffer-order-groups 'last |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
577 "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
|
578 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
579 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
580 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
581 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
582 (const :tag "none" nil)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
583 :group 'custom-buffer) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
584 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
585 (defcustom custom-menu-sort-alphabetically nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
586 "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
|
587 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
588 :group 'custom-menu) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
589 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
590 (defcustom custom-menu-order-groups 'first |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
591 "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
|
592 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
593 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
594 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
595 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
596 (const :tag "none" nil)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
597 :group 'custom-menu) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
598 |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
599 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'") |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
600 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
601 (defun custom-sort-items (items sort-alphabetically order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
602 "Return a sorted copy of ITEMS. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
603 ITEMS should be a `custom-group' property. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
604 If SORT-ALPHABETICALLY non-nil, sort alphabetically. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
605 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
|
606 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
|
607 (sort (copy-sequence items) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
608 (lambda (a b) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
609 (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
|
610 (namea (nth 0 a)) (nameb (nth 0 b))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
611 (cond ((not order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
612 ;; 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
|
613 (when sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
614 (string-lessp namea nameb))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
615 ((eq typea 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
616 ;; 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
|
617 (if (eq typeb 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
618 (when sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
619 (string-lessp namea nameb)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
620 (eq order-groups 'first))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
621 ((eq typeb 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
622 ;; 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
|
623 (eq order-groups 'last)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
624 (sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
625 ;; Since A and B cannot be groups, sort. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
626 (string-lessp namea nameb))))))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
627 |
17415 | 628 ;;; Custom Mode Commands. |
17334 | 629 |
630 (defvar custom-options nil | |
631 "Customization widgets in the current buffer.") | |
632 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
633 (defun Custom-set () |
17334 | 634 "Set changes in all modified options." |
635 (interactive) | |
636 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
637 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
638 (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
|
639 (widget-apply child :custom-set))) |
17334 | 640 children))) |
641 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
642 (defun Custom-save () |
17334 | 643 "Set all modified group members and save them." |
644 (interactive) | |
645 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
646 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
647 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
648 '(modified set changed rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
649 (widget-apply child :custom-save))) |
17334 | 650 children)) |
651 (custom-save-all)) | |
652 | |
25685 | 653 (defvar custom-reset-menu |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
654 '(("Current" . Custom-reset-current) |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
655 ("Saved" . Custom-reset-saved) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
656 ("Erase Customization (use standard settings)" . Custom-reset-standard)) |
17334 | 657 "Alist of actions for the `Reset' button. |
658 The key is a string containing the name of the action, the value is a | |
28130 | 659 Lisp function taking the widget as an element which will be called |
17334 | 660 when the action is chosen.") |
661 | |
662 (defun custom-reset (event) | |
663 "Select item from reset menu." | |
664 (let* ((completion-ignore-case t) | |
665 (answer (widget-choose "Reset to" | |
666 custom-reset-menu | |
667 event))) | |
668 (if answer | |
669 (funcall answer)))) | |
670 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
671 (defun Custom-reset-current (&rest ignore) |
17334 | 672 "Reset all modified group members to their current value." |
673 (interactive) | |
674 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
675 (mapc (lambda (widget) |
47809
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
676 (if (memq (widget-get widget :custom-state) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
677 '(modified changed)) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
678 (widget-apply widget :custom-reset-current))) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
679 children))) |
17334 | 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) |
47809
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
686 (if (memq (widget-get widget :custom-state) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
687 '(modified set changed rogue)) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
688 (widget-apply widget :custom-reset-saved))) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
689 children))) |
17334 | 690 |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
691 (defun Custom-reset-standard (&rest ignore) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
692 "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
|
693 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
|
694 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
|
695 making them as if they had never been customized at all." |
17334 | 696 (interactive) |
697 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
698 (mapc (lambda (widget) |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
699 (and (widget-apply widget :custom-standard-value) |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
700 (if (memq (widget-get widget :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
701 '(modified set changed saved rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
702 (widget-apply widget :custom-reset-standard)))) |
17334 | 703 children))) |
704 | |
705 ;;; The Customize Commands | |
706 | |
25685 | 707 (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
|
708 "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
|
709 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
|
710 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
|
711 the name of the variable. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
712 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
713 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
|
714 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
|
715 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
716 If the variable has a `custom-type' property, it must be a widget and the |
25685 | 717 `:prompt-value' property of that widget will be used for reading the value. |
718 | |
719 If optional COMMENT argument is non nil, also prompt for a comment and return | |
720 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
|
721 (let* ((var (read-variable prompt-var)) |
25685 | 722 (minibuffer-help-form '(describe-variable var)) |
723 (val | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
724 (let ((prop (get var 'variable-interactive)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
725 (type (get var 'custom-type)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
726 (prompt (format prompt-val var))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
727 (unless (listp type) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
728 (setq type (list type))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
729 (cond (prop |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
730 ;; Use VAR's `variable-interactive' property |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
731 ;; as an interactive spec for prompting. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
732 (call-interactively (list 'lambda '(arg) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
733 (list 'interactive prop) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
734 'arg))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
735 (type |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
736 (widget-prompt-value type |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
737 prompt |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
738 (if (boundp var) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
739 (symbol-value var)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
740 (not (boundp var)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
741 (t |
25685 | 742 (eval-minibuffer prompt)))))) |
743 (if comment | |
744 (list var val | |
745 (read-string "Comment: " (get var 'variable-comment))) | |
746 (list var val)))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
747 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
748 ;;;###autoload |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
749 (defun customize-set-value (variable value &optional comment) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
750 "Set VARIABLE to VALUE, and return VALUE. VALUE is a Lisp object. |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
751 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
752 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
|
753 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
|
754 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
755 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 756 `:prompt-value' property of that widget will be used for reading the value. |
757 | |
758 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
|
759 (interactive (custom-prompt-variable "Set variable: " |
25685 | 760 "Set %s to value: " |
761 current-prefix-arg)) | |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
762 |
25685 | 763 (cond ((string= comment "") |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
764 (put variable 'variable-comment nil)) |
25685 | 765 (comment |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
766 (put variable 'variable-comment comment))) |
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
767 (set variable value)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
768 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
769 ;;;###autoload |
28130 | 770 (defun customize-set-variable (variable value &optional comment) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
771 "Set the default for VARIABLE to VALUE, and return VALUE. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
772 VALUE is a Lisp object. |
17550
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)) | |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
790 (custom-load-symbol variable) |
28130 | 791 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
792 (put variable 'customized-value (list (custom-quote value))) | |
25685 | 793 (cond ((string= comment "") |
28130 | 794 (put variable 'variable-comment nil) |
795 (put variable 'customized-variable-comment nil)) | |
25685 | 796 (comment |
28130 | 797 (put variable 'variable-comment comment) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
798 (put variable 'customized-variable-comment comment))) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
799 value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
800 |
17334 | 801 ;;;###autoload |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
802 (defun customize-save-variable (variable value &optional comment) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
803 "Set the default for VARIABLE to VALUE, and save it for future sessions. |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
804 Return VALUE. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
805 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
806 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
|
807 VARIABLE, otherwise `set-default' is used. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
808 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
809 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
|
810 with a quoted VALUE as its sole list member. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
811 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
812 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
|
813 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
|
814 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
815 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 816 `:prompt-value' property of that widget will be used for reading the value. |
817 | |
818 If given a prefix (or a COMMENT argument), also prompt for a comment." | |
43063 | 819 (interactive (custom-prompt-variable "Set and save variable: " |
25685 | 820 "Set and save value for %s as: " |
821 current-prefix-arg)) | |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
822 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
823 (put variable 'saved-value (list (custom-quote value))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
824 (custom-push-theme 'theme-value variable 'user 'set (list (custom-quote value))) |
25685 | 825 (cond ((string= comment "") |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
826 (put variable 'variable-comment nil) |
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
827 (put variable 'saved-variable-comment nil)) |
25685 | 828 (comment |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
829 (put variable 'variable-comment comment) |
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
830 (put variable 'saved-variable-comment comment))) |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
831 (custom-save-all) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
832 value) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
833 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
834 ;;;###autoload |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
835 (defun customize () |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
836 "Select a customization buffer which you can use to set user options. |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
837 User options are structured into \"groups\". |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
838 Initially the top-level group `Emacs' and its immediate subgroups |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
839 are shown; the contents of those subgroups are initially hidden." |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
840 (interactive) |
17703 | 841 (customize-group 'emacs)) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
842 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
843 ;;;###autoload |
47823
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
844 (defun customize-mode (mode) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
845 "Customize options related to the current major mode. |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
846 If a prefix \\[universal-argument] was given (or if the current major mode has no known group), |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
847 then prompt for the MODE to customize." |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
848 (interactive |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
849 (list |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
850 (let ((completion-regexp-list '("-mode\\'")) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
851 (group (custom-group-of-mode major-mode))) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
852 (if (and group (not current-prefix-arg)) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
853 major-mode |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
854 (intern |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
855 (completing-read (if group |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
856 (format "Major mode (default %s): " major-mode) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
857 "Major mode: ") |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
858 obarray |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
859 'custom-group-of-mode |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
860 t nil nil (if group (symbol-name major-mode)))))))) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
861 (customize-group (custom-group-of-mode mode))) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
862 |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
863 |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
864 ;;;###autoload |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
865 (defun customize-group (group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
866 "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
|
867 (interactive (list (let ((completion-ignore-case t)) |
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
868 (completing-read "Customize group: (default emacs) " |
25685 | 869 obarray |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
870 (lambda (symbol) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
871 (or (get symbol 'custom-loads) |
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
872 (get symbol 'custom-group))) |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
873 t)))) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
874 (when (stringp group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
875 (if (string-equal "" group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
876 (setq group 'emacs) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
877 (setq group (intern group)))) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
878 (let ((name (format "*Customize Group: %s*" |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
879 (custom-unlispify-tag-name group)))) |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
880 (if (get-buffer name) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
881 (pop-to-buffer name) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
882 (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
|
883 name |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
884 (concat " for group " |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
885 (custom-unlispify-tag-name group)))))) |
17334 | 886 |
887 ;;;###autoload | |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
888 (defun customize-group-other-window (group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
889 "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
|
890 (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
|
891 (completing-read "Customize group: (default emacs) " |
25685 | 892 obarray |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
893 (lambda (symbol) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
894 (or (get symbol 'custom-loads) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
895 (get symbol 'custom-group))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
896 t)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
897 (when (stringp group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
898 (if (string-equal "" group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
899 (setq group 'emacs) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
900 (setq group (intern group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
901 (let ((name (format "*Customize Group: %s*" |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
902 (custom-unlispify-tag-name group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
903 (if (get-buffer name) |
48975
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
904 (let ((window (selected-window)) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
905 ;; Copied from `custom-buffer-create-other-window'. |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
906 (pop-up-windows t) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
907 (special-display-buffer-names nil) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
908 (special-display-regexps nil) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
909 (same-window-buffer-names nil) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
910 (same-window-regexps nil)) |
22348
86cb09249796
(customize-group-other-window): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents:
22332
diff
changeset
|
911 (pop-to-buffer name) |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
912 (select-window window)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
913 (custom-buffer-create-other-window |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
914 (list (list group 'custom-group)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
915 name |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
916 (concat " for group " |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
917 (custom-unlispify-tag-name group)))))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
918 |
18089 | 919 ;;;###autoload |
920 (defalias 'customize-variable 'customize-option) | |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
921 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
922 ;;;###autoload |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
923 (defun customize-option (symbol) |
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
924 "Customize SYMBOL, which must be a user option variable." |
17415 | 925 (interactive (custom-variable-prompt)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
926 (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
|
927 (format "*Customize Option: %s*" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
928 (custom-unlispify-tag-name symbol)))) |
17334 | 929 |
48975
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
930 ;;;###autoload |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
931 (defalias 'customize-variable-other-window 'customize-option-other-window) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
932 |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
933 ;;;###autoload |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
934 (defun customize-option-other-window (symbol) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
935 "Customize SYMBOL, which must be a user option variable. |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
936 Show the buffer in another window, but don't select it." |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
937 (interactive (custom-variable-prompt)) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
938 (custom-buffer-create-other-window |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
939 (list (list symbol 'custom-variable)) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
940 (format "*Customize Option: %s*" (custom-unlispify-tag-name symbol)))) |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
941 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
942 (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
|
943 "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
|
944 |
17334 | 945 ;;;###autoload |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
946 (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
|
947 "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
|
948 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
|
949 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
|
950 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
|
951 |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
952 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
|
953 variables that were added (or their meanings were changed) since that |
49300
b99be2b86231
(customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49218
diff
changeset
|
954 version." |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
955 |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
956 (interactive "sCustomize options changed, since version (default all versions): ") |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
957 (if (equal since-version "") |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
958 (setq since-version nil) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
959 (unless (condition-case nil |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
960 (numberp (read since-version)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
961 (error nil)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
962 (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
|
963 (unless since-version |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
964 (setq since-version customize-changed-options-previous-release)) |
49218
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
965 |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
966 ;; Load the information for versions since since-version. We use |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
967 ;; custom-load-symbol for this. |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
968 (put 'custom-versions-load-alist 'custom-loads nil) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
969 (dolist (elt custom-versions-load-alist) |
49300
b99be2b86231
(customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49218
diff
changeset
|
970 (if (customize-version-lessp since-version (car elt)) |
b99be2b86231
(customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49218
diff
changeset
|
971 (dolist (load (cdr elt)) |
b99be2b86231
(customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49218
diff
changeset
|
972 (custom-add-load 'custom-versions-load-alist load)))) |
49218
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
973 (custom-load-symbol 'custom-versions-load-alist) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
974 (put 'custom-versions-load-alist 'custom-loads nil) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
975 |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
976 (let (found) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
977 (mapatoms |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
978 (lambda (symbol) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
979 (let ((version (get symbol 'custom-version))) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
980 (if version |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
981 (when (customize-version-lessp since-version version) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
982 (if (or (get symbol 'custom-group) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
983 (get symbol 'group-documentation)) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
984 (push (list symbol 'custom-group) found)) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
985 (if (custom-variable-p symbol) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
986 (push (list symbol 'custom-variable) found)) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
987 (if (custom-facep symbol) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
988 (push (list symbol 'custom-face) found))))))) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
989 (if found |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
990 (custom-buffer-create (custom-sort-items found t 'first) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
991 "*Customize Changed Options*") |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
992 (error "No user option defaults have been changed since Emacs %s" |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
993 since-version)))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
994 |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
995 (defun customize-version-lessp (version1 version2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
996 ;; 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
|
997 ;; 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
|
998 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
999 ;; 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
|
1000 ;; in the :version value. |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1001 (if (numberp version2) |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
1002 (setq version2 (prin1-to-string version2))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1003 (let (major1 major2 minor1 minor2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1004 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1005 (setq major1 (read (or (match-string 1 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 (setq minor1 (read (or (match-string 3 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1008 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1009 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1010 (setq major2 (read (or (match-string 1 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1011 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1012 (setq minor2 (read (or (match-string 3 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1013 "0"))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1014 (or (< major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1015 (and (= major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1016 (< minor1 minor2))))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
1017 |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1018 ;;;###autoload |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1019 (defun customize-face (&optional face) |
17334 | 1020 "Customize SYMBOL, which should be a face name or nil. |
44841
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1021 If SYMBOL is nil, customize all faces. |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1022 |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1023 Interactively, when point is on text which has a face specified, |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1024 suggest to customized that face, if it's customizable." |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1025 (interactive |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1026 (list (read-face-name "Customize face" "all faces" t))) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1027 (if (member face '(nil "")) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1028 (setq face (face-list))) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1029 (if (and (listp face) (null (cdr face))) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1030 (setq face (car face))) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1031 (if (listp face) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1032 (custom-buffer-create (custom-sort-items |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1033 (mapcar (lambda (s) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1034 (list s 'custom-face)) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1035 face) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1036 t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1037 "*Customize Faces*") |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1038 (unless (facep face) |
49013
4a3d5b9c79b9
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48997
diff
changeset
|
1039 (error "Invalid face %S" face)) |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1040 (custom-buffer-create (list (list face 'custom-face)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1041 (format "*Customize Face: %s*" |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1042 (custom-unlispify-tag-name face))))) |
17334 | 1043 |
1044 ;;;###autoload | |
44891 | 1045 (defun customize-face-other-window (&optional face) |
44841
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1046 "Show customization buffer for face SYMBOL in other window. |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1047 |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1048 Interactively, when point is on text which has a face specified, |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1049 suggest to customized that face, if it's customizable." |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1050 (interactive |
44888
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1051 (list (read-face-name "Customize face" "all faces" t))) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1052 (if (member face '(nil "")) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1053 (setq face (face-list))) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1054 (if (and (listp face) (null (cdr face))) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1055 (setq face (car face))) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1056 (if (listp face) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1057 (custom-buffer-create-other-window |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1058 (custom-sort-items |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1059 (mapcar (lambda (s) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1060 (list s 'custom-face)) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1061 face) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1062 t nil) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1063 "*Customize Faces*") |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1064 (unless (facep face) |
49013
4a3d5b9c79b9
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48997
diff
changeset
|
1065 (error "Invalid face %S" face)) |
25685 | 1066 (custom-buffer-create-other-window |
44888
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1067 (list (list face 'custom-face)) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1068 (format "*Customize Face: %s*" |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1069 (custom-unlispify-tag-name face))))) |
17415 | 1070 |
1071 ;;;###autoload | |
17334 | 1072 (defun customize-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1073 "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
|
1074 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1075 (let ((found nil)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1076 (mapatoms (lambda (symbol) |
25685 | 1077 (and (or (get symbol 'customized-face) |
1078 (get symbol 'customized-face-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1079 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1080 (push (list symbol 'custom-face) found)) |
25685 | 1081 (and (or (get symbol 'customized-value) |
1082 (get symbol 'customized-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1083 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1084 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1085 (if (not found) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1086 (error "No customized user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1087 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1088 "*Customize Customized*")))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1089 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1090 ;;;###autoload |
50077
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1091 (defun customize-rogue () |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1092 "Customize all user variable modified outside customize." |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1093 (interactive) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1094 (let ((found nil)) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1095 (mapatoms (lambda (symbol) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1096 (let ((cval (or (get symbol 'customized-value) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1097 (get symbol 'saved-value) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1098 (get symbol 'standard-value)))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1099 (when (and cval ;Declared with defcustom. |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1100 (default-boundp symbol) ;Has a value. |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1101 (not (equal (eval (car cval)) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1102 ;; Which does not match customize. |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1103 (default-value symbol)))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1104 (push (list symbol 'custom-variable) found))))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1105 (if (not found) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1106 (error "No rogue user options") |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1107 (custom-buffer-create (custom-sort-items found t nil) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1108 "*Customize Rogue*")))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1109 ;;;###autoload |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1110 (defun customize-saved () |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1111 "Customize all already saved user options." |
17334 | 1112 (interactive) |
1113 (let ((found nil)) | |
1114 (mapatoms (lambda (symbol) | |
25685 | 1115 (and (or (get symbol 'saved-face) |
1116 (get symbol 'saved-face-comment)) | |
17334 | 1117 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1118 (push (list symbol 'custom-face) found)) |
25685 | 1119 (and (or (get symbol 'saved-value) |
1120 (get symbol 'saved-variable-comment)) | |
17334 | 1121 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1122 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1123 (if (not found ) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1124 (error "No saved user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1125 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1126 "*Customize Saved*")))) |
17334 | 1127 |
1128 ;;;###autoload | |
1129 (defun customize-apropos (regexp &optional all) | |
1130 "Customize all user options matching REGEXP. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1131 If ALL is `options', include only options. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1132 If ALL is `faces', include only faces. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1133 If ALL is `groups', include only groups. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1134 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
|
1135 user-settable, as well as faces and groups." |
17334 | 1136 (interactive "sCustomize regexp: \nP") |
1137 (let ((found nil)) | |
1138 (mapatoms (lambda (symbol) | |
1139 (when (string-match regexp (symbol-name symbol)) | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1140 (when (and (not (memq all '(faces options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1141 (get symbol 'custom-group)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1142 (push (list symbol 'custom-group) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1143 (when (and (not (memq all '(options groups))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1144 (custom-facep symbol)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1145 (push (list symbol 'custom-face) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1146 (when (and (not (memq all '(groups faces))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1147 (boundp symbol) |
17334 | 1148 (or (get symbol 'saved-value) |
49104
b74a6560ecbb
(custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49013
diff
changeset
|
1149 (custom-variable-p symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1150 (if (memq all '(nil options)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1151 (user-variable-p symbol) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1152 (get symbol 'variable-documentation)))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1153 (push (list symbol 'custom-variable) found))))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1154 (if (not found) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1155 (error "No matches") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1156 (custom-buffer-create (custom-sort-items found t |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1157 custom-buffer-order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1158 "*Customize Apropos*")))) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1159 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1160 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1161 (defun customize-apropos-options (regexp &optional arg) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1162 "Customize all user options matching REGEXP. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1163 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
|
1164 (interactive "sCustomize regexp: \nP") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1165 (customize-apropos regexp (or arg 'options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1166 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1167 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1168 (defun customize-apropos-faces (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1169 "Customize all user faces matching REGEXP." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1170 (interactive "sCustomize regexp: \n") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1171 (customize-apropos regexp 'faces)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1172 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1173 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1174 (defun customize-apropos-groups (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1175 "Customize all user groups matching REGEXP." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1176 (interactive "sCustomize regexp: \n") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1177 (customize-apropos regexp 'groups)) |
17334 | 1178 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1179 ;;; Buffer. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1180 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1181 (defcustom custom-buffer-style 'links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1182 "Control the presentation style for customization buffers. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1183 The value should be a symbol, one of: |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1184 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1185 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
|
1186 links: groups have links to subgroups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1187 :type '(radio (const brackets) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1188 (const links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1189 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1190 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1191 ;; 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
|
1192 ;; the window. |
25840
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1193 (defun custom-bury-buffer (buffer) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1194 (with-current-buffer buffer |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1195 (bury-buffer))) |
25840
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1196 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1197 (defcustom custom-buffer-done-function 'custom-bury-buffer |
25685 | 1198 "*Function called to remove a Custom buffer when the user is done with it. |
1199 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
|
1200 :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
|
1201 (function-item :tag "Kill buffer" kill-buffer) |
25685 | 1202 (function :tag "Other")) |
1203 :version "21.1" | |
1204 :group 'custom-buffer) | |
1205 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1206 (defcustom custom-buffer-indent 3 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1207 "Number of spaces to indent nested groups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1208 :type 'integer |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1209 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1210 |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1211 (defun custom-get-fresh-buffer (name) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1212 "Get a fresh new buffer with name NAME. |
51381
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1213 If the buffer already exist, clean it up to be like new. |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1214 Beware: it's not quite like new. Good enough for custom, but maybe |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1215 not for everybody." |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1216 ;; To be more complete, we should also kill all permanent-local variables, |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1217 ;; but it's not needed for custom. |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1218 (let ((buf (get-buffer name))) |
51429
b107764e9a67
(custom-get-fresh-buffer): Test for nonexistence buffer.
Lute Kamstra <lute@gnu.org>
parents:
51381
diff
changeset
|
1219 (when (and buf (buffer-local-value 'buffer-file-name buf)) |
51381
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1220 ;; This will check if the file is not saved. |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1221 (kill-buffer buf) |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1222 (setq buf nil)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1223 (if (null buf) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1224 (get-buffer-create name) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1225 (with-current-buffer buf |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1226 (kill-all-local-variables) |
51381
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1227 (run-hooks 'kill-buffer-hook) |
51561
bed114065e35
(custom-get-fresh-buffer): Kill overlays before erasing the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51429
diff
changeset
|
1228 ;; Delete overlays before erasing the buffer so the overlay hooks |
bed114065e35
(custom-get-fresh-buffer): Kill overlays before erasing the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51429
diff
changeset
|
1229 ;; don't get run spuriously when we erase the buffer. |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1230 (let ((ols (overlay-lists))) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1231 (dolist (ol (nconc (car ols) (cdr ols))) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1232 (delete-overlay ol))) |
51561
bed114065e35
(custom-get-fresh-buffer): Kill overlays before erasing the buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51429
diff
changeset
|
1233 (erase-buffer) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1234 buf)))) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1235 |
17334 | 1236 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1237 (defun custom-buffer-create (options &optional name description) |
17334 | 1238 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1239 Optional NAME is the name of the buffer. |
17334 | 1240 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1241 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1242 that option." | |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1243 (pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*"))) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1244 (custom-buffer-create-internal options description)) |
17415 | 1245 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1246 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1247 (defun custom-buffer-create-other-window (options &optional name description) |
17415 | 1248 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1249 Optional NAME is the name of the buffer. |
17415 | 1250 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1251 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1252 that option." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1253 (unless name (setq name "*Customization*")) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1254 (let ((window (selected-window)) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1255 (pop-up-windows t) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1256 (special-display-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1257 (special-display-regexps nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1258 (same-window-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1259 (same-window-regexps nil)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1260 (pop-to-buffer (custom-get-fresh-buffer name)) |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1261 (custom-buffer-create-internal options description) |
17415 | 1262 (select-window window))) |
18089 | 1263 |
1264 (defcustom custom-reset-button-menu nil | |
1265 "If non-nil, only show a single reset button in customize buffers. | |
1266 This button will have a menu with all three reset operations." | |
1267 :type 'boolean | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1268 :group 'custom-buffer) |
17415 | 1269 |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1270 (defcustom custom-buffer-verbose-help t |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1271 "If non-nil, include explanatory text in the customization buffer." |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1272 :type 'boolean |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1273 :group 'custom-buffer) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1274 |
25685 | 1275 (defun Custom-buffer-done (&rest ignore) |
1276 "Remove current buffer by calling `custom-buffer-done-function'." | |
1277 (interactive) | |
1278 (funcall custom-buffer-done-function (current-buffer))) | |
1279 | |
1280 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box) | |
1281 '(("unspecified" . unspecified)))) | |
1282 "If non-nil, indicate active buttons in a `raised-button' style. | |
1283 Otherwise use brackets." | |
1284 :type 'boolean | |
1285 :version "21.1" | |
1286 :group 'custom-buffer) | |
1287 | |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1288 (defun custom-buffer-create-internal (options &optional description) |
17415 | 1289 (message "Creating customization buffer...") |
17334 | 1290 (custom-mode) |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1291 (if custom-buffer-verbose-help |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1292 (progn |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1293 (widget-insert "This is a customization buffer") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1294 (if description |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1295 (widget-insert description)) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1296 (widget-insert (format ". |
25685 | 1297 %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
|
1298 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
|
1299 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
|
1300 choose the Set operation to set the option value. |
25685 | 1301 Invoke " (if custom-raised-buttons |
1302 "`Raised' buttons" | |
1303 "Square brackets"))) | |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1304 (widget-create 'info-link |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1305 :tag "Help" |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1306 :help-echo "Read the online help." |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1307 "(emacs)Easy Customization") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1308 (widget-insert " for more information.\n\n") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1309 (message "Creating customization buttons...") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1310 (widget-insert "Operate on everything in this buffer:\n ")) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1311 (widget-insert " ")) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1312 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1313 :tag "Set for Current Session" |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1314 :help-echo "\ |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1315 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
|
1316 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1317 (Custom-set))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1318 (widget-insert " ") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1319 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1320 :tag "Save for Future Sessions" |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1321 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1322 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
|
1323 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1324 (Custom-save))) |
18089 | 1325 (if custom-reset-button-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1326 (progn |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1327 (widget-insert " ") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1328 (widget-create 'push-button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1329 :tag "Reset" |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1330 :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
|
1331 :mouse-down-action (lambda (&rest junk) t) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1332 :action (lambda (widget &optional event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1333 (custom-reset event)))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1334 (widget-insert "\n ") |
18089 | 1335 (widget-create 'push-button |
1336 :tag "Reset" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1337 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1338 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
|
1339 :action 'Custom-reset-current) |
18089 | 1340 (widget-insert " ") |
1341 (widget-create 'push-button | |
1342 :tag "Reset to Saved" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1343 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1344 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
|
1345 :action 'Custom-reset-saved) |
18089 | 1346 (widget-insert " ") |
1347 (widget-create 'push-button | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1348 :tag "Erase Customization" |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1349 :help-echo "\ |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1350 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
|
1351 :action 'Custom-reset-standard)) |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1352 (if (not custom-buffer-verbose-help) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1353 (progn |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1354 (widget-insert " ") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1355 (widget-create 'info-link |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1356 :tag "Help" |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1357 :help-echo "Read the online help." |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1358 "(emacs)Easy Customization"))) |
18373
45ef45c34aa4
(custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents:
18371
diff
changeset
|
1359 (widget-insert " ") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1360 (widget-create 'push-button |
25685 | 1361 :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
|
1362 :help-echo |
80383e9be1e2
(custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents:
30184
diff
changeset
|
1363 (lambda (&rest ignore) |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1364 (cond |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1365 ((eq custom-buffer-done-function |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1366 'custom-bury-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1367 "Bury this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1368 ((eq custom-buffer-done-function 'kill-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1369 "Kill this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1370 (t "Finish with this buffer"))) |
25685 | 1371 :action #'Custom-buffer-done) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1372 (widget-insert "\n\n") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1373 (message "Creating customization items...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1374 (buffer-disable-undo) |
25685 | 1375 (setq custom-options |
17334 | 1376 (if (= (length options) 1) |
1377 (mapcar (lambda (entry) | |
1378 (widget-create (nth 1 entry) | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1379 :documentation-shown t |
17334 | 1380 :custom-state 'unknown |
1381 :tag (custom-unlispify-tag-name | |
1382 (nth 0 entry)) | |
1383 :value (nth 0 entry))) | |
1384 options) | |
1385 (let ((count 0) | |
1386 (length (length options))) | |
1387 (mapcar (lambda (entry) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1388 (prog2 |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1389 (message "Creating customization items ...%2d%%" |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1390 (/ (* 100.0 count) length)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1391 (widget-create (nth 1 entry) |
17334 | 1392 :tag (custom-unlispify-tag-name |
1393 (nth 0 entry)) | |
1394 :value (nth 0 entry)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1395 (setq count (1+ count)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1396 (unless (eq (preceding-char) ?\n) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1397 (widget-insert "\n")) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1398 (widget-insert "\n"))) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1399 options)))) |
17334 | 1400 (unless (eq (preceding-char) ?\n) |
1401 (widget-insert "\n")) | |
39153
001cb5cd0de9
(custom-buffer-create-internal): Remove "100%" from
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
1402 (message "Creating customization items ...done") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1403 (unless (eq custom-buffer-style 'tree) |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1404 (mapc 'custom-magic-reset custom-options)) |
17334 | 1405 (message "Creating customization setup...") |
1406 (widget-setup) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1407 (buffer-enable-undo) |
17334 | 1408 (goto-char (point-min)) |
1409 (message "Creating customization buffer...done")) | |
1410 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1411 ;;; The Tree Browser. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1412 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1413 ;;;###autoload |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1414 (defun customize-browse (&optional group) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1415 "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
|
1416 (interactive) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1417 (unless group |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1418 (setq group 'emacs)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1419 (let ((name "*Customize Browser*")) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1420 (pop-to-buffer (custom-get-fresh-buffer name))) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1421 (custom-mode) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1422 (widget-insert "\ |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
1423 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
|
1424 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
|
1425 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
|
1426 (if custom-browse-only-groups |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1427 (widget-insert "\ |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1428 Invoke the [Group] button below to edit that item in another window.\n\n") |
25685 | 1429 (widget-insert "Invoke the ") |
1430 (widget-create 'item | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1431 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1432 :tag "[Group]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1433 :tag-glyph "folder") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1434 (widget-insert ", ") |
25685 | 1435 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1436 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1437 :tag "[Face]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1438 :tag-glyph "face") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1439 (widget-insert ", and ") |
25685 | 1440 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1441 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1442 :tag "[Option]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1443 :tag-glyph "option") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1444 (widget-insert " buttons below to edit that |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1445 item in another window.\n\n")) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1446 (let ((custom-buffer-style 'tree)) |
25685 | 1447 (widget-create 'custom-group |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1448 :custom-last t |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1449 :custom-state 'unknown |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1450 :tag (custom-unlispify-tag-name group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1451 :value group)) |
48997
eb9dca992edf
(customize-browse): Call `widget-setup'.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48975
diff
changeset
|
1452 (widget-setup) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1453 (goto-char (point-min))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1454 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1455 (define-widget 'custom-browse-visibility 'item |
20600
323f33e3e92c
(custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
20562
diff
changeset
|
1456 "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
|
1457 :format "%[[%t]%]" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1458 :action 'custom-browse-visibility-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1459 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1460 (defun custom-browse-visibility-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1461 (let ((custom-buffer-style 'tree)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1462 (custom-toggle-parent widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1463 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1464 (define-widget 'custom-browse-group-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1465 "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
|
1466 :tag "Group" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1467 :tag-glyph "folder" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1468 :action 'custom-browse-group-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1469 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1470 (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
|
1471 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1472 (customize-group-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1473 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1474 (define-widget 'custom-browse-variable-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1475 "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
|
1476 :tag "Option" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1477 :tag-glyph "option" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1478 :action 'custom-browse-variable-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1479 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1480 (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
|
1481 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1482 (customize-variable-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1483 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1484 (define-widget 'custom-browse-face-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1485 "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
|
1486 :tag "Face" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1487 :tag-glyph "face" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1488 :action 'custom-browse-face-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1489 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1490 (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
|
1491 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1492 (customize-face-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1493 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1494 (defconst custom-browse-alist '((" " "space") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1495 (" | " "vertical") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1496 ("-\\ " "top") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1497 (" |-" "middle") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1498 (" `-" "bottom"))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1499 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1500 (defun custom-browse-insert-prefix (prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1501 "Insert PREFIX. On XEmacs convert it to line graphics." |
25685 | 1502 ;; Fixme: do graphics. |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1503 (if nil ; (string-match "XEmacs" emacs-version) |
25685 | 1504 (progn |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1505 (insert "*") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1506 (while (not (string-equal prefix "")) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1507 (let ((entry (substring prefix 0 3))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1508 (setq prefix (substring prefix 3)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1509 (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
|
1510 (name (nth 1 (assoc entry custom-browse-alist)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1511 (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
|
1512 (overlay-put overlay 'start-open t) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1513 (overlay-put overlay 'end-open t))))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1514 (insert prefix))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1515 |
17334 | 1516 ;;; Modification of Basic Widgets. |
1517 ;; | |
1518 ;; We add extra properties to the basic widgets needed here. This is | |
1519 ;; fine, as long as we are careful to stay within out own namespace. | |
1520 ;; | |
1521 ;; We want simple widgets to be displayed by default, but complex | |
1522 ;; widgets to be hidden. | |
1523 | |
1524 (widget-put (get 'item 'widget-type) :custom-show t) | |
1525 (widget-put (get 'editable-field 'widget-type) | |
1526 :custom-show (lambda (widget value) | |
1527 (let ((pp (pp-to-string value))) | |
1528 (cond ((string-match "\n" pp) | |
1529 nil) | |
1530 ((> (length pp) 40) | |
1531 nil) | |
1532 (t t))))) | |
1533 (widget-put (get 'menu-choice 'widget-type) :custom-show t) | |
1534 | |
1535 ;;; The `custom-manual' Widget. | |
1536 | |
1537 (define-widget 'custom-manual 'info-link | |
1538 "Link to the manual entry for this customization option." | |
1539 :help-echo "Read the manual entry for this option." | |
1540 :tag "Manual") | |
1541 | |
1542 ;;; The `custom-magic' Widget. | |
1543 | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1544 (defgroup custom-magic-faces nil |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1545 "Faces used by the magic button." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1546 :group 'custom-faces |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1547 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1548 |
17334 | 1549 (defface custom-invalid-face '((((class color)) |
1550 (:foreground "yellow" :background "red")) | |
1551 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1552 (:weight bold :slant italic :underline t))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1553 "Face used when the customize item is invalid." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1554 :group 'custom-magic-faces) |
17334 | 1555 |
1556 (defface custom-rogue-face '((((class color)) | |
1557 (:foreground "pink" :background "black")) | |
1558 (t | |
1559 (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1560 "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
|
1561 :group 'custom-magic-faces) |
17334 | 1562 |
25685 | 1563 (defface custom-modified-face '((((class color)) |
17334 | 1564 (:foreground "white" :background "blue")) |
1565 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1566 (:slant italic :bold))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1567 "Face used when the customize item has been modified." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1568 :group 'custom-magic-faces) |
17334 | 1569 |
25685 | 1570 (defface custom-set-face '((((class color)) |
17334 | 1571 (:foreground "blue" :background "white")) |
1572 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1573 (:slant italic))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1574 "Face used when the customize item has been set." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1575 :group 'custom-magic-faces) |
17334 | 1576 |
25685 | 1577 (defface custom-changed-face '((((class color)) |
17334 | 1578 (:foreground "white" :background "blue")) |
1579 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1580 (:slant italic))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1581 "Face used when the customize item has been changed." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1582 :group 'custom-magic-faces) |
17334 | 1583 |
1584 (defface custom-saved-face '((t (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1585 "Face used when the customize item has been saved." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1586 :group 'custom-magic-faces) |
17334 | 1587 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1588 (defconst custom-magic-alist '((nil "#" underline "\ |
17334 | 1589 uninitialized, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1590 (unknown "?" italic "\ |
17334 | 1591 unknown, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1592 (hidden "-" default "\ |
18362
4655515f51cc
(custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents:
18360
diff
changeset
|
1593 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
|
1594 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
|
1595 (invalid "x" custom-invalid-face "\ |
18089 | 1596 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
|
1597 (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
|
1598 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
|
1599 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
|
1600 (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
|
1601 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
|
1602 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
|
1603 (changed ":" custom-changed-face "\ |
18089 | 1604 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
|
1605 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
|
1606 (saved "!" custom-saved-face "\ |
18089 | 1607 this %c has been set and saved." "\ |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1608 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
|
1609 (rogue "@" custom-rogue-face "\ |
18089 | 1610 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
|
1611 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
|
1612 (standard " " nil "\ |
18089 | 1613 this %c is unchanged from its standard setting." "\ |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1614 visible group members are all at standard settings.")) |
17334 | 1615 "Alist of customize option states. |
25685 | 1616 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where |
17334 | 1617 |
1618 STATE is one of the following symbols: | |
1619 | |
1620 `nil' | |
1621 For internal use, should never occur. | |
1622 `unknown' | |
1623 For internal use, should never occur. | |
1624 `hidden' | |
25685 | 1625 This item is not being displayed. |
17334 | 1626 `invalid' |
1627 This item is modified, but has an invalid form. | |
1628 `modified' | |
1629 This item is modified, and has a valid form. | |
1630 `set' | |
1631 This item has been set but not saved. | |
1632 `changed' | |
1633 The current value of this item has been changed temporarily. | |
1634 `saved' | |
1635 This item is marked for saving. | |
1636 `rogue' | |
1637 This item has no customization information. | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1638 `standard' |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1639 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
|
1640 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1641 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
|
1642 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1643 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
|
1644 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1645 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
|
1646 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1647 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
|
1648 left out, ITEM-DESC will be used. |
17334 | 1649 |
18089 | 1650 The string %c in either description will be replaced with the |
1651 category of the item. These are `group'. `option', and `face'. | |
1652 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1653 The list should be sorted most significant first.") |
17334 | 1654 |
1655 (defcustom custom-magic-show 'long | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1656 "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
|
1657 If `long', show a full-line description, not just one word." |
17334 | 1658 :type '(choice (const :tag "no" nil) |
22600
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1659 (const long) |
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1660 (other :tag "short" short)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1661 :group 'custom-buffer) |
17334 | 1662 |
18089 | 1663 (defcustom custom-magic-show-hidden '(option face) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1664 "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
|
1665 The value should be a list with the custom categories where the State |
18089 | 1666 button should be visible. Possible categories are `group', `option', |
1667 and `face'." | |
1668 :type '(set (const group) (const option) (const face)) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1669 :group 'custom-buffer) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1670 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1671 (defcustom custom-magic-show-button nil |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1672 "Show a \"magic\" button indicating the state of each customization option." |
17334 | 1673 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1674 :group 'custom-buffer) |
17334 | 1675 |
1676 (define-widget 'custom-magic 'default | |
1677 "Show and manipulate state for a customization option." | |
1678 :format "%v" | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1679 :action 'widget-parent-action |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1680 :notify 'ignore |
17334 | 1681 :value-get 'ignore |
1682 :value-create 'custom-magic-value-create | |
1683 :value-delete 'widget-children-value-delete) | |
1684 | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1685 (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
|
1686 ;; Non-nil unless hidden. |
25685 | 1687 (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
|
1688 :custom-state) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1689 'hidden))) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1690 |
17334 | 1691 (defun custom-magic-value-create (widget) |
28130 | 1692 "Create compact status report for WIDGET." |
17334 | 1693 (let* ((parent (widget-get widget :parent)) |
1694 (state (widget-get parent :custom-state)) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1695 (hidden (eq state 'hidden)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1696 (entry (assq state custom-magic-alist)) |
17334 | 1697 (magic (nth 1 entry)) |
1698 (face (nth 2 entry)) | |
18089 | 1699 (category (widget-get parent :custom-category)) |
1700 (text (or (and (eq category 'group) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1701 (nth 4 entry)) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1702 (nth 3 entry))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1703 (form (widget-get parent :custom-form)) |
17334 | 1704 children) |
18089 | 1705 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text) |
25685 | 1706 (setq text (concat (match-string 1 text) |
18089 | 1707 (symbol-name category) |
1708 (match-string 2 text)))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1709 (when (and custom-magic-show |
18089 | 1710 (or (not hidden) |
1711 (memq category custom-magic-show-hidden))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1712 (insert " ") |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1713 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1714 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1715 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1716 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1717 (widget-get parent :custom-level)))) |
25685 | 1718 (push (widget-create-child-and-convert |
1719 widget 'choice-item | |
18087 | 1720 :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
|
1721 :format (if hidden "%t" "%[%t%]") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1722 :button-prefix 'widget-push-button-prefix |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1723 :button-suffix 'widget-push-button-suffix |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1724 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1725 :tag "State") |
17334 | 1726 children) |
1727 (insert ": ") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1728 (let ((start (point))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1729 (if (eq custom-magic-show 'long) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1730 (insert text) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1731 (insert (symbol-name state))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1732 (cond ((eq form 'lisp) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1733 (insert " (lisp)")) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1734 ((eq form 'mismatch) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1735 (insert " (mismatch)"))) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1736 (put-text-property start (point) 'face 'custom-state-face)) |
17334 | 1737 (insert "\n")) |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1738 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1739 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1740 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1741 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1742 (widget-get parent :custom-level)))) |
17334 | 1743 (when custom-magic-show-button |
1744 (when custom-magic-show | |
1745 (let ((indent (widget-get parent :indent))) | |
1746 (when indent | |
1747 (insert-char ? indent)))) | |
25685 | 1748 (push (widget-create-child-and-convert |
1749 widget 'choice-item | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1750 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1751 :button-face face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1752 :button-prefix "" |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1753 :button-suffix "" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1754 :help-echo "Change the state." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1755 :format (if hidden "%t" "%[%t%]") |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1756 :tag (if (memq form '(lisp mismatch)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1757 (concat "(" magic ")") |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1758 (concat "[" magic "]"))) |
17334 | 1759 children) |
1760 (insert " ")) | |
1761 (widget-put widget :children children))) | |
1762 | |
1763 (defun custom-magic-reset (widget) | |
1764 "Redraw the :custom-magic property of WIDGET." | |
1765 (let ((magic (widget-get widget :custom-magic))) | |
1766 (widget-value-set magic (widget-value magic)))) | |
1767 | |
1768 ;;; The `custom' Widget. | |
1769 | |
25685 | 1770 (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
|
1771 '((((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
|
1772 (: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
|
1773 :background "lightgrey" :foreground "black")) |
25685 | 1774 (t |
1775 nil)) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1776 "Face used for buttons in customization buffers." |
25685 | 1777 :version "21.1" |
1778 :group 'custom-faces) | |
1779 | |
1780 (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
|
1781 '((((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
|
1782 (: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
|
1783 :background "lightgrey" :foreground "black")) |
25685 | 1784 (t |
1785 (:inverse-video t))) | |
1786 "Face used for buttons in customization buffers." | |
1787 :version "21.1" | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1788 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1789 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1790 (defface custom-documentation-face nil |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1791 "Face used for documentation strings in customization buffers." |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1792 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1793 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1794 (defface custom-state-face '((((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1795 (background dark)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1796 (:foreground "lime green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1797 (((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1798 (background light)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1799 (:foreground "dark green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1800 (t nil)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1801 "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
|
1802 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1803 |
17334 | 1804 (define-widget 'custom 'default |
1805 "Customize a user option." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1806 :format "%v" |
17334 | 1807 :convert-widget 'custom-convert-widget |
1808 :notify 'custom-notify | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1809 :custom-prefix "" |
17334 | 1810 :custom-level 1 |
1811 :custom-state 'hidden | |
1812 :documentation-property 'widget-subclass-responsibility | |
1813 :value-create 'widget-subclass-responsibility | |
1814 :value-delete 'widget-children-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1815 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1816 :validate 'widget-children-validate |
17334 | 1817 :match (lambda (widget value) (symbolp value))) |
1818 | |
1819 (defun custom-convert-widget (widget) | |
28130 | 1820 "Initialize :value and :tag from :args in WIDGET." |
17334 | 1821 (let ((args (widget-get widget :args))) |
25685 | 1822 (when args |
17334 | 1823 (widget-put widget :value (widget-apply widget |
1824 :value-to-internal (car args))) | |
1825 (widget-put widget :tag (custom-unlispify-tag-name (car args))) | |
1826 (widget-put widget :args nil))) | |
1827 widget) | |
1828 | |
1829 (defun custom-notify (widget &rest args) | |
1830 "Keep track of changes." | |
18090 | 1831 (let ((state (widget-get widget :custom-state))) |
1832 (unless (eq state 'modified) | |
1833 (unless (memq state '(nil unknown hidden)) | |
1834 (widget-put widget :custom-state 'modified)) | |
1835 (custom-magic-reset widget) | |
1836 (apply 'widget-default-notify widget args)))) | |
17334 | 1837 |
1838 (defun custom-redraw (widget) | |
1839 "Redraw WIDGET with current settings." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1840 (let ((line (count-lines (point-min) (point))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1841 (column (current-column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1842 (pos (point)) |
17334 | 1843 (from (marker-position (widget-get widget :from))) |
1844 (to (marker-position (widget-get widget :to)))) | |
1845 (save-excursion | |
1846 (widget-value-set widget (widget-value widget)) | |
1847 (custom-redraw-magic widget)) | |
1848 (when (and (>= pos from) (<= pos to)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1849 (condition-case nil |
25685 | 1850 (progn |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1851 (if (> column 0) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1852 (goto-line line) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1853 (goto-line (1+ line))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1854 (move-to-column column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1855 (error nil))))) |
17334 | 1856 |
1857 (defun custom-redraw-magic (widget) | |
1858 "Redraw WIDGET state with current settings." | |
25685 | 1859 (while widget |
17334 | 1860 (let ((magic (widget-get widget :custom-magic))) |
25685 | 1861 (cond (magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1862 (widget-value-set magic (widget-value magic)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1863 (when (setq widget (widget-get widget :group)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1864 (custom-group-state-update widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1865 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1866 (setq widget nil))))) |
17334 | 1867 (widget-setup)) |
1868 | |
1869 (defun custom-show (widget value) | |
1870 "Non-nil if WIDGET should be shown with VALUE by default." | |
1871 (let ((show (widget-get widget :custom-show))) | |
1872 (cond ((null show) | |
1873 nil) | |
1874 ((eq t show) | |
1875 t) | |
1876 (t | |
1877 (funcall show widget value))))) | |
1878 | |
1879 (defun custom-load-widget (widget) | |
1880 "Load all dependencies for WIDGET." | |
1881 (custom-load-symbol (widget-value widget))) | |
1882 | |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1883 (defun custom-unloaded-symbol-p (symbol) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1884 "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
|
1885 (let ((found nil) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1886 (loads (get symbol 'custom-loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1887 load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1888 (while loads |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1889 (setq load (car loads) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1890 loads (cdr loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1891 (cond ((symbolp load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1892 (unless (featurep load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1893 (setq found t))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1894 ((assoc load load-history)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1895 ((assoc (locate-library load) load-history) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1896 (message nil)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1897 (t |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1898 (setq found t)))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1899 found)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1900 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1901 (defun custom-unloaded-widget-p (widget) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1902 "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
|
1903 (custom-unloaded-symbol-p (widget-value widget))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1904 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1905 (defun custom-toggle-hide (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1906 "Toggle visibility of WIDGET." |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1907 (custom-load-widget widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1908 (let ((state (widget-get widget :custom-state))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1909 (cond ((memq state '(invalid modified)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1910 (error "There are unset changes")) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1911 ((eq state 'hidden) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1912 (widget-put widget :custom-state 'unknown)) |
25685 | 1913 (t |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1914 (widget-put widget :documentation-shown nil) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1915 (widget-put widget :custom-state 'hidden))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1916 (custom-redraw widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1917 (widget-setup))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1918 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1919 (defun custom-toggle-parent (widget &rest ignore) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1920 "Toggle visibility of parent of WIDGET." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1921 (custom-toggle-hide (widget-get widget :parent))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1922 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1923 (defun custom-add-see-also (widget &optional prefix) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1924 "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
|
1925 Insert PREFIX first if non-nil." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1926 (let* ((symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1927 (links (get symbol 'custom-links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1928 (many (> (length links) 2)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1929 (buttons (widget-get widget :buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1930 (indent (widget-get widget :indent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1931 (when links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1932 (when indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1933 (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1934 (when prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1935 (insert prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1936 (insert "See also ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1937 (while links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1938 (push (widget-create-child-and-convert widget (car links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1939 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1940 (setq links (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1941 (cond ((null links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1942 (insert ".\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1943 ((null (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1944 (if many |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1945 (insert ", and ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1946 (insert " and "))) |
25685 | 1947 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1948 (insert ", ")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1949 (widget-put widget :buttons buttons)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1950 |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1951 (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
|
1952 "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
|
1953 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
|
1954 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
|
1955 (let ((name (widget-value widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1956 (type (widget-type widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1957 (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
|
1958 (start (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1959 found) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1960 (insert (or initial-string "Parent groups:")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1961 (mapatoms (lambda (symbol) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1962 (let ((entry (assq name (get symbol 'custom-group)))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1963 (when (eq (nth 1 entry) type) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1964 (insert " ") |
25685 | 1965 (push (widget-create-child-and-convert |
1966 widget 'custom-group-link | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1967 :tag (custom-unlispify-tag-name symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1968 symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1969 buttons) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1970 (setq found t))))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1971 (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
|
1972 (if found |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1973 (insert "\n") |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1974 (delete-region start (point))) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
1975 found)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1976 |
25685 | 1977 ;;; The `custom-comment' Widget. |
1978 | |
1979 ;; like the editable field | |
1980 (defface custom-comment-face '((((class grayscale color) | |
1981 (background light)) | |
1982 (:background "gray85")) | |
1983 (((class grayscale color) | |
1984 (background dark)) | |
1985 (:background "dim gray")) | |
1986 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1987 (:slant italic))) |
25685 | 1988 "Face used for comments on variables or faces" |
1989 :version "21.1" | |
1990 :group 'custom-faces) | |
1991 | |
1992 ;; like font-lock-comment-face | |
1993 (defface custom-comment-tag-face | |
1994 '((((class color) (background dark)) (:foreground "gray80")) | |
1995 (((class color) (background light)) (:foreground "blue4")) | |
1996 (((class grayscale) (background light)) | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1997 (:foreground "DimGray" :weight bold :slant italic)) |
25685 | 1998 (((class grayscale) (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1999 (:foreground "LightGray" :weight bold :slant italic)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2000 (t (:weight bold))) |
25685 | 2001 "Face used for variables or faces comment tags" |
2002 :group 'custom-faces) | |
2003 | |
2004 (define-widget 'custom-comment 'string | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2005 "User comment." |
25685 | 2006 :tag "Comment" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2007 :help-echo "Edit a comment here." |
25685 | 2008 :sample-face 'custom-comment-tag-face |
2009 :value-face 'custom-comment-face | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2010 :shown nil |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2011 :create 'custom-comment-create) |
25685 | 2012 |
2013 (defun custom-comment-create (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2014 (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
|
2015 (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
|
2016 (not null-comment)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2017 (widget-default-create widget) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2018 ;; `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
|
2019 ;; maybe it shouldn't. |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2020 (widget-put widget :from (point-marker)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2021 (widget-put widget :to (point-marker))))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2022 |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2023 (defun custom-comment-hide (widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2024 (widget-put (widget-get widget :parent) :comment-shown nil)) |
25685 | 2025 |
2026 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's | |
2027 ;; the global custom one | |
2028 (defun custom-comment-show (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2029 (widget-put widget :comment-shown t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2030 (custom-redraw widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2031 (widget-setup)) |
25685 | 2032 |
2033 (defun custom-comment-invisible-p (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2034 (let ((val (widget-value (widget-get widget :comment-widget)))) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2035 (and (equal "" val) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2036 (not (widget-get widget :comment-shown))))) |
25685 | 2037 |
17334 | 2038 ;;; The `custom-variable' Widget. |
2039 | |
28130 | 2040 ;; When this was underlined blue, users confused it with a |
2041 ;; Mosaic-style hyperlink... | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2042 (defface custom-variable-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2043 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2044 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2045 (:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2046 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2047 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2048 (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2049 (t (:weight bold))) |
17334 | 2050 "Face used for unpushable variable tags." |
17415 | 2051 :group 'custom-faces) |
17334 | 2052 |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2053 (defface custom-variable-button-face '((t (:underline t :weight bold))) |
17334 | 2054 "Face used for pushable variable tags." |
17415 | 2055 :group 'custom-faces) |
17334 | 2056 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2057 (defcustom custom-variable-default-form 'edit |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2058 "Default form of displaying variable values." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2059 :type '(choice (const edit) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2060 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2061 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2062 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2063 |
17334 | 2064 (define-widget 'custom-variable 'custom |
2065 "Customize variable." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2066 :format "%v" |
17334 | 2067 :help-echo "Set or reset this variable." |
2068 :documentation-property 'variable-documentation | |
18089 | 2069 :custom-category 'option |
17334 | 2070 :custom-state nil |
2071 :custom-menu 'custom-variable-menu-create | |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2072 :custom-form nil ; defaults to value of `custom-variable-default-form' |
17334 | 2073 :value-create 'custom-variable-value-create |
2074 :action 'custom-variable-action | |
2075 :custom-set 'custom-variable-set | |
2076 :custom-save 'custom-variable-save | |
2077 :custom-reset-current 'custom-redraw | |
2078 :custom-reset-saved 'custom-variable-reset-saved | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2079 :custom-reset-standard 'custom-variable-reset-standard |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2080 :custom-standard-value 'custom-variable-standard-value) |
17334 | 2081 |
17415 | 2082 (defun custom-variable-type (symbol) |
2083 "Return a widget suitable for editing the value of SYMBOL. | |
25685 | 2084 If SYMBOL has a `custom-type' property, use that. |
17415 | 2085 Otherwise, look up symbol in `custom-guess-type-alist'." |
2086 (let* ((type (or (get symbol 'custom-type) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2087 (and (not (get symbol 'standard-value)) |
17415 | 2088 (custom-guess-type symbol)) |
2089 'sexp)) | |
2090 (options (get symbol 'custom-options)) | |
2091 (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
|
2092 (copy-sequence type) |
17415 | 2093 (list type)))) |
2094 (when options | |
2095 (widget-put tmp :options options)) | |
2096 tmp)) | |
2097 | |
17334 | 2098 (defun custom-variable-value-create (widget) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2099 "Here is where you edit the variable's value." |
17334 | 2100 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2101 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2102 (widget-put widget :custom-form custom-variable-default-form)) |
17334 | 2103 (let* ((buttons (widget-get widget :buttons)) |
2104 (children (widget-get widget :children)) | |
2105 (form (widget-get widget :custom-form)) | |
2106 (state (widget-get widget :custom-state)) | |
2107 (symbol (widget-get widget :value)) | |
2108 (tag (widget-get widget :tag)) | |
17415 | 2109 (type (custom-variable-type symbol)) |
17334 | 2110 (conv (widget-convert type)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2111 (get (or (get symbol 'custom-get) 'default-value)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2112 (prefix (widget-get widget :custom-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2113 (last (widget-get widget :custom-last)) |
17334 | 2114 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2115 (funcall get symbol) |
17334 | 2116 (widget-get conv :value)))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2117 ;; If the widget is new, the child determines whether it is hidden. |
17334 | 2118 (cond (state) |
2119 ((custom-show type value) | |
2120 (setq state 'unknown)) | |
2121 (t | |
2122 (setq state 'hidden))) | |
2123 ;; If we don't know the state, see if we need to edit it in lisp form. | |
2124 (when (eq state 'unknown) | |
2125 (unless (widget-apply conv :match value) | |
2126 ;; (widget-apply (widget-convert type) :match value) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2127 (setq form 'mismatch))) |
17334 | 2128 ;; Now we can create the child widget. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2129 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2130 (insert prefix (if last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2131 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2132 widget 'custom-browse-variable-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2133 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2134 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2135 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2136 ((eq state 'hidden) |
17334 | 2137 ;; Indicate hidden value. |
25685 | 2138 (push (widget-create-child-and-convert |
17334 | 2139 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2140 :format "%{%t%}: " |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2141 :sample-face 'custom-variable-tag-face |
17334 | 2142 :tag tag |
2143 :parent widget) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2144 buttons) |
25685 | 2145 (push (widget-create-child-and-convert |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2146 widget 'visibility |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2147 :help-echo "Show the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2148 :off "Show Value" |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2149 :action 'custom-toggle-parent |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2150 nil) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2151 buttons)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2152 ((memq form '(lisp mismatch)) |
17334 | 2153 ;; In lisp mode edit the saved value when possible. |
2154 (let* ((value (cond ((get symbol 'saved-value) | |
2155 (car (get symbol 'saved-value))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2156 ((get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2157 (car (get symbol 'standard-value))) |
17334 | 2158 ((default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2159 (custom-quote (funcall get symbol))) |
17334 | 2160 (t |
2161 (custom-quote (widget-get conv :value)))))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2162 (insert (symbol-name symbol) ": ") |
25685 | 2163 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2164 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2165 :help-echo "Hide the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2166 :on "Hide Value" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2167 :off "Show Value" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2168 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2169 t) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2170 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2171 (insert " ") |
25685 | 2172 (push (widget-create-child-and-convert |
2173 widget 'sexp | |
17334 | 2174 :button-face 'custom-variable-button-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2175 :format "%v" |
17334 | 2176 :tag (symbol-name symbol) |
2177 :parent widget | |
2178 :value value) | |
2179 children))) | |
2180 (t | |
2181 ;; Edit mode. | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2182 (let* ((format (widget-get type :format)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2183 tag-format value-format) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2184 (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
|
2185 (error "Bad format")) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2186 (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
|
2187 (setq value-format (substring format (match-end 0))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2188 (push (widget-create-child-and-convert |
25685 | 2189 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2190 :format tag-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2191 :action 'custom-tag-action |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2192 :help-echo "Change value of this option." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2193 :mouse-down-action 'custom-tag-mouse-down-action |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2194 :button-face 'custom-variable-button-face |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2195 :sample-face 'custom-variable-tag-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2196 tag) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2197 buttons) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2198 (insert " ") |
25685 | 2199 (push (widget-create-child-and-convert |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2200 widget 'visibility |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2201 :help-echo "Hide the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2202 :on "Hide Value" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2203 :off "Show Value" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2204 :action 'custom-toggle-parent |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2205 t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2206 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2207 (push (widget-create-child-and-convert |
25685 | 2208 widget type |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2209 :format value-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2210 :value value) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2211 children)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2212 (unless (eq custom-buffer-style 'tree) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2213 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2214 (widget-insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2215 ;; Create the magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2216 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2217 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2218 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2219 (push magic buttons)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2220 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property |
25685 | 2221 ;; before the call to `widget-default-format-handler'. Otherwise, I |
2222 ;; loose my current `buttons'. This function shouldn't be called like | |
2223 ;; this anyway. The doc string widget should be added like the others. | |
2224 ;; --dv | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2225 (widget-put widget :buttons buttons) |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2226 (insert "\n") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2227 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2228 (widget-default-format-handler widget ?h) |
25685 | 2229 |
2230 ;; The comment field | |
2231 (unless (eq state 'hidden) | |
2232 (let* ((comment (get symbol 'variable-comment)) | |
2233 (comment-widget | |
2234 (widget-create-child-and-convert | |
2235 widget 'custom-comment | |
2236 :parent widget | |
2237 :value (or comment "")))) | |
2238 (widget-put widget :comment-widget comment-widget) | |
2239 ;; Don't push it !!! Custom assumes that the first child is the | |
2240 ;; value one. | |
2241 (setq children (append children (list comment-widget))))) | |
2242 ;; Update the rest of the properties properties. | |
2243 (widget-put widget :custom-form form) | |
2244 (widget-put widget :children children) | |
2245 ;; Now update the state. | |
2246 (if (eq state 'hidden) | |
2247 (widget-put widget :custom-state state) | |
2248 (custom-variable-state-set widget)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2249 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2250 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2251 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2252 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2253 (custom-add-see-also widget))))) |
17334 | 2254 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2255 (defun custom-tag-action (widget &rest args) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2256 "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
|
2257 (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
|
2258 :action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2259 |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2260 (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
|
2261 "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
|
2262 (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
|
2263 :mouse-down-action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2264 |
17334 | 2265 (defun custom-variable-state-set (widget) |
2266 "Set the state of WIDGET." | |
2267 (let* ((symbol (widget-value widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2268 (get (or (get symbol 'custom-get) 'default-value)) |
17334 | 2269 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2270 (funcall get symbol) |
17334 | 2271 (widget-get widget :value))) |
25685 | 2272 (comment (get symbol 'variable-comment)) |
17334 | 2273 tmp |
25685 | 2274 temp |
2275 (state (cond ((progn (setq tmp (get symbol 'customized-value)) | |
2276 (setq temp | |
2277 (get symbol 'customized-variable-comment)) | |
2278 (or tmp temp)) | |
17334 | 2279 (if (condition-case nil |
25685 | 2280 (and (equal value (eval (car tmp))) |
2281 (equal comment temp)) | |
17334 | 2282 (error nil)) |
2283 'set | |
2284 'changed)) | |
25685 | 2285 ((progn (setq tmp (get symbol 'saved-value)) |
2286 (setq temp (get symbol 'saved-variable-comment)) | |
2287 (or tmp temp)) | |
17334 | 2288 (if (condition-case nil |
25685 | 2289 (and (equal value (eval (car tmp))) |
2290 (equal comment temp)) | |
17334 | 2291 (error nil)) |
2292 'saved | |
2293 'changed)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2294 ((setq tmp (get symbol 'standard-value)) |
17334 | 2295 (if (condition-case nil |
25685 | 2296 (and (equal value (eval (car tmp))) |
2297 (equal comment nil)) | |
17334 | 2298 (error nil)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2299 'standard |
17334 | 2300 'changed)) |
2301 (t 'rogue)))) | |
2302 (widget-put widget :custom-state state))) | |
2303 | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2304 (defun custom-variable-standard-value (widget) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2305 (get (widget-value widget) 'standard-value)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2306 |
25685 | 2307 (defvar custom-variable-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
2308 '(("Set for Current Session" custom-variable-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2309 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2310 (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
|
2311 ("Save for Future Sessions" custom-variable-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2312 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2313 (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
|
2314 ("Reset to Current" custom-redraw |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2315 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2316 (and (default-boundp (widget-value widget)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2317 (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
|
2318 ("Reset to Saved" custom-variable-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2319 (lambda (widget) |
25685 | 2320 (and (or (get (widget-value widget) 'saved-value) |
2321 (get (widget-value widget) 'saved-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2322 (memq (widget-get widget :custom-state) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2323 '(modified set changed rogue))))) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2324 ("Erase Customization" custom-variable-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2325 (lambda (widget) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2326 (and (get (widget-value widget) 'standard-value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2327 (memq (widget-get widget :custom-state) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2328 '(modified set changed saved rogue))))) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2329 ("Use Backup Value" custom-variable-reset-backup |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2330 (lambda (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2331 (get (widget-value widget) 'backup-value))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2332 ("---" ignore ignore) |
25685 | 2333 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2334 ("---" ignore ignore) | |
2335 ("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
|
2336 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2337 (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
|
2338 ("Show initial Lisp expression" custom-variable-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2339 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2340 (eq (widget-get widget :custom-form) 'edit)))) |
17334 | 2341 "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
|
2342 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
|
2343 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
|
2344 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
|
2345 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
|
2346 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2347 |
2348 (defun custom-variable-action (widget &optional event) | |
2349 "Show the menu for `custom-variable' WIDGET. | |
2350 Optional EVENT is the location for the menu." | |
2351 (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
|
2352 (custom-toggle-hide widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2353 (unless (eq (widget-get widget :custom-state) 'modified) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2354 (custom-variable-state-set widget)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2355 (custom-redraw-magic widget) |
17334 | 2356 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2357 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2358 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2359 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2360 (custom-menu-filter custom-variable-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2361 widget) |
17334 | 2362 event))) |
2363 (if answer | |
2364 (funcall answer widget))))) | |
2365 | |
2366 (defun custom-variable-edit (widget) | |
2367 "Edit value of WIDGET." | |
2368 (widget-put widget :custom-state 'unknown) | |
2369 (widget-put widget :custom-form 'edit) | |
2370 (custom-redraw widget)) | |
2371 | |
2372 (defun custom-variable-edit-lisp (widget) | |
28130 | 2373 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2374 (widget-put widget :custom-state 'unknown) |
2375 (widget-put widget :custom-form 'lisp) | |
2376 (custom-redraw widget)) | |
2377 | |
2378 (defun custom-variable-set (widget) | |
2379 "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
|
2380 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2381 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2382 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2383 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2384 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2385 (comment-widget (widget-get widget :comment-widget)) |
2386 (comment (widget-value comment-widget)) | |
2387 val) | |
17334 | 2388 (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
|
2389 (error "Cannot set hidden variable")) |
17334 | 2390 ((setq val (widget-apply child :validate)) |
2391 (goto-char (widget-get val :from)) | |
2392 (error "%s" (widget-get val :error))) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2393 ((memq form '(lisp mismatch)) |
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)) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2398 (custom-variable-backup-value widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2399 (funcall set symbol (eval (setq val (widget-value child)))) |
25685 | 2400 (put symbol 'customized-value (list val)) |
2401 (put symbol 'variable-comment comment) | |
2402 (put symbol 'customized-variable-comment comment)) | |
17334 | 2403 (t |
25685 | 2404 (when (equal comment "") |
2405 (setq comment nil) | |
2406 ;; 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
|
2407 (custom-comment-hide comment-widget)) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2408 (custom-variable-backup-value widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2409 (funcall set symbol (setq val (widget-value child))) |
25685 | 2410 (put symbol 'customized-value (list (custom-quote val))) |
2411 (put symbol 'variable-comment comment) | |
2412 (put symbol 'customized-variable-comment comment))) | |
17334 | 2413 (custom-variable-state-set widget) |
2414 (custom-redraw-magic widget))) | |
2415 | |
2416 (defun custom-variable-save (widget) | |
19823
0c1b4a44db76
(custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents:
19822
diff
changeset
|
2417 "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
|
2418 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2419 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2420 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2421 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2422 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2423 (comment-widget (widget-get widget :comment-widget)) |
2424 (comment (widget-value comment-widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2425 val) |
17334 | 2426 (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
|
2427 (error "Cannot set hidden variable")) |
17334 | 2428 ((setq val (widget-apply child :validate)) |
2429 (goto-char (widget-get val :from)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
2430 (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
|
2431 ((memq form '(lisp mismatch)) |
25685 | 2432 (when (equal comment "") |
2433 (setq comment nil) | |
2434 ;; 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
|
2435 (custom-comment-hide comment-widget)) |
17334 | 2436 (put symbol 'saved-value (list (widget-value child))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2437 (custom-push-theme 'theme-value symbol 'user |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2438 'set (list (widget-value child))) |
25685 | 2439 (funcall set symbol (eval (widget-value child))) |
2440 (put symbol 'variable-comment comment) | |
2441 (put symbol 'saved-variable-comment comment)) | |
17334 | 2442 (t |
25685 | 2443 (when (equal comment "") |
2444 (setq comment nil) | |
2445 ;; 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
|
2446 (custom-comment-hide comment-widget)) |
25685 | 2447 (put symbol 'saved-value |
2448 (list (custom-quote (widget-value child)))) | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2449 (custom-push-theme 'theme-value symbol 'user |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2450 'set (list (custom-quote (widget-value |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2451 child)))) |
25685 | 2452 (funcall set symbol (widget-value child)) |
2453 (put symbol 'variable-comment comment) | |
2454 (put symbol 'saved-variable-comment comment))) | |
17334 | 2455 (put symbol 'customized-value nil) |
25685 | 2456 (put symbol 'customized-variable-comment nil) |
17334 | 2457 (custom-save-all) |
2458 (custom-variable-state-set widget) | |
2459 (custom-redraw-magic widget))) | |
2460 | |
2461 (defun custom-variable-reset-saved (widget) | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2462 "Restore the saved value for the variable being edited by WIDGET. |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2463 The value that was current before this operation |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2464 becomes the backup value, so you can get it again." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2465 (let* ((symbol (widget-value widget)) |
25685 | 2466 (set (or (get symbol 'custom-set) 'set-default)) |
2467 (value (get symbol 'saved-value)) | |
2468 (comment (get symbol 'saved-variable-comment))) | |
2469 (cond ((or value comment) | |
2470 (put symbol 'variable-comment comment) | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2471 (custom-variable-backup-value widget) |
25685 | 2472 (condition-case nil |
2473 (funcall set symbol (eval (car value))) | |
2474 (error nil))) | |
2475 (t | |
2476 (error "No saved value for %s" symbol))) | |
17334 | 2477 (put symbol 'customized-value nil) |
25685 | 2478 (put symbol 'customized-variable-comment nil) |
17334 | 2479 (widget-put widget :custom-state 'unknown) |
25685 | 2480 ;; This call will possibly make the comment invisible |
17334 | 2481 (custom-redraw widget))) |
2482 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2483 (defun custom-variable-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2484 "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
|
2485 This operation eliminates any saved setting for the variable, |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2486 restoring it to the state of a variable that has never been customized. |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2487 The value that was current before this operation |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2488 becomes the backup value, so you can get it again." |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2489 (let* ((symbol (widget-value widget)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
2490 (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
|
2491 (if (get symbol 'standard-value) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2492 (progn |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2493 (custom-variable-backup-value widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2494 (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
|
2495 (error "No standard setting known for %S" symbol)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2496 (put symbol 'variable-comment nil) |
17334 | 2497 (put symbol 'customized-value nil) |
25685 | 2498 (put symbol 'customized-variable-comment nil) |
2499 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | |
17334 | 2500 (put symbol 'saved-value nil) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2501 (custom-push-theme 'theme-value symbol 'user 'reset 'standard) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2502 ;; As a special optimizations we do not (explictly) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2503 ;; save resets to standard when no theme set the value. |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2504 (if (null (cdr (get symbol 'theme-value))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2505 (put symbol 'theme-value nil)) |
25685 | 2506 (put symbol 'saved-variable-comment nil) |
17334 | 2507 (custom-save-all)) |
2508 (widget-put widget :custom-state 'unknown) | |
25685 | 2509 ;; This call will possibly make the comment invisible |
17334 | 2510 (custom-redraw widget))) |
2511 | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2512 (defun custom-variable-backup-value (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2513 "Back up the current value for WIDGET's variable. |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2514 The backup value is kept in the car of the `backup-value' property." |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2515 (let* ((symbol (widget-value widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2516 (get (or (get symbol 'custom-get) 'default-value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2517 (type (custom-variable-type symbol)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2518 (conv (widget-convert type)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2519 (value (if (default-boundp symbol) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2520 (funcall get symbol) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2521 (widget-get conv :value)))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2522 (put symbol 'backup-value (list value)))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2523 |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2524 (defun custom-variable-reset-backup (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2525 "Restore the backup value for the variable being edited by WIDGET. |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2526 The value that was current before this operation |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2527 becomes the backup value, so you can use this operation repeatedly |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2528 to switch between two values." |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2529 (let* ((symbol (widget-value widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2530 (set (or (get symbol 'custom-set) 'set-default)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2531 (value (get symbol 'backup-value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2532 (comment-widget (widget-get widget :comment-widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2533 (comment (widget-value comment-widget))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2534 (if value |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2535 (progn |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2536 (custom-variable-backup-value widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2537 (condition-case nil |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2538 (funcall set symbol (car value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2539 (error nil))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2540 (error "No backup value for %s" symbol)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2541 (put symbol 'customized-value (list (car value))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2542 (put symbol 'variable-comment comment) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2543 (put symbol 'customized-variable-comment comment) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2544 (custom-variable-state-set widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2545 ;; This call will possibly make the comment invisible |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2546 (custom-redraw widget))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2547 |
17334 | 2548 ;;; The `custom-face-edit' Widget. |
2549 | |
2550 (define-widget 'custom-face-edit 'checklist | |
2551 "Edit face attributes." | |
2552 :format "%t: %v" | |
2553 :tag "Attributes" | |
2554 :extra-offset 12 | |
25685 | 2555 :button-args '(:help-echo "Control whether this attribute has any effect.") |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2556 :value-to-internal 'custom-face-edit-fix-value |
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2557 :match (lambda (widget value) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2558 (widget-checklist-match widget |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2559 (custom-face-edit-fix-value widget value))) |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2560 :convert-widget 'custom-face-edit-convert-widget |
17334 | 2561 :args (mapcar (lambda (att) |
25685 | 2562 (list 'group |
17334 | 2563 :inline t |
2564 :sibling-args (widget-get (nth 1 att) :sibling-args) | |
25685 | 2565 (list 'const :format "" :value (nth 0 att)) |
17334 | 2566 (nth 1 att))) |
2567 custom-face-attributes)) | |
2568 | |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2569 (defun custom-face-edit-fix-value (widget value) |
48709
d1efe2b99d8a
(custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents:
48633
diff
changeset
|
2570 "Ignoring WIDGET, convert :bold and :italic in VALUE to new form. |
d1efe2b99d8a
(custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents:
48633
diff
changeset
|
2571 Also change :reverse-video to :inverse-video." |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2572 (if (listp value) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2573 (let (result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2574 (while value |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2575 (let ((key (car value)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2576 (val (car (cdr value)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2577 (cond ((eq key :italic) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2578 (push :slant result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2579 (push (if val 'italic 'normal) result)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2580 ((eq key :bold) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2581 (push :weight result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2582 (push (if val 'bold 'normal) result)) |
48709
d1efe2b99d8a
(custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents:
48633
diff
changeset
|
2583 ((eq key :reverse-video) |
d1efe2b99d8a
(custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents:
48633
diff
changeset
|
2584 (push :inverse-video result) |
d1efe2b99d8a
(custom-face-edit-fix-value): Change :reverse-video to :inverse-video.
Andreas Schwab <schwab@suse.de>
parents:
48633
diff
changeset
|
2585 (push val result)) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2586 (t |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2587 (push key result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2588 (push val result)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2589 (setq value (cdr (cdr value)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2590 (setq result (nreverse result)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2591 result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2592 value)) |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2593 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2594 (defun custom-face-edit-convert-widget (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2595 "Convert :args as widget types in WIDGET." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2596 (widget-put |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2597 widget |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2598 :args (mapcar (lambda (arg) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2599 (widget-convert arg |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2600 :deactivate 'custom-face-edit-deactivate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2601 :activate 'custom-face-edit-activate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2602 :delete 'custom-face-edit-delete)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2603 (widget-get widget :args))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2604 widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2605 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2606 (defun custom-face-edit-deactivate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2607 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2608 (unless (widget-get widget :inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2609 (let ((tag (custom-face-edit-attribute-tag widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2610 (from (copy-marker (widget-get widget :from))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2611 (value (widget-value widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2612 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2613 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2614 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2615 (goto-char from) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2616 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2617 (insert tag ": *\n") |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2618 (widget-put widget :inactive |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2619 (cons value (cons from (- (point) from)))))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2620 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2621 (defun custom-face-edit-activate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2622 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2623 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2624 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2625 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2626 (when (consp inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2627 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2628 (goto-char (car (cdr inactive))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2629 (delete-region (point) (+ (point) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2630 (widget-put widget :inactive nil) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2631 (widget-apply widget :create) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2632 (widget-value-set widget (car inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2633 (widget-setup))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2634 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2635 (defun custom-face-edit-delete (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2636 "Remove widget from the buffer." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2637 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2638 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2639 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2640 (if (not inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2641 ;; Widget is alive, we don't have to do anything special |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2642 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2643 ;; WIDGET is already deleted because we did so to inactivate it; |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2644 ;; now just get rid of the label we put in its place. |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2645 (delete-region (car (cdr inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2646 (+ (car (cdr inactive)) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2647 (widget-put widget :inactive nil)))) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2648 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2649 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2650 (defun custom-face-edit-attribute-tag (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2651 "Returns the first :tag property in WIDGET or one of its children." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2652 (let ((tag (widget-get widget :tag))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2653 (or (and (not (equal tag "")) tag) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2654 (let ((children (widget-get widget :children))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2655 (while (and (null tag) children) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2656 (setq tag (custom-face-edit-attribute-tag (pop children)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2657 tag)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2658 |
17334 | 2659 ;;; The `custom-display' Widget. |
2660 | |
2661 (define-widget 'custom-display 'menu-choice | |
2662 "Select a display type." | |
2663 :tag "Display" | |
2664 :value t | |
2665 :help-echo "Specify frames where the face attributes should be used." | |
2666 :args '((const :tag "all" t) | |
2667 (checklist | |
2668 :offset 0 | |
2669 :extra-offset 9 | |
2670 :args ((group :sibling-args (:help-echo "\ | |
2671 Only match the specified window systems.") | |
2672 (const :format "Type: " | |
2673 type) | |
2674 (checklist :inline t | |
2675 :offset 0 | |
2676 (const :format "X " | |
2677 :sibling-args (:help-echo "\ | |
2678 The X11 Window System.") | |
2679 x) | |
2680 (const :format "PM " | |
2681 :sibling-args (:help-echo "\ | |
2682 OS/2 Presentation Manager.") | |
2683 pm) | |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2684 (const :format "W32 " |
17334 | 2685 :sibling-args (:help-echo "\ |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2686 Windows NT/9X.") |
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2687 w32) |
48633
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2688 (const :format "MAC " |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2689 :sibling-args (:help-echo "\ |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2690 Macintosh OS.") |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2691 mac) |
17334 | 2692 (const :format "DOS " |
2693 :sibling-args (:help-echo "\ | |
2694 Plain MS-DOS.") | |
2695 pc) | |
2696 (const :format "TTY%n" | |
2697 :sibling-args (:help-echo "\ | |
2698 Plain text terminals.") | |
2699 tty))) | |
2700 (group :sibling-args (:help-echo "\ | |
2701 Only match the frames with the specified color support.") | |
2702 (const :format "Class: " | |
2703 class) | |
2704 (checklist :inline t | |
2705 :offset 0 | |
2706 (const :format "Color " | |
2707 :sibling-args (:help-echo "\ | |
2708 Match color frames.") | |
2709 color) | |
2710 (const :format "Grayscale " | |
2711 :sibling-args (:help-echo "\ | |
2712 Match grayscale frames.") | |
2713 grayscale) | |
2714 (const :format "Monochrome%n" | |
2715 :sibling-args (:help-echo "\ | |
2716 Match frames with no color support.") | |
2717 mono))) | |
2718 (group :sibling-args (:help-echo "\ | |
2719 Only match frames with the specified intensity.") | |
2720 (const :format "\ | |
2721 Background brightness: " | |
2722 background) | |
2723 (checklist :inline t | |
2724 :offset 0 | |
2725 (const :format "Light " | |
2726 :sibling-args (:help-echo "\ | |
2727 Match frames with light backgrounds.") | |
2728 light) | |
2729 (const :format "Dark\n" | |
2730 :sibling-args (:help-echo "\ | |
2731 Match frames with dark backgrounds.") | |
45724
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2732 dark))) |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2733 (group :sibling-args (:help-echo "\ |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2734 Only match frames that support the specified face attributes.") |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2735 (const :format "Supports attributes:" supports) |
45725
abb237aa3c61
(custom-display): Use correct syntax for `supports' attributes.
Miles Bader <miles@gnu.org>
parents:
45724
diff
changeset
|
2736 (custom-face-edit :inline t :format "%n%v")))))) |
17334 | 2737 |
2738 ;;; The `custom-face' Widget. | |
2739 | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2740 (defface custom-face-tag-face |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2741 `((t (:weight bold :height 1.2 :inherit variable-pitch))) |
17334 | 2742 "Face used for face tags." |
17415 | 2743 :group 'custom-faces) |
17334 | 2744 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2745 (defcustom custom-face-default-form 'selected |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2746 "Default form of displaying face definition." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2747 :type '(choice (const all) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2748 (const selected) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2749 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2750 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2751 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2752 |
17334 | 2753 (define-widget 'custom-face 'custom |
2754 "Customize face." | |
2755 :sample-face 'custom-face-tag-face | |
2756 :help-echo "Set or reset this face." | |
28716
e9fb71a3e51d
(custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28700
diff
changeset
|
2757 :documentation-property #'face-doc-string |
17334 | 2758 :value-create 'custom-face-value-create |
2759 :action 'custom-face-action | |
18089 | 2760 :custom-category 'face |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2761 :custom-form nil ; defaults to value of `custom-face-default-form' |
17334 | 2762 :custom-set 'custom-face-set |
2763 :custom-save 'custom-face-save | |
2764 :custom-reset-current 'custom-redraw | |
2765 :custom-reset-saved 'custom-face-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2766 :custom-reset-standard 'custom-face-reset-standard |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2767 :custom-standard-value 'custom-face-standard-value |
17334 | 2768 :custom-menu 'custom-face-menu-create) |
2769 | |
25685 | 2770 (define-widget 'custom-face-all 'editable-list |
17334 | 2771 "An editable list of display specifications and attributes." |
2772 :entry-format "%i %d %v" | |
2773 :insert-button-args '(:help-echo "Insert new display specification here.") | |
2774 :append-button-args '(:help-echo "Append new display specification here.") | |
2775 :delete-button-args '(:help-echo "Delete this display specification.") | |
2776 :args '((group :format "%v" custom-display custom-face-edit))) | |
2777 | |
2778 (defconst custom-face-all (widget-convert 'custom-face-all) | |
2779 "Converted version of the `custom-face-all' widget.") | |
2780 | |
2781 (define-widget 'custom-display-unselected 'item | |
2782 "A display specification that doesn't match the selected display." | |
2783 :match 'custom-display-unselected-match) | |
2784 | |
2785 (defun custom-display-unselected-match (widget value) | |
2786 "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
|
2787 (not (face-spec-set-match-display value (selected-frame)))) |
17334 | 2788 |
25685 | 2789 (define-widget 'custom-face-selected 'group |
17334 | 2790 "Edit the attributes of the selected display in a face specification." |
2791 :args '((repeat :format "" | |
2792 :inline t | |
2793 (group custom-display-unselected sexp)) | |
2794 (group (sexp :format "") custom-face-edit) | |
2795 (repeat :format "" | |
2796 :inline t | |
2797 sexp))) | |
2798 | |
2799 (defconst custom-face-selected (widget-convert 'custom-face-selected) | |
2800 "Converted version of the `custom-face-selected' widget.") | |
2801 | |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2802 (defun custom-filter-face-spec (spec filter-index &optional default-filter) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2803 "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
|
2804 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
|
2805 `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
|
2806 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
|
2807 don't specify one." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2808 (mapcar (lambda (entry) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2809 ;; 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
|
2810 (let ((tests (car entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2811 (unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2812 ;; 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
|
2813 (if (listp (car (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2814 (car (cdr entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2815 (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2816 (filtered-attrs nil)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2817 ;; Filter each face attribute |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2818 (while unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2819 (let* ((attr (pop unfiltered-attrs)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2820 (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
|
2821 (filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2822 (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
|
2823 default-filter)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2824 (filtered-value |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2825 (if filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2826 (funcall filter pre-filtered-value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2827 pre-filtered-value))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2828 (push filtered-value filtered-attrs) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2829 (push attr filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2830 ;; |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2831 (list tests filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2832 spec)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2833 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2834 (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
|
2835 "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
|
2836 SPEC must be a full face spec." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2837 (custom-filter-face-spec spec 2)) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2838 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2839 (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
|
2840 "Return the customized SPEC in a form suitable for setting the face." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2841 (custom-filter-face-spec spec 3)) |
33843
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2842 |
17334 | 2843 (defun custom-face-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2844 "Create a list of the display specifications for WIDGET." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2845 (let ((buttons (widget-get widget :buttons)) |
25685 | 2846 children |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2847 (symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2848 (tag (widget-get widget :tag)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2849 (state (widget-get widget :custom-state)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2850 (begin (point)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2851 (is-last (widget-get widget :custom-last)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2852 (prefix (widget-get widget :custom-prefix))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2853 (unless tag |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2854 (setq tag (prin1-to-string symbol))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2855 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2856 (insert prefix (if is-last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2857 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2858 widget 'custom-browse-face-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2859 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2860 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2861 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2862 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2863 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2864 (insert tag) |
34041
40708840c132
(custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents:
33986
diff
changeset
|
2865 (widget-specify-sample widget begin (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2866 (if (eq custom-buffer-style 'face) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2867 (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
|
2868 (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
|
2869 (insert ":") |
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2870 (insert " face: "))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2871 ;; Sample. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2872 (push (widget-create-child-and-convert widget 'item |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2873 :format "(%{%t%})" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2874 :sample-face symbol |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2875 :tag "sample") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2876 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2877 ;; Visibility. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2878 (insert " ") |
25685 | 2879 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2880 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2881 :help-echo "Hide or show this face." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2882 :on "Hide Face" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2883 :off "Show Face" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2884 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2885 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2886 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2887 ;; Magic. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2888 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2889 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2890 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2891 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2892 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2893 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2894 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2895 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2896 (widget-default-format-handler widget ?h) |
25685 | 2897 ;; The comment field |
2898 (unless (eq state 'hidden) | |
2899 (let* ((comment (get symbol 'face-comment)) | |
2900 (comment-widget | |
2901 (widget-create-child-and-convert | |
2902 widget 'custom-comment | |
2903 :parent widget | |
2904 :value (or comment "")))) | |
2905 (widget-put widget :comment-widget comment-widget) | |
2906 (push comment-widget children))) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2907 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2908 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2909 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2910 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2911 (custom-add-see-also widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2912 ;; Editor. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2913 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2914 (insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2915 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2916 (message "Creating face editor...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2917 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2918 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2919 (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
|
2920 (let* ((symbol (widget-value widget)) |
40825
22caa22b7399
2001-11-07 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40801
diff
changeset
|
2921 (spec (or (get symbol 'customized-face) |
22caa22b7399
2001-11-07 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40801
diff
changeset
|
2922 (get symbol 'saved-face) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2923 (get symbol 'face-defface-spec) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2924 ;; Attempt to construct it. |
25685 | 2925 (list (list t (custom-face-attributes-get |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2926 symbol (selected-frame)))))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2927 (form (widget-get widget :custom-form)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2928 (indent (widget-get widget :indent)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2929 edit) |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2930 ;; 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
|
2931 ;; 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
|
2932 (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
|
2933 (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
|
2934 (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
|
2935 (setq edit (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2936 widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2937 (cond ((and (eq form 'selected) |
25685 | 2938 (widget-apply custom-face-selected |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2939 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2940 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2941 'custom-face-selected) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2942 ((and (not (eq form 'lisp)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2943 (widget-apply custom-face-all |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2944 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2945 'custom-face-all) |
25685 | 2946 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2947 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2948 'sexp)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2949 :value spec)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2950 (custom-face-state-set widget) |
25685 | 2951 (push edit children) |
2952 (widget-put widget :children children)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2953 (message "Creating face editor...done")))))) |
17334 | 2954 |
25685 | 2955 (defvar custom-face-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
2956 '(("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
|
2957 ("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
|
2958 ("Reset to Saved" custom-face-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2959 (lambda (widget) |
25685 | 2960 (or (get (widget-value widget) 'saved-face) |
2961 (get (widget-value widget) 'saved-face-comment)))) | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2962 ("Erase Customization" custom-face-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2963 (lambda (widget) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2964 (get (widget-value widget) 'face-defface-spec))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2965 ("---" ignore ignore) |
25685 | 2966 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2967 ("---" ignore ignore) | |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2968 ("Show all display specs" custom-face-edit-all |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2969 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2970 (not (eq (widget-get widget :custom-form) 'all)))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2971 ("Just current attributes" custom-face-edit-selected |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2972 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2973 (not (eq (widget-get widget :custom-form) 'selected)))) |
40801
f49e883aeab2
Backed out last change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40800
diff
changeset
|
2974 ("Show as Lisp expression" custom-face-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2975 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2976 (not (eq (widget-get widget :custom-form) 'lisp))))) |
17334 | 2977 "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
|
2978 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
|
2979 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
|
2980 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
|
2981 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
|
2982 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2983 |
2984 (defun custom-face-edit-selected (widget) | |
2985 "Edit selected attributes of the value of WIDGET." | |
2986 (widget-put widget :custom-state 'unknown) | |
2987 (widget-put widget :custom-form 'selected) | |
2988 (custom-redraw widget)) | |
2989 | |
2990 (defun custom-face-edit-all (widget) | |
2991 "Edit all attributes of the value of WIDGET." | |
2992 (widget-put widget :custom-state 'unknown) | |
2993 (widget-put widget :custom-form 'all) | |
2994 (custom-redraw widget)) | |
2995 | |
2996 (defun custom-face-edit-lisp (widget) | |
28130 | 2997 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2998 (widget-put widget :custom-state 'unknown) |
2999 (widget-put widget :custom-form 'lisp) | |
3000 (custom-redraw widget)) | |
3001 | |
3002 (defun custom-face-state-set (widget) | |
3003 "Set the state of WIDGET." | |
25685 | 3004 (let* ((symbol (widget-value widget)) |
3005 (comment (get symbol 'face-comment)) | |
51277
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3006 tmp temp |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3007 (state |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3008 (cond ((progn |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3009 (setq tmp (get symbol 'customized-face)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3010 (setq temp (get symbol 'customized-face-comment)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3011 (or tmp temp)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3012 (if (equal temp comment) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3013 'set |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3014 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3015 ((progn |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3016 (setq tmp (get symbol 'saved-face)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3017 (setq temp (get symbol 'saved-face-comment)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3018 (or tmp temp)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3019 (if (equal temp comment) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3020 'saved |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3021 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3022 ((get symbol 'face-defface-spec) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3023 (if (equal comment nil) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3024 'standard |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3025 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3026 (t |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3027 'rogue)))) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3028 ;; If the user called set-face-attribute to change the default |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3029 ;; for new frames, this face is "set outside of Customize". |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3030 (if (and (not (eq state 'rogue)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3031 (get symbol 'face-modified)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3032 (setq state 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3033 (widget-put widget :custom-state state))) |
17334 | 3034 |
3035 (defun custom-face-action (widget &optional event) | |
3036 "Show the menu for `custom-face' WIDGET. | |
3037 Optional EVENT is the location for the menu." | |
3038 (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
|
3039 (custom-toggle-hide widget) |
17334 | 3040 (let* ((completion-ignore-case t) |
3041 (symbol (widget-get widget :value)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3042 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3043 (custom-unlispify-tag-name symbol)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3044 (custom-menu-filter custom-face-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3045 widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3046 event))) |
17334 | 3047 (if answer |
3048 (funcall answer widget))))) | |
3049 | |
3050 (defun custom-face-set (widget) | |
3051 "Make the face attributes in WIDGET take effect." | |
3052 (let* ((symbol (widget-value widget)) | |
3053 (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
|
3054 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 3055 (comment-widget (widget-get widget :comment-widget)) |
3056 (comment (widget-value comment-widget))) | |
3057 (when (equal comment "") | |
3058 (setq comment nil) | |
3059 ;; 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
|
3060 (custom-comment-hide comment-widget)) |
17334 | 3061 (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
|
3062 (if (face-spec-choose value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3063 (face-spec-set symbol value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3064 ;; 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
|
3065 ;; something harmless instead. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3066 (face-spec-set symbol '((t :foreground unspecified)))) |
25685 | 3067 (put symbol 'customized-face-comment comment) |
3068 (put symbol 'face-comment comment) | |
17334 | 3069 (custom-face-state-set widget) |
3070 (custom-redraw-magic widget))) | |
3071 | |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
3072 (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
|
3073 "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
|
3074 (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
|
3075 (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
|
3076 |
17334 | 3077 (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
|
3078 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'." |
17334 | 3079 (let* ((symbol (widget-value widget)) |
3080 (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
|
3081 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 3082 (comment-widget (widget-get widget :comment-widget)) |
3083 (comment (widget-value comment-widget))) | |
3084 (when (equal comment "") | |
3085 (setq comment nil) | |
3086 ;; 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
|
3087 (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
|
3088 (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
|
3089 (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
|
3090 ;; 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
|
3091 ;; 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
|
3092 (face-spec-set symbol '((t :foreground unspecified)))) |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3093 (unless (eq (widget-get widget :custom-state) 'standard) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3094 (put symbol 'saved-face value)) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3095 (custom-push-theme 'theme-face symbol 'user 'set value) |
17334 | 3096 (put symbol 'customized-face nil) |
25685 | 3097 (put symbol 'face-comment comment) |
3098 (put symbol 'customized-face-comment nil) | |
3099 (put symbol 'saved-face-comment comment) | |
20262
c6532008f2a9
(custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents:
20174
diff
changeset
|
3100 (custom-save-all) |
17334 | 3101 (custom-face-state-set widget) |
3102 (custom-redraw-magic widget))) | |
3103 | |
3104 (defun custom-face-reset-saved (widget) | |
3105 "Restore WIDGET to the face's default attributes." | |
3106 (let* ((symbol (widget-value widget)) | |
3107 (child (car (widget-get widget :children))) | |
25685 | 3108 (value (get symbol 'saved-face)) |
3109 (comment (get symbol 'saved-face-comment)) | |
3110 (comment-widget (widget-get widget :comment-widget))) | |
3111 (unless (or value comment) | |
17334 | 3112 (error "No saved value for this face")) |
3113 (put symbol 'customized-face nil) | |
25685 | 3114 (put symbol 'customized-face-comment nil) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3115 (face-spec-set symbol value) |
25685 | 3116 (put symbol 'face-comment comment) |
17334 | 3117 (widget-value-set child value) |
25685 | 3118 ;; This call manages the comment visibility |
3119 (widget-value-set comment-widget (or comment "")) | |
17334 | 3120 (custom-face-state-set widget) |
3121 (custom-redraw-magic widget))) | |
3122 | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3123 (defun custom-face-standard-value (widget) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3124 (get (widget-value widget) 'face-defface-spec)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3125 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3126 (defun custom-face-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3127 "Restore WIDGET to the face's standard settings. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3128 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
|
3129 restoring it to the state of a face that has never been customized." |
17334 | 3130 (let* ((symbol (widget-value widget)) |
3131 (child (car (widget-get widget :children))) | |
25685 | 3132 (value (get symbol 'face-defface-spec)) |
3133 (comment-widget (widget-get widget :comment-widget))) | |
17334 | 3134 (unless value |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
3135 (error "No standard setting for this face")) |
17334 | 3136 (put symbol 'customized-face nil) |
25685 | 3137 (put symbol 'customized-face-comment nil) |
3138 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | |
17334 | 3139 (put symbol 'saved-face nil) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3140 (custom-push-theme 'theme-face symbol 'user 'reset 'standard) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3141 ;; Do not explictly save resets to standards without themes. |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3142 (if (null (cdr (get symbol 'theme-face))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3143 (put symbol 'theme-face nil)) |
25685 | 3144 (put symbol 'saved-face-comment nil) |
17334 | 3145 (custom-save-all)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3146 (face-spec-set symbol value) |
25685 | 3147 (put symbol 'face-comment nil) |
17334 | 3148 (widget-value-set child value) |
25685 | 3149 ;; This call manages the comment visibility |
3150 (widget-value-set comment-widget "") | |
17334 | 3151 (custom-face-state-set widget) |
3152 (custom-redraw-magic widget))) | |
3153 | |
3154 ;;; The `face' Widget. | |
3155 | |
3156 (define-widget 'face 'default | |
3157 "Select and customize a face." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3158 :convert-widget 'widget-value-convert-widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3159 :button-prefix 'widget-push-button-prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3160 :button-suffix 'widget-push-button-suffix |
33986 | 3161 :format "%{%t%}: %[select face%] %v" |
17334 | 3162 :tag "Face" |
3163 :value 'default | |
3164 :value-create 'widget-face-value-create | |
3165 :value-delete 'widget-face-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3166 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3167 :validate 'widget-children-validate |
17334 | 3168 :action 'widget-face-action |
28612
0051d3178111
(custom-face, face): Unquote the lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28568
diff
changeset
|
3169 :match (lambda (widget value) (symbolp value))) |
17334 | 3170 |
3171 (defun widget-face-value-create (widget) | |
28130 | 3172 "Create a `custom-face' child." |
17334 | 3173 (let* ((symbol (widget-value widget)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3174 (custom-buffer-style 'face) |
17334 | 3175 (child (widget-create-child-and-convert |
3176 widget 'custom-face | |
3177 :custom-level nil | |
3178 :value symbol))) | |
3179 (custom-magic-reset child) | |
3180 (setq custom-options (cons child custom-options)) | |
3181 (widget-put widget :children (list child)))) | |
3182 | |
3183 (defun widget-face-value-delete (widget) | |
28130 | 3184 "Remove the child from the options." |
17334 | 3185 (let ((child (car (widget-get widget :children)))) |
3186 (setq custom-options (delq child custom-options)) | |
3187 (widget-children-value-delete widget))) | |
3188 | |
3189 (defvar face-history nil | |
3190 "History of entered face names.") | |
3191 | |
3192 (defun widget-face-action (widget &optional event) | |
3193 "Prompt for a face." | |
3194 (let ((answer (completing-read "Face: " | |
3195 (mapcar (lambda (face) | |
3196 (list (symbol-name face))) | |
3197 (face-list)) | |
25685 | 3198 nil nil nil |
17334 | 3199 'face-history))) |
3200 (unless (zerop (length answer)) | |
3201 (widget-value-set widget (intern answer)) | |
3202 (widget-apply widget :notify widget event) | |
3203 (widget-setup)))) | |
3204 | |
3205 ;;; The `hook' Widget. | |
3206 | |
3207 (define-widget 'hook 'list | |
3208 "A emacs lisp hook" | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3209 :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
|
3210 (if (and value (symbolp value)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3211 (list value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3212 value)) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3213 :match (lambda (widget value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3214 (or (symbolp value) |
20174
e1ca1fe89e6e
(hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents:
20100
diff
changeset
|
3215 (widget-group-match widget value))) |
28130 | 3216 ;; Avoid adding undefined functions to the hook, especially for |
3217 ;; things like `find-file-hook' or even more basic ones, to avoid | |
3218 ;; chaos. | |
3219 :set (lambda (symbol value) | |
28310
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3220 (dolist (elt value) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3221 (if (fboundp elt) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3222 (add-hook symbol elt)))) |
17334 | 3223 :convert-widget 'custom-hook-convert-widget |
3224 :tag "Hook") | |
3225 | |
3226 (defun custom-hook-convert-widget (widget) | |
27250
807fc106b24c
(custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
26803
diff
changeset
|
3227 ;; Handle `:options'. |
17334 | 3228 (let* ((options (widget-get widget :options)) |
25685 | 3229 (other `(editable-list :inline t |
17334 | 3230 :entry-format "%i %d%v" |
3231 (function :format " %v"))) | |
3232 (args (if options | |
3233 (list `(checklist :inline t | |
3234 ,@(mapcar (lambda (entry) | |
3235 `(function-item ,entry)) | |
3236 options)) | |
3237 other) | |
3238 (list other)))) | |
3239 (widget-put widget :args args) | |
3240 widget)) | |
3241 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3242 ;;; The `custom-group-link' Widget. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3243 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3244 (define-widget 'custom-group-link 'link |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3245 "Show parent in other window when activated." |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3246 :help-echo "Create customization buffer for this group." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3247 :action 'custom-group-link-action) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3248 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3249 (defun custom-group-link-action (widget &rest ignore) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3250 (customize-group (widget-value widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3251 |
17334 | 3252 ;;; The `custom-group' Widget. |
3253 | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3254 (defcustom custom-group-tag-faces nil |
17334 | 3255 ;; In XEmacs, this ought to play games with font size. |
25685 | 3256 ;; Fixme: make it do so in Emacs. |
17334 | 3257 "Face used for group tags. |
3258 The first member is used for level 1 groups, the second for level 2, | |
3259 and so forth. The remaining group tags are shown with | |
3260 `custom-group-tag-face'." | |
3261 :type '(repeat face) | |
17415 | 3262 :group 'custom-faces) |
17334 | 3263 |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3264 (defface custom-group-tag-face-1 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3265 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3266 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3267 (:foreground "pink" :weight bold :height 1.2 :inherit variable-pitch)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3268 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3269 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3270 (:foreground "red" :weight bold :height 1.2 :inherit variable-pitch)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3271 (t (:weight bold))) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3272 "Face used for group tags." |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3273 :group 'custom-faces) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3274 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3275 (defface custom-group-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3276 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3277 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3278 (:foreground "light blue" :weight bold :height 1.2)) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3279 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3280 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3281 (:foreground "blue" :weight bold :height 1.2)) |
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3282 (t (:weight bold))) |
17334 | 3283 "Face used for low level group tags." |
17415 | 3284 :group 'custom-faces) |
17334 | 3285 |
3286 (define-widget 'custom-group 'custom | |
3287 "Customize group." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3288 :format "%v" |
17334 | 3289 :sample-face-get 'custom-group-sample-face-get |
3290 :documentation-property 'group-documentation | |
3291 :help-echo "Set or reset all members of this group." | |
3292 :value-create 'custom-group-value-create | |
3293 :action 'custom-group-action | |
18089 | 3294 :custom-category 'group |
17334 | 3295 :custom-set 'custom-group-set |
3296 :custom-save 'custom-group-save | |
3297 :custom-reset-current 'custom-group-reset-current | |
3298 :custom-reset-saved 'custom-group-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3299 :custom-reset-standard 'custom-group-reset-standard |
17334 | 3300 :custom-menu 'custom-group-menu-create) |
3301 | |
3302 (defun custom-group-sample-face-get (widget) | |
3303 ;; Use :sample-face. | |
3304 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) | |
3305 'custom-group-tag-face)) | |
3306 | |
18430
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3307 (define-widget 'custom-group-visibility 'visibility |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3308 "An indicator and manipulator for hidden group contents." |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3309 :create 'custom-group-visibility-create) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3310 |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3311 (defun custom-group-visibility-create (widget) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3312 (let ((visible (widget-value widget))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3313 (if visible |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3314 (insert "--------"))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3315 (widget-default-create widget)) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3316 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3317 (defun custom-group-members (symbol groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3318 "Return SYMBOL's custom group members. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3319 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
|
3320 (if (not groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3321 (get symbol 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3322 (let (members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3323 (dolist (entry (get symbol 'custom-group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3324 (when (eq (nth 1 entry) 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3325 (push entry members))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3326 (nreverse members)))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3327 |
17334 | 3328 (defun custom-group-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3329 "Insert a customize group for WIDGET in the current buffer." |
49126
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3330 (unless (eq (widget-get widget :custom-state) 'hidden) |
49300
b99be2b86231
(customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49218
diff
changeset
|
3331 (custom-load-widget widget)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3332 (let* ((state (widget-get widget :custom-state)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3333 (level (widget-get widget :custom-level)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3334 ;; (indent (widget-get widget :indent)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3335 (prefix (widget-get widget :custom-prefix)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3336 (buttons (widget-get widget :buttons)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3337 (tag (widget-get widget :tag)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3338 (symbol (widget-value widget)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3339 (members (custom-group-members symbol |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3340 (and (eq custom-buffer-style 'tree) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3341 custom-browse-only-groups)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3342 (cond ((and (eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3343 (eq state 'hidden) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3344 (or members (custom-unloaded-widget-p widget))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3345 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3346 (push (widget-create-child-and-convert |
25685 | 3347 widget 'custom-browse-visibility |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3348 ;; :tag-glyph "plus" |
18856
03eeb83520d8
(custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents:
18812
diff
changeset
|
3349 :tag "+") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3350 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3351 (insert "-- ") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3352 ;; (widget-glyph-insert nil "-- " "horizontal") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3353 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3354 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3355 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3356 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3357 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3358 ((and (eq custom-buffer-style 'tree) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3359 (zerop (length members))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3360 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3361 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3362 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3363 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3364 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3365 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3366 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3367 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3368 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3369 ((eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3370 (custom-browse-insert-prefix prefix) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3371 (if (zerop (length members)) |
25685 | 3372 (progn |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3373 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3374 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3375 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3376 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3377 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3378 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3379 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3380 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3381 (widget-put widget :buttons buttons)) |
25685 | 3382 (push (widget-create-child-and-convert |
3383 widget 'custom-browse-visibility | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3384 ;; :tag-glyph "minus" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3385 :tag "-") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3386 buttons) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3387 (insert "-\\ ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3388 ;; (widget-glyph-insert nil "-\\ " "top") |
25685 | 3389 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3390 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3391 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3392 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3393 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3394 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3395 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3396 custom-browse-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3397 custom-browse-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3398 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3399 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3400 (extra-prefix (if (widget-get widget :custom-last) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3401 " " |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3402 " | ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3403 (prefix (concat prefix extra-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3404 children entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3405 (while members |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3406 (setq entry (car members) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3407 members (cdr members)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3408 (push (widget-create-child-and-convert |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3409 widget (nth 1 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3410 :group widget |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3411 :tag (custom-unlispify-tag-name (nth 0 entry)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3412 :custom-prefixes custom-prefix-list |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3413 :custom-level (1+ level) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3414 :custom-last (null members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3415 :value (nth 0 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3416 :custom-prefix prefix) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3417 children)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3418 (widget-put widget :children (reverse children))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3419 (message "Creating group...done"))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3420 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3421 ((eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3422 ;; Create level indicator. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3423 (unless (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3424 (insert-char ?\ (* custom-buffer-indent (1- level))) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3425 (insert "-- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3426 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3427 (let ((begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3428 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3429 (widget-specify-sample widget begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3430 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3431 ;; Create link/visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3432 (if (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3433 (push (widget-create-child-and-convert |
25685 | 3434 widget 'custom-group-link |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3435 :tag "Go to Group" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3436 symbol) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3437 buttons) |
25685 | 3438 (push (widget-create-child-and-convert |
20100
0db4553d47cc
(custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents:
19886
diff
changeset
|
3439 widget 'custom-group-visibility |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3440 :help-echo "Show members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3441 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3442 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3443 buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3444 (insert " \n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3445 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3446 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3447 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3448 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3449 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3450 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3451 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3452 ;; Insert documentation. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3453 (if (and (eq custom-buffer-style 'links) (> level 1)) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3454 (widget-put widget :documentation-indent 0)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3455 (widget-default-format-handler widget ?h)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3456 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3457 (t ;Visible. |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3458 ;; 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
|
3459 (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
|
3460 ;;; 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
|
3461 (when (eq level 1) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
3462 (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
|
3463 "Go to parent group:") |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3464 (insert "\n")))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3465 ;; Create level indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3466 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3467 (insert "/- ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3468 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3469 (let ((start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3470 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3471 (widget-specify-sample widget start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3472 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3473 ;; Create visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3474 (unless (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3475 (insert "--------") |
25685 | 3476 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3477 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3478 :help-echo "Hide members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3479 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3480 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3481 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3482 (insert " ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3483 ;; Create more dashes. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3484 ;; Use 76 instead of 75 to compensate for the temporary "<" |
25685 | 3485 ;; added by `widget-insert'. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3486 (insert-char ?- (- 76 (current-column) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3487 (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3488 (insert "\\\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3489 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3490 (let ((magic (widget-create-child-and-convert |
25685 | 3491 widget 'custom-magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3492 :indent 0 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3493 nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3494 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3495 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3496 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3497 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3498 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3499 (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
|
3500 ;; Parent groups. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3501 (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
|
3502 ;;; 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
|
3503 (when (eq level 1) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3504 (insert-char ?\ custom-buffer-indent) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3505 (custom-add-parent-links widget))) |
25685 | 3506 (custom-add-see-also widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3507 (make-string (* custom-buffer-indent level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3508 ?\ )) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3509 ;; Members. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3510 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3511 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3512 custom-buffer-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3513 custom-buffer-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3514 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3515 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3516 (length (length members)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3517 (count 0) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3518 (children (mapcar (lambda (entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3519 (widget-insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3520 (message "\ |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3521 Creating group members... %2d%%" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3522 (/ (* 100.0 count) length)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3523 (setq count (1+ count)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3524 (prog1 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3525 (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3526 widget (nth 1 entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3527 :group widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3528 :tag (custom-unlispify-tag-name |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3529 (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3530 :custom-prefixes custom-prefix-list |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3531 :custom-level (1+ level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3532 :value (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3533 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3534 (widget-insert "\n")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3535 members))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3536 (message "Creating group magic...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3537 (mapc 'custom-magic-reset children) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3538 (message "Creating group state...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3539 (widget-put widget :children children) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3540 (custom-group-state-update widget) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3541 (message "Creating group... done")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3542 ;; End line |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3543 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3544 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3545 (insert "\\- " (widget-get widget :tag) " group end ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3546 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3547 (insert "/\n"))))) |
17334 | 3548 |
25685 | 3549 (defvar custom-group-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3550 '(("Set for Current Session" custom-group-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3551 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3552 (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
|
3553 ("Save for Future Sessions" custom-group-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3554 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3555 (memq (widget-get widget :custom-state) '(modified set)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3556 ("Reset to Current" custom-group-reset-current |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3557 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3558 (memq (widget-get widget :custom-state) '(modified)))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3559 ("Reset to Saved" custom-group-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3560 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3561 (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
|
3562 ("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
|
3563 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3564 (memq (widget-get widget :custom-state) '(modified set saved))))) |
17334 | 3565 "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
|
3566 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
|
3567 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
|
3568 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
|
3569 widget as an argument, and returns non-nil if ACTION is valid on that |
25685 | 3570 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3571 |
3572 (defun custom-group-action (widget &optional event) | |
3573 "Show the menu for `custom-group' WIDGET. | |
3574 Optional EVENT is the location for the menu." | |
3575 (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
|
3576 (custom-toggle-hide widget) |
17334 | 3577 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3578 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3579 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3580 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3581 (custom-menu-filter custom-group-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3582 widget) |
17334 | 3583 event))) |
3584 (if answer | |
3585 (funcall answer widget))))) | |
3586 | |
3587 (defun custom-group-set (widget) | |
3588 "Set changes in all modified group members." | |
3589 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3590 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3591 (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
|
3592 (widget-apply child :custom-set))) |
17334 | 3593 children ))) |
3594 | |
3595 (defun custom-group-save (widget) | |
3596 "Save all modified group members." | |
3597 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3598 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3599 (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
|
3600 (widget-apply child :custom-save))) |
17334 | 3601 children ))) |
3602 | |
3603 (defun custom-group-reset-current (widget) | |
3604 "Reset all modified group members." | |
3605 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3606 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3607 (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
|
3608 (widget-apply child :custom-reset-current))) |
17334 | 3609 children ))) |
3610 | |
3611 (defun custom-group-reset-saved (widget) | |
3612 "Reset all modified or set group members." | |
3613 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3614 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3615 (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
|
3616 (widget-apply child :custom-reset-saved))) |
17334 | 3617 children ))) |
3618 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3619 (defun custom-group-reset-standard (widget) |
17334 | 3620 "Reset all modified, set, or saved group members." |
3621 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3622 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3623 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3624 '(modified set saved)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3625 (widget-apply child :custom-reset-standard))) |
17334 | 3626 children ))) |
3627 | |
3628 (defun custom-group-state-update (widget) | |
3629 "Update magic." | |
3630 (unless (eq (widget-get widget :custom-state) 'hidden) | |
3631 (let* ((children (widget-get widget :children)) | |
3632 (states (mapcar (lambda (child) | |
3633 (widget-get child :custom-state)) | |
3634 children)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3635 (magics custom-magic-alist) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3636 (found 'standard)) |
17334 | 3637 (while magics |
3638 (let ((magic (car (car magics)))) | |
3639 (if (and (not (eq magic 'hidden)) | |
3640 (memq magic states)) | |
3641 (setq found magic | |
3642 magics nil) | |
3643 (setq magics (cdr magics))))) | |
3644 (widget-put widget :custom-state found))) | |
3645 (custom-magic-reset widget)) | |
3646 | |
3647 ;;; The `custom-save-all' Function. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
3648 ;;;###autoload |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3649 (defcustom custom-file nil |
17334 | 3650 "File used for storing customization information. |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3651 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
|
3652 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
|
3653 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
|
3654 |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3655 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
|
3656 \(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
|
3657 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
|
3658 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
|
3659 :type '(choice (const :tag "Your Emacs init file" nil) file) |
17334 | 3660 :group 'customize) |
3661 | |
20974 | 3662 (defun custom-file () |
3663 "Return the file name for saving customizations." | |
37911
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3664 (setq custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3665 (or custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3666 (let ((user-init-file user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3667 (default-init-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3668 (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3669 (when (null user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3670 (if (or (file-exists-p default-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3671 (and (eq system-type 'windows-nt) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3672 (file-exists-p "~/_emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3673 ;; Started with -q, i.e. the file containing |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3674 ;; Custom settings hasn't been read. Saving |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3675 ;; settings there would overwrite other settings. |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3676 (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3677 (setq user-init-file default-init-file)) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3678 user-init-file)))) |
20974 | 3679 |
17334 | 3680 (defun custom-save-delete (symbol) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3681 "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
|
3682 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
|
3683 or (if there were none) at the end of the buffer." |
48243
dd12a68149b5
(custom-save-delete): Force emacs-lisp-mode.
Juanma Barranquero <lekktu@gmail.com>
parents:
47823
diff
changeset
|
3684 (let ((default-major-mode 'emacs-lisp-mode)) |
20974 | 3685 (set-buffer (find-file-noselect (custom-file)))) |
17334 | 3686 (goto-char (point-min)) |
25058
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3687 ;; Skip all whitespace and comments. |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3688 (while (forward-comment 1)) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3689 (or (eobp) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3690 (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
|
3691 (let (first) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3692 (catch 'found |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3693 (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
|
3694 ;; Skip all whitespace and comments. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3695 (while (forward-comment 1)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3696 (let ((start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3697 (sexp (condition-case nil |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3698 (read (current-buffer)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3699 (end-of-file (throw 'found nil))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3700 (when (and (listp sexp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3701 (eq (car sexp) symbol)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3702 (delete-region start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3703 (unless first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3704 (setq first (point))))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3705 (if first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3706 (goto-char first) |
36628
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3707 ;; 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
|
3708 ;; entries would make them ineffective. |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3709 (let ((pos (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3710 (case-fold-search t)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3711 (save-excursion |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3712 (goto-char (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3713 (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
|
3714 'move) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3715 (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
|
3716 (setq pos (line-beginning-position)))) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3717 (goto-char pos))))) |
17334 | 3718 |
3719 (defun custom-save-variables () | |
3720 "Save all customized variables in `custom-file'." | |
3721 (save-excursion | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3722 (custom-save-delete 'custom-load-themes) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3723 (custom-save-delete 'custom-reset-variables) |
17334 | 3724 (custom-save-delete 'custom-set-variables) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3725 (custom-save-loaded-themes) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3726 (custom-save-resets 'theme-value 'custom-reset-variables nil) |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3727 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3728 (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
|
3729 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3730 ;; 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
|
3731 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3732 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3733 (if (get symbol 'saved-value) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3734 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3735 (setq saved-list (sort (cdr saved-list) 'string<)) |
17334 | 3736 (unless (bolp) |
3737 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3738 (princ "(custom-set-variables |
47315
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3739 ;; custom-set-variables was added by Custom. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3740 ;; If you edit it by hand, you could mess it up, so be careful. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3741 ;; Your init file should contain only one such instance. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3742 ;; If there is more than one, they won't work right.\n") |
49556
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3743 (dolist (symbol saved-list) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3744 (let ((spec (car-safe (get symbol 'theme-value))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3745 (value (get symbol 'saved-value)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3746 (requests (get symbol 'custom-requests)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3747 (now (not (or (custom-variable-p symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3748 (and (not (boundp symbol)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3749 (not (eq (get symbol 'force-value) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3750 'rogue)))))) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
3751 (comment (get symbol 'saved-variable-comment))) |
49556
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3752 ;; Check `requests'. |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3753 (dolist (request requests) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3754 (when (and (symbolp request) (not (featurep request))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3755 (message "Unknown requested feature: %s" request) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3756 (setq requests (delq request requests)))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3757 (when (or (and spec |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3758 (eq (nth 0 spec) 'user) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3759 (eq (nth 1 spec) 'set)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3760 comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3761 (and (null spec) (get symbol 'saved-value))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3762 (unless (bolp) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3763 (princ "\n")) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3764 (princ " '(") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3765 (prin1 symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3766 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3767 (prin1 (car value)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3768 (when (or now requests comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3769 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3770 (prin1 now) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3771 (when (or requests comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3772 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3773 (prin1 requests) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3774 (when comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3775 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3776 (prin1 comment)))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3777 (princ ")")))) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3778 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3779 (princ " ")) |
17334 | 3780 (princ ")") |
3781 (unless (looking-at "\n") | |
3782 (princ "\n"))))) | |
3783 | |
3784 (defun custom-save-faces () | |
3785 "Save all customized faces in `custom-file'." | |
3786 (save-excursion | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3787 (custom-save-delete 'custom-reset-faces) |
17334 | 3788 (custom-save-delete 'custom-set-faces) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3789 (custom-save-resets 'theme-face 'custom-reset-faces '(default)) |
25059
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3790 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3791 (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
|
3792 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3793 ;; 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
|
3794 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3795 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3796 (if (get symbol 'saved-face) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3797 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3798 (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
|
3799 ;; 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
|
3800 (if (memq 'default saved-list) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3801 (setq saved-list (cons 'default (delq 'default saved-list)))) |
17334 | 3802 (unless (bolp) |
3803 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3804 (princ "(custom-set-faces |
47315
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3805 ;; custom-set-faces was added by Custom. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3806 ;; If you edit it by hand, you could mess it up, so be careful. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3807 ;; Your init file should contain only one such instance. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3808 ;; If there is more than one, they won't work right.\n") |
49556
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3809 (dolist (symbol saved-list) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3810 (let ((spec (car-safe (get symbol 'theme-face))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3811 (value (get symbol 'saved-face)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3812 (now (not (or (get symbol 'face-defface-spec) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3813 (and (not (custom-facep symbol)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3814 (not (get symbol 'force-face)))))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3815 (comment (get symbol 'saved-face-comment))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3816 (when (or (and spec |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3817 (eq (nth 0 spec) 'user) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3818 (eq (nth 1 spec) 'set)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3819 comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3820 (and (null spec) (get symbol 'saved-face))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3821 ;; Don't print default face here. |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3822 (unless (bolp) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3823 (princ "\n")) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3824 (princ " '(") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3825 (prin1 symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3826 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3827 (prin1 value) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3828 (when (or now comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3829 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3830 (prin1 now) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3831 (when comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3832 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3833 (prin1 comment))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3834 (princ ")")))) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3835 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3836 (princ " ")) |
17334 | 3837 (princ ")") |
3838 (unless (looking-at "\n") | |
48958
6b4f6412de76
(custom-save-faces): Fix typo.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48949
diff
changeset
|
3839 (princ "\n"))))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3840 |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3841 (defun custom-save-resets (property setter special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3842 (let (started-writing ignored-special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3843 ;; (custom-save-delete setter) Done by caller |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3844 (let ((standard-output (current-buffer)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3845 (mapper `(lambda (object) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3846 (let ((spec (car-safe (get object (quote ,property))))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3847 (when (and (not (memq object ignored-special)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3848 (eq (nth 0 spec) 'user) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3849 (eq (nth 1 spec) 'reset)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3850 ;; Do not write reset statements unless necessary. |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3851 (unless started-writing |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3852 (setq started-writing t) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3853 (unless (bolp) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3854 (princ "\n")) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3855 (princ "(") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3856 (princ (quote ,setter)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3857 (princ "\n '(") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3858 (prin1 object) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3859 (princ " ") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3860 (prin1 (nth 3 spec)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3861 (princ ")"))))))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3862 (mapc mapper special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3863 (setq ignored-special special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3864 (mapatoms mapper) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3865 (when started-writing |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3866 (princ ")\n"))))) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
3867 |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3868 (defun custom-save-loaded-themes () |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3869 (let ((themes (reverse (get 'user 'theme-loads-themes))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3870 (standard-output (current-buffer))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3871 (when themes |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3872 (unless (bolp) (princ "\n")) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3873 (princ "(custom-load-themes") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3874 (mapc (lambda (theme) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3875 (princ "\n '") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3876 (prin1 theme)) themes) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
3877 (princ " )\n")))) |
17334 | 3878 |
3879 ;;;###autoload | |
18436
2163f03bb88f
(customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents:
18435
diff
changeset
|
3880 (defun customize-save-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3881 "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
|
3882 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3883 (mapatoms (lambda (symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3884 (let ((face (get symbol 'customized-face)) |
25685 | 3885 (value (get symbol 'customized-value)) |
3886 (face-comment (get symbol 'customized-face-comment)) | |
3887 (variable-comment | |
3888 (get symbol 'customized-variable-comment))) | |
3889 (when face | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3890 (put symbol 'saved-face face) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3891 (custom-push-theme 'theme-face symbol 'user 'set value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3892 (put symbol 'customized-face nil)) |
25685 | 3893 (when value |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3894 (put symbol 'saved-value value) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3895 (custom-push-theme 'theme-value symbol 'user 'set value) |
25685 | 3896 (put symbol 'customized-value nil)) |
3897 (when variable-comment | |
3898 (put symbol 'saved-variable-comment variable-comment) | |
3899 (put symbol 'customized-variable-comment nil)) | |
3900 (when face-comment | |
3901 (put symbol 'saved-face-comment face-comment) | |
3902 (put symbol 'customized-face-comment nil))))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3903 ;; We really should update all custom buffers here. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3904 (custom-save-all)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3905 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3906 ;;;###autoload |
17334 | 3907 (defun custom-save-all () |
3908 "Save all customizations in `custom-file'." | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3909 (let ((inhibit-read-only t)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3910 (custom-save-variables) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3911 (custom-save-faces) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3912 (save-excursion |
20398
47f326ffb7ba
(custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents:
20397
diff
changeset
|
3913 (let ((default-major-mode nil)) |
20974 | 3914 (set-buffer (find-file-noselect (custom-file)))) |
42930
09e1ef4107e7
(custom-save-all): Bind file-precious-flag to t for saving .emacs.
Richard M. Stallman <rms@gnu.org>
parents:
42451
diff
changeset
|
3915 (let ((file-precious-flag t)) |
09e1ef4107e7
(custom-save-all): Bind file-precious-flag to t for saving .emacs.
Richard M. Stallman <rms@gnu.org>
parents:
42451
diff
changeset
|
3916 (save-buffer))))) |
17334 | 3917 |
3918 ;;; The Customize Menu. | |
3919 | |
17415 | 3920 ;;; Menu support |
3921 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3922 (defcustom custom-menu-nesting 2 |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3923 "Maximum nesting in custom menus." |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3924 :type 'integer |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3925 :group 'custom-menu) |
17334 | 3926 |
3927 (defun custom-face-menu-create (widget symbol) | |
3928 "Ignoring WIDGET, create a menu entry for customization face SYMBOL." | |
3929 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3930 `(customize-face ',symbol) |
17334 | 3931 t)) |
3932 | |
3933 (defun custom-variable-menu-create (widget symbol) | |
3934 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL." | |
3935 (let ((type (get symbol 'custom-type))) | |
3936 (unless (listp type) | |
3937 (setq type (list type))) | |
3938 (if (and type (widget-get type :custom-menu)) | |
3939 (widget-apply type :custom-menu symbol) | |
3940 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3941 `(customize-variable ',symbol) |
17334 | 3942 t)))) |
3943 | |
17415 | 3944 ;; Add checkboxes to boolean variable entries. |
17334 | 3945 (widget-put (get 'boolean 'widget-type) |
3946 :custom-menu (lambda (widget symbol) | |
3947 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3948 `(customize-variable ',symbol) |
17334 | 3949 ':style 'toggle |
3950 ':selected symbol))) | |
3951 | |
30184
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3952 (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
|
3953 "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
|
3954 `( ,(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
|
3955 :filter (lambda (&rest junk) |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3956 (let ((menu (custom-menu-create ',symbol))) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3957 (if (consp menu) (cdr menu) menu))))) |
17334 | 3958 |
17415 | 3959 ;;;###autoload |
3960 (defun custom-menu-create (symbol) | |
17334 | 3961 "Create menu for customization group SYMBOL. |
3962 The menu is in a format applicable to `easy-menu-define'." | |
17415 | 3963 (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
|
3964 `(customize-group ',symbol) |
17415 | 3965 t))) |
3966 (if (and (or (not (boundp 'custom-menu-nesting)) | |
3967 (>= custom-menu-nesting 0)) | |
49126
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3968 (progn |
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3969 (custom-load-symbol symbol) |
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3970 (< (length (get symbol 'custom-group)) widget-menu-max-size))) |
17334 | 3971 (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
|
3972 custom-prefix-list)) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3973 (members (custom-sort-items (get symbol 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3974 custom-menu-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3975 custom-menu-order-groups))) |
17334 | 3976 `(,(custom-unlispify-menu-entry symbol t) |
3977 ,item | |
3978 "--" | |
3979 ,@(mapcar (lambda (entry) | |
3980 (widget-apply (if (listp (nth 1 entry)) | |
3981 (nth 1 entry) | |
3982 (list (nth 1 entry))) | |
3983 :custom-menu (nth 0 entry))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3984 members))) |
17334 | 3985 item))) |
3986 | |
3987 ;;;###autoload | |
17415 | 3988 (defun customize-menu-create (symbol &optional name) |
3989 "Return a customize menu for customization group SYMBOL. | |
25685 | 3990 If optional NAME is given, use that as the name of the menu. |
17415 | 3991 Otherwise the menu will be named `Customize'. |
3992 The format is suitable for use with `easy-menu-define'." | |
3993 (unless name | |
3994 (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
|
3995 `(,name |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3996 :filter (lambda (&rest junk) |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3997 (let ((menu (custom-menu-create ',symbol))) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3998 (if (consp menu) (cdr menu) menu))))) |
17334 | 3999 |
17415 | 4000 ;;; The Custom Mode. |
4001 | |
4002 (defvar custom-mode-map nil | |
4003 "Keymap for `custom-mode'.") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4004 |
17415 | 4005 (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
|
4006 ;; 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
|
4007 ;; "\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
|
4008 (setq custom-mode-map (make-sparse-keymap)) |
17415 | 4009 (set-keymap-parent custom-mode-map widget-keymap) |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
4010 (suppress-keymap custom-mode-map) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4011 (define-key custom-mode-map " " 'scroll-up) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4012 (define-key custom-mode-map "\177" 'scroll-down) |
25685 | 4013 (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
|
4014 (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
|
4015 (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
|
4016 (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
|
4017 (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
|
4018 |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4019 (defun Custom-move-and-invoke (event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4020 "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
|
4021 (interactive "e") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4022 (mouse-set-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4023 (if (widget-event-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4024 (let* ((pos (widget-event-point event)) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4025 (button (get-char-property pos 'button))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4026 (if button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4027 (widget-button-click event))))) |
17415 | 4028 |
25685 | 4029 (easy-menu-define Custom-mode-menu |
17415 | 4030 custom-mode-map |
4031 "Menu used in customization buffers." | |
4032 `("Custom" | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
4033 ,(customize-menu-create 'customize) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4034 ["Set" Custom-set t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4035 ["Save" Custom-save t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4036 ["Reset to Current" Custom-reset-current t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4037 ["Reset to Saved" Custom-reset-saved t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4038 ["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
|
4039 ["Info" (Info-goto-node "(emacs)Easy Customization") t])) |
17415 | 4040 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4041 (defun Custom-goto-parent () |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4042 "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
|
4043 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
|
4044 (interactive) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4045 (save-excursion |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4046 (goto-char (point-min)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4047 (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
|
4048 (let* ((button (get-char-property (point) 'button)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4049 (parent (downcase (widget-get button :tag)))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4050 (customize-group parent))))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4051 |
17415 | 4052 (defcustom custom-mode-hook nil |
25685 | 4053 "Hook called when entering Custom mode." |
17415 | 4054 :type 'hook |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
4055 :group 'custom-buffer ) |
17415 | 4056 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4057 (defun custom-state-buffer-message (widget) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4058 (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
|
4059 (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
|
4060 |
17415 | 4061 (defun custom-mode () |
4062 "Major mode for editing customization buffers. | |
4063 | |
4064 The following commands are available: | |
4065 | |
4066 Move to next button or editable field. \\[widget-forward] | |
4067 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
|
4068 \\<widget-field-keymap>\ |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
4069 Complete content of editable text field. \\[widget-complete] |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
4070 \\<custom-mode-map>\ |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4071 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
|
4072 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
|
4073 Set all modifications. \\[Custom-set] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4074 Make all modifications default. \\[Custom-save] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4075 Reset all modified options. \\[Custom-reset-current] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4076 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
|
4077 Reset all options. \\[Custom-reset-standard] |
17415 | 4078 |
4079 Entry to this mode calls the value of `custom-mode-hook' | |
4080 if that value is non-nil." | |
4081 (kill-all-local-variables) | |
4082 (setq major-mode 'custom-mode | |
4083 mode-name "Custom") | |
4084 (use-local-map custom-mode-map) | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4085 (easy-menu-add Custom-mode-menu) |
17415 | 4086 (make-local-variable 'custom-options) |
50283
73ab8e5b6d65
2003-03-24 Luc Teirlinck <teirllm@mail.auburn.edu>
John Paul Wallington <jpw@pobox.com>
parents:
50077
diff
changeset
|
4087 (make-local-variable 'custom-local-buffer) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4088 (make-local-variable 'widget-documentation-face) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4089 (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
|
4090 (make-local-variable 'widget-button-face) |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
4091 (setq widget-button-face 'custom-button-face) |
25685 | 4092 (set (make-local-variable 'widget-button-pressed-face) |
4093 'custom-button-pressed-face) | |
4094 (set (make-local-variable 'widget-mouse-face) | |
4095 'custom-button-pressed-face) ; buttons `depress' when moused | |
4096 ;; When possible, use relief for buttons, not bracketing. This test | |
4097 ;; may not be optimal. | |
4098 (when custom-raised-buttons | |
4099 (set (make-local-variable 'widget-push-button-prefix) "") | |
4100 (set (make-local-variable 'widget-push-button-suffix) "") | |
4101 (set (make-local-variable 'widget-link-prefix) "") | |
4102 (set (make-local-variable 'widget-link-suffix) "")) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4103 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t) |
17415 | 4104 (run-hooks 'custom-mode-hook)) |
17334 | 4105 |
32904
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
4106 (put 'custom-mode 'mode-class 'special) |
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
4107 |
28130 | 4108 (add-to-list |
4109 'debug-ignored-errors | |
4110 "^No user options have changed defaults in recent Emacs versions$") | |
4111 | |
17334 | 4112 ;;; The End. |
4113 | |
4114 (provide 'cus-edit) | |
4115 | |
52401 | 4116 ;;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f |
25685 | 4117 ;;; cus-edit.el ends here |