Mercurial > emacs
annotate lisp/cus-edit.el @ 53285:2d8ed1a93299
*** empty log message ***
author | Markus Rost <rost@math.uni-bielefeld.de> |
---|---|
date | Wed, 24 Dec 2003 23:19:04 +0000 |
parents | 1fa5a4fc03e5 |
children | 36b31fc002f2 |
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)) |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1959 (parents nil)) |
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) |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1970 (setq parents (cons symbol parents)))))) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1971 (and (null (get symbol 'custom-links)) ;No links of its own. |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1972 (= (length parents) 1) ;A single parent. |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1973 (let ((links (get (car parents) 'custom-links))) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1974 (when links |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1975 (insert "\nParent documentation: ") |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1976 (while links |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1977 (push (widget-create-child-and-convert widget (car links)) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1978 buttons) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1979 (setq links (cdr links)) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1980 (cond ((null links) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1981 (insert ".\n")) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1982 ((null (cdr links)) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1983 (if many |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1984 (insert ", and ") |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1985 (insert " and "))) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1986 (t |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1987 (insert ", "))))))) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1988 (if parents |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1989 (insert "\n") |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1990 (delete-region start (point))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1991 (widget-put widget :buttons buttons) |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1992 parents)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1993 |
25685 | 1994 ;;; The `custom-comment' Widget. |
1995 | |
1996 ;; like the editable field | |
1997 (defface custom-comment-face '((((class grayscale color) | |
1998 (background light)) | |
1999 (:background "gray85")) | |
2000 (((class grayscale color) | |
2001 (background dark)) | |
2002 (:background "dim gray")) | |
2003 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2004 (:slant italic))) |
25685 | 2005 "Face used for comments on variables or faces" |
2006 :version "21.1" | |
2007 :group 'custom-faces) | |
2008 | |
2009 ;; like font-lock-comment-face | |
2010 (defface custom-comment-tag-face | |
2011 '((((class color) (background dark)) (:foreground "gray80")) | |
2012 (((class color) (background light)) (:foreground "blue4")) | |
2013 (((class grayscale) (background light)) | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2014 (:foreground "DimGray" :weight bold :slant italic)) |
25685 | 2015 (((class grayscale) (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2016 (: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
|
2017 (t (:weight bold))) |
25685 | 2018 "Face used for variables or faces comment tags" |
2019 :group 'custom-faces) | |
2020 | |
2021 (define-widget 'custom-comment 'string | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2022 "User comment." |
25685 | 2023 :tag "Comment" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2024 :help-echo "Edit a comment here." |
25685 | 2025 :sample-face 'custom-comment-tag-face |
2026 :value-face 'custom-comment-face | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2027 :shown nil |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2028 :create 'custom-comment-create) |
25685 | 2029 |
2030 (defun custom-comment-create (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2031 (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
|
2032 (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
|
2033 (not null-comment)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2034 (widget-default-create widget) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2035 ;; `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
|
2036 ;; maybe it shouldn't. |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2037 (widget-put widget :from (point-marker)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2038 (widget-put widget :to (point-marker))))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2039 |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2040 (defun custom-comment-hide (widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2041 (widget-put (widget-get widget :parent) :comment-shown nil)) |
25685 | 2042 |
2043 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's | |
2044 ;; the global custom one | |
2045 (defun custom-comment-show (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2046 (widget-put widget :comment-shown t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2047 (custom-redraw widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2048 (widget-setup)) |
25685 | 2049 |
2050 (defun custom-comment-invisible-p (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2051 (let ((val (widget-value (widget-get widget :comment-widget)))) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2052 (and (equal "" val) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2053 (not (widget-get widget :comment-shown))))) |
25685 | 2054 |
17334 | 2055 ;;; The `custom-variable' Widget. |
2056 | |
28130 | 2057 ;; When this was underlined blue, users confused it with a |
2058 ;; Mosaic-style hyperlink... | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2059 (defface custom-variable-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2060 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2061 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2062 (: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
|
2063 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2064 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2065 (: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
|
2066 (t (:weight bold))) |
17334 | 2067 "Face used for unpushable variable tags." |
17415 | 2068 :group 'custom-faces) |
17334 | 2069 |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2070 (defface custom-variable-button-face '((t (:underline t :weight bold))) |
17334 | 2071 "Face used for pushable variable tags." |
17415 | 2072 :group 'custom-faces) |
17334 | 2073 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2074 (defcustom custom-variable-default-form 'edit |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2075 "Default form of displaying variable values." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2076 :type '(choice (const edit) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2077 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2078 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2079 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2080 |
17334 | 2081 (define-widget 'custom-variable 'custom |
2082 "Customize variable." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2083 :format "%v" |
17334 | 2084 :help-echo "Set or reset this variable." |
2085 :documentation-property 'variable-documentation | |
18089 | 2086 :custom-category 'option |
17334 | 2087 :custom-state nil |
2088 :custom-menu 'custom-variable-menu-create | |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2089 :custom-form nil ; defaults to value of `custom-variable-default-form' |
17334 | 2090 :value-create 'custom-variable-value-create |
2091 :action 'custom-variable-action | |
2092 :custom-set 'custom-variable-set | |
2093 :custom-save 'custom-variable-save | |
2094 :custom-reset-current 'custom-redraw | |
2095 :custom-reset-saved 'custom-variable-reset-saved | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2096 :custom-reset-standard 'custom-variable-reset-standard |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2097 :custom-standard-value 'custom-variable-standard-value) |
17334 | 2098 |
17415 | 2099 (defun custom-variable-type (symbol) |
2100 "Return a widget suitable for editing the value of SYMBOL. | |
25685 | 2101 If SYMBOL has a `custom-type' property, use that. |
17415 | 2102 Otherwise, look up symbol in `custom-guess-type-alist'." |
2103 (let* ((type (or (get symbol 'custom-type) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2104 (and (not (get symbol 'standard-value)) |
17415 | 2105 (custom-guess-type symbol)) |
2106 'sexp)) | |
2107 (options (get symbol 'custom-options)) | |
2108 (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
|
2109 (copy-sequence type) |
17415 | 2110 (list type)))) |
2111 (when options | |
2112 (widget-put tmp :options options)) | |
2113 tmp)) | |
2114 | |
17334 | 2115 (defun custom-variable-value-create (widget) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2116 "Here is where you edit the variable's value." |
17334 | 2117 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2118 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2119 (widget-put widget :custom-form custom-variable-default-form)) |
17334 | 2120 (let* ((buttons (widget-get widget :buttons)) |
2121 (children (widget-get widget :children)) | |
2122 (form (widget-get widget :custom-form)) | |
2123 (state (widget-get widget :custom-state)) | |
2124 (symbol (widget-get widget :value)) | |
2125 (tag (widget-get widget :tag)) | |
17415 | 2126 (type (custom-variable-type symbol)) |
17334 | 2127 (conv (widget-convert type)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2128 (get (or (get symbol 'custom-get) 'default-value)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2129 (prefix (widget-get widget :custom-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2130 (last (widget-get widget :custom-last)) |
17334 | 2131 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2132 (funcall get symbol) |
17334 | 2133 (widget-get conv :value)))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2134 ;; If the widget is new, the child determines whether it is hidden. |
17334 | 2135 (cond (state) |
2136 ((custom-show type value) | |
2137 (setq state 'unknown)) | |
2138 (t | |
2139 (setq state 'hidden))) | |
2140 ;; If we don't know the state, see if we need to edit it in lisp form. | |
2141 (when (eq state 'unknown) | |
2142 (unless (widget-apply conv :match value) | |
2143 ;; (widget-apply (widget-convert type) :match value) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2144 (setq form 'mismatch))) |
17334 | 2145 ;; Now we can create the child widget. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2146 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2147 (insert prefix (if last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2148 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2149 widget 'custom-browse-variable-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2150 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2151 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2152 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2153 ((eq state 'hidden) |
17334 | 2154 ;; Indicate hidden value. |
25685 | 2155 (push (widget-create-child-and-convert |
17334 | 2156 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2157 :format "%{%t%}: " |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2158 :sample-face 'custom-variable-tag-face |
17334 | 2159 :tag tag |
2160 :parent widget) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2161 buttons) |
25685 | 2162 (push (widget-create-child-and-convert |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2163 widget 'visibility |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2164 :help-echo "Show the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2165 :off "Show Value" |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2166 :action 'custom-toggle-parent |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2167 nil) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2168 buttons)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2169 ((memq form '(lisp mismatch)) |
17334 | 2170 ;; In lisp mode edit the saved value when possible. |
2171 (let* ((value (cond ((get symbol 'saved-value) | |
2172 (car (get symbol 'saved-value))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2173 ((get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2174 (car (get symbol 'standard-value))) |
17334 | 2175 ((default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2176 (custom-quote (funcall get symbol))) |
17334 | 2177 (t |
2178 (custom-quote (widget-get conv :value)))))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2179 (insert (symbol-name symbol) ": ") |
25685 | 2180 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2181 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2182 :help-echo "Hide the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2183 :on "Hide Value" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2184 :off "Show Value" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2185 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2186 t) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2187 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2188 (insert " ") |
25685 | 2189 (push (widget-create-child-and-convert |
2190 widget 'sexp | |
17334 | 2191 :button-face 'custom-variable-button-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2192 :format "%v" |
17334 | 2193 :tag (symbol-name symbol) |
2194 :parent widget | |
2195 :value value) | |
2196 children))) | |
2197 (t | |
2198 ;; Edit mode. | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2199 (let* ((format (widget-get type :format)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2200 tag-format value-format) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2201 (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
|
2202 (error "Bad format")) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2203 (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
|
2204 (setq value-format (substring format (match-end 0))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2205 (push (widget-create-child-and-convert |
25685 | 2206 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2207 :format tag-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2208 :action 'custom-tag-action |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2209 :help-echo "Change value of this option." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2210 :mouse-down-action 'custom-tag-mouse-down-action |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2211 :button-face 'custom-variable-button-face |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2212 :sample-face 'custom-variable-tag-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2213 tag) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2214 buttons) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2215 (insert " ") |
25685 | 2216 (push (widget-create-child-and-convert |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2217 widget 'visibility |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2218 :help-echo "Hide the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2219 :on "Hide Value" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2220 :off "Show Value" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2221 :action 'custom-toggle-parent |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2222 t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2223 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2224 (push (widget-create-child-and-convert |
25685 | 2225 widget type |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2226 :format value-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2227 :value value) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2228 children)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2229 (unless (eq custom-buffer-style 'tree) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2230 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2231 (widget-insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2232 ;; Create the magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2233 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2234 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2235 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2236 (push magic buttons)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2237 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property |
25685 | 2238 ;; before the call to `widget-default-format-handler'. Otherwise, I |
2239 ;; loose my current `buttons'. This function shouldn't be called like | |
2240 ;; this anyway. The doc string widget should be added like the others. | |
2241 ;; --dv | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2242 (widget-put widget :buttons buttons) |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2243 (insert "\n") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2244 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2245 (widget-default-format-handler widget ?h) |
25685 | 2246 |
2247 ;; The comment field | |
2248 (unless (eq state 'hidden) | |
2249 (let* ((comment (get symbol 'variable-comment)) | |
2250 (comment-widget | |
2251 (widget-create-child-and-convert | |
2252 widget 'custom-comment | |
2253 :parent widget | |
2254 :value (or comment "")))) | |
2255 (widget-put widget :comment-widget comment-widget) | |
2256 ;; Don't push it !!! Custom assumes that the first child is the | |
2257 ;; value one. | |
2258 (setq children (append children (list comment-widget))))) | |
2259 ;; Update the rest of the properties properties. | |
2260 (widget-put widget :custom-form form) | |
2261 (widget-put widget :children children) | |
2262 ;; Now update the state. | |
2263 (if (eq state 'hidden) | |
2264 (widget-put widget :custom-state state) | |
2265 (custom-variable-state-set widget)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2266 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2267 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2268 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2269 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2270 (custom-add-see-also widget))))) |
17334 | 2271 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2272 (defun custom-tag-action (widget &rest args) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2273 "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
|
2274 (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
|
2275 :action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2276 |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2277 (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
|
2278 "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
|
2279 (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
|
2280 :mouse-down-action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2281 |
17334 | 2282 (defun custom-variable-state-set (widget) |
2283 "Set the state of WIDGET." | |
2284 (let* ((symbol (widget-value widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2285 (get (or (get symbol 'custom-get) 'default-value)) |
17334 | 2286 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2287 (funcall get symbol) |
17334 | 2288 (widget-get widget :value))) |
25685 | 2289 (comment (get symbol 'variable-comment)) |
17334 | 2290 tmp |
25685 | 2291 temp |
2292 (state (cond ((progn (setq tmp (get symbol 'customized-value)) | |
2293 (setq temp | |
2294 (get symbol 'customized-variable-comment)) | |
2295 (or tmp temp)) | |
17334 | 2296 (if (condition-case nil |
25685 | 2297 (and (equal value (eval (car tmp))) |
2298 (equal comment temp)) | |
17334 | 2299 (error nil)) |
2300 'set | |
2301 'changed)) | |
25685 | 2302 ((progn (setq tmp (get symbol 'saved-value)) |
2303 (setq temp (get symbol 'saved-variable-comment)) | |
2304 (or tmp temp)) | |
17334 | 2305 (if (condition-case nil |
25685 | 2306 (and (equal value (eval (car tmp))) |
2307 (equal comment temp)) | |
17334 | 2308 (error nil)) |
2309 'saved | |
2310 'changed)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2311 ((setq tmp (get symbol 'standard-value)) |
17334 | 2312 (if (condition-case nil |
25685 | 2313 (and (equal value (eval (car tmp))) |
2314 (equal comment nil)) | |
17334 | 2315 (error nil)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2316 'standard |
17334 | 2317 'changed)) |
2318 (t 'rogue)))) | |
2319 (widget-put widget :custom-state state))) | |
2320 | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2321 (defun custom-variable-standard-value (widget) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2322 (get (widget-value widget) 'standard-value)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2323 |
25685 | 2324 (defvar custom-variable-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
2325 '(("Set for Current Session" custom-variable-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2326 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2327 (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
|
2328 ("Save for Future Sessions" custom-variable-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2329 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2330 (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
|
2331 ("Reset to Current" custom-redraw |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2332 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2333 (and (default-boundp (widget-value widget)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2334 (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
|
2335 ("Reset to Saved" custom-variable-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2336 (lambda (widget) |
25685 | 2337 (and (or (get (widget-value widget) 'saved-value) |
2338 (get (widget-value widget) 'saved-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2339 (memq (widget-get widget :custom-state) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2340 '(modified set changed rogue))))) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2341 ("Erase Customization" custom-variable-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2342 (lambda (widget) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2343 (and (get (widget-value widget) 'standard-value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2344 (memq (widget-get widget :custom-state) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2345 '(modified set changed saved rogue))))) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2346 ("Use Backup Value" custom-variable-reset-backup |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2347 (lambda (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2348 (get (widget-value widget) 'backup-value))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2349 ("---" ignore ignore) |
25685 | 2350 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2351 ("---" ignore ignore) | |
2352 ("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
|
2353 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2354 (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
|
2355 ("Show initial Lisp expression" custom-variable-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2356 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2357 (eq (widget-get widget :custom-form) 'edit)))) |
17334 | 2358 "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
|
2359 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
|
2360 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
|
2361 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
|
2362 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
|
2363 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2364 |
2365 (defun custom-variable-action (widget &optional event) | |
2366 "Show the menu for `custom-variable' WIDGET. | |
2367 Optional EVENT is the location for the menu." | |
2368 (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
|
2369 (custom-toggle-hide widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2370 (unless (eq (widget-get widget :custom-state) 'modified) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2371 (custom-variable-state-set widget)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2372 (custom-redraw-magic widget) |
17334 | 2373 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2374 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2375 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2376 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2377 (custom-menu-filter custom-variable-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2378 widget) |
17334 | 2379 event))) |
2380 (if answer | |
2381 (funcall answer widget))))) | |
2382 | |
2383 (defun custom-variable-edit (widget) | |
2384 "Edit value of WIDGET." | |
2385 (widget-put widget :custom-state 'unknown) | |
2386 (widget-put widget :custom-form 'edit) | |
2387 (custom-redraw widget)) | |
2388 | |
2389 (defun custom-variable-edit-lisp (widget) | |
28130 | 2390 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2391 (widget-put widget :custom-state 'unknown) |
2392 (widget-put widget :custom-form 'lisp) | |
2393 (custom-redraw widget)) | |
2394 | |
2395 (defun custom-variable-set (widget) | |
2396 "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
|
2397 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2398 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2399 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2400 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2401 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2402 (comment-widget (widget-get widget :comment-widget)) |
2403 (comment (widget-value comment-widget)) | |
2404 val) | |
17334 | 2405 (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
|
2406 (error "Cannot set hidden variable")) |
17334 | 2407 ((setq val (widget-apply child :validate)) |
2408 (goto-char (widget-get val :from)) | |
2409 (error "%s" (widget-get val :error))) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2410 ((memq form '(lisp mismatch)) |
25685 | 2411 (when (equal comment "") |
2412 (setq comment nil) | |
2413 ;; 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
|
2414 (custom-comment-hide comment-widget)) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2415 (custom-variable-backup-value widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2416 (funcall set symbol (eval (setq val (widget-value child)))) |
25685 | 2417 (put symbol 'customized-value (list val)) |
2418 (put symbol 'variable-comment comment) | |
2419 (put symbol 'customized-variable-comment comment)) | |
17334 | 2420 (t |
25685 | 2421 (when (equal comment "") |
2422 (setq comment nil) | |
2423 ;; 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
|
2424 (custom-comment-hide comment-widget)) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2425 (custom-variable-backup-value widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2426 (funcall set symbol (setq val (widget-value child))) |
25685 | 2427 (put symbol 'customized-value (list (custom-quote val))) |
2428 (put symbol 'variable-comment comment) | |
2429 (put symbol 'customized-variable-comment comment))) | |
17334 | 2430 (custom-variable-state-set widget) |
2431 (custom-redraw-magic widget))) | |
2432 | |
2433 (defun custom-variable-save (widget) | |
19823
0c1b4a44db76
(custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents:
19822
diff
changeset
|
2434 "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
|
2435 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2436 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2437 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2438 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2439 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2440 (comment-widget (widget-get widget :comment-widget)) |
2441 (comment (widget-value comment-widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2442 val) |
17334 | 2443 (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
|
2444 (error "Cannot set hidden variable")) |
17334 | 2445 ((setq val (widget-apply child :validate)) |
2446 (goto-char (widget-get val :from)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
2447 (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
|
2448 ((memq form '(lisp mismatch)) |
25685 | 2449 (when (equal comment "") |
2450 (setq comment nil) | |
2451 ;; 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
|
2452 (custom-comment-hide comment-widget)) |
17334 | 2453 (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
|
2454 (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
|
2455 'set (list (widget-value child))) |
25685 | 2456 (funcall set symbol (eval (widget-value child))) |
2457 (put symbol 'variable-comment comment) | |
2458 (put symbol 'saved-variable-comment comment)) | |
17334 | 2459 (t |
25685 | 2460 (when (equal comment "") |
2461 (setq comment nil) | |
2462 ;; 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
|
2463 (custom-comment-hide comment-widget)) |
25685 | 2464 (put symbol 'saved-value |
2465 (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
|
2466 (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
|
2467 'set (list (custom-quote (widget-value |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2468 child)))) |
25685 | 2469 (funcall set symbol (widget-value child)) |
2470 (put symbol 'variable-comment comment) | |
2471 (put symbol 'saved-variable-comment comment))) | |
17334 | 2472 (put symbol 'customized-value nil) |
25685 | 2473 (put symbol 'customized-variable-comment nil) |
17334 | 2474 (custom-save-all) |
2475 (custom-variable-state-set widget) | |
2476 (custom-redraw-magic widget))) | |
2477 | |
2478 (defun custom-variable-reset-saved (widget) | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2479 "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
|
2480 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
|
2481 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
|
2482 (let* ((symbol (widget-value widget)) |
25685 | 2483 (set (or (get symbol 'custom-set) 'set-default)) |
2484 (value (get symbol 'saved-value)) | |
2485 (comment (get symbol 'saved-variable-comment))) | |
2486 (cond ((or value comment) | |
2487 (put symbol 'variable-comment comment) | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2488 (custom-variable-backup-value widget) |
25685 | 2489 (condition-case nil |
2490 (funcall set symbol (eval (car value))) | |
2491 (error nil))) | |
2492 (t | |
2493 (error "No saved value for %s" symbol))) | |
17334 | 2494 (put symbol 'customized-value nil) |
25685 | 2495 (put symbol 'customized-variable-comment nil) |
17334 | 2496 (widget-put widget :custom-state 'unknown) |
25685 | 2497 ;; This call will possibly make the comment invisible |
17334 | 2498 (custom-redraw widget))) |
2499 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2500 (defun custom-variable-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2501 "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
|
2502 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
|
2503 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
|
2504 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
|
2505 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
|
2506 (let* ((symbol (widget-value widget)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
2507 (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
|
2508 (if (get symbol 'standard-value) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2509 (progn |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2510 (custom-variable-backup-value widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2511 (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
|
2512 (error "No standard setting known for %S" symbol)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2513 (put symbol 'variable-comment nil) |
17334 | 2514 (put symbol 'customized-value nil) |
25685 | 2515 (put symbol 'customized-variable-comment nil) |
2516 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | |
17334 | 2517 (put symbol 'saved-value nil) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2518 (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
|
2519 ;; 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
|
2520 ;; 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
|
2521 (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
|
2522 (put symbol 'theme-value nil)) |
25685 | 2523 (put symbol 'saved-variable-comment nil) |
17334 | 2524 (custom-save-all)) |
2525 (widget-put widget :custom-state 'unknown) | |
25685 | 2526 ;; This call will possibly make the comment invisible |
17334 | 2527 (custom-redraw widget))) |
2528 | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2529 (defun custom-variable-backup-value (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2530 "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
|
2531 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
|
2532 (let* ((symbol (widget-value widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2533 (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
|
2534 (type (custom-variable-type symbol)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2535 (conv (widget-convert type)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2536 (value (if (default-boundp symbol) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2537 (funcall get symbol) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2538 (widget-get conv :value)))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2539 (put symbol 'backup-value (list value)))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2540 |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2541 (defun custom-variable-reset-backup (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2542 "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
|
2543 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
|
2544 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
|
2545 to switch between two values." |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2546 (let* ((symbol (widget-value widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2547 (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
|
2548 (value (get symbol 'backup-value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2549 (comment-widget (widget-get widget :comment-widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2550 (comment (widget-value comment-widget))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2551 (if value |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2552 (progn |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2553 (custom-variable-backup-value widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2554 (condition-case nil |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2555 (funcall set symbol (car value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2556 (error nil))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2557 (error "No backup value for %s" symbol)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2558 (put symbol 'customized-value (list (car value))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2559 (put symbol 'variable-comment comment) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2560 (put symbol 'customized-variable-comment comment) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2561 (custom-variable-state-set widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2562 ;; 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
|
2563 (custom-redraw widget))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2564 |
17334 | 2565 ;;; The `custom-face-edit' Widget. |
2566 | |
2567 (define-widget 'custom-face-edit 'checklist | |
2568 "Edit face attributes." | |
2569 :format "%t: %v" | |
2570 :tag "Attributes" | |
2571 :extra-offset 12 | |
25685 | 2572 :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
|
2573 :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
|
2574 :match (lambda (widget value) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2575 (widget-checklist-match widget |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2576 (custom-face-edit-fix-value widget value))) |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2577 :convert-widget 'custom-face-edit-convert-widget |
17334 | 2578 :args (mapcar (lambda (att) |
25685 | 2579 (list 'group |
17334 | 2580 :inline t |
2581 :sibling-args (widget-get (nth 1 att) :sibling-args) | |
25685 | 2582 (list 'const :format "" :value (nth 0 att)) |
17334 | 2583 (nth 1 att))) |
2584 custom-face-attributes)) | |
2585 | |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2586 (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
|
2587 "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
|
2588 Also change :reverse-video to :inverse-video." |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2589 (if (listp value) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2590 (let (result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2591 (while value |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2592 (let ((key (car value)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2593 (val (car (cdr value)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2594 (cond ((eq key :italic) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2595 (push :slant result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2596 (push (if val 'italic 'normal) result)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2597 ((eq key :bold) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2598 (push :weight result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2599 (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
|
2600 ((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
|
2601 (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
|
2602 (push val result)) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2603 (t |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2604 (push key result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2605 (push val result)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2606 (setq value (cdr (cdr value)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2607 (setq result (nreverse result)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2608 result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2609 value)) |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2610 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2611 (defun custom-face-edit-convert-widget (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2612 "Convert :args as widget types in WIDGET." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2613 (widget-put |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2614 widget |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2615 :args (mapcar (lambda (arg) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2616 (widget-convert arg |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2617 :deactivate 'custom-face-edit-deactivate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2618 :activate 'custom-face-edit-activate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2619 :delete 'custom-face-edit-delete)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2620 (widget-get widget :args))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2621 widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2622 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2623 (defun custom-face-edit-deactivate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2624 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2625 (unless (widget-get widget :inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2626 (let ((tag (custom-face-edit-attribute-tag widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2627 (from (copy-marker (widget-get widget :from))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2628 (value (widget-value widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2629 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2630 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2631 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2632 (goto-char from) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2633 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2634 (insert tag ": *\n") |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2635 (widget-put widget :inactive |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2636 (cons value (cons from (- (point) from)))))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2637 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2638 (defun custom-face-edit-activate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2639 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2640 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2641 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2642 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2643 (when (consp inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2644 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2645 (goto-char (car (cdr inactive))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2646 (delete-region (point) (+ (point) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2647 (widget-put widget :inactive nil) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2648 (widget-apply widget :create) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2649 (widget-value-set widget (car inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2650 (widget-setup))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2651 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2652 (defun custom-face-edit-delete (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2653 "Remove widget from the buffer." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2654 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2655 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2656 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2657 (if (not inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2658 ;; 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
|
2659 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2660 ;; 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
|
2661 ;; 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
|
2662 (delete-region (car (cdr inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2663 (+ (car (cdr inactive)) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2664 (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
|
2665 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2666 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2667 (defun custom-face-edit-attribute-tag (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2668 "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
|
2669 (let ((tag (widget-get widget :tag))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2670 (or (and (not (equal tag "")) tag) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2671 (let ((children (widget-get widget :children))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2672 (while (and (null tag) children) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2673 (setq tag (custom-face-edit-attribute-tag (pop children)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2674 tag)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2675 |
17334 | 2676 ;;; The `custom-display' Widget. |
2677 | |
2678 (define-widget 'custom-display 'menu-choice | |
2679 "Select a display type." | |
2680 :tag "Display" | |
2681 :value t | |
2682 :help-echo "Specify frames where the face attributes should be used." | |
2683 :args '((const :tag "all" t) | |
2684 (checklist | |
2685 :offset 0 | |
2686 :extra-offset 9 | |
2687 :args ((group :sibling-args (:help-echo "\ | |
2688 Only match the specified window systems.") | |
2689 (const :format "Type: " | |
2690 type) | |
2691 (checklist :inline t | |
2692 :offset 0 | |
2693 (const :format "X " | |
2694 :sibling-args (:help-echo "\ | |
2695 The X11 Window System.") | |
2696 x) | |
2697 (const :format "PM " | |
2698 :sibling-args (:help-echo "\ | |
2699 OS/2 Presentation Manager.") | |
2700 pm) | |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2701 (const :format "W32 " |
17334 | 2702 :sibling-args (:help-echo "\ |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2703 Windows NT/9X.") |
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2704 w32) |
48633
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2705 (const :format "MAC " |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2706 :sibling-args (:help-echo "\ |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2707 Macintosh OS.") |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2708 mac) |
17334 | 2709 (const :format "DOS " |
2710 :sibling-args (:help-echo "\ | |
2711 Plain MS-DOS.") | |
2712 pc) | |
2713 (const :format "TTY%n" | |
2714 :sibling-args (:help-echo "\ | |
2715 Plain text terminals.") | |
2716 tty))) | |
2717 (group :sibling-args (:help-echo "\ | |
2718 Only match the frames with the specified color support.") | |
2719 (const :format "Class: " | |
2720 class) | |
2721 (checklist :inline t | |
2722 :offset 0 | |
2723 (const :format "Color " | |
2724 :sibling-args (:help-echo "\ | |
2725 Match color frames.") | |
2726 color) | |
2727 (const :format "Grayscale " | |
2728 :sibling-args (:help-echo "\ | |
2729 Match grayscale frames.") | |
2730 grayscale) | |
2731 (const :format "Monochrome%n" | |
2732 :sibling-args (:help-echo "\ | |
2733 Match frames with no color support.") | |
2734 mono))) | |
2735 (group :sibling-args (:help-echo "\ | |
2736 Only match frames with the specified intensity.") | |
2737 (const :format "\ | |
2738 Background brightness: " | |
2739 background) | |
2740 (checklist :inline t | |
2741 :offset 0 | |
2742 (const :format "Light " | |
2743 :sibling-args (:help-echo "\ | |
2744 Match frames with light backgrounds.") | |
2745 light) | |
2746 (const :format "Dark\n" | |
2747 :sibling-args (:help-echo "\ | |
2748 Match frames with dark backgrounds.") | |
45724
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2749 dark))) |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2750 (group :sibling-args (:help-echo "\ |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2751 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
|
2752 (const :format "Supports attributes:" supports) |
45725
abb237aa3c61
(custom-display): Use correct syntax for `supports' attributes.
Miles Bader <miles@gnu.org>
parents:
45724
diff
changeset
|
2753 (custom-face-edit :inline t :format "%n%v")))))) |
17334 | 2754 |
2755 ;;; The `custom-face' Widget. | |
2756 | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2757 (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
|
2758 `((t (:weight bold :height 1.2 :inherit variable-pitch))) |
17334 | 2759 "Face used for face tags." |
17415 | 2760 :group 'custom-faces) |
17334 | 2761 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2762 (defcustom custom-face-default-form 'selected |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2763 "Default form of displaying face definition." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2764 :type '(choice (const all) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2765 (const selected) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2766 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2767 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2768 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2769 |
17334 | 2770 (define-widget 'custom-face 'custom |
2771 "Customize face." | |
2772 :sample-face 'custom-face-tag-face | |
2773 :help-echo "Set or reset this face." | |
28716
e9fb71a3e51d
(custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28700
diff
changeset
|
2774 :documentation-property #'face-doc-string |
17334 | 2775 :value-create 'custom-face-value-create |
2776 :action 'custom-face-action | |
18089 | 2777 :custom-category 'face |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2778 :custom-form nil ; defaults to value of `custom-face-default-form' |
17334 | 2779 :custom-set 'custom-face-set |
2780 :custom-save 'custom-face-save | |
2781 :custom-reset-current 'custom-redraw | |
2782 :custom-reset-saved 'custom-face-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2783 :custom-reset-standard 'custom-face-reset-standard |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2784 :custom-standard-value 'custom-face-standard-value |
17334 | 2785 :custom-menu 'custom-face-menu-create) |
2786 | |
25685 | 2787 (define-widget 'custom-face-all 'editable-list |
17334 | 2788 "An editable list of display specifications and attributes." |
2789 :entry-format "%i %d %v" | |
2790 :insert-button-args '(:help-echo "Insert new display specification here.") | |
2791 :append-button-args '(:help-echo "Append new display specification here.") | |
2792 :delete-button-args '(:help-echo "Delete this display specification.") | |
2793 :args '((group :format "%v" custom-display custom-face-edit))) | |
2794 | |
2795 (defconst custom-face-all (widget-convert 'custom-face-all) | |
2796 "Converted version of the `custom-face-all' widget.") | |
2797 | |
2798 (define-widget 'custom-display-unselected 'item | |
2799 "A display specification that doesn't match the selected display." | |
2800 :match 'custom-display-unselected-match) | |
2801 | |
2802 (defun custom-display-unselected-match (widget value) | |
2803 "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
|
2804 (not (face-spec-set-match-display value (selected-frame)))) |
17334 | 2805 |
25685 | 2806 (define-widget 'custom-face-selected 'group |
17334 | 2807 "Edit the attributes of the selected display in a face specification." |
2808 :args '((repeat :format "" | |
2809 :inline t | |
2810 (group custom-display-unselected sexp)) | |
2811 (group (sexp :format "") custom-face-edit) | |
2812 (repeat :format "" | |
2813 :inline t | |
2814 sexp))) | |
2815 | |
2816 (defconst custom-face-selected (widget-convert 'custom-face-selected) | |
2817 "Converted version of the `custom-face-selected' widget.") | |
2818 | |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2819 (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
|
2820 "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
|
2821 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
|
2822 `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
|
2823 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
|
2824 don't specify one." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2825 (mapcar (lambda (entry) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2826 ;; 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
|
2827 (let ((tests (car entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2828 (unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2829 ;; 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
|
2830 (if (listp (car (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2831 (car (cdr entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2832 (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2833 (filtered-attrs nil)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2834 ;; Filter each face attribute |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2835 (while unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2836 (let* ((attr (pop unfiltered-attrs)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2837 (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
|
2838 (filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2839 (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
|
2840 default-filter)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2841 (filtered-value |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2842 (if filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2843 (funcall filter pre-filtered-value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2844 pre-filtered-value))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2845 (push filtered-value filtered-attrs) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2846 (push attr filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2847 ;; |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2848 (list tests filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2849 spec)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2850 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2851 (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
|
2852 "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
|
2853 SPEC must be a full face spec." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2854 (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
|
2855 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2856 (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
|
2857 "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
|
2858 (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
|
2859 |
17334 | 2860 (defun custom-face-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2861 "Create a list of the display specifications for WIDGET." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2862 (let ((buttons (widget-get widget :buttons)) |
25685 | 2863 children |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2864 (symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2865 (tag (widget-get widget :tag)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2866 (state (widget-get widget :custom-state)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2867 (begin (point)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2868 (is-last (widget-get widget :custom-last)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2869 (prefix (widget-get widget :custom-prefix))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2870 (unless tag |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2871 (setq tag (prin1-to-string symbol))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2872 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2873 (insert prefix (if is-last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2874 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2875 widget 'custom-browse-face-tag) |
18364
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 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2878 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2879 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2880 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2881 (insert tag) |
34041
40708840c132
(custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents:
33986
diff
changeset
|
2882 (widget-specify-sample widget begin (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2883 (if (eq custom-buffer-style 'face) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2884 (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
|
2885 (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
|
2886 (insert ":") |
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2887 (insert " face: "))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2888 ;; Sample. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2889 (push (widget-create-child-and-convert widget 'item |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2890 :format "(%{%t%})" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2891 :sample-face symbol |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2892 :tag "sample") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2893 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2894 ;; Visibility. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2895 (insert " ") |
25685 | 2896 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2897 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2898 :help-echo "Hide or show this face." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2899 :on "Hide Face" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2900 :off "Show Face" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2901 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2902 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2903 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2904 ;; Magic. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2905 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2906 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2907 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2908 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2909 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2910 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2911 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2912 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2913 (widget-default-format-handler widget ?h) |
25685 | 2914 ;; The comment field |
2915 (unless (eq state 'hidden) | |
2916 (let* ((comment (get symbol 'face-comment)) | |
2917 (comment-widget | |
2918 (widget-create-child-and-convert | |
2919 widget 'custom-comment | |
2920 :parent widget | |
2921 :value (or comment "")))) | |
2922 (widget-put widget :comment-widget comment-widget) | |
2923 (push comment-widget children))) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2924 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2925 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2926 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2927 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2928 (custom-add-see-also widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2929 ;; Editor. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2930 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2931 (insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2932 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2933 (message "Creating face editor...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2934 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2935 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2936 (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
|
2937 (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
|
2938 (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
|
2939 (get symbol 'saved-face) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2940 (get symbol 'face-defface-spec) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2941 ;; Attempt to construct it. |
25685 | 2942 (list (list t (custom-face-attributes-get |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2943 symbol (selected-frame)))))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2944 (form (widget-get widget :custom-form)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2945 (indent (widget-get widget :indent)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2946 edit) |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2947 ;; 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
|
2948 ;; 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
|
2949 (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
|
2950 (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
|
2951 (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
|
2952 (setq edit (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2953 widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2954 (cond ((and (eq form 'selected) |
25685 | 2955 (widget-apply custom-face-selected |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2956 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2957 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2958 'custom-face-selected) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2959 ((and (not (eq form 'lisp)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2960 (widget-apply custom-face-all |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2961 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2962 'custom-face-all) |
25685 | 2963 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2964 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2965 'sexp)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2966 :value spec)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2967 (custom-face-state-set widget) |
25685 | 2968 (push edit children) |
2969 (widget-put widget :children children)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2970 (message "Creating face editor...done")))))) |
17334 | 2971 |
25685 | 2972 (defvar custom-face-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
2973 '(("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
|
2974 ("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
|
2975 ("Reset to Saved" custom-face-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2976 (lambda (widget) |
25685 | 2977 (or (get (widget-value widget) 'saved-face) |
2978 (get (widget-value widget) 'saved-face-comment)))) | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2979 ("Erase Customization" custom-face-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2980 (lambda (widget) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2981 (get (widget-value widget) 'face-defface-spec))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2982 ("---" ignore ignore) |
25685 | 2983 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2984 ("---" ignore ignore) | |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2985 ("Show all display specs" custom-face-edit-all |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2986 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2987 (not (eq (widget-get widget :custom-form) 'all)))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2988 ("Just current attributes" custom-face-edit-selected |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2989 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2990 (not (eq (widget-get widget :custom-form) 'selected)))) |
40801
f49e883aeab2
Backed out last change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40800
diff
changeset
|
2991 ("Show as Lisp expression" custom-face-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2992 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2993 (not (eq (widget-get widget :custom-form) 'lisp))))) |
17334 | 2994 "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
|
2995 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
|
2996 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
|
2997 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
|
2998 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
|
2999 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3000 |
3001 (defun custom-face-edit-selected (widget) | |
3002 "Edit selected attributes of the value of WIDGET." | |
3003 (widget-put widget :custom-state 'unknown) | |
3004 (widget-put widget :custom-form 'selected) | |
3005 (custom-redraw widget)) | |
3006 | |
3007 (defun custom-face-edit-all (widget) | |
3008 "Edit all attributes of the value of WIDGET." | |
3009 (widget-put widget :custom-state 'unknown) | |
3010 (widget-put widget :custom-form 'all) | |
3011 (custom-redraw widget)) | |
3012 | |
3013 (defun custom-face-edit-lisp (widget) | |
28130 | 3014 "Edit the Lisp representation of the value of WIDGET." |
17334 | 3015 (widget-put widget :custom-state 'unknown) |
3016 (widget-put widget :custom-form 'lisp) | |
3017 (custom-redraw widget)) | |
3018 | |
3019 (defun custom-face-state-set (widget) | |
3020 "Set the state of WIDGET." | |
25685 | 3021 (let* ((symbol (widget-value widget)) |
3022 (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
|
3023 tmp temp |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3024 (state |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3025 (cond ((progn |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3026 (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
|
3027 (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
|
3028 (or tmp temp)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3029 (if (equal temp comment) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3030 'set |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3031 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3032 ((progn |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3033 (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
|
3034 (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
|
3035 (or tmp temp)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3036 (if (equal temp comment) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3037 'saved |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3038 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3039 ((get symbol 'face-defface-spec) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3040 (if (equal comment nil) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3041 'standard |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3042 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3043 (t |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3044 'rogue)))) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3045 ;; 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
|
3046 ;; 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
|
3047 (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
|
3048 (get symbol 'face-modified)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3049 (setq state 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3050 (widget-put widget :custom-state state))) |
17334 | 3051 |
3052 (defun custom-face-action (widget &optional event) | |
3053 "Show the menu for `custom-face' WIDGET. | |
3054 Optional EVENT is the location for the menu." | |
3055 (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
|
3056 (custom-toggle-hide widget) |
17334 | 3057 (let* ((completion-ignore-case t) |
3058 (symbol (widget-get widget :value)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3059 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3060 (custom-unlispify-tag-name symbol)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3061 (custom-menu-filter custom-face-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3062 widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3063 event))) |
17334 | 3064 (if answer |
3065 (funcall answer widget))))) | |
3066 | |
3067 (defun custom-face-set (widget) | |
3068 "Make the face attributes in WIDGET take effect." | |
3069 (let* ((symbol (widget-value widget)) | |
3070 (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
|
3071 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 3072 (comment-widget (widget-get widget :comment-widget)) |
3073 (comment (widget-value comment-widget))) | |
3074 (when (equal comment "") | |
3075 (setq comment nil) | |
3076 ;; 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
|
3077 (custom-comment-hide comment-widget)) |
17334 | 3078 (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
|
3079 (if (face-spec-choose value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3080 (face-spec-set symbol value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3081 ;; 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
|
3082 ;; something harmless instead. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3083 (face-spec-set symbol '((t :foreground unspecified)))) |
25685 | 3084 (put symbol 'customized-face-comment comment) |
3085 (put symbol 'face-comment comment) | |
17334 | 3086 (custom-face-state-set widget) |
3087 (custom-redraw-magic widget))) | |
3088 | |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
3089 (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
|
3090 "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
|
3091 (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
|
3092 (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
|
3093 |
17334 | 3094 (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
|
3095 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'." |
17334 | 3096 (let* ((symbol (widget-value widget)) |
3097 (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
|
3098 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 3099 (comment-widget (widget-get widget :comment-widget)) |
3100 (comment (widget-value comment-widget))) | |
3101 (when (equal comment "") | |
3102 (setq comment nil) | |
3103 ;; 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
|
3104 (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
|
3105 (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
|
3106 (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
|
3107 ;; 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
|
3108 ;; 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
|
3109 (face-spec-set symbol '((t :foreground unspecified)))) |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3110 (unless (eq (widget-get widget :custom-state) 'standard) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3111 (put symbol 'saved-face value)) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3112 (custom-push-theme 'theme-face symbol 'user 'set value) |
17334 | 3113 (put symbol 'customized-face nil) |
25685 | 3114 (put symbol 'face-comment comment) |
3115 (put symbol 'customized-face-comment nil) | |
3116 (put symbol 'saved-face-comment comment) | |
20262
c6532008f2a9
(custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents:
20174
diff
changeset
|
3117 (custom-save-all) |
17334 | 3118 (custom-face-state-set widget) |
3119 (custom-redraw-magic widget))) | |
3120 | |
3121 (defun custom-face-reset-saved (widget) | |
3122 "Restore WIDGET to the face's default attributes." | |
3123 (let* ((symbol (widget-value widget)) | |
3124 (child (car (widget-get widget :children))) | |
25685 | 3125 (value (get symbol 'saved-face)) |
3126 (comment (get symbol 'saved-face-comment)) | |
3127 (comment-widget (widget-get widget :comment-widget))) | |
3128 (unless (or value comment) | |
17334 | 3129 (error "No saved value for this face")) |
3130 (put symbol 'customized-face nil) | |
25685 | 3131 (put symbol 'customized-face-comment nil) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3132 (face-spec-set symbol value) |
25685 | 3133 (put symbol 'face-comment comment) |
17334 | 3134 (widget-value-set child value) |
25685 | 3135 ;; This call manages the comment visibility |
3136 (widget-value-set comment-widget (or comment "")) | |
17334 | 3137 (custom-face-state-set widget) |
3138 (custom-redraw-magic widget))) | |
3139 | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3140 (defun custom-face-standard-value (widget) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3141 (get (widget-value widget) 'face-defface-spec)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3142 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3143 (defun custom-face-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3144 "Restore WIDGET to the face's standard settings. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3145 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
|
3146 restoring it to the state of a face that has never been customized." |
17334 | 3147 (let* ((symbol (widget-value widget)) |
3148 (child (car (widget-get widget :children))) | |
25685 | 3149 (value (get symbol 'face-defface-spec)) |
3150 (comment-widget (widget-get widget :comment-widget))) | |
17334 | 3151 (unless value |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
3152 (error "No standard setting for this face")) |
17334 | 3153 (put symbol 'customized-face nil) |
25685 | 3154 (put symbol 'customized-face-comment nil) |
3155 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | |
17334 | 3156 (put symbol 'saved-face nil) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3157 (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
|
3158 ;; 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
|
3159 (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
|
3160 (put symbol 'theme-face nil)) |
25685 | 3161 (put symbol 'saved-face-comment nil) |
17334 | 3162 (custom-save-all)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3163 (face-spec-set symbol value) |
25685 | 3164 (put symbol 'face-comment nil) |
17334 | 3165 (widget-value-set child value) |
25685 | 3166 ;; This call manages the comment visibility |
3167 (widget-value-set comment-widget "") | |
17334 | 3168 (custom-face-state-set widget) |
3169 (custom-redraw-magic widget))) | |
3170 | |
3171 ;;; The `face' Widget. | |
3172 | |
3173 (define-widget 'face 'default | |
3174 "Select and customize a face." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3175 :convert-widget 'widget-value-convert-widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3176 :button-prefix 'widget-push-button-prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3177 :button-suffix 'widget-push-button-suffix |
33986 | 3178 :format "%{%t%}: %[select face%] %v" |
17334 | 3179 :tag "Face" |
3180 :value 'default | |
3181 :value-create 'widget-face-value-create | |
3182 :value-delete 'widget-face-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3183 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3184 :validate 'widget-children-validate |
17334 | 3185 :action 'widget-face-action |
28612
0051d3178111
(custom-face, face): Unquote the lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28568
diff
changeset
|
3186 :match (lambda (widget value) (symbolp value))) |
17334 | 3187 |
3188 (defun widget-face-value-create (widget) | |
28130 | 3189 "Create a `custom-face' child." |
17334 | 3190 (let* ((symbol (widget-value widget)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3191 (custom-buffer-style 'face) |
17334 | 3192 (child (widget-create-child-and-convert |
3193 widget 'custom-face | |
3194 :custom-level nil | |
3195 :value symbol))) | |
3196 (custom-magic-reset child) | |
3197 (setq custom-options (cons child custom-options)) | |
3198 (widget-put widget :children (list child)))) | |
3199 | |
3200 (defun widget-face-value-delete (widget) | |
28130 | 3201 "Remove the child from the options." |
17334 | 3202 (let ((child (car (widget-get widget :children)))) |
3203 (setq custom-options (delq child custom-options)) | |
3204 (widget-children-value-delete widget))) | |
3205 | |
3206 (defvar face-history nil | |
3207 "History of entered face names.") | |
3208 | |
3209 (defun widget-face-action (widget &optional event) | |
3210 "Prompt for a face." | |
3211 (let ((answer (completing-read "Face: " | |
3212 (mapcar (lambda (face) | |
3213 (list (symbol-name face))) | |
3214 (face-list)) | |
25685 | 3215 nil nil nil |
17334 | 3216 'face-history))) |
3217 (unless (zerop (length answer)) | |
3218 (widget-value-set widget (intern answer)) | |
3219 (widget-apply widget :notify widget event) | |
3220 (widget-setup)))) | |
3221 | |
3222 ;;; The `hook' Widget. | |
3223 | |
3224 (define-widget 'hook 'list | |
3225 "A emacs lisp hook" | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3226 :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
|
3227 (if (and value (symbolp value)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3228 (list value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3229 value)) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3230 :match (lambda (widget value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3231 (or (symbolp value) |
20174
e1ca1fe89e6e
(hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents:
20100
diff
changeset
|
3232 (widget-group-match widget value))) |
28130 | 3233 ;; Avoid adding undefined functions to the hook, especially for |
3234 ;; things like `find-file-hook' or even more basic ones, to avoid | |
3235 ;; chaos. | |
3236 :set (lambda (symbol value) | |
28310
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3237 (dolist (elt value) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3238 (if (fboundp elt) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3239 (add-hook symbol elt)))) |
17334 | 3240 :convert-widget 'custom-hook-convert-widget |
3241 :tag "Hook") | |
3242 | |
3243 (defun custom-hook-convert-widget (widget) | |
27250
807fc106b24c
(custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
26803
diff
changeset
|
3244 ;; Handle `:options'. |
17334 | 3245 (let* ((options (widget-get widget :options)) |
25685 | 3246 (other `(editable-list :inline t |
17334 | 3247 :entry-format "%i %d%v" |
3248 (function :format " %v"))) | |
3249 (args (if options | |
3250 (list `(checklist :inline t | |
3251 ,@(mapcar (lambda (entry) | |
3252 `(function-item ,entry)) | |
3253 options)) | |
3254 other) | |
3255 (list other)))) | |
3256 (widget-put widget :args args) | |
3257 widget)) | |
3258 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3259 ;;; The `custom-group-link' Widget. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3260 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3261 (define-widget 'custom-group-link 'link |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3262 "Show parent in other window when activated." |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3263 :help-echo "Create customization buffer for this group." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3264 :action 'custom-group-link-action) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3265 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3266 (defun custom-group-link-action (widget &rest ignore) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3267 (customize-group (widget-value widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3268 |
17334 | 3269 ;;; The `custom-group' Widget. |
3270 | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3271 (defcustom custom-group-tag-faces nil |
17334 | 3272 ;; In XEmacs, this ought to play games with font size. |
25685 | 3273 ;; Fixme: make it do so in Emacs. |
17334 | 3274 "Face used for group tags. |
3275 The first member is used for level 1 groups, the second for level 2, | |
3276 and so forth. The remaining group tags are shown with | |
3277 `custom-group-tag-face'." | |
3278 :type '(repeat face) | |
17415 | 3279 :group 'custom-faces) |
17334 | 3280 |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3281 (defface custom-group-tag-face-1 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3282 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3283 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3284 (: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
|
3285 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3286 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3287 (: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
|
3288 (t (:weight bold))) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3289 "Face used for group tags." |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3290 :group 'custom-faces) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3291 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3292 (defface custom-group-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3293 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3294 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3295 (: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
|
3296 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3297 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3298 (: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
|
3299 (t (:weight bold))) |
17334 | 3300 "Face used for low level group tags." |
17415 | 3301 :group 'custom-faces) |
17334 | 3302 |
3303 (define-widget 'custom-group 'custom | |
3304 "Customize group." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3305 :format "%v" |
17334 | 3306 :sample-face-get 'custom-group-sample-face-get |
3307 :documentation-property 'group-documentation | |
3308 :help-echo "Set or reset all members of this group." | |
3309 :value-create 'custom-group-value-create | |
3310 :action 'custom-group-action | |
18089 | 3311 :custom-category 'group |
17334 | 3312 :custom-set 'custom-group-set |
3313 :custom-save 'custom-group-save | |
3314 :custom-reset-current 'custom-group-reset-current | |
3315 :custom-reset-saved 'custom-group-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3316 :custom-reset-standard 'custom-group-reset-standard |
17334 | 3317 :custom-menu 'custom-group-menu-create) |
3318 | |
3319 (defun custom-group-sample-face-get (widget) | |
3320 ;; Use :sample-face. | |
3321 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) | |
3322 'custom-group-tag-face)) | |
3323 | |
18430
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3324 (define-widget 'custom-group-visibility 'visibility |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3325 "An indicator and manipulator for hidden group contents." |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3326 :create 'custom-group-visibility-create) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3327 |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3328 (defun custom-group-visibility-create (widget) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3329 (let ((visible (widget-value widget))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3330 (if visible |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3331 (insert "--------"))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3332 (widget-default-create widget)) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3333 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3334 (defun custom-group-members (symbol groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3335 "Return SYMBOL's custom group members. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3336 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
|
3337 (if (not groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3338 (get symbol 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3339 (let (members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3340 (dolist (entry (get symbol 'custom-group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3341 (when (eq (nth 1 entry) 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3342 (push entry members))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3343 (nreverse members)))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3344 |
17334 | 3345 (defun custom-group-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3346 "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
|
3347 (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
|
3348 (custom-load-widget widget)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3349 (let* ((state (widget-get widget :custom-state)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3350 (level (widget-get widget :custom-level)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3351 ;; (indent (widget-get widget :indent)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3352 (prefix (widget-get widget :custom-prefix)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3353 (buttons (widget-get widget :buttons)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3354 (tag (widget-get widget :tag)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3355 (symbol (widget-value widget)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3356 (members (custom-group-members symbol |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3357 (and (eq custom-buffer-style 'tree) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3358 custom-browse-only-groups)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3359 (cond ((and (eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3360 (eq state 'hidden) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3361 (or members (custom-unloaded-widget-p widget))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3362 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3363 (push (widget-create-child-and-convert |
25685 | 3364 widget 'custom-browse-visibility |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3365 ;; :tag-glyph "plus" |
18856
03eeb83520d8
(custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents:
18812
diff
changeset
|
3366 :tag "+") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3367 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3368 (insert "-- ") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3369 ;; (widget-glyph-insert nil "-- " "horizontal") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3370 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3371 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3372 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3373 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3374 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3375 ((and (eq custom-buffer-style 'tree) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3376 (zerop (length members))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3377 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3378 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3379 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3380 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3381 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3382 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3383 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3384 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3385 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3386 ((eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3387 (custom-browse-insert-prefix prefix) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3388 (if (zerop (length members)) |
25685 | 3389 (progn |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3390 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3391 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3392 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3393 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3394 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3395 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3396 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3397 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3398 (widget-put widget :buttons buttons)) |
25685 | 3399 (push (widget-create-child-and-convert |
3400 widget 'custom-browse-visibility | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3401 ;; :tag-glyph "minus" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3402 :tag "-") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3403 buttons) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3404 (insert "-\\ ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3405 ;; (widget-glyph-insert nil "-\\ " "top") |
25685 | 3406 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3407 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3408 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3409 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3410 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3411 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3412 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3413 custom-browse-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3414 custom-browse-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3415 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3416 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3417 (extra-prefix (if (widget-get widget :custom-last) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3418 " " |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3419 " | ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3420 (prefix (concat prefix extra-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3421 children entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3422 (while members |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3423 (setq entry (car members) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3424 members (cdr members)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3425 (push (widget-create-child-and-convert |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3426 widget (nth 1 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3427 :group widget |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3428 :tag (custom-unlispify-tag-name (nth 0 entry)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3429 :custom-prefixes custom-prefix-list |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3430 :custom-level (1+ level) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3431 :custom-last (null members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3432 :value (nth 0 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3433 :custom-prefix prefix) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3434 children)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3435 (widget-put widget :children (reverse children))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3436 (message "Creating group...done"))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3437 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3438 ((eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3439 ;; Create level indicator. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3440 (unless (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3441 (insert-char ?\ (* custom-buffer-indent (1- level))) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3442 (insert "-- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3443 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3444 (let ((begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3445 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3446 (widget-specify-sample widget begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3447 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3448 ;; Create link/visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3449 (if (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3450 (push (widget-create-child-and-convert |
25685 | 3451 widget 'custom-group-link |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3452 :tag "Go to Group" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3453 symbol) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3454 buttons) |
25685 | 3455 (push (widget-create-child-and-convert |
20100
0db4553d47cc
(custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents:
19886
diff
changeset
|
3456 widget 'custom-group-visibility |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3457 :help-echo "Show members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3458 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3459 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3460 buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3461 (insert " \n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3462 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3463 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3464 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3465 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3466 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3467 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3468 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3469 ;; Insert documentation. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3470 (if (and (eq custom-buffer-style 'links) (> level 1)) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3471 (widget-put widget :documentation-indent 0)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3472 (widget-default-format-handler widget ?h)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3473 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3474 (t ;Visible. |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3475 ;; 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
|
3476 (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
|
3477 ;;; 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
|
3478 (when (eq level 1) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
3479 (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
|
3480 "Go to parent group:") |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3481 (insert "\n")))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3482 ;; Create level indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3483 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3484 (insert "/- ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3485 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3486 (let ((start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3487 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3488 (widget-specify-sample widget start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3489 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3490 ;; Create visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3491 (unless (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3492 (insert "--------") |
25685 | 3493 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3494 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3495 :help-echo "Hide members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3496 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3497 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3498 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3499 (insert " ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3500 ;; Create more dashes. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3501 ;; Use 76 instead of 75 to compensate for the temporary "<" |
25685 | 3502 ;; added by `widget-insert'. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3503 (insert-char ?- (- 76 (current-column) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3504 (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3505 (insert "\\\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3506 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3507 (let ((magic (widget-create-child-and-convert |
25685 | 3508 widget 'custom-magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3509 :indent 0 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3510 nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3511 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3512 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3513 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3514 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3515 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3516 (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
|
3517 ;; Parent groups. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3518 (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
|
3519 ;;; 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
|
3520 (when (eq level 1) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3521 (insert-char ?\ custom-buffer-indent) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3522 (custom-add-parent-links widget))) |
25685 | 3523 (custom-add-see-also widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3524 (make-string (* custom-buffer-indent level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3525 ?\ )) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3526 ;; Members. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3527 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3528 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3529 custom-buffer-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3530 custom-buffer-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3531 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3532 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3533 (length (length members)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3534 (count 0) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3535 (children (mapcar (lambda (entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3536 (widget-insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3537 (message "\ |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3538 Creating group members... %2d%%" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3539 (/ (* 100.0 count) length)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3540 (setq count (1+ count)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3541 (prog1 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3542 (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3543 widget (nth 1 entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3544 :group widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3545 :tag (custom-unlispify-tag-name |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3546 (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3547 :custom-prefixes custom-prefix-list |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3548 :custom-level (1+ level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3549 :value (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3550 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3551 (widget-insert "\n")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3552 members))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3553 (message "Creating group magic...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3554 (mapc 'custom-magic-reset children) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3555 (message "Creating group state...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3556 (widget-put widget :children children) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3557 (custom-group-state-update widget) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3558 (message "Creating group... done")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3559 ;; End line |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3560 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3561 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3562 (insert "\\- " (widget-get widget :tag) " group end ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3563 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3564 (insert "/\n"))))) |
17334 | 3565 |
25685 | 3566 (defvar custom-group-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3567 '(("Set for Current Session" custom-group-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3568 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3569 (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
|
3570 ("Save for Future Sessions" custom-group-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3571 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3572 (memq (widget-get widget :custom-state) '(modified set)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3573 ("Reset to Current" custom-group-reset-current |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3574 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3575 (memq (widget-get widget :custom-state) '(modified)))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3576 ("Reset to Saved" custom-group-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3577 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3578 (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
|
3579 ("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
|
3580 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3581 (memq (widget-get widget :custom-state) '(modified set saved))))) |
17334 | 3582 "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
|
3583 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
|
3584 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
|
3585 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
|
3586 widget as an argument, and returns non-nil if ACTION is valid on that |
25685 | 3587 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3588 |
3589 (defun custom-group-action (widget &optional event) | |
3590 "Show the menu for `custom-group' WIDGET. | |
3591 Optional EVENT is the location for the menu." | |
3592 (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
|
3593 (custom-toggle-hide widget) |
17334 | 3594 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3595 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3596 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3597 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3598 (custom-menu-filter custom-group-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3599 widget) |
17334 | 3600 event))) |
3601 (if answer | |
3602 (funcall answer widget))))) | |
3603 | |
3604 (defun custom-group-set (widget) | |
3605 "Set changes in all modified group members." | |
3606 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3607 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3608 (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
|
3609 (widget-apply child :custom-set))) |
17334 | 3610 children ))) |
3611 | |
3612 (defun custom-group-save (widget) | |
3613 "Save all modified group members." | |
3614 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3615 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3616 (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
|
3617 (widget-apply child :custom-save))) |
17334 | 3618 children ))) |
3619 | |
3620 (defun custom-group-reset-current (widget) | |
3621 "Reset all modified group members." | |
3622 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3623 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3624 (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
|
3625 (widget-apply child :custom-reset-current))) |
17334 | 3626 children ))) |
3627 | |
3628 (defun custom-group-reset-saved (widget) | |
3629 "Reset all modified or set group members." | |
3630 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3631 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3632 (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
|
3633 (widget-apply child :custom-reset-saved))) |
17334 | 3634 children ))) |
3635 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3636 (defun custom-group-reset-standard (widget) |
17334 | 3637 "Reset all modified, set, or saved group members." |
3638 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3639 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3640 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3641 '(modified set saved)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3642 (widget-apply child :custom-reset-standard))) |
17334 | 3643 children ))) |
3644 | |
3645 (defun custom-group-state-update (widget) | |
3646 "Update magic." | |
3647 (unless (eq (widget-get widget :custom-state) 'hidden) | |
3648 (let* ((children (widget-get widget :children)) | |
3649 (states (mapcar (lambda (child) | |
3650 (widget-get child :custom-state)) | |
3651 children)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3652 (magics custom-magic-alist) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3653 (found 'standard)) |
17334 | 3654 (while magics |
3655 (let ((magic (car (car magics)))) | |
3656 (if (and (not (eq magic 'hidden)) | |
3657 (memq magic states)) | |
3658 (setq found magic | |
3659 magics nil) | |
3660 (setq magics (cdr magics))))) | |
3661 (widget-put widget :custom-state found))) | |
3662 (custom-magic-reset widget)) | |
3663 | |
3664 ;;; The `custom-save-all' Function. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
3665 ;;;###autoload |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3666 (defcustom custom-file nil |
17334 | 3667 "File used for storing customization information. |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3668 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
|
3669 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
|
3670 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
|
3671 |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3672 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
|
3673 \(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
|
3674 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
|
3675 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
|
3676 :type '(choice (const :tag "Your Emacs init file" nil) file) |
17334 | 3677 :group 'customize) |
3678 | |
20974 | 3679 (defun custom-file () |
3680 "Return the file name for saving customizations." | |
37911
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3681 (setq custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3682 (or custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3683 (let ((user-init-file user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3684 (default-init-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3685 (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3686 (when (null user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3687 (if (or (file-exists-p default-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3688 (and (eq system-type 'windows-nt) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3689 (file-exists-p "~/_emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3690 ;; Started with -q, i.e. the file containing |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3691 ;; Custom settings hasn't been read. Saving |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3692 ;; settings there would overwrite other settings. |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3693 (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
|
3694 (setq user-init-file default-init-file)) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3695 user-init-file)))) |
20974 | 3696 |
17334 | 3697 (defun custom-save-delete (symbol) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3698 "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
|
3699 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
|
3700 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
|
3701 (let ((default-major-mode 'emacs-lisp-mode)) |
20974 | 3702 (set-buffer (find-file-noselect (custom-file)))) |
17334 | 3703 (goto-char (point-min)) |
25058
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3704 ;; Skip all whitespace and comments. |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3705 (while (forward-comment 1)) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3706 (or (eobp) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3707 (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
|
3708 (let (first) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3709 (catch 'found |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3710 (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
|
3711 ;; Skip all whitespace and comments. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3712 (while (forward-comment 1)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3713 (let ((start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3714 (sexp (condition-case nil |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3715 (read (current-buffer)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3716 (end-of-file (throw 'found nil))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3717 (when (and (listp sexp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3718 (eq (car sexp) symbol)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3719 (delete-region start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3720 (unless first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3721 (setq first (point))))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3722 (if first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3723 (goto-char first) |
36628
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3724 ;; 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
|
3725 ;; entries would make them ineffective. |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3726 (let ((pos (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3727 (case-fold-search t)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3728 (save-excursion |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3729 (goto-char (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3730 (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
|
3731 'move) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3732 (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
|
3733 (setq pos (line-beginning-position)))) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3734 (goto-char pos))))) |
17334 | 3735 |
3736 (defun custom-save-variables () | |
3737 "Save all customized variables in `custom-file'." | |
3738 (save-excursion | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3739 (custom-save-delete 'custom-load-themes) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3740 (custom-save-delete 'custom-reset-variables) |
17334 | 3741 (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
|
3742 (custom-save-loaded-themes) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3743 (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
|
3744 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3745 (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
|
3746 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3747 ;; 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
|
3748 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3749 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3750 (if (get symbol 'saved-value) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3751 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3752 (setq saved-list (sort (cdr saved-list) 'string<)) |
17334 | 3753 (unless (bolp) |
3754 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3755 (princ "(custom-set-variables |
47315
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3756 ;; custom-set-variables was added by Custom. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3757 ;; 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
|
3758 ;; 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
|
3759 ;; 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
|
3760 (dolist (symbol saved-list) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3761 (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
|
3762 (value (get symbol 'saved-value)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3763 (requests (get symbol 'custom-requests)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3764 (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
|
3765 (and (not (boundp symbol)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3766 (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
|
3767 'rogue)))))) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
3768 (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
|
3769 ;; Check `requests'. |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3770 (dolist (request requests) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3771 (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
|
3772 (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
|
3773 (setq requests (delq request requests)))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3774 (when (or (and spec |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3775 (eq (nth 0 spec) 'user) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3776 (eq (nth 1 spec) 'set)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3777 comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3778 (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
|
3779 (unless (bolp) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3780 (princ "\n")) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3781 (princ " '(") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3782 (prin1 symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3783 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3784 (prin1 (car value)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3785 (when (or now requests comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3786 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3787 (prin1 now) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3788 (when (or requests comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3789 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3790 (prin1 requests) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3791 (when comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3792 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3793 (prin1 comment)))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3794 (princ ")")))) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3795 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3796 (princ " ")) |
17334 | 3797 (princ ")") |
3798 (unless (looking-at "\n") | |
3799 (princ "\n"))))) | |
3800 | |
3801 (defun custom-save-faces () | |
3802 "Save all customized faces in `custom-file'." | |
3803 (save-excursion | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3804 (custom-save-delete 'custom-reset-faces) |
17334 | 3805 (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
|
3806 (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
|
3807 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3808 (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
|
3809 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3810 ;; 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
|
3811 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3812 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3813 (if (get symbol 'saved-face) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3814 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3815 (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
|
3816 ;; 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
|
3817 (if (memq 'default saved-list) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3818 (setq saved-list (cons 'default (delq 'default saved-list)))) |
17334 | 3819 (unless (bolp) |
3820 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3821 (princ "(custom-set-faces |
47315
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3822 ;; custom-set-faces was added by Custom. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3823 ;; 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
|
3824 ;; 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
|
3825 ;; 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
|
3826 (dolist (symbol saved-list) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3827 (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
|
3828 (value (get symbol 'saved-face)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3829 (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
|
3830 (and (not (custom-facep symbol)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3831 (not (get symbol 'force-face)))))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3832 (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
|
3833 (when (or (and spec |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3834 (eq (nth 0 spec) 'user) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3835 (eq (nth 1 spec) 'set)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3836 comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3837 (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
|
3838 ;; 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
|
3839 (unless (bolp) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3840 (princ "\n")) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3841 (princ " '(") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3842 (prin1 symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3843 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3844 (prin1 value) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3845 (when (or now comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3846 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3847 (prin1 now) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3848 (when comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3849 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3850 (prin1 comment))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3851 (princ ")")))) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3852 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3853 (princ " ")) |
17334 | 3854 (princ ")") |
3855 (unless (looking-at "\n") | |
48958
6b4f6412de76
(custom-save-faces): Fix typo.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48949
diff
changeset
|
3856 (princ "\n"))))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3857 |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3858 (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
|
3859 (let (started-writing ignored-special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3860 ;; (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
|
3861 (let ((standard-output (current-buffer)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3862 (mapper `(lambda (object) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3863 (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
|
3864 (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
|
3865 (eq (nth 0 spec) 'user) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3866 (eq (nth 1 spec) 'reset)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3867 ;; 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
|
3868 (unless started-writing |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3869 (setq started-writing t) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3870 (unless (bolp) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3871 (princ "\n")) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3872 (princ "(") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3873 (princ (quote ,setter)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3874 (princ "\n '(") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3875 (prin1 object) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3876 (princ " ") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3877 (prin1 (nth 3 spec)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3878 (princ ")"))))))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3879 (mapc mapper special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3880 (setq ignored-special special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3881 (mapatoms mapper) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3882 (when started-writing |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3883 (princ ")\n"))))) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
3884 |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3885 (defun custom-save-loaded-themes () |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3886 (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
|
3887 (standard-output (current-buffer))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3888 (when themes |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3889 (unless (bolp) (princ "\n")) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3890 (princ "(custom-load-themes") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3891 (mapc (lambda (theme) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3892 (princ "\n '") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3893 (prin1 theme)) themes) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
3894 (princ " )\n")))) |
17334 | 3895 |
3896 ;;;###autoload | |
18436
2163f03bb88f
(customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents:
18435
diff
changeset
|
3897 (defun customize-save-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3898 "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
|
3899 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3900 (mapatoms (lambda (symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3901 (let ((face (get symbol 'customized-face)) |
25685 | 3902 (value (get symbol 'customized-value)) |
3903 (face-comment (get symbol 'customized-face-comment)) | |
3904 (variable-comment | |
3905 (get symbol 'customized-variable-comment))) | |
3906 (when face | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3907 (put symbol 'saved-face face) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3908 (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
|
3909 (put symbol 'customized-face nil)) |
25685 | 3910 (when value |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3911 (put symbol 'saved-value value) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3912 (custom-push-theme 'theme-value symbol 'user 'set value) |
25685 | 3913 (put symbol 'customized-value nil)) |
3914 (when variable-comment | |
3915 (put symbol 'saved-variable-comment variable-comment) | |
3916 (put symbol 'customized-variable-comment nil)) | |
3917 (when face-comment | |
3918 (put symbol 'saved-face-comment face-comment) | |
3919 (put symbol 'customized-face-comment nil))))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3920 ;; We really should update all custom buffers here. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3921 (custom-save-all)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3922 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3923 ;;;###autoload |
17334 | 3924 (defun custom-save-all () |
3925 "Save all customizations in `custom-file'." | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3926 (let ((inhibit-read-only t)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3927 (custom-save-variables) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3928 (custom-save-faces) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3929 (save-excursion |
20398
47f326ffb7ba
(custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents:
20397
diff
changeset
|
3930 (let ((default-major-mode nil)) |
20974 | 3931 (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
|
3932 (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
|
3933 (save-buffer))))) |
17334 | 3934 |
3935 ;;; The Customize Menu. | |
3936 | |
17415 | 3937 ;;; Menu support |
3938 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3939 (defcustom custom-menu-nesting 2 |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3940 "Maximum nesting in custom menus." |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3941 :type 'integer |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3942 :group 'custom-menu) |
17334 | 3943 |
3944 (defun custom-face-menu-create (widget symbol) | |
3945 "Ignoring WIDGET, create a menu entry for customization face SYMBOL." | |
3946 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3947 `(customize-face ',symbol) |
17334 | 3948 t)) |
3949 | |
3950 (defun custom-variable-menu-create (widget symbol) | |
3951 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL." | |
3952 (let ((type (get symbol 'custom-type))) | |
3953 (unless (listp type) | |
3954 (setq type (list type))) | |
3955 (if (and type (widget-get type :custom-menu)) | |
3956 (widget-apply type :custom-menu symbol) | |
3957 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3958 `(customize-variable ',symbol) |
17334 | 3959 t)))) |
3960 | |
17415 | 3961 ;; Add checkboxes to boolean variable entries. |
17334 | 3962 (widget-put (get 'boolean 'widget-type) |
3963 :custom-menu (lambda (widget symbol) | |
3964 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3965 `(customize-variable ',symbol) |
17334 | 3966 ':style 'toggle |
3967 ':selected symbol))) | |
3968 | |
30184
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3969 (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
|
3970 "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
|
3971 `( ,(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
|
3972 :filter (lambda (&rest junk) |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3973 (let ((menu (custom-menu-create ',symbol))) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3974 (if (consp menu) (cdr menu) menu))))) |
17334 | 3975 |
17415 | 3976 ;;;###autoload |
3977 (defun custom-menu-create (symbol) | |
17334 | 3978 "Create menu for customization group SYMBOL. |
3979 The menu is in a format applicable to `easy-menu-define'." | |
17415 | 3980 (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
|
3981 `(customize-group ',symbol) |
17415 | 3982 t))) |
3983 (if (and (or (not (boundp 'custom-menu-nesting)) | |
3984 (>= custom-menu-nesting 0)) | |
49126
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3985 (progn |
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3986 (custom-load-symbol symbol) |
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3987 (< (length (get symbol 'custom-group)) widget-menu-max-size))) |
17334 | 3988 (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
|
3989 custom-prefix-list)) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3990 (members (custom-sort-items (get symbol 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3991 custom-menu-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3992 custom-menu-order-groups))) |
17334 | 3993 `(,(custom-unlispify-menu-entry symbol t) |
3994 ,item | |
3995 "--" | |
3996 ,@(mapcar (lambda (entry) | |
3997 (widget-apply (if (listp (nth 1 entry)) | |
3998 (nth 1 entry) | |
3999 (list (nth 1 entry))) | |
4000 :custom-menu (nth 0 entry))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
4001 members))) |
17334 | 4002 item))) |
4003 | |
4004 ;;;###autoload | |
17415 | 4005 (defun customize-menu-create (symbol &optional name) |
4006 "Return a customize menu for customization group SYMBOL. | |
25685 | 4007 If optional NAME is given, use that as the name of the menu. |
17415 | 4008 Otherwise the menu will be named `Customize'. |
4009 The format is suitable for use with `easy-menu-define'." | |
4010 (unless name | |
4011 (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
|
4012 `(,name |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
4013 :filter (lambda (&rest junk) |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
4014 (let ((menu (custom-menu-create ',symbol))) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
4015 (if (consp menu) (cdr menu) menu))))) |
17334 | 4016 |
17415 | 4017 ;;; The Custom Mode. |
4018 | |
4019 (defvar custom-mode-map nil | |
4020 "Keymap for `custom-mode'.") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4021 |
17415 | 4022 (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
|
4023 ;; 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
|
4024 ;; "\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
|
4025 (setq custom-mode-map (make-sparse-keymap)) |
17415 | 4026 (set-keymap-parent custom-mode-map widget-keymap) |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
4027 (suppress-keymap custom-mode-map) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4028 (define-key custom-mode-map " " 'scroll-up) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4029 (define-key custom-mode-map "\177" 'scroll-down) |
25685 | 4030 (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
|
4031 (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
|
4032 (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
|
4033 (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
|
4034 (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
|
4035 |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4036 (defun Custom-move-and-invoke (event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4037 "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
|
4038 (interactive "e") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4039 (mouse-set-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4040 (if (widget-event-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4041 (let* ((pos (widget-event-point event)) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4042 (button (get-char-property pos 'button))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4043 (if button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4044 (widget-button-click event))))) |
17415 | 4045 |
25685 | 4046 (easy-menu-define Custom-mode-menu |
17415 | 4047 custom-mode-map |
4048 "Menu used in customization buffers." | |
4049 `("Custom" | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
4050 ,(customize-menu-create 'customize) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4051 ["Set" Custom-set t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4052 ["Save" Custom-save t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4053 ["Reset to Current" Custom-reset-current t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4054 ["Reset to Saved" Custom-reset-saved t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4055 ["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
|
4056 ["Info" (Info-goto-node "(emacs)Easy Customization") t])) |
17415 | 4057 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4058 (defun Custom-goto-parent () |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4059 "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
|
4060 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
|
4061 (interactive) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4062 (save-excursion |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4063 (goto-char (point-min)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4064 (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
|
4065 (let* ((button (get-char-property (point) 'button)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4066 (parent (downcase (widget-get button :tag)))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4067 (customize-group parent))))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4068 |
17415 | 4069 (defcustom custom-mode-hook nil |
25685 | 4070 "Hook called when entering Custom mode." |
17415 | 4071 :type 'hook |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
4072 :group 'custom-buffer ) |
17415 | 4073 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4074 (defun custom-state-buffer-message (widget) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4075 (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
|
4076 (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
|
4077 |
17415 | 4078 (defun custom-mode () |
4079 "Major mode for editing customization buffers. | |
4080 | |
4081 The following commands are available: | |
4082 | |
4083 Move to next button or editable field. \\[widget-forward] | |
4084 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
|
4085 \\<widget-field-keymap>\ |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
4086 Complete content of editable text field. \\[widget-complete] |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
4087 \\<custom-mode-map>\ |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4088 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
|
4089 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
|
4090 Set all modifications. \\[Custom-set] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4091 Make all modifications default. \\[Custom-save] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4092 Reset all modified options. \\[Custom-reset-current] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4093 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
|
4094 Reset all options. \\[Custom-reset-standard] |
17415 | 4095 |
4096 Entry to this mode calls the value of `custom-mode-hook' | |
4097 if that value is non-nil." | |
4098 (kill-all-local-variables) | |
4099 (setq major-mode 'custom-mode | |
4100 mode-name "Custom") | |
4101 (use-local-map custom-mode-map) | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4102 (easy-menu-add Custom-mode-menu) |
17415 | 4103 (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
|
4104 (make-local-variable 'custom-local-buffer) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4105 (make-local-variable 'widget-documentation-face) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4106 (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
|
4107 (make-local-variable 'widget-button-face) |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
4108 (setq widget-button-face 'custom-button-face) |
25685 | 4109 (set (make-local-variable 'widget-button-pressed-face) |
4110 'custom-button-pressed-face) | |
4111 (set (make-local-variable 'widget-mouse-face) | |
4112 'custom-button-pressed-face) ; buttons `depress' when moused | |
4113 ;; When possible, use relief for buttons, not bracketing. This test | |
4114 ;; may not be optimal. | |
4115 (when custom-raised-buttons | |
4116 (set (make-local-variable 'widget-push-button-prefix) "") | |
4117 (set (make-local-variable 'widget-push-button-suffix) "") | |
4118 (set (make-local-variable 'widget-link-prefix) "") | |
4119 (set (make-local-variable 'widget-link-suffix) "")) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4120 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t) |
17415 | 4121 (run-hooks 'custom-mode-hook)) |
17334 | 4122 |
32904
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
4123 (put 'custom-mode 'mode-class 'special) |
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
4124 |
28130 | 4125 (add-to-list |
4126 'debug-ignored-errors | |
4127 "^No user options have changed defaults in recent Emacs versions$") | |
4128 | |
17334 | 4129 ;;; The End. |
4130 | |
4131 (provide 'cus-edit) | |
4132 | |
52401 | 4133 ;;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f |
25685 | 4134 ;;; cus-edit.el ends here |