Mercurial > emacs
annotate lisp/cus-edit.el @ 58349:e497e4d0b665
(Regexp Search): Rename that to search-spaces-regexp.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 20 Nov 2004 14:06:54 +0000 |
parents | 27e0c6aa31c5 |
children | 2318e0187ad9 e24e2e78deda |
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 ;; |
54312
459874ec71ce
(fill) <defgroup>: Move to fill.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53319
diff
changeset
|
3 ;; Copyright (C) 1996,97,1999,2000,01,02,03,2004 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 editing-basics nil | |
290 "Most basic editing facilities." | |
291 :group 'editing) | |
292 | |
293 (defgroup display nil | |
294 "How characters are displayed in buffers." | |
295 :group 'environment) | |
296 | |
297 (defgroup execute nil | |
298 "Executing external commands." | |
299 :group 'processes) | |
300 | |
301 (defgroup installation nil | |
302 "The Emacs installation." | |
303 :group 'environment) | |
304 | |
305 (defgroup dired nil | |
306 "Directory editing." | |
307 :group 'environment) | |
308 | |
309 (defgroup limits nil | |
310 "Internal Emacs limits." | |
311 :group 'internal) | |
312 | |
313 (defgroup debug nil | |
314 "Debugging Emacs itself." | |
315 :group 'development) | |
316 | |
317 (defgroup minibuffer nil | |
318 "Controling the behaviour of the minibuffer." | |
52281 | 319 :link '(custom-manual "(emacs)Minibuffer") |
17415 | 320 :group 'environment) |
321 | |
322 (defgroup keyboard nil | |
323 "Input from the keyboard." | |
324 :group 'environment) | |
325 | |
326 (defgroup mouse nil | |
327 "Input from the mouse." | |
328 :group 'environment) | |
329 | |
330 (defgroup menu nil | |
331 "Input from the menus." | |
332 :group 'environment) | |
333 | |
334 (defgroup auto-save nil | |
335 "Preventing accidential loss of data." | |
18320
bb83860447d0
(files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents:
18258
diff
changeset
|
336 :group 'files) |
17415 | 337 |
338 (defgroup processes-basics nil | |
339 "Basic stuff dealing with processes." | |
340 :group 'processes) | |
341 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
342 (defgroup mule nil |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
343 "MULE Emacs internationalization." |
18053
941f5d1a241e
(cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents:
18033
diff
changeset
|
344 :group 'i18n) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
345 |
17415 | 346 (defgroup windows nil |
347 "Windows within a frame." | |
52281 | 348 :link '(custom-manual "(emacs)Windows") |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
349 :group 'environment) |
17415 | 350 |
17334 | 351 ;;; Utilities. |
352 | |
353 (defun custom-quote (sexp) | |
354 "Quote SEXP iff it is not self quoting." | |
355 (if (or (memq sexp '(t nil)) | |
28130 | 356 (keywordp sexp) |
17334 | 357 (and (listp sexp) |
358 (memq (car sexp) '(lambda))) | |
359 (stringp sexp) | |
360 (numberp sexp) | |
25685 | 361 (vectorp sexp) |
362 ;;; (and (fboundp 'characterp) | |
363 ;;; (characterp sexp)) | |
364 ) | |
17334 | 365 sexp |
366 (list 'quote sexp))) | |
367 | |
368 (defun custom-split-regexp-maybe (regexp) | |
369 "If REGEXP is a string, split it to a list at `\\|'. | |
25685 | 370 You can get the original back with from the result with: |
17334 | 371 (mapconcat 'identity result \"\\|\") |
372 | |
373 IF REGEXP is not a string, return it unchanged." | |
374 (if (stringp regexp) | |
375 (let ((start 0) | |
376 all) | |
377 (while (string-match "\\\\|" regexp start) | |
378 (setq all (cons (substring regexp start (match-beginning 0)) all) | |
379 start (match-end 0))) | |
380 (nreverse (cons (substring regexp start) all))) | |
381 regexp)) | |
382 | |
17415 | 383 (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
|
384 "Prompt for a custom variable, defaulting to the variable at point. |
17415 | 385 Return a list suitable for use in `interactive'." |
386 (let ((v (variable-at-point)) | |
387 (enable-recursive-minibuffers t) | |
388 val) | |
25685 | 389 (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
|
390 (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
|
391 (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
|
392 "Customize option: ") |
b74a6560ecbb
(custom-variable-prompt): Doc change. Use custom-variable-p.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49013
diff
changeset
|
393 obarray 'custom-variable-p t)) |
17415 | 394 (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
|
395 (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
|
396 (intern val))))) |
17415 | 397 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
398 (defun custom-menu-filter (menu widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
399 "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
|
400 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
|
401 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
|
402 (let ((result nil) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
403 current name action filter) |
25685 | 404 (while menu |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
405 (setq current (car menu) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
406 name (nth 0 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
407 action (nth 1 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
408 filter (nth 2 current) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
409 menu (cdr menu)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
410 (if (or (null filter) (funcall filter widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
411 (push (cons name action) result) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
412 (push name result))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
413 (nreverse result))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
414 |
17415 | 415 ;;; Unlispify. |
416 | |
17334 | 417 (defvar custom-prefix-list nil |
28130 | 418 "List of prefixes that should be ignored by `custom-unlispify'.") |
17334 | 419 |
420 (defcustom custom-unlispify-menu-entries t | |
421 "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
|
422 :group 'custom-menu |
17334 | 423 :type 'boolean) |
424 | |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
425 (defcustom custom-unlispify-remove-prefixes nil |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
426 "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
|
427 :group 'custom-menu |
43508
c092c3c65251
2002-02-24 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43246
diff
changeset
|
428 :group 'custom-buffer |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
429 :type 'boolean) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
430 |
17334 | 431 (defun custom-unlispify-menu-entry (symbol &optional no-suffix) |
28130 | 432 "Convert SYMBOL into a menu entry." |
17334 | 433 (cond ((not custom-unlispify-menu-entries) |
434 (symbol-name symbol)) | |
435 ((get symbol 'custom-tag) | |
436 (if no-suffix | |
437 (get symbol 'custom-tag) | |
438 (concat (get symbol 'custom-tag) "..."))) | |
439 (t | |
49556
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
440 (with-current-buffer (get-buffer-create " *Custom-Work*") |
17334 | 441 (erase-buffer) |
442 (princ symbol (current-buffer)) | |
443 (goto-char (point-min)) | |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
444 ;; 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
|
445 ;; end with `-p'. -stef |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
446 ;; (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
|
447 ;; (re-search-forward "-p\\'" nil t)) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
448 ;; (replace-match "" t t) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
449 ;; (goto-char (point-min))) |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
450 (if custom-unlispify-remove-prefixes |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
451 (let ((prefixes custom-prefix-list) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
452 prefix) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
453 (while prefixes |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
454 (setq prefix (car prefixes)) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
455 (if (search-forward prefix (+ (point) (length prefix)) t) |
25685 | 456 (progn |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
457 (setq prefixes nil) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
458 (delete-region (point-min) (point))) |
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
459 (setq prefixes (cdr prefixes)))))) |
17334 | 460 (subst-char-in-region (point-min) (point-max) ?- ?\ t) |
461 (capitalize-region (point-min) (point-max)) | |
25685 | 462 (unless no-suffix |
17334 | 463 (goto-char (point-max)) |
464 (insert "...")) | |
465 (buffer-string))))) | |
466 | |
467 (defcustom custom-unlispify-tag-names t | |
468 "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
|
469 :group 'custom-buffer |
17334 | 470 :type 'boolean) |
471 | |
472 (defun custom-unlispify-tag-name (symbol) | |
28130 | 473 "Convert SYMBOL into a menu entry." |
17334 | 474 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names)) |
475 (custom-unlispify-menu-entry symbol t))) | |
476 | |
477 (defun custom-prefix-add (symbol prefixes) | |
28130 | 478 "Add SYMBOL to list of ignored PREFIXES." |
17334 | 479 (cons (or (get symbol 'custom-prefix) |
480 (concat (symbol-name symbol) "-")) | |
481 prefixes)) | |
482 | |
17415 | 483 ;;; Guess. |
484 | |
485 (defcustom custom-guess-name-alist | |
486 '(("-p\\'" boolean) | |
487 ("-hook\\'" hook) | |
488 ("-face\\'" face) | |
489 ("-file\\'" file) | |
490 ("-function\\'" function) | |
491 ("-functions\\'" (repeat function)) | |
492 ("-list\\'" (repeat sexp)) | |
493 ("-alist\\'" (repeat (cons sexp sexp)))) | |
494 "Alist of (MATCH TYPE). | |
495 | |
25685 | 496 MATCH should be a regexp matching the name of a symbol, and TYPE should |
17415 | 497 be a widget suitable for editing the value of that symbol. The TYPE |
498 of the first entry where MATCH matches the name of the symbol will be | |
25685 | 499 used. |
17415 | 500 |
501 This is used for guessing the type of variables not declared with | |
502 customize." | |
503 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) | |
504 :group 'customize) | |
505 | |
506 (defcustom custom-guess-doc-alist | |
507 '(("\\`\\*?Non-nil " boolean)) | |
508 "Alist of (MATCH TYPE). | |
509 | |
510 MATCH should be a regexp matching a documentation string, and TYPE | |
511 should be a widget suitable for editing the value of a variable with | |
512 that documentation string. The TYPE of the first entry where MATCH | |
513 matches the name of the symbol will be used. | |
514 | |
515 This is used for guessing the type of variables not declared with | |
516 customize." | |
517 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type"))) | |
518 :group 'customize) | |
519 | |
520 (defun custom-guess-type (symbol) | |
521 "Guess a widget suitable for editing the value of SYMBOL. | |
25685 | 522 This is done by matching SYMBOL with `custom-guess-name-alist' and |
17415 | 523 if that fails, the doc string with `custom-guess-doc-alist'." |
524 (let ((name (symbol-name symbol)) | |
525 (names custom-guess-name-alist) | |
526 current found) | |
527 (while names | |
528 (setq current (car names) | |
529 names (cdr names)) | |
530 (when (string-match (nth 0 current) name) | |
531 (setq found (nth 1 current) | |
532 names nil))) | |
533 (unless found | |
534 (let ((doc (documentation-property symbol 'variable-documentation)) | |
535 (docs custom-guess-doc-alist)) | |
25685 | 536 (when doc |
17415 | 537 (while docs |
538 (setq current (car docs) | |
539 docs (cdr docs)) | |
540 (when (string-match (nth 0 current) doc) | |
541 (setq found (nth 1 current) | |
542 docs nil)))))) | |
543 found)) | |
544 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
545 ;;; Sorting. |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
546 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
547 (defcustom custom-browse-sort-alphabetically nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
548 "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
|
549 :type 'boolean |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
550 :group 'custom-browse) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
551 |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
552 (defcustom custom-browse-order-groups nil |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
553 "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
|
554 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
555 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
556 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
557 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
558 (const :tag "none" nil)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
559 :group 'custom-browse) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
560 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
561 (defcustom custom-browse-only-groups nil |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
562 "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
|
563 :type 'boolean |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
564 :group 'custom-browse) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
565 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
566 (defcustom custom-buffer-sort-alphabetically nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
567 "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
|
568 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
569 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
570 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
571 (defcustom custom-buffer-order-groups 'last |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
572 "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
|
573 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
574 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
575 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
576 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
577 (const :tag "none" nil)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
578 :group 'custom-buffer) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
579 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
580 (defcustom custom-menu-sort-alphabetically nil |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
581 "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
|
582 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
583 :group 'custom-menu) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
584 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
585 (defcustom custom-menu-order-groups 'first |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
586 "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
|
587 If `first', order groups before non-groups. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
588 If `last', order groups after non-groups." |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
589 :type '(choice (const first) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
590 (const last) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
591 (const :tag "none" nil)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
592 :group 'custom-menu) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
593 |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
594 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'") |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
595 |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
596 (defun custom-sort-items (items sort-alphabetically order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
597 "Return a sorted copy of ITEMS. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
598 ITEMS should be a `custom-group' property. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
599 If SORT-ALPHABETICALLY non-nil, sort alphabetically. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
600 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
|
601 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
|
602 (sort (copy-sequence items) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
603 (lambda (a b) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
604 (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
|
605 (namea (nth 0 a)) (nameb (nth 0 b))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
606 (cond ((not order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
607 ;; 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
|
608 (when sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
609 (string-lessp namea nameb))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
610 ((eq typea 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
611 ;; 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
|
612 (if (eq typeb 'custom-group) |
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 order-groups 'first))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
616 ((eq typeb 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
617 ;; 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
|
618 (eq order-groups 'last)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
619 (sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
620 ;; Since A and B cannot be groups, sort. |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
621 (string-lessp namea nameb))))))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
622 |
17415 | 623 ;;; Custom Mode Commands. |
17334 | 624 |
625 (defvar custom-options nil | |
626 "Customization widgets in the current buffer.") | |
627 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
628 (defun Custom-set () |
17334 | 629 "Set changes in all modified options." |
630 (interactive) | |
631 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
632 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
633 (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
|
634 (widget-apply child :custom-set))) |
17334 | 635 children))) |
636 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
637 (defun Custom-save () |
17334 | 638 "Set all modified group members and save them." |
639 (interactive) | |
640 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
641 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
642 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
643 '(modified set changed rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
644 (widget-apply child :custom-save))) |
17334 | 645 children)) |
646 (custom-save-all)) | |
647 | |
25685 | 648 (defvar custom-reset-menu |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
649 '(("Current" . Custom-reset-current) |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
650 ("Saved" . Custom-reset-saved) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
651 ("Erase Customization (use standard settings)" . Custom-reset-standard)) |
17334 | 652 "Alist of actions for the `Reset' button. |
653 The key is a string containing the name of the action, the value is a | |
28130 | 654 Lisp function taking the widget as an element which will be called |
17334 | 655 when the action is chosen.") |
656 | |
657 (defun custom-reset (event) | |
658 "Select item from reset menu." | |
659 (let* ((completion-ignore-case t) | |
660 (answer (widget-choose "Reset to" | |
661 custom-reset-menu | |
662 event))) | |
663 (if answer | |
664 (funcall answer)))) | |
665 | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
666 (defun Custom-reset-current (&rest ignore) |
17334 | 667 "Reset all modified group members to their current value." |
668 (interactive) | |
669 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
670 (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
|
671 (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
|
672 '(modified changed)) |
26938a3af137
(Custom-reset-current): Don't test for default-boundp.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47503
diff
changeset
|
673 (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
|
674 children))) |
17334 | 675 |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
676 (defun Custom-reset-saved (&rest ignore) |
17334 | 677 "Reset all modified or set group members to their saved value." |
678 (interactive) | |
679 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
680 (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
|
681 (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
|
682 '(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
|
683 (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
|
684 children))) |
17334 | 685 |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
686 (defun Custom-reset-standard (&rest ignore) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
687 "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
|
688 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
|
689 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
|
690 making them as if they had never been customized at all." |
17334 | 691 (interactive) |
692 (let ((children custom-options)) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
693 (mapc (lambda (widget) |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
694 (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
|
695 (if (memq (widget-get widget :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
696 '(modified set changed saved rogue)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
697 (widget-apply widget :custom-reset-standard)))) |
17334 | 698 children))) |
699 | |
700 ;;; The Customize Commands | |
701 | |
25685 | 702 (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
|
703 "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
|
704 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
|
705 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
|
706 the name of the variable. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
707 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
708 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
|
709 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
|
710 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
711 If the variable has a `custom-type' property, it must be a widget and the |
25685 | 712 `:prompt-value' property of that widget will be used for reading the value. |
713 | |
714 If optional COMMENT argument is non nil, also prompt for a comment and return | |
715 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
|
716 (let* ((var (read-variable prompt-var)) |
25685 | 717 (minibuffer-help-form '(describe-variable var)) |
718 (val | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
719 (let ((prop (get var 'variable-interactive)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
720 (type (get var 'custom-type)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
721 (prompt (format prompt-val var))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
722 (unless (listp type) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
723 (setq type (list type))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
724 (cond (prop |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
725 ;; Use VAR's `variable-interactive' property |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
726 ;; as an interactive spec for prompting. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
727 (call-interactively (list 'lambda '(arg) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
728 (list 'interactive prop) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
729 'arg))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
730 (type |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
731 (widget-prompt-value type |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
732 prompt |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
733 (if (boundp var) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
734 (symbol-value var)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
735 (not (boundp var)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
736 (t |
25685 | 737 (eval-minibuffer prompt)))))) |
738 (if comment | |
739 (list var val | |
740 (read-string "Comment: " (get var 'variable-comment))) | |
741 (list var val)))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
742 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
743 ;;;###autoload |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
744 (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
|
745 "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
|
746 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
747 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
|
748 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
|
749 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
750 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 751 `:prompt-value' property of that widget will be used for reading the value. |
752 | |
753 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
|
754 (interactive (custom-prompt-variable "Set variable: " |
25685 | 755 "Set %s to value: " |
756 current-prefix-arg)) | |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
757 |
25685 | 758 (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
|
759 (put variable 'variable-comment nil)) |
25685 | 760 (comment |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
761 (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
|
762 (set variable value)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
763 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
764 ;;;###autoload |
28130 | 765 (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
|
766 "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
|
767 VALUE is a Lisp object. |
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 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
|
770 VARIABLE, otherwise `set-default' is used. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
771 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
772 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
|
773 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
|
774 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
775 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
|
776 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
|
777 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
778 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 779 `:prompt-value' property of that widget will be used for reading the value. |
780 | |
781 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
|
782 (interactive (custom-prompt-variable "Set variable: " |
25685 | 783 "Set customized value for %s to: " |
784 current-prefix-arg)) | |
43246
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
785 (custom-load-symbol variable) |
28130 | 786 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
787 (put variable 'customized-value (list (custom-quote value))) | |
25685 | 788 (cond ((string= comment "") |
28130 | 789 (put variable 'variable-comment nil) |
790 (put variable 'customized-variable-comment nil)) | |
25685 | 791 (comment |
28130 | 792 (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
|
793 (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
|
794 value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
795 |
17334 | 796 ;;;###autoload |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
797 (defun customize-save-variable (variable value &optional comment) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
798 "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
|
799 Return VALUE. |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
800 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
801 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
|
802 VARIABLE, otherwise `set-default' is used. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
803 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
804 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
|
805 with a quoted VALUE as its sole list member. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
806 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
807 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
|
808 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
|
809 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
810 If VARIABLE has a `custom-type' property, it must be a widget and the |
25685 | 811 `:prompt-value' property of that widget will be used for reading the value. |
812 | |
813 If given a prefix (or a COMMENT argument), also prompt for a comment." | |
43063 | 814 (interactive (custom-prompt-variable "Set and save variable: " |
25685 | 815 "Set and save value for %s as: " |
816 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
|
817 (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
|
818 (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
|
819 (custom-push-theme 'theme-value variable 'user 'set (list (custom-quote value))) |
25685 | 820 (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
|
821 (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
|
822 (put variable 'saved-variable-comment nil)) |
25685 | 823 (comment |
45244
3fe5828abc37
(customize-set-value): Rename `var' to `variable' and `val' to `value'.
Pavel Janík <Pavel@Janik.cz>
parents:
45102
diff
changeset
|
824 (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
|
825 (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
|
826 (custom-save-all) |
c187056ac630
2002-02-11 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
43167
diff
changeset
|
827 value) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
828 |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
829 ;;;###autoload |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
830 (defun customize () |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
831 "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
|
832 User options are structured into \"groups\". |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
833 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
|
834 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
|
835 (interactive) |
17703 | 836 (customize-group 'emacs)) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
837 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
838 ;;;###autoload |
47823
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
839 (defun customize-mode (mode) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
840 "Customize options related to the current major mode. |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
841 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
|
842 then prompt for the MODE to customize." |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
843 (interactive |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
844 (list |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
845 (let ((completion-regexp-list '("-mode\\'")) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
846 (group (custom-group-of-mode major-mode))) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
847 (if (and group (not current-prefix-arg)) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
848 major-mode |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
849 (intern |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
850 (completing-read (if group |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
851 (format "Major mode (default %s): " major-mode) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
852 "Major mode: ") |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
853 obarray |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
854 'custom-group-of-mode |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
855 t nil nil (if group (symbol-name major-mode)))))))) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
856 (customize-group (custom-group-of-mode mode))) |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
857 |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
858 |
4649d9cb92dd
(customize-mode): New command.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47809
diff
changeset
|
859 ;;;###autoload |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
860 (defun customize-group (group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
861 "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
|
862 (interactive (list (let ((completion-ignore-case t)) |
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
863 (completing-read "Customize group: (default emacs) " |
25685 | 864 obarray |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
865 (lambda (symbol) |
19886
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
866 (or (get symbol 'custom-loads) |
539d06d1f0da
(customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents:
19883
diff
changeset
|
867 (get symbol 'custom-group))) |
18352
4951826c2ed2
(customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents:
18336
diff
changeset
|
868 t)))) |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
869 (when (stringp group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
870 (if (string-equal "" group) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
871 (setq group 'emacs) |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
872 (setq group (intern group)))) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
873 (let ((name (format "*Customize Group: %s*" |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
874 (custom-unlispify-tag-name group)))) |
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
875 (if (get-buffer name) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
876 (pop-to-buffer name) |
18359
057bb638549c
(custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18352
diff
changeset
|
877 (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
|
878 name |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
879 (concat " for group " |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
880 (custom-unlispify-tag-name group)))))) |
17334 | 881 |
882 ;;;###autoload | |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
883 (defun customize-group-other-window (group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
884 "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
|
885 (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
|
886 (completing-read "Customize group: (default emacs) " |
25685 | 887 obarray |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
888 (lambda (symbol) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
889 (or (get symbol 'custom-loads) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
890 (get symbol 'custom-group))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
891 t)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
892 (when (stringp group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
893 (if (string-equal "" group) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
894 (setq group 'emacs) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
895 (setq group (intern group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
896 (let ((name (format "*Customize Group: %s*" |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
897 (custom-unlispify-tag-name group)))) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
898 (if (get-buffer name) |
57896
27e0c6aa31c5
(customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents:
56161
diff
changeset
|
899 (let ( |
48975
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
900 ;; 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
|
901 (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
|
902 (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
|
903 (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
|
904 (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
|
905 (same-window-regexps nil)) |
57896
27e0c6aa31c5
(customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents:
56161
diff
changeset
|
906 (pop-to-buffer name)) |
22001
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
907 (custom-buffer-create-other-window |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
908 (list (list group 'custom-group)) |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
909 name |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
910 (concat " for group " |
e35aafba190f
(customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
911 (custom-unlispify-tag-name group)))))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
912 |
18089 | 913 ;;;###autoload |
914 (defalias 'customize-variable 'customize-option) | |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
915 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
916 ;;;###autoload |
18086
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
917 (defun customize-option (symbol) |
dbae3eb8b351
(customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents:
18085
diff
changeset
|
918 "Customize SYMBOL, which must be a user option variable." |
17415 | 919 (interactive (custom-variable-prompt)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
920 (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
|
921 (format "*Customize Option: %s*" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
922 (custom-unlispify-tag-name symbol)))) |
17334 | 923 |
48975
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
924 ;;;###autoload |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
925 (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
|
926 |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
927 ;;;###autoload |
227f251b919a
(customize-group-other-window): Use pop-to-buffer in
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48958
diff
changeset
|
928 (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
|
929 "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
|
930 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
|
931 (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
|
932 (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
|
933 (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
|
934 (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
|
935 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
936 (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
|
937 "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
|
938 |
17334 | 939 ;;;###autoload |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
940 (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
|
941 "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
|
942 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
|
943 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
|
944 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
|
945 |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
946 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
|
947 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
|
948 version." |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
949 |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
950 (interactive "sCustomize options changed, since version (default all versions): ") |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
951 (if (equal since-version "") |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
952 (setq since-version nil) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
953 (unless (condition-case nil |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
954 (numberp (read since-version)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
955 (error nil)) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
956 (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
|
957 (unless since-version |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
958 (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
|
959 |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
960 ;; 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
|
961 ;; custom-load-symbol for this. |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
962 (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
|
963 (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
|
964 (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
|
965 (dolist (load (cdr elt)) |
b99be2b86231
(customize-changed-options): Undo last doc change.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49218
diff
changeset
|
966 (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
|
967 (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
|
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 |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
970 (let (found) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
971 (mapatoms |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
972 (lambda (symbol) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
973 (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
|
974 (if version |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
975 (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
|
976 (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
|
977 (get symbol 'group-documentation)) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
978 (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
|
979 (if (custom-variable-p symbol) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
980 (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
|
981 (if (custom-facep symbol) |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
982 (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
|
983 (if found |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
984 (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
|
985 "*Customize Changed Options*") |
ddeb57b6c977
(customize-changed-options): Doc addition. Load the
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49126
diff
changeset
|
986 (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
|
987 since-version)))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
988 |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
989 (defun customize-version-lessp (version1 version2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
990 ;; 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
|
991 ;; 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
|
992 |
23105
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
993 ;; 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
|
994 ;; in the :version value. |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
995 (if (numberp version2) |
a47a69af14c8
(customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents:
22667
diff
changeset
|
996 (setq version2 (prin1-to-string version2))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
997 (let (major1 major2 minor1 minor2) |
29762
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
998 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
999 (setq major1 (read (or (match-string 1 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1000 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1001 (setq minor1 (read (or (match-string 3 version1) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1002 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1003 (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1004 (setq major2 (read (or (match-string 1 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1005 "0"))) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1006 (setq minor2 (read (or (match-string 3 version2) |
8c4512ba3671
(customize-changed-options): Check arg.
Dave Love <fx@gnu.org>
parents:
28941
diff
changeset
|
1007 "0"))) |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1008 (or (< major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1009 (and (= major1 major2) |
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1010 (< minor1 minor2))))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
1011 |
20444
a9fbb6791eb7
(customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents:
20411
diff
changeset
|
1012 ;;;###autoload |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1013 (defun customize-face (&optional face) |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1014 "Customize FACE, which should be a face name or nil. |
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1015 If FACE is nil, customize all faces. |
44841
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1016 |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1017 Interactively, when point is on text which has a face specified, |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1018 suggest to customize that face, if it's customizable." |
44841
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1019 (interactive |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1020 (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
|
1021 (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
|
1022 (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
|
1023 (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
|
1024 (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
|
1025 (if (listp face) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1026 (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
|
1027 (mapcar (lambda (s) |
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1028 (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
|
1029 face) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1030 t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1031 "*Customize Faces*") |
44887
01a5b217fd7f
(customize-face): Use read-face-name and handle multiple faces.
Richard M. Stallman <rms@gnu.org>
parents:
44846
diff
changeset
|
1032 (unless (facep face) |
49013
4a3d5b9c79b9
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48997
diff
changeset
|
1033 (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
|
1034 (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
|
1035 (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
|
1036 (custom-unlispify-tag-name face))))) |
17334 | 1037 |
1038 ;;;###autoload | |
44891 | 1039 (defun customize-face-other-window (&optional face) |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1040 "Show customization buffer for face FACE in other window. |
44841
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1041 |
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1042 Interactively, when point is on text which has a face specified, |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1043 suggest to customize that face, if it's customizable." |
44841
ca88dc883a8d
(customize-face-other-window, customize-face):
Gerd Moellmann <gerd@gnu.org>
parents:
44682
diff
changeset
|
1044 (interactive |
44888
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1045 (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
|
1046 (if (member face '(nil "")) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1047 (setq face (face-list))) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1048 (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
|
1049 (setq face (car face))) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1050 (if (listp face) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1051 (custom-buffer-create-other-window |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1052 (custom-sort-items |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1053 (mapcar (lambda (s) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1054 (list s 'custom-face)) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1055 face) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1056 t nil) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1057 "*Customize Faces*") |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1058 (unless (facep face) |
49013
4a3d5b9c79b9
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48997
diff
changeset
|
1059 (error "Invalid face %S" face)) |
25685 | 1060 (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
|
1061 (list (list face 'custom-face)) |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1062 (format "*Customize Face: %s*" |
b74399186334
(customize-face-other-window): Make it work similarly.
Richard M. Stallman <rms@gnu.org>
parents:
44887
diff
changeset
|
1063 (custom-unlispify-tag-name face))))) |
17415 | 1064 |
1065 ;;;###autoload | |
17334 | 1066 (defun customize-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1067 "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
|
1068 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1069 (let ((found nil)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1070 (mapatoms (lambda (symbol) |
25685 | 1071 (and (or (get symbol 'customized-face) |
1072 (get symbol 'customized-face-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1073 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1074 (push (list symbol 'custom-face) found)) |
25685 | 1075 (and (or (get symbol 'customized-value) |
1076 (get symbol 'customized-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1077 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1078 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1079 (if (not found) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1080 (error "No customized user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1081 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1082 "*Customize Customized*")))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1083 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1084 ;;;###autoload |
50077
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1085 (defun customize-rogue () |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1086 "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
|
1087 (interactive) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1088 (let ((found nil)) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1089 (mapatoms (lambda (symbol) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1090 (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
|
1091 (get symbol 'saved-value) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1092 (get symbol 'standard-value)))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1093 (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
|
1094 (default-boundp symbol) ;Has a value. |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1095 (not (equal (eval (car cval)) |
50077
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1096 ;; 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
|
1097 (default-value symbol)))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1098 (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
|
1099 (if (not found) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1100 (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
|
1101 (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
|
1102 "*Customize Rogue*")))) |
21135e13f9cd
2003-03-10 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
49556
diff
changeset
|
1103 ;;;###autoload |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1104 (defun customize-saved () |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1105 "Customize all already saved user options." |
17334 | 1106 (interactive) |
1107 (let ((found nil)) | |
1108 (mapatoms (lambda (symbol) | |
25685 | 1109 (and (or (get symbol 'saved-face) |
1110 (get symbol 'saved-face-comment)) | |
17334 | 1111 (custom-facep symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1112 (push (list symbol 'custom-face) found)) |
25685 | 1113 (and (or (get symbol 'saved-value) |
1114 (get symbol 'saved-variable-comment)) | |
17334 | 1115 (boundp symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1116 (push (list symbol 'custom-variable) found)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1117 (if (not found ) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1118 (error "No saved user options") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1119 (custom-buffer-create (custom-sort-items found t nil) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1120 "*Customize Saved*")))) |
17334 | 1121 |
1122 ;;;###autoload | |
1123 (defun customize-apropos (regexp &optional all) | |
1124 "Customize all user options matching REGEXP. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1125 If ALL is `options', include only options. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1126 If ALL is `faces', include only faces. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1127 If ALL is `groups', include only groups. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1128 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
|
1129 user-settable, as well as faces and groups." |
17334 | 1130 (interactive "sCustomize regexp: \nP") |
1131 (let ((found nil)) | |
1132 (mapatoms (lambda (symbol) | |
1133 (when (string-match regexp (symbol-name symbol)) | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1134 (when (and (not (memq all '(faces options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1135 (get symbol 'custom-group)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1136 (push (list symbol 'custom-group) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1137 (when (and (not (memq all '(options groups))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1138 (custom-facep symbol)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1139 (push (list symbol 'custom-face) found)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1140 (when (and (not (memq all '(groups faces))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1141 (boundp symbol) |
17334 | 1142 (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
|
1143 (custom-variable-p symbol) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1144 (if (memq all '(nil options)) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1145 (user-variable-p symbol) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1146 (get symbol 'variable-documentation)))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1147 (push (list symbol 'custom-variable) found))))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1148 (if (not found) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1149 (error "No matches") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1150 (custom-buffer-create (custom-sort-items found t |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1151 custom-buffer-order-groups) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1152 "*Customize Apropos*")))) |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1153 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1154 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1155 (defun customize-apropos-options (regexp &optional arg) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1156 "Customize all user options matching REGEXP. |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1157 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
|
1158 (interactive "sCustomize regexp: \nP") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1159 (customize-apropos regexp (or arg 'options))) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1160 |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1161 ;;;###autoload |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1162 (defun customize-apropos-faces (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1163 "Customize all user faces matching REGEXP." |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1164 (interactive "sCustomize regexp: \n") |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1165 (customize-apropos regexp 'faces)) |
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-groups (regexp) |
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
1169 "Customize all user groups 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 'groups)) |
17334 | 1172 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1173 ;;; Buffer. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1174 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1175 (defcustom custom-buffer-style 'links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1176 "Control the presentation style for customization buffers. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1177 The value should be a symbol, one of: |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1178 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1179 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
|
1180 links: groups have links to subgroups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1181 :type '(radio (const brackets) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1182 (const links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1183 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1184 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1185 ;; 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
|
1186 ;; the window. |
25840
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1187 (defun custom-bury-buffer (buffer) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1188 (with-current-buffer buffer |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1189 (bury-buffer))) |
25840
6beb132dd31c
(custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents:
25824
diff
changeset
|
1190 |
26451
91e697e38599
(customize-face, customize-face-other-window): Require match from
Dave Love <fx@gnu.org>
parents:
25847
diff
changeset
|
1191 (defcustom custom-buffer-done-function 'custom-bury-buffer |
25685 | 1192 "*Function called to remove a Custom buffer when the user is done with it. |
1193 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
|
1194 :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
|
1195 (function-item :tag "Kill buffer" kill-buffer) |
25685 | 1196 (function :tag "Other")) |
1197 :version "21.1" | |
1198 :group 'custom-buffer) | |
1199 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1200 (defcustom custom-buffer-indent 3 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1201 "Number of spaces to indent nested groups." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1202 :type 'integer |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1203 :group 'custom-buffer) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1204 |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1205 (defun custom-get-fresh-buffer (name) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1206 "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
|
1207 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
|
1208 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
|
1209 not for everybody." |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1210 ;; 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
|
1211 ;; 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
|
1212 (let ((buf (get-buffer name))) |
51429
b107764e9a67
(custom-get-fresh-buffer): Test for nonexistence buffer.
Lute Kamstra <lute@gnu.org>
parents:
51381
diff
changeset
|
1213 (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
|
1214 ;; 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
|
1215 (kill-buffer buf) |
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1216 (setq buf nil)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1217 (if (null buf) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1218 (get-buffer-create name) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1219 (with-current-buffer buf |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1220 (kill-all-local-variables) |
51381
a2b5bb57e1c9
(custom-get-fresh-buffer): Be extra paranoid,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51362
diff
changeset
|
1221 (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
|
1222 ;; 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
|
1223 ;; 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
|
1224 (let ((ols (overlay-lists))) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1225 (dolist (ol (nconc (car ols) (cdr ols))) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1226 (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
|
1227 (erase-buffer) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1228 buf)))) |
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1229 |
17334 | 1230 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1231 (defun custom-buffer-create (options &optional name description) |
17334 | 1232 "Create a buffer containing OPTIONS. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1233 Optional NAME is the name of the buffer. |
17334 | 1234 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1235 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1236 that option." | |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1237 (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
|
1238 (custom-buffer-create-internal options description)) |
17415 | 1239 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1240 ;;;###autoload |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1241 (defun custom-buffer-create-other-window (options &optional name description) |
57896
27e0c6aa31c5
(customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents:
56161
diff
changeset
|
1242 "Create a buffer containing OPTIONS, and display it in another window. |
27e0c6aa31c5
(customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents:
56161
diff
changeset
|
1243 The result includes selecting that window. |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1244 Optional NAME is the name of the buffer. |
17415 | 1245 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1246 SYMBOL is a customization option, and WIDGET is a widget for editing | |
1247 that option." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1248 (unless name (setq name "*Customization*")) |
57896
27e0c6aa31c5
(customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents:
56161
diff
changeset
|
1249 (let ((pop-up-windows t) |
22332
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1250 (special-display-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1251 (special-display-regexps nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1252 (same-window-buffer-names nil) |
7ad747c6c5a9
(customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents:
22068
diff
changeset
|
1253 (same-window-regexps nil)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1254 (pop-to-buffer (custom-get-fresh-buffer name)) |
57896
27e0c6aa31c5
(customize-group-other-window):
Richard M. Stallman <rms@gnu.org>
parents:
56161
diff
changeset
|
1255 (custom-buffer-create-internal options description))) |
18089 | 1256 |
1257 (defcustom custom-reset-button-menu nil | |
1258 "If non-nil, only show a single reset button in customize buffers. | |
1259 This button will have a menu with all three reset operations." | |
1260 :type 'boolean | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1261 :group 'custom-buffer) |
17415 | 1262 |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1263 (defcustom custom-buffer-verbose-help t |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1264 "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
|
1265 :type 'boolean |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1266 :group 'custom-buffer) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1267 |
25685 | 1268 (defun Custom-buffer-done (&rest ignore) |
1269 "Remove current buffer by calling `custom-buffer-done-function'." | |
1270 (interactive) | |
1271 (funcall custom-buffer-done-function (current-buffer))) | |
1272 | |
1273 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box) | |
1274 '(("unspecified" . unspecified)))) | |
1275 "If non-nil, indicate active buttons in a `raised-button' style. | |
1276 Otherwise use brackets." | |
1277 :type 'boolean | |
1278 :version "21.1" | |
1279 :group 'custom-buffer) | |
1280 | |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
1281 (defun custom-buffer-create-internal (options &optional description) |
17415 | 1282 (message "Creating customization buffer...") |
17334 | 1283 (custom-mode) |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1284 (if custom-buffer-verbose-help |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1285 (progn |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1286 (widget-insert "This is a customization buffer") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1287 (if description |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1288 (widget-insert description)) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1289 (widget-insert (format ". |
25685 | 1290 %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
|
1291 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
|
1292 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
|
1293 choose the Set operation to set the option value. |
25685 | 1294 Invoke " (if custom-raised-buttons |
1295 "`Raised' buttons" | |
1296 "Square brackets"))) | |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1297 (widget-create 'info-link |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1298 :tag "Help" |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1299 :help-echo "Read the online help." |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1300 "(emacs)Easy Customization") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1301 (widget-insert " for more information.\n\n") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1302 (message "Creating customization buttons...") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1303 (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
|
1304 (widget-insert " ")) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1305 (widget-create 'push-button |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1306 :tag "Set for Current Session" |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1307 :help-echo "\ |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1308 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
|
1309 :action (lambda (widget &optional event) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
1310 (Custom-set))) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1311 (widget-insert " ") |
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 "Save for Future Sessions" |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1314 :help-echo "\ |
18437
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 future Emacs sessions." |
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-save))) |
18089 | 1318 (if custom-reset-button-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1319 (progn |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1320 (widget-insert " ") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1321 (widget-create 'push-button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1322 :tag "Reset" |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1323 :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
|
1324 :mouse-down-action (lambda (&rest junk) t) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1325 :action (lambda (widget &optional event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1326 (custom-reset event)))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
1327 (widget-insert "\n ") |
18089 | 1328 (widget-create 'push-button |
1329 :tag "Reset" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1330 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1331 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
|
1332 :action 'Custom-reset-current) |
18089 | 1333 (widget-insert " ") |
1334 (widget-create 'push-button | |
1335 :tag "Reset to Saved" | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1336 :help-echo "\ |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1337 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
|
1338 :action 'Custom-reset-saved) |
18089 | 1339 (widget-insert " ") |
1340 (widget-create 'push-button | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1341 :tag "Erase Customization" |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1342 :help-echo "\ |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
1343 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
|
1344 :action 'Custom-reset-standard)) |
45102
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1345 (if (not custom-buffer-verbose-help) |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1346 (progn |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1347 (widget-insert " ") |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1348 (widget-create 'info-link |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1349 :tag "Help" |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1350 :help-echo "Read the online help." |
387844a1f703
(custom-buffer-verbose-help): New variable.
Kim F. Storm <storm@cua.dk>
parents:
44912
diff
changeset
|
1351 "(emacs)Easy Customization"))) |
18373
45ef45c34aa4
(custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents:
18371
diff
changeset
|
1352 (widget-insert " ") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1353 (widget-create 'push-button |
25685 | 1354 :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
|
1355 :help-echo |
80383e9be1e2
(custom-buffer-create-internal): Use a help-echo function to be more
Dave Love <fx@gnu.org>
parents:
30184
diff
changeset
|
1356 (lambda (&rest ignore) |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1357 (cond |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1358 ((eq custom-buffer-done-function |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1359 'custom-bury-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1360 "Bury this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1361 ((eq custom-buffer-done-function 'kill-buffer) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1362 "Kill this buffer") |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1363 (t "Finish with this buffer"))) |
25685 | 1364 :action #'Custom-buffer-done) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1365 (widget-insert "\n\n") |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1366 (message "Creating customization items...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1367 (buffer-disable-undo) |
25685 | 1368 (setq custom-options |
17334 | 1369 (if (= (length options) 1) |
1370 (mapcar (lambda (entry) | |
1371 (widget-create (nth 1 entry) | |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1372 :documentation-shown t |
17334 | 1373 :custom-state 'unknown |
1374 :tag (custom-unlispify-tag-name | |
1375 (nth 0 entry)) | |
1376 :value (nth 0 entry))) | |
1377 options) | |
1378 (let ((count 0) | |
1379 (length (length options))) | |
1380 (mapcar (lambda (entry) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1381 (prog2 |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1382 (message "Creating customization items ...%2d%%" |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1383 (/ (* 100.0 count) length)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1384 (widget-create (nth 1 entry) |
17334 | 1385 :tag (custom-unlispify-tag-name |
1386 (nth 0 entry)) | |
1387 :value (nth 0 entry)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1388 (setq count (1+ count)) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1389 (unless (eq (preceding-char) ?\n) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1390 (widget-insert "\n")) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1391 (widget-insert "\n"))) |
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
1392 options)))) |
17334 | 1393 (unless (eq (preceding-char) ?\n) |
1394 (widget-insert "\n")) | |
39153
001cb5cd0de9
(custom-buffer-create-internal): Remove "100%" from
Eli Zaretskii <eliz@gnu.org>
parents:
38436
diff
changeset
|
1395 (message "Creating customization items ...done") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1396 (unless (eq custom-buffer-style 'tree) |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1397 (mapc 'custom-magic-reset custom-options)) |
17334 | 1398 (message "Creating customization setup...") |
1399 (widget-setup) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
1400 (buffer-enable-undo) |
17334 | 1401 (goto-char (point-min)) |
1402 (message "Creating customization buffer...done")) | |
1403 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1404 ;;; The Tree Browser. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1405 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1406 ;;;###autoload |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1407 (defun customize-browse (&optional group) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1408 "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
|
1409 (interactive) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1410 (unless group |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1411 (setq group 'emacs)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1412 (let ((name "*Customize Browser*")) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
1413 (pop-to-buffer (custom-get-fresh-buffer name))) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1414 (custom-mode) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1415 (widget-insert "\ |
18812
82c80b23fa9d
(custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18669
diff
changeset
|
1416 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
|
1417 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
|
1418 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
|
1419 (if custom-browse-only-groups |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1420 (widget-insert "\ |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1421 Invoke the [Group] button below to edit that item in another window.\n\n") |
25685 | 1422 (widget-insert "Invoke the ") |
1423 (widget-create 'item | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1424 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1425 :tag "[Group]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1426 :tag-glyph "folder") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1427 (widget-insert ", ") |
25685 | 1428 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1429 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1430 :tag "[Face]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1431 :tag-glyph "face") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1432 (widget-insert ", and ") |
25685 | 1433 (widget-create 'item |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1434 :format "%t" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1435 :tag "[Option]" |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1436 :tag-glyph "option") |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1437 (widget-insert " buttons below to edit that |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1438 item in another window.\n\n")) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1439 (let ((custom-buffer-style 'tree)) |
25685 | 1440 (widget-create 'custom-group |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1441 :custom-last t |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1442 :custom-state 'unknown |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1443 :tag (custom-unlispify-tag-name group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1444 :value group)) |
48997
eb9dca992edf
(customize-browse): Call `widget-setup'.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48975
diff
changeset
|
1445 (widget-setup) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
1446 (goto-char (point-min))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1447 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1448 (define-widget 'custom-browse-visibility 'item |
20600
323f33e3e92c
(custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
20562
diff
changeset
|
1449 "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
|
1450 :format "%[[%t]%]" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1451 :action 'custom-browse-visibility-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1452 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1453 (defun custom-browse-visibility-action (widget &rest ignore) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1454 (let ((custom-buffer-style 'tree)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1455 (custom-toggle-parent widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1456 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1457 (define-widget 'custom-browse-group-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1458 "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
|
1459 :tag "Group" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1460 :tag-glyph "folder" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1461 :action 'custom-browse-group-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1462 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1463 (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
|
1464 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1465 (customize-group-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1466 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1467 (define-widget 'custom-browse-variable-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1468 "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
|
1469 :tag "Option" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1470 :tag-glyph "option" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1471 :action 'custom-browse-variable-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1472 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1473 (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
|
1474 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1475 (customize-variable-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1476 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1477 (define-widget 'custom-browse-face-tag 'push-button |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1478 "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
|
1479 :tag "Face" |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1480 :tag-glyph "face" |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1481 :action 'custom-browse-face-tag-action) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1482 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1483 (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
|
1484 (let ((parent (widget-get widget :parent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1485 (customize-face-other-window (widget-value parent)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1486 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1487 (defconst custom-browse-alist '((" " "space") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1488 (" | " "vertical") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1489 ("-\\ " "top") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1490 (" |-" "middle") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1491 (" `-" "bottom"))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1492 |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1493 (defun custom-browse-insert-prefix (prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1494 "Insert PREFIX. On XEmacs convert it to line graphics." |
25685 | 1495 ;; Fixme: do graphics. |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1496 (if nil ; (string-match "XEmacs" emacs-version) |
25685 | 1497 (progn |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1498 (insert "*") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1499 (while (not (string-equal prefix "")) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1500 (let ((entry (substring prefix 0 3))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1501 (setq prefix (substring prefix 3)) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1502 (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
|
1503 (name (nth 1 (assoc entry custom-browse-alist)))) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1504 (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
|
1505 (overlay-put overlay 'start-open t) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1506 (overlay-put overlay 'end-open t))))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1507 (insert prefix))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1508 |
17334 | 1509 ;;; Modification of Basic Widgets. |
1510 ;; | |
1511 ;; We add extra properties to the basic widgets needed here. This is | |
1512 ;; fine, as long as we are careful to stay within out own namespace. | |
1513 ;; | |
1514 ;; We want simple widgets to be displayed by default, but complex | |
1515 ;; widgets to be hidden. | |
1516 | |
1517 (widget-put (get 'item 'widget-type) :custom-show t) | |
1518 (widget-put (get 'editable-field 'widget-type) | |
1519 :custom-show (lambda (widget value) | |
1520 (let ((pp (pp-to-string value))) | |
1521 (cond ((string-match "\n" pp) | |
1522 nil) | |
1523 ((> (length pp) 40) | |
1524 nil) | |
1525 (t t))))) | |
1526 (widget-put (get 'menu-choice 'widget-type) :custom-show t) | |
1527 | |
1528 ;;; The `custom-manual' Widget. | |
1529 | |
1530 (define-widget 'custom-manual 'info-link | |
1531 "Link to the manual entry for this customization option." | |
1532 :help-echo "Read the manual entry for this option." | |
1533 :tag "Manual") | |
1534 | |
1535 ;;; The `custom-magic' Widget. | |
1536 | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1537 (defgroup custom-magic-faces nil |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1538 "Faces used by the magic button." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1539 :group 'custom-faces |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1540 :group 'custom-buffer) |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1541 |
17334 | 1542 (defface custom-invalid-face '((((class color)) |
1543 (:foreground "yellow" :background "red")) | |
1544 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1545 (:weight bold :slant italic :underline t))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1546 "Face used when the customize item is invalid." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1547 :group 'custom-magic-faces) |
17334 | 1548 |
1549 (defface custom-rogue-face '((((class color)) | |
1550 (:foreground "pink" :background "black")) | |
1551 (t | |
1552 (: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 not defined for customization." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1554 :group 'custom-magic-faces) |
17334 | 1555 |
25685 | 1556 (defface custom-modified-face '((((class color)) |
17334 | 1557 (:foreground "white" :background "blue")) |
1558 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1559 (:slant italic :bold))) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1560 "Face used when the customize item has been modified." |
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-set-face '((((class color)) |
17334 | 1564 (:foreground "blue" :background "white")) |
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))) |
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 set." |
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-changed-face '((((class color)) |
17334 | 1571 (:foreground "white" :background "blue")) |
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 changed." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1575 :group 'custom-magic-faces) |
17334 | 1576 |
1577 (defface custom-saved-face '((t (:underline t))) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1578 "Face used when the customize item has been saved." |
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1579 :group 'custom-magic-faces) |
17334 | 1580 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1581 (defconst custom-magic-alist '((nil "#" underline "\ |
17334 | 1582 uninitialized, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1583 (unknown "?" italic "\ |
17334 | 1584 unknown, you should not see this.") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1585 (hidden "-" default "\ |
18362
4655515f51cc
(custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents:
18360
diff
changeset
|
1586 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
|
1587 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
|
1588 (invalid "x" custom-invalid-face "\ |
18089 | 1589 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
|
1590 (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
|
1591 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
|
1592 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
|
1593 (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
|
1594 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
|
1595 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
|
1596 (changed ":" custom-changed-face "\ |
18089 | 1597 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
|
1598 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
|
1599 (saved "!" custom-saved-face "\ |
18089 | 1600 this %c has been set and saved." "\ |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1601 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
|
1602 (rogue "@" custom-rogue-face "\ |
18089 | 1603 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
|
1604 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
|
1605 (standard " " nil "\ |
18089 | 1606 this %c is unchanged from its standard setting." "\ |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
1607 visible group members are all at standard settings.")) |
17334 | 1608 "Alist of customize option states. |
25685 | 1609 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where |
17334 | 1610 |
1611 STATE is one of the following symbols: | |
1612 | |
1613 `nil' | |
1614 For internal use, should never occur. | |
1615 `unknown' | |
1616 For internal use, should never occur. | |
1617 `hidden' | |
25685 | 1618 This item is not being displayed. |
17334 | 1619 `invalid' |
1620 This item is modified, but has an invalid form. | |
1621 `modified' | |
1622 This item is modified, and has a valid form. | |
1623 `set' | |
1624 This item has been set but not saved. | |
1625 `changed' | |
1626 The current value of this item has been changed temporarily. | |
1627 `saved' | |
1628 This item is marked for saving. | |
1629 `rogue' | |
1630 This item has no customization information. | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1631 `standard' |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1632 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
|
1633 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1634 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
|
1635 |
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
1636 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
|
1637 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1638 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
|
1639 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1640 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
|
1641 left out, ITEM-DESC will be used. |
17334 | 1642 |
18089 | 1643 The string %c in either description will be replaced with the |
1644 category of the item. These are `group'. `option', and `face'. | |
1645 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1646 The list should be sorted most significant first.") |
17334 | 1647 |
1648 (defcustom custom-magic-show 'long | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1649 "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
|
1650 If `long', show a full-line description, not just one word." |
17334 | 1651 :type '(choice (const :tag "no" nil) |
22600
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1652 (const long) |
2f3b4c74e9a1
(custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents:
22538
diff
changeset
|
1653 (other :tag "short" short)) |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1654 :group 'custom-buffer) |
17334 | 1655 |
18089 | 1656 (defcustom custom-magic-show-hidden '(option face) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1657 "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
|
1658 The value should be a list with the custom categories where the State |
18089 | 1659 button should be visible. Possible categories are `group', `option', |
1660 and `face'." | |
1661 :type '(set (const group) (const option) (const face)) | |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1662 :group 'custom-buffer) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1663 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1664 (defcustom custom-magic-show-button nil |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1665 "Show a \"magic\" button indicating the state of each customization option." |
17334 | 1666 :type 'boolean |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
1667 :group 'custom-buffer) |
17334 | 1668 |
1669 (define-widget 'custom-magic 'default | |
1670 "Show and manipulate state for a customization option." | |
1671 :format "%v" | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1672 :action 'widget-parent-action |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1673 :notify 'ignore |
17334 | 1674 :value-get 'ignore |
1675 :value-create 'custom-magic-value-create | |
1676 :value-delete 'widget-children-value-delete) | |
1677 | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1678 (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
|
1679 ;; Non-nil unless hidden. |
25685 | 1680 (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
|
1681 :custom-state) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1682 'hidden))) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1683 |
17334 | 1684 (defun custom-magic-value-create (widget) |
28130 | 1685 "Create compact status report for WIDGET." |
17334 | 1686 (let* ((parent (widget-get widget :parent)) |
1687 (state (widget-get parent :custom-state)) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1688 (hidden (eq state 'hidden)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1689 (entry (assq state custom-magic-alist)) |
17334 | 1690 (magic (nth 1 entry)) |
1691 (face (nth 2 entry)) | |
18089 | 1692 (category (widget-get parent :custom-category)) |
1693 (text (or (and (eq category 'group) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1694 (nth 4 entry)) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1695 (nth 3 entry))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1696 (form (widget-get parent :custom-form)) |
17334 | 1697 children) |
18089 | 1698 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text) |
25685 | 1699 (setq text (concat (match-string 1 text) |
18089 | 1700 (symbol-name category) |
1701 (match-string 2 text)))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1702 (when (and custom-magic-show |
18089 | 1703 (or (not hidden) |
1704 (memq category custom-magic-show-hidden))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1705 (insert " ") |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1706 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1707 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1708 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1709 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1710 (widget-get parent :custom-level)))) |
25685 | 1711 (push (widget-create-child-and-convert |
1712 widget 'choice-item | |
18087 | 1713 :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
|
1714 :format (if hidden "%t" "%[%t%]") |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1715 :button-prefix 'widget-push-button-prefix |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
1716 :button-suffix 'widget-push-button-suffix |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1717 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1718 :tag "State") |
17334 | 1719 children) |
1720 (insert ": ") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1721 (let ((start (point))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1722 (if (eq custom-magic-show 'long) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1723 (insert text) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1724 (insert (symbol-name state))) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1725 (cond ((eq form 'lisp) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1726 (insert " (lisp)")) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1727 ((eq form 'mismatch) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1728 (insert " (mismatch)"))) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1729 (put-text-property start (point) 'face 'custom-state-face)) |
17334 | 1730 (insert "\n")) |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1731 (when (and (eq category 'group) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1732 (not (and (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
1733 (> (widget-get parent :custom-level) 1)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1734 (insert-char ?\ (* custom-buffer-indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1735 (widget-get parent :custom-level)))) |
17334 | 1736 (when custom-magic-show-button |
1737 (when custom-magic-show | |
1738 (let ((indent (widget-get parent :indent))) | |
1739 (when indent | |
1740 (insert-char ? indent)))) | |
25685 | 1741 (push (widget-create-child-and-convert |
1742 widget 'choice-item | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1743 :mouse-down-action 'widget-magic-mouse-down-action |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1744 :button-face face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1745 :button-prefix "" |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1746 :button-suffix "" |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1747 :help-echo "Change the state." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1748 :format (if hidden "%t" "%[%t%]") |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
1749 :tag (if (memq form '(lisp mismatch)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1750 (concat "(" magic ")") |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1751 (concat "[" magic "]"))) |
17334 | 1752 children) |
1753 (insert " ")) | |
1754 (widget-put widget :children children))) | |
1755 | |
1756 (defun custom-magic-reset (widget) | |
1757 "Redraw the :custom-magic property of WIDGET." | |
1758 (let ((magic (widget-get widget :custom-magic))) | |
1759 (widget-value-set magic (widget-value magic)))) | |
1760 | |
1761 ;;; The `custom' Widget. | |
1762 | |
25685 | 1763 (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
|
1764 '((((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
|
1765 (: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
|
1766 :background "lightgrey" :foreground "black")) |
25685 | 1767 (t |
1768 nil)) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1769 "Face used for buttons in customization buffers." |
25685 | 1770 :version "21.1" |
1771 :group 'custom-faces) | |
1772 | |
1773 (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
|
1774 '((((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
|
1775 (: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
|
1776 :background "lightgrey" :foreground "black")) |
25685 | 1777 (t |
1778 (:inverse-video t))) | |
1779 "Face used for buttons in customization buffers." | |
1780 :version "21.1" | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1781 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1782 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1783 (defface custom-documentation-face nil |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1784 "Face used for documentation strings in customization buffers." |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1785 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1786 |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1787 (defface custom-state-face '((((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1788 (background dark)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1789 (:foreground "lime green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1790 (((class color) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1791 (background light)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1792 (:foreground "dark green")) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1793 (t nil)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1794 "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
|
1795 :group 'custom-faces) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1796 |
17334 | 1797 (define-widget 'custom 'default |
1798 "Customize a user option." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1799 :format "%v" |
17334 | 1800 :convert-widget 'custom-convert-widget |
1801 :notify 'custom-notify | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1802 :custom-prefix "" |
17334 | 1803 :custom-level 1 |
1804 :custom-state 'hidden | |
1805 :documentation-property 'widget-subclass-responsibility | |
1806 :value-create 'widget-subclass-responsibility | |
1807 :value-delete 'widget-children-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1808 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1809 :validate 'widget-children-validate |
17334 | 1810 :match (lambda (widget value) (symbolp value))) |
1811 | |
1812 (defun custom-convert-widget (widget) | |
28130 | 1813 "Initialize :value and :tag from :args in WIDGET." |
17334 | 1814 (let ((args (widget-get widget :args))) |
25685 | 1815 (when args |
17334 | 1816 (widget-put widget :value (widget-apply widget |
1817 :value-to-internal (car args))) | |
1818 (widget-put widget :tag (custom-unlispify-tag-name (car args))) | |
1819 (widget-put widget :args nil))) | |
1820 widget) | |
1821 | |
1822 (defun custom-notify (widget &rest args) | |
1823 "Keep track of changes." | |
18090 | 1824 (let ((state (widget-get widget :custom-state))) |
1825 (unless (eq state 'modified) | |
1826 (unless (memq state '(nil unknown hidden)) | |
1827 (widget-put widget :custom-state 'modified)) | |
1828 (custom-magic-reset widget) | |
1829 (apply 'widget-default-notify widget args)))) | |
17334 | 1830 |
1831 (defun custom-redraw (widget) | |
1832 "Redraw WIDGET with current settings." | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1833 (let ((line (count-lines (point-min) (point))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1834 (column (current-column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1835 (pos (point)) |
17334 | 1836 (from (marker-position (widget-get widget :from))) |
1837 (to (marker-position (widget-get widget :to)))) | |
1838 (save-excursion | |
1839 (widget-value-set widget (widget-value widget)) | |
1840 (custom-redraw-magic widget)) | |
1841 (when (and (>= pos from) (<= pos to)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1842 (condition-case nil |
25685 | 1843 (progn |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1844 (if (> column 0) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1845 (goto-line line) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
1846 (goto-line (1+ line))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1847 (move-to-column column)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1848 (error nil))))) |
17334 | 1849 |
1850 (defun custom-redraw-magic (widget) | |
1851 "Redraw WIDGET state with current settings." | |
25685 | 1852 (while widget |
17334 | 1853 (let ((magic (widget-get widget :custom-magic))) |
25685 | 1854 (cond (magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1855 (widget-value-set magic (widget-value magic)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1856 (when (setq widget (widget-get widget :group)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1857 (custom-group-state-update widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1858 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1859 (setq widget nil))))) |
17334 | 1860 (widget-setup)) |
1861 | |
1862 (defun custom-show (widget value) | |
1863 "Non-nil if WIDGET should be shown with VALUE by default." | |
1864 (let ((show (widget-get widget :custom-show))) | |
1865 (cond ((null show) | |
1866 nil) | |
1867 ((eq t show) | |
1868 t) | |
1869 (t | |
1870 (funcall show widget value))))) | |
1871 | |
1872 (defun custom-load-widget (widget) | |
1873 "Load all dependencies for WIDGET." | |
1874 (custom-load-symbol (widget-value widget))) | |
1875 | |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1876 (defun custom-unloaded-symbol-p (symbol) |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1877 "Return non-nil if the dependencies of SYMBOL have not yet been loaded." |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1878 (let ((found nil) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1879 (loads (get symbol 'custom-loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1880 load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1881 (while loads |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1882 (setq load (car loads) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1883 loads (cdr loads)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1884 (cond ((symbolp load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1885 (unless (featurep load) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1886 (setq found t))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1887 ((assoc load load-history)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1888 ((assoc (locate-library load) load-history) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1889 (message nil)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1890 (t |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1891 (setq found t)))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1892 found)) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1893 |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1894 (defun custom-unloaded-widget-p (widget) |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
1895 "Return non-nil if the dependencies of WIDGET have not yet been loaded." |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1896 (custom-unloaded-symbol-p (widget-value widget))) |
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1897 |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1898 (defun custom-toggle-hide (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1899 "Toggle visibility of WIDGET." |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
1900 (custom-load-widget widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1901 (let ((state (widget-get widget :custom-state))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1902 (cond ((memq state '(invalid modified)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1903 (error "There are unset changes")) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1904 ((eq state 'hidden) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1905 (widget-put widget :custom-state 'unknown)) |
25685 | 1906 (t |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1907 (widget-put widget :documentation-shown nil) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1908 (widget-put widget :custom-state 'hidden))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1909 (custom-redraw widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
1910 (widget-setup))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
1911 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1912 (defun custom-toggle-parent (widget &rest ignore) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
1913 "Toggle visibility of parent of WIDGET." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1914 (custom-toggle-hide (widget-get widget :parent))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
1915 |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1916 (defun custom-add-see-also (widget &optional prefix) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1917 "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
|
1918 Insert PREFIX first if non-nil." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1919 (let* ((symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1920 (links (get symbol 'custom-links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1921 (many (> (length links) 2)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1922 (buttons (widget-get widget :buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1923 (indent (widget-get widget :indent))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1924 (when links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1925 (when indent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1926 (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1927 (when prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1928 (insert prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1929 (insert "See also ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1930 (while links |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1931 (push (widget-create-child-and-convert widget (car links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1932 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1933 (setq links (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1934 (cond ((null links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1935 (insert ".\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1936 ((null (cdr links)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1937 (if many |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1938 (insert ", and ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1939 (insert " and "))) |
25685 | 1940 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1941 (insert ", ")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1942 (widget-put widget :buttons buttons)))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1943 |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1944 (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
|
1945 "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
|
1946 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
|
1947 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
|
1948 (let ((name (widget-value widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1949 (type (widget-type widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1950 (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
|
1951 (start (point)) |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1952 (parents nil)) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
1953 (insert (or initial-string "Parent groups:")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1954 (mapatoms (lambda (symbol) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1955 (let ((entry (assq name (get symbol 'custom-group)))) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1956 (when (eq (nth 1 entry) type) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1957 (insert " ") |
25685 | 1958 (push (widget-create-child-and-convert |
1959 widget 'custom-group-link | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1960 :tag (custom-unlispify-tag-name symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1961 symbol) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
1962 buttons) |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1963 (setq parents (cons symbol parents)))))) |
54721
5b50970ffa95
2004-04-05 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
54312
diff
changeset
|
1964 (and (null (get name 'custom-links)) ;No links of its own. |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1965 (= (length parents) 1) ;A single parent. |
53319
36b31fc002f2
2003-12-12 Jesper Harder <harder@ifa.au.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
53223
diff
changeset
|
1966 (let* ((links (get (car parents) 'custom-links)) |
36b31fc002f2
2003-12-12 Jesper Harder <harder@ifa.au.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
53223
diff
changeset
|
1967 (many (> (length links) 2))) |
53223
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1968 (when links |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1969 (insert "\nParent documentation: ") |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1970 (while links |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1971 (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
|
1972 buttons) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1973 (setq links (cdr links)) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1974 (cond ((null links) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1975 (insert ".\n")) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1976 ((null (cdr links)) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1977 (if many |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1978 (insert ", and ") |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1979 (insert " and "))) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1980 (t |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1981 (insert ", "))))))) |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1982 (if parents |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1983 (insert "\n") |
1fa5a4fc03e5
2003-11-30 Per Abrahamsen <abraham@dina.kvl.dk>
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
52401
diff
changeset
|
1984 (delete-region start (point))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1985 (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
|
1986 parents)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
1987 |
25685 | 1988 ;;; The `custom-comment' Widget. |
1989 | |
1990 ;; like the editable field | |
1991 (defface custom-comment-face '((((class grayscale color) | |
1992 (background light)) | |
1993 (:background "gray85")) | |
1994 (((class grayscale color) | |
1995 (background dark)) | |
1996 (:background "dim gray")) | |
1997 (t | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
1998 (:slant italic))) |
25685 | 1999 "Face used for comments on variables or faces" |
2000 :version "21.1" | |
2001 :group 'custom-faces) | |
2002 | |
2003 ;; like font-lock-comment-face | |
2004 (defface custom-comment-tag-face | |
2005 '((((class color) (background dark)) (:foreground "gray80")) | |
2006 (((class color) (background light)) (:foreground "blue4")) | |
2007 (((class grayscale) (background light)) | |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2008 (:foreground "DimGray" :weight bold :slant italic)) |
25685 | 2009 (((class grayscale) (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2010 (: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
|
2011 (t (:weight bold))) |
25685 | 2012 "Face used for variables or faces comment tags" |
2013 :group 'custom-faces) | |
2014 | |
2015 (define-widget 'custom-comment 'string | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2016 "User comment." |
25685 | 2017 :tag "Comment" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2018 :help-echo "Edit a comment here." |
25685 | 2019 :sample-face 'custom-comment-tag-face |
2020 :value-face 'custom-comment-face | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2021 :shown nil |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2022 :create 'custom-comment-create) |
25685 | 2023 |
2024 (defun custom-comment-create (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2025 (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
|
2026 (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
|
2027 (not null-comment)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2028 (widget-default-create widget) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2029 ;; `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
|
2030 ;; maybe it shouldn't. |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2031 (widget-put widget :from (point-marker)) |
f54121af02c8
(custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents:
25840
diff
changeset
|
2032 (widget-put widget :to (point-marker))))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2033 |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2034 (defun custom-comment-hide (widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2035 (widget-put (widget-get widget :parent) :comment-shown nil)) |
25685 | 2036 |
2037 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's | |
2038 ;; the global custom one | |
2039 (defun custom-comment-show (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2040 (widget-put widget :comment-shown t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2041 (custom-redraw widget) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2042 (widget-setup)) |
25685 | 2043 |
2044 (defun custom-comment-invisible-p (widget) | |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2045 (let ((val (widget-value (widget-get widget :comment-widget)))) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2046 (and (equal "" val) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2047 (not (widget-get widget :comment-shown))))) |
25685 | 2048 |
17334 | 2049 ;;; The `custom-variable' Widget. |
2050 | |
28130 | 2051 ;; When this was underlined blue, users confused it with a |
2052 ;; Mosaic-style hyperlink... | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2053 (defface custom-variable-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2054 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2055 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2056 (: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
|
2057 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2058 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2059 (: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
|
2060 (t (:weight bold))) |
17334 | 2061 "Face used for unpushable variable tags." |
17415 | 2062 :group 'custom-faces) |
17334 | 2063 |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
2064 (defface custom-variable-button-face '((t (:underline t :weight bold))) |
17334 | 2065 "Face used for pushable variable tags." |
17415 | 2066 :group 'custom-faces) |
17334 | 2067 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2068 (defcustom custom-variable-default-form 'edit |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2069 "Default form of displaying variable values." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2070 :type '(choice (const edit) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2071 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2072 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2073 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2074 |
56161
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2075 (defun custom-variable-documentation (variable) |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2076 "Return documentation of VARIABLE for use in Custom buffer. |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2077 Normally just return the docstring. But if VARIABLE automatically |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2078 becomes buffer local when set, append a message to that effect." |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2079 (if (and (local-variable-if-set-p variable) |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2080 (or (not (local-variable-p variable)) |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2081 (with-temp-buffer |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2082 (local-variable-if-set-p variable)))) |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2083 (concat (documentation-property variable 'variable-documentation) |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2084 "\n |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2085 This variable automatically becomes buffer-local when set outside Custom. |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2086 However, setting it through Custom sets the default value.") |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2087 (documentation-property variable 'variable-documentation))) |
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2088 |
17334 | 2089 (define-widget 'custom-variable 'custom |
2090 "Customize variable." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2091 :format "%v" |
17334 | 2092 :help-echo "Set or reset this variable." |
56161
a8ce8bdfcee6
(custom-variable-documentation): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55944
diff
changeset
|
2093 :documentation-property #'custom-variable-documentation |
18089 | 2094 :custom-category 'option |
17334 | 2095 :custom-state nil |
2096 :custom-menu 'custom-variable-menu-create | |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2097 :custom-form nil ; defaults to value of `custom-variable-default-form' |
17334 | 2098 :value-create 'custom-variable-value-create |
2099 :action 'custom-variable-action | |
2100 :custom-set 'custom-variable-set | |
2101 :custom-save 'custom-variable-save | |
2102 :custom-reset-current 'custom-redraw | |
2103 :custom-reset-saved 'custom-variable-reset-saved | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2104 :custom-reset-standard 'custom-variable-reset-standard |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2105 :custom-standard-value 'custom-variable-standard-value) |
17334 | 2106 |
17415 | 2107 (defun custom-variable-type (symbol) |
2108 "Return a widget suitable for editing the value of SYMBOL. | |
25685 | 2109 If SYMBOL has a `custom-type' property, use that. |
17415 | 2110 Otherwise, look up symbol in `custom-guess-type-alist'." |
2111 (let* ((type (or (get symbol 'custom-type) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2112 (and (not (get symbol 'standard-value)) |
17415 | 2113 (custom-guess-type symbol)) |
2114 'sexp)) | |
2115 (options (get symbol 'custom-options)) | |
2116 (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
|
2117 (copy-sequence type) |
17415 | 2118 (list type)))) |
2119 (when options | |
2120 (widget-put tmp :options options)) | |
2121 tmp)) | |
2122 | |
17334 | 2123 (defun custom-variable-value-create (widget) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2124 "Here is where you edit the variable's value." |
17334 | 2125 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2126 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2127 (widget-put widget :custom-form custom-variable-default-form)) |
17334 | 2128 (let* ((buttons (widget-get widget :buttons)) |
2129 (children (widget-get widget :children)) | |
2130 (form (widget-get widget :custom-form)) | |
2131 (state (widget-get widget :custom-state)) | |
2132 (symbol (widget-get widget :value)) | |
2133 (tag (widget-get widget :tag)) | |
17415 | 2134 (type (custom-variable-type symbol)) |
17334 | 2135 (conv (widget-convert type)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2136 (get (or (get symbol 'custom-get) 'default-value)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2137 (prefix (widget-get widget :custom-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2138 (last (widget-get widget :custom-last)) |
17334 | 2139 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2140 (funcall get symbol) |
17334 | 2141 (widget-get conv :value)))) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2142 ;; If the widget is new, the child determines whether it is hidden. |
17334 | 2143 (cond (state) |
2144 ((custom-show type value) | |
2145 (setq state 'unknown)) | |
2146 (t | |
2147 (setq state 'hidden))) | |
2148 ;; If we don't know the state, see if we need to edit it in lisp form. | |
2149 (when (eq state 'unknown) | |
2150 (unless (widget-apply conv :match value) | |
2151 ;; (widget-apply (widget-convert type) :match value) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2152 (setq form 'mismatch))) |
17334 | 2153 ;; Now we can create the child widget. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2154 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2155 (insert prefix (if last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2156 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2157 widget 'custom-browse-variable-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2158 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2159 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2160 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2161 ((eq state 'hidden) |
17334 | 2162 ;; Indicate hidden value. |
25685 | 2163 (push (widget-create-child-and-convert |
17334 | 2164 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2165 :format "%{%t%}: " |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2166 :sample-face 'custom-variable-tag-face |
17334 | 2167 :tag tag |
2168 :parent widget) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2169 buttons) |
25685 | 2170 (push (widget-create-child-and-convert |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2171 widget 'visibility |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2172 :help-echo "Show the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2173 :off "Show Value" |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2174 :action 'custom-toggle-parent |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2175 nil) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2176 buttons)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2177 ((memq form '(lisp mismatch)) |
17334 | 2178 ;; In lisp mode edit the saved value when possible. |
2179 (let* ((value (cond ((get symbol 'saved-value) | |
2180 (car (get symbol 'saved-value))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2181 ((get symbol 'standard-value) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2182 (car (get symbol 'standard-value))) |
17334 | 2183 ((default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2184 (custom-quote (funcall get symbol))) |
17334 | 2185 (t |
2186 (custom-quote (widget-get conv :value)))))) | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2187 (insert (symbol-name symbol) ": ") |
25685 | 2188 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2189 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2190 :help-echo "Hide the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2191 :on "Hide Value" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2192 :off "Show Value" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2193 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2194 t) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2195 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2196 (insert " ") |
25685 | 2197 (push (widget-create-child-and-convert |
2198 widget 'sexp | |
17334 | 2199 :button-face 'custom-variable-button-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2200 :format "%v" |
17334 | 2201 :tag (symbol-name symbol) |
2202 :parent widget | |
2203 :value value) | |
2204 children))) | |
2205 (t | |
2206 ;; Edit mode. | |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2207 (let* ((format (widget-get type :format)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2208 tag-format value-format) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2209 (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
|
2210 (error "Bad format")) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2211 (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
|
2212 (setq value-format (substring format (match-end 0))) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2213 (push (widget-create-child-and-convert |
25685 | 2214 widget 'item |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2215 :format tag-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2216 :action 'custom-tag-action |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2217 :help-echo "Change value of this option." |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2218 :mouse-down-action 'custom-tag-mouse-down-action |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2219 :button-face 'custom-variable-button-face |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
2220 :sample-face 'custom-variable-tag-face |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2221 tag) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2222 buttons) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2223 (insert " ") |
25685 | 2224 (push (widget-create-child-and-convert |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2225 widget 'visibility |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2226 :help-echo "Hide the value of this option." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2227 :on "Hide Value" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2228 :off "Show Value" |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2229 :action 'custom-toggle-parent |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2230 t) |
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2231 buttons) |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2232 (push (widget-create-child-and-convert |
25685 | 2233 widget type |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2234 :format value-format |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2235 :value value) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2236 children)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2237 (unless (eq custom-buffer-style 'tree) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2238 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2239 (widget-insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2240 ;; Create the magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2241 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2242 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2243 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2244 (push magic buttons)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2245 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property |
25685 | 2246 ;; before the call to `widget-default-format-handler'. Otherwise, I |
2247 ;; loose my current `buttons'. This function shouldn't be called like | |
2248 ;; this anyway. The doc string widget should be added like the others. | |
2249 ;; --dv | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2250 (widget-put widget :buttons buttons) |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2251 (insert "\n") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2252 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2253 (widget-default-format-handler widget ?h) |
25685 | 2254 |
2255 ;; The comment field | |
2256 (unless (eq state 'hidden) | |
2257 (let* ((comment (get symbol 'variable-comment)) | |
2258 (comment-widget | |
2259 (widget-create-child-and-convert | |
2260 widget 'custom-comment | |
2261 :parent widget | |
2262 :value (or comment "")))) | |
2263 (widget-put widget :comment-widget comment-widget) | |
2264 ;; Don't push it !!! Custom assumes that the first child is the | |
2265 ;; value one. | |
2266 (setq children (append children (list comment-widget))))) | |
2267 ;; Update the rest of the properties properties. | |
2268 (widget-put widget :custom-form form) | |
2269 (widget-put widget :children children) | |
2270 ;; Now update the state. | |
2271 (if (eq state 'hidden) | |
2272 (widget-put widget :custom-state state) | |
2273 (custom-variable-state-set widget)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2274 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2275 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2276 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2277 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2278 (custom-add-see-also widget))))) |
17334 | 2279 |
18067
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2280 (defun custom-tag-action (widget &rest args) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2281 "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
|
2282 (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
|
2283 :action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2284 |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2285 (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
|
2286 "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
|
2287 (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
|
2288 :mouse-down-action args)) |
0e2aa3b58e16
Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18059
diff
changeset
|
2289 |
17334 | 2290 (defun custom-variable-state-set (widget) |
2291 "Set the state of WIDGET." | |
2292 (let* ((symbol (widget-value widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2293 (get (or (get symbol 'custom-get) 'default-value)) |
17334 | 2294 (value (if (default-boundp symbol) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2295 (funcall get symbol) |
17334 | 2296 (widget-get widget :value))) |
25685 | 2297 (comment (get symbol 'variable-comment)) |
17334 | 2298 tmp |
25685 | 2299 temp |
2300 (state (cond ((progn (setq tmp (get symbol 'customized-value)) | |
2301 (setq temp | |
2302 (get symbol 'customized-variable-comment)) | |
2303 (or tmp temp)) | |
17334 | 2304 (if (condition-case nil |
25685 | 2305 (and (equal value (eval (car tmp))) |
2306 (equal comment temp)) | |
17334 | 2307 (error nil)) |
2308 'set | |
2309 'changed)) | |
25685 | 2310 ((progn (setq tmp (get symbol 'saved-value)) |
2311 (setq temp (get symbol 'saved-variable-comment)) | |
2312 (or tmp temp)) | |
17334 | 2313 (if (condition-case nil |
25685 | 2314 (and (equal value (eval (car tmp))) |
2315 (equal comment temp)) | |
17334 | 2316 (error nil)) |
2317 'saved | |
2318 'changed)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2319 ((setq tmp (get symbol 'standard-value)) |
17334 | 2320 (if (condition-case nil |
25685 | 2321 (and (equal value (eval (car tmp))) |
2322 (equal comment nil)) | |
17334 | 2323 (error nil)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2324 'standard |
17334 | 2325 'changed)) |
2326 (t 'rogue)))) | |
2327 (widget-put widget :custom-state state))) | |
2328 | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2329 (defun custom-variable-standard-value (widget) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2330 (get (widget-value widget) 'standard-value)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2331 |
25685 | 2332 (defvar custom-variable-menu |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
2333 '(("Set for Current Session" custom-variable-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2334 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2335 (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
|
2336 ("Save for Future Sessions" custom-variable-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2337 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2338 (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
|
2339 ("Reset to Current" custom-redraw |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2340 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2341 (and (default-boundp (widget-value widget)) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2342 (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
|
2343 ("Reset to Saved" custom-variable-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2344 (lambda (widget) |
25685 | 2345 (and (or (get (widget-value widget) 'saved-value) |
2346 (get (widget-value widget) 'saved-variable-comment)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2347 (memq (widget-get widget :custom-state) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2348 '(modified set changed rogue))))) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2349 ("Erase Customization" custom-variable-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2350 (lambda (widget) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2351 (and (get (widget-value widget) 'standard-value) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2352 (memq (widget-get widget :custom-state) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2353 '(modified set changed saved rogue))))) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2354 ("Use Backup Value" custom-variable-reset-backup |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2355 (lambda (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2356 (get (widget-value widget) 'backup-value))) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2357 ("---" ignore ignore) |
25685 | 2358 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2359 ("---" ignore ignore) | |
2360 ("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
|
2361 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2362 (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
|
2363 ("Show initial Lisp expression" custom-variable-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2364 (lambda (widget) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2365 (eq (widget-get widget :custom-form) 'edit)))) |
17334 | 2366 "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
|
2367 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
|
2368 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
|
2369 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
|
2370 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
|
2371 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 2372 |
2373 (defun custom-variable-action (widget &optional event) | |
2374 "Show the menu for `custom-variable' WIDGET. | |
2375 Optional EVENT is the location for the menu." | |
2376 (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
|
2377 (custom-toggle-hide widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2378 (unless (eq (widget-get widget :custom-state) 'modified) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2379 (custom-variable-state-set widget)) |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
2380 (custom-redraw-magic widget) |
17334 | 2381 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2382 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2383 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2384 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2385 (custom-menu-filter custom-variable-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2386 widget) |
17334 | 2387 event))) |
2388 (if answer | |
2389 (funcall answer widget))))) | |
2390 | |
2391 (defun custom-variable-edit (widget) | |
2392 "Edit value of WIDGET." | |
2393 (widget-put widget :custom-state 'unknown) | |
2394 (widget-put widget :custom-form 'edit) | |
2395 (custom-redraw widget)) | |
2396 | |
2397 (defun custom-variable-edit-lisp (widget) | |
28130 | 2398 "Edit the Lisp representation of the value of WIDGET." |
17334 | 2399 (widget-put widget :custom-state 'unknown) |
2400 (widget-put widget :custom-form 'lisp) | |
2401 (custom-redraw widget)) | |
2402 | |
2403 (defun custom-variable-set (widget) | |
2404 "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
|
2405 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2406 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2407 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2408 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2409 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2410 (comment-widget (widget-get widget :comment-widget)) |
2411 (comment (widget-value comment-widget)) | |
2412 val) | |
17334 | 2413 (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
|
2414 (error "Cannot set hidden variable")) |
17334 | 2415 ((setq val (widget-apply child :validate)) |
2416 (goto-char (widget-get val :from)) | |
2417 (error "%s" (widget-get val :error))) | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
2418 ((memq form '(lisp mismatch)) |
25685 | 2419 (when (equal comment "") |
2420 (setq comment nil) | |
2421 ;; 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
|
2422 (custom-comment-hide comment-widget)) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2423 (custom-variable-backup-value widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2424 (funcall set symbol (eval (setq val (widget-value child)))) |
25685 | 2425 (put symbol 'customized-value (list val)) |
2426 (put symbol 'variable-comment comment) | |
2427 (put symbol 'customized-variable-comment comment)) | |
17334 | 2428 (t |
25685 | 2429 (when (equal comment "") |
2430 (setq comment nil) | |
2431 ;; 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
|
2432 (custom-comment-hide comment-widget)) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2433 (custom-variable-backup-value widget) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2434 (funcall set symbol (setq val (widget-value child))) |
25685 | 2435 (put symbol 'customized-value (list (custom-quote val))) |
2436 (put symbol 'variable-comment comment) | |
2437 (put symbol 'customized-variable-comment comment))) | |
17334 | 2438 (custom-variable-state-set widget) |
2439 (custom-redraw-magic widget))) | |
2440 | |
2441 (defun custom-variable-save (widget) | |
19823
0c1b4a44db76
(custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents:
19822
diff
changeset
|
2442 "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
|
2443 (let* ((form (widget-get widget :custom-form)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2444 (state (widget-get widget :custom-state)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2445 (child (car (widget-get widget :children))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2446 (symbol (widget-value widget)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2447 (set (or (get symbol 'custom-set) 'set-default)) |
25685 | 2448 (comment-widget (widget-get widget :comment-widget)) |
2449 (comment (widget-value comment-widget)) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2450 val) |
17334 | 2451 (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
|
2452 (error "Cannot set hidden variable")) |
17334 | 2453 ((setq val (widget-apply child :validate)) |
2454 (goto-char (widget-get val :from)) | |
33774
77d48dfb2b29
(custom-buffer-create-internal): Save some consing.
Dave Love <fx@gnu.org>
parents:
33110
diff
changeset
|
2455 (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
|
2456 ((memq form '(lisp mismatch)) |
25685 | 2457 (when (equal comment "") |
2458 (setq comment nil) | |
2459 ;; 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
|
2460 (custom-comment-hide comment-widget)) |
17334 | 2461 (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
|
2462 (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
|
2463 'set (list (widget-value child))) |
25685 | 2464 (funcall set symbol (eval (widget-value child))) |
2465 (put symbol 'variable-comment comment) | |
2466 (put symbol 'saved-variable-comment comment)) | |
17334 | 2467 (t |
25685 | 2468 (when (equal comment "") |
2469 (setq comment nil) | |
2470 ;; 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
|
2471 (custom-comment-hide comment-widget)) |
25685 | 2472 (put symbol 'saved-value |
2473 (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
|
2474 (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
|
2475 'set (list (custom-quote (widget-value |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2476 child)))) |
25685 | 2477 (funcall set symbol (widget-value child)) |
2478 (put symbol 'variable-comment comment) | |
2479 (put symbol 'saved-variable-comment comment))) | |
17334 | 2480 (put symbol 'customized-value nil) |
25685 | 2481 (put symbol 'customized-variable-comment nil) |
17334 | 2482 (custom-save-all) |
2483 (custom-variable-state-set widget) | |
2484 (custom-redraw-magic widget))) | |
2485 | |
2486 (defun custom-variable-reset-saved (widget) | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2487 "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
|
2488 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
|
2489 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
|
2490 (let* ((symbol (widget-value widget)) |
25685 | 2491 (set (or (get symbol 'custom-set) 'set-default)) |
2492 (value (get symbol 'saved-value)) | |
2493 (comment (get symbol 'saved-variable-comment))) | |
2494 (cond ((or value comment) | |
2495 (put symbol 'variable-comment comment) | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2496 (custom-variable-backup-value widget) |
25685 | 2497 (condition-case nil |
2498 (funcall set symbol (eval (car value))) | |
2499 (error nil))) | |
2500 (t | |
2501 (error "No saved value for %s" symbol))) | |
17334 | 2502 (put symbol 'customized-value nil) |
25685 | 2503 (put symbol 'customized-variable-comment nil) |
17334 | 2504 (widget-put widget :custom-state 'unknown) |
25685 | 2505 ;; This call will possibly make the comment invisible |
17334 | 2506 (custom-redraw widget))) |
2507 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2508 (defun custom-variable-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2509 "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
|
2510 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
|
2511 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
|
2512 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
|
2513 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
|
2514 (let* ((symbol (widget-value widget)) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
2515 (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
|
2516 (if (get symbol 'standard-value) |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2517 (progn |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2518 (custom-variable-backup-value widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2519 (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
|
2520 (error "No standard setting known for %S" symbol)) |
25824
0d1ba90ad774
(custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents:
25685
diff
changeset
|
2521 (put symbol 'variable-comment nil) |
17334 | 2522 (put symbol 'customized-value nil) |
25685 | 2523 (put symbol 'customized-variable-comment nil) |
2524 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment)) | |
17334 | 2525 (put symbol 'saved-value nil) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
2526 (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
|
2527 ;; 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
|
2528 ;; 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
|
2529 (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
|
2530 (put symbol 'theme-value nil)) |
25685 | 2531 (put symbol 'saved-variable-comment nil) |
17334 | 2532 (custom-save-all)) |
2533 (widget-put widget :custom-state 'unknown) | |
25685 | 2534 ;; This call will possibly make the comment invisible |
17334 | 2535 (custom-redraw widget))) |
2536 | |
47503
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2537 (defun custom-variable-backup-value (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2538 "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
|
2539 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
|
2540 (let* ((symbol (widget-value widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2541 (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
|
2542 (type (custom-variable-type symbol)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2543 (conv (widget-convert type)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2544 (value (if (default-boundp symbol) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2545 (funcall get symbol) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2546 (widget-get conv :value)))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2547 (put symbol 'backup-value (list value)))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2548 |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2549 (defun custom-variable-reset-backup (widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2550 "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
|
2551 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
|
2552 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
|
2553 to switch between two values." |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2554 (let* ((symbol (widget-value widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2555 (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
|
2556 (value (get symbol 'backup-value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2557 (comment-widget (widget-get widget :comment-widget)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2558 (comment (widget-value comment-widget))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2559 (if value |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2560 (progn |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2561 (custom-variable-backup-value widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2562 (condition-case nil |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2563 (funcall set symbol (car value)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2564 (error nil))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2565 (error "No backup value for %s" symbol)) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2566 (put symbol 'customized-value (list (car value))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2567 (put symbol 'variable-comment comment) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2568 (put symbol 'customized-variable-comment comment) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2569 (custom-variable-state-set widget) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2570 ;; 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
|
2571 (custom-redraw widget))) |
8b3fa993e0ad
(custom-variable-backup-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
47315
diff
changeset
|
2572 |
17334 | 2573 ;;; The `custom-face-edit' Widget. |
2574 | |
2575 (define-widget 'custom-face-edit 'checklist | |
2576 "Edit face attributes." | |
2577 :format "%t: %v" | |
2578 :tag "Attributes" | |
2579 :extra-offset 12 | |
25685 | 2580 :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
|
2581 :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
|
2582 :match (lambda (widget value) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2583 (widget-checklist-match widget |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2584 (custom-face-edit-fix-value widget value))) |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2585 :convert-widget 'custom-face-edit-convert-widget |
17334 | 2586 :args (mapcar (lambda (att) |
25685 | 2587 (list 'group |
17334 | 2588 :inline t |
2589 :sibling-args (widget-get (nth 1 att) :sibling-args) | |
25685 | 2590 (list 'const :format "" :value (nth 0 att)) |
17334 | 2591 (nth 1 att))) |
2592 custom-face-attributes)) | |
2593 | |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2594 (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
|
2595 "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
|
2596 Also change :reverse-video to :inverse-video." |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2597 (if (listp value) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2598 (let (result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2599 (while value |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2600 (let ((key (car value)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2601 (val (car (cdr value)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2602 (cond ((eq key :italic) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2603 (push :slant result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2604 (push (if val 'italic 'normal) result)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2605 ((eq key :bold) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2606 (push :weight result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2607 (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
|
2608 ((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
|
2609 (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
|
2610 (push val result)) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
2611 (t |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2612 (push key result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2613 (push val result)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2614 (setq value (cdr (cdr value)))) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2615 (setq result (nreverse result)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2616 result) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2617 value)) |
42448
5269e6fd0fbc
(custom-face-edit-fix-value): New function.
Richard M. Stallman <rms@gnu.org>
parents:
41606
diff
changeset
|
2618 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2619 (defun custom-face-edit-convert-widget (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2620 "Convert :args as widget types in WIDGET." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2621 (widget-put |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2622 widget |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2623 :args (mapcar (lambda (arg) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2624 (widget-convert arg |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2625 :deactivate 'custom-face-edit-deactivate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2626 :activate 'custom-face-edit-activate |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2627 :delete 'custom-face-edit-delete)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2628 (widget-get widget :args))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2629 widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2630 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2631 (defun custom-face-edit-deactivate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2632 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2633 (unless (widget-get widget :inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2634 (let ((tag (custom-face-edit-attribute-tag widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2635 (from (copy-marker (widget-get widget :from))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2636 (value (widget-value widget)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2637 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2638 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2639 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2640 (goto-char from) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2641 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2642 (insert tag ": *\n") |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2643 (widget-put widget :inactive |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2644 (cons value (cons from (- (point) from)))))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2645 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2646 (defun custom-face-edit-activate (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2647 "Make face widget WIDGET inactive for user modifications." |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2648 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2649 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2650 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2651 (when (consp inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2652 (save-excursion |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2653 (goto-char (car (cdr inactive))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2654 (delete-region (point) (+ (point) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2655 (widget-put widget :inactive nil) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2656 (widget-apply widget :create) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2657 (widget-value-set widget (car inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2658 (widget-setup))))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2659 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2660 (defun custom-face-edit-delete (widget) |
55789
e004c3c8a4b6
(customize-face, customize-face-other-window, custom-face-edit-delete):
Juanma Barranquero <lekktu@gmail.com>
parents:
55272
diff
changeset
|
2661 "Remove WIDGET from the buffer." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2662 (let ((inactive (widget-get widget :inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2663 (inhibit-read-only t) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2664 (inhibit-modification-hooks t)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2665 (if (not inactive) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2666 ;; 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
|
2667 (widget-default-delete widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2668 ;; 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
|
2669 ;; 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
|
2670 (delete-region (car (cdr inactive)) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2671 (+ (car (cdr inactive)) (cdr (cdr inactive)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2672 (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
|
2673 |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2674 |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2675 (defun custom-face-edit-attribute-tag (widget) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2676 "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
|
2677 (let ((tag (widget-get widget :tag))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2678 (or (and (not (equal tag "")) tag) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2679 (let ((children (widget-get widget :children))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2680 (while (and (null tag) children) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2681 (setq tag (custom-face-edit-attribute-tag (pop children)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2682 tag)))) |
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2683 |
17334 | 2684 ;;; The `custom-display' Widget. |
2685 | |
2686 (define-widget 'custom-display 'menu-choice | |
2687 "Select a display type." | |
2688 :tag "Display" | |
2689 :value t | |
2690 :help-echo "Specify frames where the face attributes should be used." | |
2691 :args '((const :tag "all" t) | |
2692 (checklist | |
2693 :offset 0 | |
2694 :extra-offset 9 | |
2695 :args ((group :sibling-args (:help-echo "\ | |
2696 Only match the specified window systems.") | |
2697 (const :format "Type: " | |
2698 type) | |
2699 (checklist :inline t | |
2700 :offset 0 | |
2701 (const :format "X " | |
2702 :sibling-args (:help-echo "\ | |
2703 The X11 Window System.") | |
2704 x) | |
2705 (const :format "PM " | |
2706 :sibling-args (:help-echo "\ | |
2707 OS/2 Presentation Manager.") | |
2708 pm) | |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2709 (const :format "W32 " |
17334 | 2710 :sibling-args (:help-echo "\ |
19684
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2711 Windows NT/9X.") |
d5378da3dd73
(custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19316
diff
changeset
|
2712 w32) |
48633
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2713 (const :format "MAC " |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2714 :sibling-args (:help-echo "\ |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2715 Macintosh OS.") |
8ef126b2490a
(custom-display): Add checkbox for type mac.
Andreas Schwab <schwab@suse.de>
parents:
48243
diff
changeset
|
2716 mac) |
17334 | 2717 (const :format "DOS " |
2718 :sibling-args (:help-echo "\ | |
2719 Plain MS-DOS.") | |
2720 pc) | |
2721 (const :format "TTY%n" | |
2722 :sibling-args (:help-echo "\ | |
2723 Plain text terminals.") | |
2724 tty))) | |
2725 (group :sibling-args (:help-echo "\ | |
2726 Only match the frames with the specified color support.") | |
2727 (const :format "Class: " | |
2728 class) | |
2729 (checklist :inline t | |
2730 :offset 0 | |
2731 (const :format "Color " | |
2732 :sibling-args (:help-echo "\ | |
2733 Match color frames.") | |
2734 color) | |
2735 (const :format "Grayscale " | |
2736 :sibling-args (:help-echo "\ | |
2737 Match grayscale frames.") | |
2738 grayscale) | |
2739 (const :format "Monochrome%n" | |
2740 :sibling-args (:help-echo "\ | |
2741 Match frames with no color support.") | |
2742 mono))) | |
2743 (group :sibling-args (:help-echo "\ | |
55944
173cdf06168d
(custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents:
55789
diff
changeset
|
2744 The minimum number of colors the frame should support.") |
173cdf06168d
(custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents:
55789
diff
changeset
|
2745 (const :format "" min-colors) |
173cdf06168d
(custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents:
55789
diff
changeset
|
2746 (integer :tag "Minimum number of colors" )) |
173cdf06168d
(custom-display): Add `min-colors'.
Juri Linkov <juri@jurta.org>
parents:
55789
diff
changeset
|
2747 (group :sibling-args (:help-echo "\ |
17334 | 2748 Only match frames with the specified intensity.") |
2749 (const :format "\ | |
2750 Background brightness: " | |
2751 background) | |
2752 (checklist :inline t | |
2753 :offset 0 | |
2754 (const :format "Light " | |
2755 :sibling-args (:help-echo "\ | |
2756 Match frames with light backgrounds.") | |
2757 light) | |
2758 (const :format "Dark\n" | |
2759 :sibling-args (:help-echo "\ | |
2760 Match frames with dark backgrounds.") | |
45724
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2761 dark))) |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2762 (group :sibling-args (:help-echo "\ |
ee1a7b81cb0e
(custom-display): Add support for `supports' predicate.
Miles Bader <miles@gnu.org>
parents:
45244
diff
changeset
|
2763 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
|
2764 (const :format "Supports attributes:" supports) |
45725
abb237aa3c61
(custom-display): Use correct syntax for `supports' attributes.
Miles Bader <miles@gnu.org>
parents:
45724
diff
changeset
|
2765 (custom-face-edit :inline t :format "%n%v")))))) |
17334 | 2766 |
2767 ;;; The `custom-face' Widget. | |
2768 | |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
2769 (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
|
2770 `((t (:weight bold :height 1.2 :inherit variable-pitch))) |
17334 | 2771 "Face used for face tags." |
17415 | 2772 :group 'custom-faces) |
17334 | 2773 |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2774 (defcustom custom-face-default-form 'selected |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2775 "Default form of displaying face definition." |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2776 :type '(choice (const all) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2777 (const selected) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2778 (const lisp)) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2779 :group 'custom-buffer |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21649
diff
changeset
|
2780 :version "20.3") |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2781 |
17334 | 2782 (define-widget 'custom-face 'custom |
2783 "Customize face." | |
2784 :sample-face 'custom-face-tag-face | |
2785 :help-echo "Set or reset this face." | |
28716
e9fb71a3e51d
(custom-face): Fix parenthesis.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28700
diff
changeset
|
2786 :documentation-property #'face-doc-string |
17334 | 2787 :value-create 'custom-face-value-create |
2788 :action 'custom-face-action | |
18089 | 2789 :custom-category 'face |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2790 :custom-form nil ; defaults to value of `custom-face-default-form' |
17334 | 2791 :custom-set 'custom-face-set |
2792 :custom-save 'custom-face-save | |
2793 :custom-reset-current 'custom-redraw | |
2794 :custom-reset-saved 'custom-face-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
2795 :custom-reset-standard 'custom-face-reset-standard |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
2796 :custom-standard-value 'custom-face-standard-value |
17334 | 2797 :custom-menu 'custom-face-menu-create) |
2798 | |
25685 | 2799 (define-widget 'custom-face-all 'editable-list |
17334 | 2800 "An editable list of display specifications and attributes." |
2801 :entry-format "%i %d %v" | |
2802 :insert-button-args '(:help-echo "Insert new display specification here.") | |
2803 :append-button-args '(:help-echo "Append new display specification here.") | |
2804 :delete-button-args '(:help-echo "Delete this display specification.") | |
2805 :args '((group :format "%v" custom-display custom-face-edit))) | |
2806 | |
2807 (defconst custom-face-all (widget-convert 'custom-face-all) | |
2808 "Converted version of the `custom-face-all' widget.") | |
2809 | |
2810 (define-widget 'custom-display-unselected 'item | |
2811 "A display specification that doesn't match the selected display." | |
2812 :match 'custom-display-unselected-match) | |
2813 | |
2814 (defun custom-display-unselected-match (widget value) | |
2815 "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
|
2816 (not (face-spec-set-match-display value (selected-frame)))) |
17334 | 2817 |
25685 | 2818 (define-widget 'custom-face-selected 'group |
17334 | 2819 "Edit the attributes of the selected display in a face specification." |
2820 :args '((repeat :format "" | |
2821 :inline t | |
2822 (group custom-display-unselected sexp)) | |
2823 (group (sexp :format "") custom-face-edit) | |
2824 (repeat :format "" | |
2825 :inline t | |
2826 sexp))) | |
2827 | |
2828 (defconst custom-face-selected (widget-convert 'custom-face-selected) | |
2829 "Converted version of the `custom-face-selected' widget.") | |
2830 | |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2831 (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
|
2832 "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
|
2833 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
|
2834 `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
|
2835 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
|
2836 don't specify one." |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2837 (mapcar (lambda (entry) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2838 ;; 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
|
2839 (let ((tests (car entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2840 (unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2841 ;; 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
|
2842 (if (listp (car (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2843 (car (cdr entry)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2844 (cdr entry))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2845 (filtered-attrs nil)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2846 ;; Filter each face attribute |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2847 (while unfiltered-attrs |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2848 (let* ((attr (pop unfiltered-attrs)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2849 (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
|
2850 (filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2851 (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
|
2852 default-filter)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2853 (filtered-value |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2854 (if filter |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2855 (funcall filter pre-filtered-value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2856 pre-filtered-value))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2857 (push filtered-value filtered-attrs) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2858 (push attr filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2859 ;; |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2860 (list tests filtered-attrs))) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2861 spec)) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2862 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2863 (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
|
2864 "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
|
2865 SPEC must be a full face spec." |
39606
1b4259bc2f74
(custom-face-edit-convert-widget)
Miles Bader <miles@gnu.org>
parents:
39153
diff
changeset
|
2866 (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
|
2867 |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
2868 (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
|
2869 "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
|
2870 (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
|
2871 |
17334 | 2872 (defun custom-face-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2873 "Create a list of the display specifications for WIDGET." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2874 (let ((buttons (widget-get widget :buttons)) |
25685 | 2875 children |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2876 (symbol (widget-get widget :value)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2877 (tag (widget-get widget :tag)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2878 (state (widget-get widget :custom-state)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2879 (begin (point)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2880 (is-last (widget-get widget :custom-last)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2881 (prefix (widget-get widget :custom-prefix))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2882 (unless tag |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2883 (setq tag (prin1-to-string symbol))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2884 (cond ((eq custom-buffer-style 'tree) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
2885 (insert prefix (if is-last " `--- " " |--- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2886 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
2887 widget 'custom-browse-face-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2888 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2889 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2890 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2891 (t |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2892 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2893 (insert tag) |
34041
40708840c132
(custom-face-value-create): Always emphasize tag.
Gerd Moellmann <gerd@gnu.org>
parents:
33986
diff
changeset
|
2894 (widget-specify-sample widget begin (point)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2895 (if (eq custom-buffer-style 'face) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2896 (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
|
2897 (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
|
2898 (insert ":") |
42e118959715
(custom-face-value-create): If face name doesn't end with "face", add
Miles Bader <miles@gnu.org>
parents:
32936
diff
changeset
|
2899 (insert " face: "))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2900 ;; Sample. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2901 (push (widget-create-child-and-convert widget 'item |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2902 :format "(%{%t%})" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2903 :sample-face symbol |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2904 :tag "sample") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2905 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2906 ;; Visibility. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2907 (insert " ") |
25685 | 2908 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2909 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2910 :help-echo "Hide or show this face." |
46580
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2911 :on "Hide Face" |
2c25b46baf82
(custom-variable-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
46408
diff
changeset
|
2912 :off "Show Face" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2913 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2914 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2915 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2916 ;; Magic. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2917 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2918 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2919 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2920 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2921 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2922 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2923 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2924 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2925 (widget-default-format-handler widget ?h) |
25685 | 2926 ;; The comment field |
2927 (unless (eq state 'hidden) | |
2928 (let* ((comment (get symbol 'face-comment)) | |
2929 (comment-widget | |
2930 (widget-create-child-and-convert | |
2931 widget 'custom-comment | |
2932 :parent widget | |
2933 :value (or comment "")))) | |
2934 (widget-put widget :comment-widget comment-widget) | |
2935 (push comment-widget children))) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2936 ;; See also. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2937 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2938 (when (eq (widget-get widget :custom-level) 1) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2939 (custom-add-parent-links widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2940 (custom-add-see-also widget)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2941 ;; Editor. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2942 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2943 (insert "\n")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2944 (unless (eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2945 (message "Creating face editor...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2946 (custom-load-widget widget) |
20411
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2947 (unless (widget-get widget :custom-form) |
089ca3e66e6d
(custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents:
20398
diff
changeset
|
2948 (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
|
2949 (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
|
2950 (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
|
2951 (get symbol 'saved-face) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2952 (get symbol 'face-defface-spec) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2953 ;; Attempt to construct it. |
25685 | 2954 (list (list t (custom-face-attributes-get |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2955 symbol (selected-frame)))))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2956 (form (widget-get widget :custom-form)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2957 (indent (widget-get widget :indent)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2958 edit) |
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2959 ;; 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
|
2960 ;; 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
|
2961 (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
|
2962 (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
|
2963 (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
|
2964 (setq edit (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2965 widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2966 (cond ((and (eq form 'selected) |
25685 | 2967 (widget-apply custom-face-selected |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2968 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2969 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2970 'custom-face-selected) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2971 ((and (not (eq form 'lisp)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2972 (widget-apply custom-face-all |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2973 :match spec)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2974 'custom-face-all) |
25685 | 2975 (t |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2976 (when indent (insert-char ?\ indent)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2977 'sexp)) |
19097
200ff7e7d620
(custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents:
19040
diff
changeset
|
2978 :value spec)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2979 (custom-face-state-set widget) |
25685 | 2980 (push edit children) |
2981 (widget-put widget :children children)) | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
2982 (message "Creating face editor...done")))))) |
17334 | 2983 |
25685 | 2984 (defvar custom-face-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
2985 '(("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
|
2986 ("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
|
2987 ("Reset to Saved" custom-face-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2988 (lambda (widget) |
25685 | 2989 (or (get (widget-value widget) 'saved-face) |
2990 (get (widget-value widget) 'saved-face-comment)))) | |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
2991 ("Erase Customization" custom-face-reset-standard |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
2992 (lambda (widget) |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2993 (get (widget-value widget) 'face-defface-spec))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2994 ("---" ignore ignore) |
25685 | 2995 ("Add Comment" custom-comment-show custom-comment-invisible-p) |
2996 ("---" ignore ignore) | |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2997 ("Show all display specs" custom-face-edit-all |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2998 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
2999 (not (eq (widget-get widget :custom-form) 'all)))) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
3000 ("Just current attributes" custom-face-edit-selected |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
3001 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
3002 (not (eq (widget-get widget :custom-form) 'selected)))) |
40801
f49e883aeab2
Backed out last change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
40800
diff
changeset
|
3003 ("Show as Lisp expression" custom-face-edit-lisp |
18258
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
3004 (lambda (widget) |
e83bc8150072
Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18244
diff
changeset
|
3005 (not (eq (widget-get widget :custom-form) 'lisp))))) |
17334 | 3006 "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
|
3007 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
|
3008 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
|
3009 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
|
3010 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
|
3011 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3012 |
3013 (defun custom-face-edit-selected (widget) | |
3014 "Edit selected attributes of the value of WIDGET." | |
3015 (widget-put widget :custom-state 'unknown) | |
3016 (widget-put widget :custom-form 'selected) | |
3017 (custom-redraw widget)) | |
3018 | |
3019 (defun custom-face-edit-all (widget) | |
3020 "Edit all attributes of the value of WIDGET." | |
3021 (widget-put widget :custom-state 'unknown) | |
3022 (widget-put widget :custom-form 'all) | |
3023 (custom-redraw widget)) | |
3024 | |
3025 (defun custom-face-edit-lisp (widget) | |
28130 | 3026 "Edit the Lisp representation of the value of WIDGET." |
17334 | 3027 (widget-put widget :custom-state 'unknown) |
3028 (widget-put widget :custom-form 'lisp) | |
3029 (custom-redraw widget)) | |
3030 | |
3031 (defun custom-face-state-set (widget) | |
3032 "Set the state of WIDGET." | |
25685 | 3033 (let* ((symbol (widget-value widget)) |
3034 (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
|
3035 tmp temp |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3036 (state |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3037 (cond ((progn |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3038 (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
|
3039 (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
|
3040 (or tmp temp)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3041 (if (equal temp comment) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3042 'set |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3043 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3044 ((progn |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3045 (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
|
3046 (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
|
3047 (or tmp temp)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3048 (if (equal temp comment) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3049 'saved |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3050 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3051 ((get symbol 'face-defface-spec) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3052 (if (equal comment nil) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3053 'standard |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3054 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3055 (t |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3056 'rogue)))) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3057 ;; 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
|
3058 ;; 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
|
3059 (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
|
3060 (get symbol 'face-modified)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3061 (setq state 'changed)) |
caaa4fda6808
(custom-face-state-set): non-nil `face-modified'
Richard M. Stallman <rms@gnu.org>
parents:
50283
diff
changeset
|
3062 (widget-put widget :custom-state state))) |
17334 | 3063 |
3064 (defun custom-face-action (widget &optional event) | |
3065 "Show the menu for `custom-face' WIDGET. | |
3066 Optional EVENT is the location for the menu." | |
3067 (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
|
3068 (custom-toggle-hide widget) |
17334 | 3069 (let* ((completion-ignore-case t) |
3070 (symbol (widget-get widget :value)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3071 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3072 (custom-unlispify-tag-name symbol)) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3073 (custom-menu-filter custom-face-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3074 widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3075 event))) |
17334 | 3076 (if answer |
3077 (funcall answer widget))))) | |
3078 | |
3079 (defun custom-face-set (widget) | |
3080 "Make the face attributes in WIDGET take effect." | |
3081 (let* ((symbol (widget-value widget)) | |
3082 (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
|
3083 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 3084 (comment-widget (widget-get widget :comment-widget)) |
3085 (comment (widget-value comment-widget))) | |
3086 (when (equal comment "") | |
3087 (setq comment nil) | |
3088 ;; 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
|
3089 (custom-comment-hide comment-widget)) |
17334 | 3090 (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
|
3091 (if (face-spec-choose value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3092 (face-spec-set symbol value) |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3093 ;; 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
|
3094 ;; something harmless instead. |
388a61e78c53
(custom-filter-face-spec, custom-pre-filter-face-spec)
Miles Bader <miles@gnu.org>
parents:
33774
diff
changeset
|
3095 (face-spec-set symbol '((t :foreground unspecified)))) |
25685 | 3096 (put symbol 'customized-face-comment comment) |
3097 (put symbol 'face-comment comment) | |
17334 | 3098 (custom-face-state-set widget) |
3099 (custom-redraw-magic widget))) | |
3100 | |
19883
519eab181c36
(custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents:
19823
diff
changeset
|
3101 (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
|
3102 "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
|
3103 (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
|
3104 (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
|
3105 |
17334 | 3106 (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
|
3107 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'." |
17334 | 3108 (let* ((symbol (widget-value widget)) |
3109 (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
|
3110 (value (custom-post-filter-face-spec (widget-value child))) |
25685 | 3111 (comment-widget (widget-get widget :comment-widget)) |
3112 (comment (widget-value comment-widget))) | |
3113 (when (equal comment "") | |
3114 (setq comment nil) | |
3115 ;; 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
|
3116 (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
|
3117 (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
|
3118 (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
|
3119 ;; 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
|
3120 ;; 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
|
3121 (face-spec-set symbol '((t :foreground unspecified)))) |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3122 (unless (eq (widget-get widget :custom-state) 'standard) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3123 (put symbol 'saved-face value)) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3124 (custom-push-theme 'theme-face symbol 'user 'set value) |
17334 | 3125 (put symbol 'customized-face nil) |
25685 | 3126 (put symbol 'face-comment comment) |
3127 (put symbol 'customized-face-comment nil) | |
3128 (put symbol 'saved-face-comment comment) | |
20262
c6532008f2a9
(custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents:
20174
diff
changeset
|
3129 (custom-save-all) |
17334 | 3130 (custom-face-state-set widget) |
3131 (custom-redraw-magic widget))) | |
3132 | |
3133 (defun custom-face-reset-saved (widget) | |
3134 "Restore WIDGET to the face's default attributes." | |
3135 (let* ((symbol (widget-value widget)) | |
3136 (child (car (widget-get widget :children))) | |
25685 | 3137 (value (get symbol 'saved-face)) |
3138 (comment (get symbol 'saved-face-comment)) | |
3139 (comment-widget (widget-get widget :comment-widget))) | |
3140 (unless (or value comment) | |
17334 | 3141 (error "No saved value for this face")) |
3142 (put symbol 'customized-face nil) | |
25685 | 3143 (put symbol 'customized-face-comment nil) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3144 (face-spec-set symbol value) |
25685 | 3145 (put symbol 'face-comment comment) |
17334 | 3146 (widget-value-set child value) |
25685 | 3147 ;; This call manages the comment visibility |
3148 (widget-value-set comment-widget (or comment "")) | |
17334 | 3149 (custom-face-state-set widget) |
3150 (custom-redraw-magic widget))) | |
3151 | |
46408
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3152 (defun custom-face-standard-value (widget) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3153 (get (widget-value widget) 'face-defface-spec)) |
ccaa90ab16a3
New operation :custom-standard-value.
Richard M. Stallman <rms@gnu.org>
parents:
45725
diff
changeset
|
3154 |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3155 (defun custom-face-reset-standard (widget) |
26625
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3156 "Restore WIDGET to the face's standard settings. |
faf989c7a28e
(Custom-reset-standard): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
26451
diff
changeset
|
3157 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
|
3158 restoring it to the state of a face that has never been customized." |
17334 | 3159 (let* ((symbol (widget-value widget)) |
3160 (child (car (widget-get widget :children))) | |
25685 | 3161 (value (get symbol 'face-defface-spec)) |
3162 (comment-widget (widget-get widget :comment-widget))) | |
17334 | 3163 (unless value |
17641
4650d25e48f6
Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents:
17550
diff
changeset
|
3164 (error "No standard setting for this face")) |
17334 | 3165 (put symbol 'customized-face nil) |
25685 | 3166 (put symbol 'customized-face-comment nil) |
3167 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment)) | |
17334 | 3168 (put symbol 'saved-face nil) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3169 (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
|
3170 ;; 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
|
3171 (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
|
3172 (put symbol 'theme-face nil)) |
25685 | 3173 (put symbol 'saved-face-comment nil) |
17334 | 3174 (custom-save-all)) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3175 (face-spec-set symbol value) |
25685 | 3176 (put symbol 'face-comment nil) |
17334 | 3177 (widget-value-set child value) |
25685 | 3178 ;; This call manages the comment visibility |
3179 (widget-value-set comment-widget "") | |
17334 | 3180 (custom-face-state-set widget) |
3181 (custom-redraw-magic widget))) | |
3182 | |
3183 ;;; The `face' Widget. | |
3184 | |
3185 (define-widget 'face 'default | |
3186 "Select and customize a face." | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3187 :convert-widget 'widget-value-convert-widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3188 :button-prefix 'widget-push-button-prefix |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3189 :button-suffix 'widget-push-button-suffix |
33986 | 3190 :format "%{%t%}: %[select face%] %v" |
17334 | 3191 :tag "Face" |
3192 :value 'default | |
3193 :value-create 'widget-face-value-create | |
3194 :value-delete 'widget-face-value-delete | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3195 :value-get 'widget-value-value-get |
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3196 :validate 'widget-children-validate |
17334 | 3197 :action 'widget-face-action |
28612
0051d3178111
(custom-face, face): Unquote the lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28568
diff
changeset
|
3198 :match (lambda (widget value) (symbolp value))) |
17334 | 3199 |
3200 (defun widget-face-value-create (widget) | |
28130 | 3201 "Create a `custom-face' child." |
17334 | 3202 (let* ((symbol (widget-value widget)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3203 (custom-buffer-style 'face) |
17334 | 3204 (child (widget-create-child-and-convert |
3205 widget 'custom-face | |
3206 :custom-level nil | |
3207 :value symbol))) | |
3208 (custom-magic-reset child) | |
3209 (setq custom-options (cons child custom-options)) | |
3210 (widget-put widget :children (list child)))) | |
3211 | |
3212 (defun widget-face-value-delete (widget) | |
28130 | 3213 "Remove the child from the options." |
17334 | 3214 (let ((child (car (widget-get widget :children)))) |
3215 (setq custom-options (delq child custom-options)) | |
3216 (widget-children-value-delete widget))) | |
3217 | |
3218 (defvar face-history nil | |
3219 "History of entered face names.") | |
3220 | |
3221 (defun widget-face-action (widget &optional event) | |
3222 "Prompt for a face." | |
3223 (let ((answer (completing-read "Face: " | |
3224 (mapcar (lambda (face) | |
3225 (list (symbol-name face))) | |
3226 (face-list)) | |
25685 | 3227 nil nil nil |
17334 | 3228 'face-history))) |
3229 (unless (zerop (length answer)) | |
3230 (widget-value-set widget (intern answer)) | |
3231 (widget-apply widget :notify widget event) | |
3232 (widget-setup)))) | |
3233 | |
3234 ;;; The `hook' Widget. | |
3235 | |
3236 (define-widget 'hook 'list | |
3237 "A emacs lisp hook" | |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3238 :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
|
3239 (if (and value (symbolp value)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3240 (list value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3241 value)) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3242 :match (lambda (widget value) |
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3243 (or (symbolp value) |
20174
e1ca1fe89e6e
(hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents:
20100
diff
changeset
|
3244 (widget-group-match widget value))) |
28130 | 3245 ;; Avoid adding undefined functions to the hook, especially for |
3246 ;; things like `find-file-hook' or even more basic ones, to avoid | |
3247 ;; chaos. | |
3248 :set (lambda (symbol value) | |
28310
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3249 (dolist (elt value) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3250 (if (fboundp elt) |
9ba6478b7a27
(hook): Use `dolist' instead of CL's `mapc'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28245
diff
changeset
|
3251 (add-hook symbol elt)))) |
17334 | 3252 :convert-widget 'custom-hook-convert-widget |
3253 :tag "Hook") | |
3254 | |
3255 (defun custom-hook-convert-widget (widget) | |
27250
807fc106b24c
(custom-hook-convert-widget): Fix comment.
Gerd Moellmann <gerd@gnu.org>
parents:
26803
diff
changeset
|
3256 ;; Handle `:options'. |
17334 | 3257 (let* ((options (widget-get widget :options)) |
25685 | 3258 (other `(editable-list :inline t |
17334 | 3259 :entry-format "%i %d%v" |
3260 (function :format " %v"))) | |
3261 (args (if options | |
3262 (list `(checklist :inline t | |
3263 ,@(mapcar (lambda (entry) | |
3264 `(function-item ,entry)) | |
3265 options)) | |
3266 other) | |
3267 (list other)))) | |
3268 (widget-put widget :args args) | |
3269 widget)) | |
3270 | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3271 ;;; The `custom-group-link' Widget. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3272 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3273 (define-widget 'custom-group-link 'link |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3274 "Show parent in other window when activated." |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3275 :help-echo "Create customization buffer for this group." |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3276 :action 'custom-group-link-action) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3277 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3278 (defun custom-group-link-action (widget &rest ignore) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3279 (customize-group (widget-value widget))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3280 |
17334 | 3281 ;;; The `custom-group' Widget. |
3282 | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3283 (defcustom custom-group-tag-faces nil |
17334 | 3284 ;; In XEmacs, this ought to play games with font size. |
25685 | 3285 ;; Fixme: make it do so in Emacs. |
17334 | 3286 "Face used for group tags. |
3287 The first member is used for level 1 groups, the second for level 2, | |
3288 and so forth. The remaining group tags are shown with | |
3289 `custom-group-tag-face'." | |
3290 :type '(repeat face) | |
17415 | 3291 :group 'custom-faces) |
17334 | 3292 |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3293 (defface custom-group-tag-face-1 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3294 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3295 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3296 (: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
|
3297 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3298 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3299 (: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
|
3300 (t (:weight bold))) |
28172
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3301 "Face used for group tags." |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3302 :group 'custom-faces) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3303 |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3304 (defface custom-group-tag-face |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3305 `((((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3306 (background dark)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3307 (: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
|
3308 (((class color) |
b243caac6505
(custom-variable-tag-face): Handle case that
Gerd Moellmann <gerd@gnu.org>
parents:
28130
diff
changeset
|
3309 (background light)) |
42451
cade20d9a300
(custom-face-edit-fix-value): Delete `assert' call.
Richard M. Stallman <rms@gnu.org>
parents:
42448
diff
changeset
|
3310 (: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
|
3311 (t (:weight bold))) |
17334 | 3312 "Face used for low level group tags." |
17415 | 3313 :group 'custom-faces) |
17334 | 3314 |
3315 (define-widget 'custom-group 'custom | |
3316 "Customize group." | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3317 :format "%v" |
17334 | 3318 :sample-face-get 'custom-group-sample-face-get |
3319 :documentation-property 'group-documentation | |
3320 :help-echo "Set or reset all members of this group." | |
3321 :value-create 'custom-group-value-create | |
3322 :action 'custom-group-action | |
18089 | 3323 :custom-category 'group |
17334 | 3324 :custom-set 'custom-group-set |
3325 :custom-save 'custom-group-save | |
3326 :custom-reset-current 'custom-group-reset-current | |
3327 :custom-reset-saved 'custom-group-reset-saved | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3328 :custom-reset-standard 'custom-group-reset-standard |
17334 | 3329 :custom-menu 'custom-group-menu-create) |
3330 | |
3331 (defun custom-group-sample-face-get (widget) | |
3332 ;; Use :sample-face. | |
3333 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces) | |
3334 'custom-group-tag-face)) | |
3335 | |
18430
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3336 (define-widget 'custom-group-visibility 'visibility |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3337 "An indicator and manipulator for hidden group contents." |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3338 :create 'custom-group-visibility-create) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3339 |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3340 (defun custom-group-visibility-create (widget) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3341 (let ((visible (widget-value widget))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3342 (if visible |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3343 (insert "--------"))) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3344 (widget-default-create widget)) |
a8ae9c653696
(custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents:
18373
diff
changeset
|
3345 |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3346 (defun custom-group-members (symbol groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3347 "Return SYMBOL's custom group members. |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3348 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
|
3349 (if (not groups-only) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3350 (get symbol 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3351 (let (members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3352 (dolist (entry (get symbol 'custom-group)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3353 (when (eq (nth 1 entry) 'custom-group) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3354 (push entry members))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3355 (nreverse members)))) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3356 |
17334 | 3357 (defun custom-group-value-create (widget) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3358 "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
|
3359 (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
|
3360 (custom-load-widget widget)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3361 (let* ((state (widget-get widget :custom-state)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3362 (level (widget-get widget :custom-level)) |
19040
c0dc58ad2d47
Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19022
diff
changeset
|
3363 ;; (indent (widget-get widget :indent)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3364 (prefix (widget-get widget :custom-prefix)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3365 (buttons (widget-get widget :buttons)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3366 (tag (widget-get widget :tag)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3367 (symbol (widget-value widget)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3368 (members (custom-group-members symbol |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3369 (and (eq custom-buffer-style 'tree) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3370 custom-browse-only-groups)))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3371 (cond ((and (eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3372 (eq state 'hidden) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3373 (or members (custom-unloaded-widget-p widget))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3374 (custom-browse-insert-prefix prefix) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3375 (push (widget-create-child-and-convert |
25685 | 3376 widget 'custom-browse-visibility |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3377 ;; :tag-glyph "plus" |
18856
03eeb83520d8
(custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents:
18812
diff
changeset
|
3378 :tag "+") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3379 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3380 (insert "-- ") |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3381 ;; (widget-glyph-insert nil "-- " "horizontal") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3382 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3383 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3384 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3385 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3386 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3387 ((and (eq custom-buffer-style 'tree) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3388 (zerop (length members))) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3389 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3390 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3391 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3392 ;; (widget-glyph-insert nil "-- " "horizontal") |
25685 | 3393 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3394 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3395 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3396 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3397 (widget-put widget :buttons buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3398 ((eq custom-buffer-style 'tree) |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3399 (custom-browse-insert-prefix prefix) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3400 (if (zerop (length members)) |
25685 | 3401 (progn |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3402 (custom-browse-insert-prefix prefix) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3403 (insert "[ ]-- ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3404 ;; (widget-glyph-insert nil "[ ]" "empty") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3405 ;; (widget-glyph-insert nil "-- " "horizontal") |
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)) |
25685 | 3411 (push (widget-create-child-and-convert |
3412 widget 'custom-browse-visibility | |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3413 ;; :tag-glyph "minus" |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3414 :tag "-") |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3415 buttons) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3416 (insert "-\\ ") |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3417 ;; (widget-glyph-insert nil "-\\ " "top") |
25685 | 3418 (push (widget-create-child-and-convert |
18562
e22e2a4e683a
Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18462
diff
changeset
|
3419 widget 'custom-browse-group-tag) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3420 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3421 (insert " " tag "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3422 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3423 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3424 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3425 custom-browse-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3426 custom-browse-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3427 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3428 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3429 (extra-prefix (if (widget-get widget :custom-last) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3430 " " |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3431 " | ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3432 (prefix (concat prefix extra-prefix)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3433 children entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3434 (while members |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3435 (setq entry (car members) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3436 members (cdr members)) |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3437 (push (widget-create-child-and-convert |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3438 widget (nth 1 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3439 :group widget |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3440 :tag (custom-unlispify-tag-name (nth 0 entry)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3441 :custom-prefixes custom-prefix-list |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3442 :custom-level (1+ level) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3443 :custom-last (null members) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3444 :value (nth 0 entry) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3445 :custom-prefix prefix) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3446 children)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3447 (widget-put widget :children (reverse children))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3448 (message "Creating group...done"))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3449 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3450 ((eq state 'hidden) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3451 ;; Create level indicator. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3452 (unless (eq custom-buffer-style 'links) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3453 (insert-char ?\ (* custom-buffer-indent (1- level))) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3454 (insert "-- ")) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3455 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3456 (let ((begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3457 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3458 (widget-specify-sample widget begin (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3459 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3460 ;; Create link/visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3461 (if (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3462 (push (widget-create-child-and-convert |
25685 | 3463 widget 'custom-group-link |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
3464 :tag "Go to Group" |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3465 symbol) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3466 buttons) |
25685 | 3467 (push (widget-create-child-and-convert |
20100
0db4553d47cc
(custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents:
19886
diff
changeset
|
3468 widget 'custom-group-visibility |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3469 :help-echo "Show members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3470 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3471 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3472 buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3473 (insert " \n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3474 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3475 (let ((magic (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3476 widget 'custom-magic nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3477 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3478 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3479 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3480 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3481 ;; Insert documentation. |
18367
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3482 (if (and (eq custom-buffer-style 'links) (> level 1)) |
f4682a047be1
(custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents:
18364
diff
changeset
|
3483 (widget-put widget :documentation-indent 0)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3484 (widget-default-format-handler widget ?h)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3485 ;; Nested style. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3486 (t ;Visible. |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3487 ;; 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
|
3488 (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
|
3489 ;;; 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
|
3490 (when (eq level 1) |
18371
a32f9b2c2e0c
(custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents:
18370
diff
changeset
|
3491 (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
|
3492 "Go to parent group:") |
18370
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3493 (insert "\n")))) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3494 ;; Create level indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3495 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3496 (insert "/- ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3497 ;; Create tag. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3498 (let ((start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3499 (insert tag) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3500 (widget-specify-sample widget start (point))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3501 (insert " group: ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3502 ;; Create visibility indicator. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3503 (unless (eq custom-buffer-style 'links) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3504 (insert "--------") |
25685 | 3505 (push (widget-create-child-and-convert |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3506 widget 'visibility |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3507 :help-echo "Hide members of this group." |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3508 :action 'custom-toggle-parent |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3509 (not (eq state 'hidden))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3510 buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3511 (insert " ")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3512 ;; Create more dashes. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3513 ;; Use 76 instead of 75 to compensate for the temporary "<" |
25685 | 3514 ;; added by `widget-insert'. |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3515 (insert-char ?- (- 76 (current-column) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3516 (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3517 (insert "\\\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3518 ;; Create magic button. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3519 (let ((magic (widget-create-child-and-convert |
25685 | 3520 widget 'custom-magic |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3521 :indent 0 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3522 nil))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3523 (widget-put widget :custom-magic magic) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3524 (push magic buttons)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3525 ;; Update buttons. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3526 (widget-put widget :buttons buttons) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3527 ;; Insert documentation. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3528 (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
|
3529 ;; Parent groups. |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3530 (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
|
3531 ;;; 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
|
3532 (when (eq level 1) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3533 (insert-char ?\ custom-buffer-indent) |
74558272517b
(custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents:
18368
diff
changeset
|
3534 (custom-add-parent-links widget))) |
25685 | 3535 (custom-add-see-also widget |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3536 (make-string (* custom-buffer-indent level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3537 ?\ )) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3538 ;; Members. |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3539 (message "Creating group...") |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3540 (let* ((members (custom-sort-items members |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3541 custom-buffer-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
3542 custom-buffer-order-groups)) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3543 (prefixes (widget-get widget :custom-prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3544 (custom-prefix-list (custom-prefix-add symbol prefixes)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3545 (length (length members)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3546 (count 0) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3547 (children (mapcar (lambda (entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3548 (widget-insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3549 (message "\ |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3550 Creating group members... %2d%%" |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3551 (/ (* 100.0 count) length)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3552 (setq count (1+ count)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3553 (prog1 |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3554 (widget-create-child-and-convert |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3555 widget (nth 1 entry) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3556 :group widget |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3557 :tag (custom-unlispify-tag-name |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3558 (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3559 :custom-prefixes custom-prefix-list |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3560 :custom-level (1+ level) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3561 :value (nth 0 entry)) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3562 (unless (eq (preceding-char) ?\n) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3563 (widget-insert "\n")))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3564 members))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3565 (message "Creating group magic...") |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3566 (mapc 'custom-magic-reset children) |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3567 (message "Creating group state...") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3568 (widget-put widget :children children) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3569 (custom-group-state-update widget) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3570 (message "Creating group... done")) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3571 ;; End line |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3572 (insert "\n") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3573 (insert-char ?\ (* custom-buffer-indent (1- level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3574 (insert "\\- " (widget-get widget :tag) " group end ") |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3575 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level))) |
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
3576 (insert "/\n"))))) |
17334 | 3577 |
25685 | 3578 (defvar custom-group-menu |
18571
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
3579 '(("Set for Current Session" custom-group-set |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3580 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3581 (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
|
3582 ("Save for Future Sessions" custom-group-save |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3583 (lambda (widget) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3584 (memq (widget-get widget :custom-state) '(modified set)))) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3585 ("Reset to Current" custom-group-reset-current |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3586 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3587 (memq (widget-get widget :custom-state) '(modified)))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3588 ("Reset to Saved" custom-group-reset-saved |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3589 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3590 (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
|
3591 ("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
|
3592 (lambda (widget) |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3593 (memq (widget-get widget :custom-state) '(modified set saved))))) |
17334 | 3594 "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
|
3595 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
|
3596 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
|
3597 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
|
3598 widget as an argument, and returns non-nil if ACTION is valid on that |
25685 | 3599 widget. If FILTER is nil, ACTION is always valid.") |
17334 | 3600 |
3601 (defun custom-group-action (widget &optional event) | |
3602 "Show the menu for `custom-group' WIDGET. | |
3603 Optional EVENT is the location for the menu." | |
3604 (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
|
3605 (custom-toggle-hide widget) |
17334 | 3606 (let* ((completion-ignore-case t) |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3607 (answer (widget-choose (concat "Operation on " |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3608 (custom-unlispify-tag-name |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3609 (widget-get widget :value))) |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3610 (custom-menu-filter custom-group-menu |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3611 widget) |
17334 | 3612 event))) |
3613 (if answer | |
3614 (funcall answer widget))))) | |
3615 | |
3616 (defun custom-group-set (widget) | |
3617 "Set changes in all modified group members." | |
3618 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3619 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3620 (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
|
3621 (widget-apply child :custom-set))) |
17334 | 3622 children ))) |
3623 | |
3624 (defun custom-group-save (widget) | |
3625 "Save all modified group members." | |
3626 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3627 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3628 (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
|
3629 (widget-apply child :custom-save))) |
17334 | 3630 children ))) |
3631 | |
3632 (defun custom-group-reset-current (widget) | |
3633 "Reset all modified group members." | |
3634 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3635 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3636 (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
|
3637 (widget-apply child :custom-reset-current))) |
17334 | 3638 children ))) |
3639 | |
3640 (defun custom-group-reset-saved (widget) | |
3641 "Reset all modified or set group members." | |
3642 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3643 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3644 (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
|
3645 (widget-apply child :custom-reset-saved))) |
17334 | 3646 children ))) |
3647 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3648 (defun custom-group-reset-standard (widget) |
17334 | 3649 "Reset all modified, set, or saved group members." |
3650 (let ((children (widget-get widget :children))) | |
28700
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3651 (mapc (lambda (child) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3652 (when (memq (widget-get child :custom-state) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3653 '(modified set saved)) |
a57bafeec17c
(Custom-set, Custom-save, Custom-reset-current)
Dave Love <fx@gnu.org>
parents:
28612
diff
changeset
|
3654 (widget-apply child :custom-reset-standard))) |
17334 | 3655 children ))) |
3656 | |
3657 (defun custom-group-state-update (widget) | |
3658 "Update magic." | |
3659 (unless (eq (widget-get widget :custom-state) 'hidden) | |
3660 (let* ((children (widget-get widget :children)) | |
3661 (states (mapcar (lambda (child) | |
3662 (widget-get child :custom-state)) | |
3663 children)) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3664 (magics custom-magic-alist) |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3665 (found 'standard)) |
17334 | 3666 (while magics |
3667 (let ((magic (car (car magics)))) | |
3668 (if (and (not (eq magic 'hidden)) | |
3669 (memq magic states)) | |
3670 (setq found magic | |
3671 magics nil) | |
3672 (setq magics (cdr magics))))) | |
3673 (widget-put widget :custom-state found))) | |
3674 (custom-magic-reset widget)) | |
3675 | |
3676 ;;; The `custom-save-all' Function. | |
18336
325190603227
Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18320
diff
changeset
|
3677 ;;;###autoload |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3678 (defcustom custom-file nil |
17334 | 3679 "File used for storing customization information. |
19822
b5c12a2d1c26
*** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
19684
diff
changeset
|
3680 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
|
3681 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
|
3682 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
|
3683 |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3684 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
|
3685 \(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
|
3686 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
|
3687 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
|
3688 :type '(choice (const :tag "Your Emacs init file" nil) file) |
17334 | 3689 :group 'customize) |
3690 | |
20974 | 3691 (defun custom-file () |
3692 "Return the file name for saving customizations." | |
37911
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3693 (setq custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3694 (or custom-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3695 (let ((user-init-file user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3696 (default-init-file |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3697 (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3698 (when (null user-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3699 (if (or (file-exists-p default-init-file) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3700 (and (eq system-type 'windows-nt) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3701 (file-exists-p "~/_emacs"))) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3702 ;; Started with -q, i.e. the file containing |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3703 ;; Custom settings hasn't been read. Saving |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3704 ;; settings there would overwrite other settings. |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3705 (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
|
3706 (setq user-init-file default-init-file)) |
747d5805111c
(custom-file): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
37902
diff
changeset
|
3707 user-init-file)))) |
20974 | 3708 |
17334 | 3709 (defun custom-save-delete (symbol) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3710 "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
|
3711 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
|
3712 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
|
3713 (let ((default-major-mode 'emacs-lisp-mode)) |
20974 | 3714 (set-buffer (find-file-noselect (custom-file)))) |
17334 | 3715 (goto-char (point-min)) |
25058
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3716 ;; Skip all whitespace and comments. |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3717 (while (forward-comment 1)) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3718 (or (eobp) |
af119d40c92d
(custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents:
24509
diff
changeset
|
3719 (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
|
3720 (let (first) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3721 (catch 'found |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3722 (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
|
3723 ;; Skip all whitespace and comments. |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3724 (while (forward-comment 1)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3725 (let ((start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3726 (sexp (condition-case nil |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3727 (read (current-buffer)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3728 (end-of-file (throw 'found nil))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3729 (when (and (listp sexp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3730 (eq (car sexp) symbol)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3731 (delete-region start (point)) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3732 (unless first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3733 (setq first (point))))))) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3734 (if first |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3735 (goto-char first) |
36628
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3736 ;; 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
|
3737 ;; entries would make them ineffective. |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3738 (let ((pos (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3739 (case-fold-search t)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3740 (save-excursion |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3741 (goto-char (point-max)) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3742 (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
|
3743 'move) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3744 (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
|
3745 (setq pos (line-beginning-position)))) |
d1106e82508b
(custom-save-delete): Move in front of local
Gerd Moellmann <gerd@gnu.org>
parents:
35441
diff
changeset
|
3746 (goto-char pos))))) |
17334 | 3747 |
3748 (defun custom-save-variables () | |
3749 "Save all customized variables in `custom-file'." | |
3750 (save-excursion | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3751 (custom-save-delete 'custom-load-themes) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3752 (custom-save-delete 'custom-reset-variables) |
17334 | 3753 (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
|
3754 (custom-save-loaded-themes) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3755 (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
|
3756 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3757 (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
|
3758 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3759 ;; 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
|
3760 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3761 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3762 (if (get symbol 'saved-value) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3763 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3764 (setq saved-list (sort (cdr saved-list) 'string<)) |
17334 | 3765 (unless (bolp) |
3766 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3767 (princ "(custom-set-variables |
47315
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3768 ;; custom-set-variables was added by Custom. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3769 ;; 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
|
3770 ;; 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
|
3771 ;; 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
|
3772 (dolist (symbol saved-list) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3773 (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
|
3774 (value (get symbol 'saved-value)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3775 (requests (get symbol 'custom-requests)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3776 (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
|
3777 (and (not (boundp symbol)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3778 (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
|
3779 'rogue)))))) |
51362
0b5cb555fd17
(custom-get-fresh-buffer): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51277
diff
changeset
|
3780 (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
|
3781 ;; Check `requests'. |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3782 (dolist (request requests) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3783 (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
|
3784 (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
|
3785 (setq requests (delq request requests)))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3786 (when (or (and spec |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3787 (eq (nth 0 spec) 'user) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3788 (eq (nth 1 spec) 'set)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3789 comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3790 (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
|
3791 (unless (bolp) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3792 (princ "\n")) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3793 (princ " '(") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3794 (prin1 symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3795 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3796 (prin1 (car value)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3797 (when (or now requests comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3798 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3799 (prin1 now) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3800 (when (or requests comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3801 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3802 (prin1 requests) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3803 (when comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3804 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3805 (prin1 comment)))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3806 (princ ")")))) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3807 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3808 (princ " ")) |
17334 | 3809 (princ ")") |
3810 (unless (looking-at "\n") | |
3811 (princ "\n"))))) | |
3812 | |
3813 (defun custom-save-faces () | |
3814 "Save all customized faces in `custom-file'." | |
3815 (save-excursion | |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3816 (custom-save-delete 'custom-reset-faces) |
17334 | 3817 (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
|
3818 (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
|
3819 (let ((standard-output (current-buffer)) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3820 (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
|
3821 sort-fold-case) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3822 ;; 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
|
3823 (mapatoms |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3824 (lambda (symbol) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3825 (if (get symbol 'saved-face) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3826 (nconc saved-list (list symbol))))) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3827 (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
|
3828 ;; 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
|
3829 (if (memq 'default saved-list) |
d6081fb56cda
(custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents:
25058
diff
changeset
|
3830 (setq saved-list (cons 'default (delq 'default saved-list)))) |
17334 | 3831 (unless (bolp) |
3832 (princ "\n")) | |
26653
ea8ae3c8fad5
(custom-save-variables, custom-save-faces): Write a
Dave Love <fx@gnu.org>
parents:
26625
diff
changeset
|
3833 (princ "(custom-set-faces |
47315
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3834 ;; custom-set-faces was added by Custom. |
655350cd09e5
(custom-save-variables, custom-save-faces):
Richard M. Stallman <rms@gnu.org>
parents:
47168
diff
changeset
|
3835 ;; 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
|
3836 ;; 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
|
3837 ;; 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
|
3838 (dolist (symbol saved-list) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3839 (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
|
3840 (value (get symbol 'saved-face)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3841 (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
|
3842 (and (not (custom-facep symbol)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3843 (not (get symbol 'force-face)))))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3844 (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
|
3845 (when (or (and spec |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3846 (eq (nth 0 spec) 'user) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3847 (eq (nth 1 spec) 'set)) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3848 comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3849 (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
|
3850 ;; 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
|
3851 (unless (bolp) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3852 (princ "\n")) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3853 (princ " '(") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3854 (prin1 symbol) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3855 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3856 (prin1 value) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3857 (when (or now comment) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3858 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3859 (prin1 now) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3860 (when comment |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3861 (princ " ") |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3862 (prin1 comment))) |
e8de2a4807e5
(custom-unlispify-menu-entry): Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49521
diff
changeset
|
3863 (princ ")")))) |
26803
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3864 (if (bolp) |
f7c68655bd5d
(custom-save-delete): Delete all occurrences,
Richard M. Stallman <rms@gnu.org>
parents:
26653
diff
changeset
|
3865 (princ " ")) |
17334 | 3866 (princ ")") |
3867 (unless (looking-at "\n") | |
48958
6b4f6412de76
(custom-save-faces): Fix typo.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48949
diff
changeset
|
3868 (princ "\n"))))) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3869 |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3870 (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
|
3871 (let (started-writing ignored-special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3872 ;; (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
|
3873 (let ((standard-output (current-buffer)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3874 (mapper `(lambda (object) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3875 (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
|
3876 (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
|
3877 (eq (nth 0 spec) 'user) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3878 (eq (nth 1 spec) 'reset)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3879 ;; 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
|
3880 (unless started-writing |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3881 (setq started-writing t) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3882 (unless (bolp) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3883 (princ "\n")) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3884 (princ "(") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3885 (princ (quote ,setter)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3886 (princ "\n '(") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3887 (prin1 object) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3888 (princ " ") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3889 (prin1 (nth 3 spec)) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3890 (princ ")"))))))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3891 (mapc mapper special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3892 (setq ignored-special special) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3893 (mapatoms mapper) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3894 (when started-writing |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3895 (princ ")\n"))))) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
3896 |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3897 (defun custom-save-loaded-themes () |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3898 (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
|
3899 (standard-output (current-buffer))) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3900 (when themes |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3901 (unless (bolp) (princ "\n")) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3902 (princ "(custom-load-themes") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3903 (mapc (lambda (theme) |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3904 (princ "\n '") |
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3905 (prin1 theme)) themes) |
49521
c259d8177692
2003-01-29 Didier Verna <didier@xemacs.org>
John Paul Wallington <jpw@pobox.com>
parents:
49300
diff
changeset
|
3906 (princ " )\n")))) |
17334 | 3907 |
3908 ;;;###autoload | |
18436
2163f03bb88f
(customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents:
18435
diff
changeset
|
3909 (defun customize-save-customized () |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3910 "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
|
3911 (interactive) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3912 (mapatoms (lambda (symbol) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3913 (let ((face (get symbol 'customized-face)) |
25685 | 3914 (value (get symbol 'customized-value)) |
3915 (face-comment (get symbol 'customized-face-comment)) | |
3916 (variable-comment | |
3917 (get symbol 'customized-variable-comment))) | |
3918 (when face | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3919 (put symbol 'saved-face face) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3920 (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
|
3921 (put symbol 'customized-face nil)) |
25685 | 3922 (when value |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3923 (put symbol 'saved-value value) |
48949
f216c93c4189
(customize-save-variable): Take themes into account.
Richard M. Stallman <rms@gnu.org>
parents:
48709
diff
changeset
|
3924 (custom-push-theme 'theme-value symbol 'user 'set value) |
25685 | 3925 (put symbol 'customized-value nil)) |
3926 (when variable-comment | |
3927 (put symbol 'saved-variable-comment variable-comment) | |
3928 (put symbol 'customized-variable-comment nil)) | |
3929 (when face-comment | |
3930 (put symbol 'saved-face-comment face-comment) | |
3931 (put symbol 'customized-face-comment nil))))) | |
17550
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3932 ;; We really should update all custom buffers here. |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3933 (custom-save-all)) |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3934 |
d6545cfb6c5a
Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17534
diff
changeset
|
3935 ;;;###autoload |
17334 | 3936 (defun custom-save-all () |
3937 "Save all customizations in `custom-file'." | |
19022
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3938 (let ((inhibit-read-only t)) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3939 (custom-save-variables) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3940 (custom-save-faces) |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
3941 (save-excursion |
20398
47f326ffb7ba
(custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents:
20397
diff
changeset
|
3942 (let ((default-major-mode nil)) |
20974 | 3943 (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
|
3944 (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
|
3945 (save-buffer))))) |
17334 | 3946 |
3947 ;;; The Customize Menu. | |
3948 | |
17415 | 3949 ;;; Menu support |
3950 | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3951 (defcustom custom-menu-nesting 2 |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3952 "Maximum nesting in custom menus." |
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
3953 :type 'integer |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
3954 :group 'custom-menu) |
17334 | 3955 |
3956 (defun custom-face-menu-create (widget symbol) | |
3957 "Ignoring WIDGET, create a menu entry for customization face SYMBOL." | |
3958 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3959 `(customize-face ',symbol) |
17334 | 3960 t)) |
3961 | |
3962 (defun custom-variable-menu-create (widget symbol) | |
3963 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL." | |
3964 (let ((type (get symbol 'custom-type))) | |
3965 (unless (listp type) | |
3966 (setq type (list type))) | |
3967 (if (and type (widget-get type :custom-menu)) | |
3968 (widget-apply type :custom-menu symbol) | |
3969 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3970 `(customize-variable ',symbol) |
17334 | 3971 t)))) |
3972 | |
17415 | 3973 ;; Add checkboxes to boolean variable entries. |
17334 | 3974 (widget-put (get 'boolean 'widget-type) |
3975 :custom-menu (lambda (widget symbol) | |
3976 (vector (custom-unlispify-menu-entry symbol) | |
17798
f59c9a63514b
Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17703
diff
changeset
|
3977 `(customize-variable ',symbol) |
17334 | 3978 ':style 'toggle |
3979 ':selected symbol))) | |
3980 | |
30184
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
3981 (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
|
3982 "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
|
3983 `( ,(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
|
3984 :filter (lambda (&rest junk) |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3985 (let ((menu (custom-menu-create ',symbol))) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
3986 (if (consp menu) (cdr menu) menu))))) |
17334 | 3987 |
17415 | 3988 ;;;###autoload |
3989 (defun custom-menu-create (symbol) | |
17334 | 3990 "Create menu for customization group SYMBOL. |
3991 The menu is in a format applicable to `easy-menu-define'." | |
17415 | 3992 (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
|
3993 `(customize-group ',symbol) |
17415 | 3994 t))) |
3995 (if (and (or (not (boundp 'custom-menu-nesting)) | |
3996 (>= custom-menu-nesting 0)) | |
49126
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3997 (progn |
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3998 (custom-load-symbol symbol) |
697ca5db73b8
(customize-group, customize-group-other-window):
Markus Rost <rost@math.uni-bielefeld.de>
parents:
49104
diff
changeset
|
3999 (< (length (get symbol 'custom-group)) widget-menu-max-size))) |
17334 | 4000 (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
|
4001 custom-prefix-list)) |
18451
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
4002 (members (custom-sort-items (get symbol 'custom-group) |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
4003 custom-menu-sort-alphabetically |
8eb08560287b
Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18437
diff
changeset
|
4004 custom-menu-order-groups))) |
17334 | 4005 `(,(custom-unlispify-menu-entry symbol t) |
4006 ,item | |
4007 "--" | |
4008 ,@(mapcar (lambda (entry) | |
4009 (widget-apply (if (listp (nth 1 entry)) | |
4010 (nth 1 entry) | |
4011 (list (nth 1 entry))) | |
4012 :custom-menu (nth 0 entry))) | |
18033
bccd356a3b7c
Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18032
diff
changeset
|
4013 members))) |
17334 | 4014 item))) |
4015 | |
4016 ;;;###autoload | |
17415 | 4017 (defun customize-menu-create (symbol &optional name) |
4018 "Return a customize menu for customization group SYMBOL. | |
25685 | 4019 If optional NAME is given, use that as the name of the menu. |
17415 | 4020 Otherwise the menu will be named `Customize'. |
4021 The format is suitable for use with `easy-menu-define'." | |
4022 (unless name | |
4023 (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
|
4024 `(,name |
aa305b5e66ed
(custom-group-menu-create, customize-menu-create): Use :filter, per old
Dave Love <fx@gnu.org>
parents:
29879
diff
changeset
|
4025 :filter (lambda (&rest junk) |
47168
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
4026 (let ((menu (custom-menu-create ',symbol))) |
59fc9e6fd3e8
(custom-unlispify-menu-entry): Don't remove
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46580
diff
changeset
|
4027 (if (consp menu) (cdr menu) menu))))) |
17334 | 4028 |
17415 | 4029 ;;; The Custom Mode. |
4030 | |
4031 (defvar custom-mode-map nil | |
4032 "Keymap for `custom-mode'.") | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4033 |
17415 | 4034 (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
|
4035 ;; 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
|
4036 ;; "\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
|
4037 (setq custom-mode-map (make-sparse-keymap)) |
17415 | 4038 (set-keymap-parent custom-mode-map widget-keymap) |
18139
ee3c0d09dcd3
Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18131
diff
changeset
|
4039 (suppress-keymap custom-mode-map) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4040 (define-key custom-mode-map " " 'scroll-up) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4041 (define-key custom-mode-map "\177" 'scroll-down) |
55272
ee2b597412c9
(custom-mode-map): Add key binding `C-x C-s' to `Custom-save'.
Juri Linkov <juri@jurta.org>
parents:
54721
diff
changeset
|
4042 (define-key custom-mode-map "\C-x\C-s" 'Custom-save) |
25685 | 4043 (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
|
4044 (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
|
4045 (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
|
4046 (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
|
4047 (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
|
4048 |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4049 (defun Custom-move-and-invoke (event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4050 "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
|
4051 (interactive "e") |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4052 (mouse-set-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4053 (if (widget-event-point event) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4054 (let* ((pos (widget-event-point event)) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4055 (button (get-char-property pos 'button))) |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4056 (if button |
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4057 (widget-button-click event))))) |
17415 | 4058 |
25685 | 4059 (easy-menu-define Custom-mode-menu |
17415 | 4060 custom-mode-map |
4061 "Menu used in customization buffers." | |
4062 `("Custom" | |
18364
01666331d10f
Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18362
diff
changeset
|
4063 ,(customize-menu-create 'customize) |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4064 ["Set" Custom-set t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4065 ["Save" Custom-save t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4066 ["Reset to Current" Custom-reset-current t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4067 ["Reset to Saved" Custom-reset-saved t] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4068 ["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
|
4069 ["Info" (Info-goto-node "(emacs)Easy Customization") t])) |
17415 | 4070 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4071 (defun Custom-goto-parent () |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4072 "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
|
4073 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
|
4074 (interactive) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4075 (save-excursion |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4076 (goto-char (point-min)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4077 (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
|
4078 (let* ((button (get-char-property (point) 'button)) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4079 (parent (downcase (widget-get button :tag)))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4080 (customize-group parent))))) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4081 |
17415 | 4082 (defcustom custom-mode-hook nil |
25685 | 4083 "Hook called when entering Custom mode." |
17415 | 4084 :type 'hook |
18244
909a0f9169b8
Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18139
diff
changeset
|
4085 :group 'custom-buffer ) |
17415 | 4086 |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4087 (defun custom-state-buffer-message (widget) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4088 (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
|
4089 (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
|
4090 |
17415 | 4091 (defun custom-mode () |
4092 "Major mode for editing customization buffers. | |
4093 | |
4094 The following commands are available: | |
4095 | |
4096 Move to next button or editable field. \\[widget-forward] | |
4097 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
|
4098 \\<widget-field-keymap>\ |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
4099 Complete content of editable text field. \\[widget-complete] |
904dcdbb8576
Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
18856
diff
changeset
|
4100 \\<custom-mode-map>\ |
18460
a2be4f4ac8ed
(Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents:
18451
diff
changeset
|
4101 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
|
4102 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
|
4103 Set all modifications. \\[Custom-set] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4104 Make all modifications default. \\[Custom-save] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4105 Reset all modified options. \\[Custom-reset-current] |
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4106 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
|
4107 Reset all options. \\[Custom-reset-standard] |
17415 | 4108 |
4109 Entry to this mode calls the value of `custom-mode-hook' | |
4110 if that value is non-nil." | |
4111 (kill-all-local-variables) | |
4112 (setq major-mode 'custom-mode | |
4113 mode-name "Custom") | |
4114 (use-local-map custom-mode-map) | |
18435
2f906938425b
(Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents:
18430
diff
changeset
|
4115 (easy-menu-add Custom-mode-menu) |
17415 | 4116 (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
|
4117 (make-local-variable 'custom-local-buffer) |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4118 (make-local-variable 'widget-documentation-face) |
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4119 (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
|
4120 (make-local-variable 'widget-button-face) |
1beba85e8c62
(custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents:
18562
diff
changeset
|
4121 (setq widget-button-face 'custom-button-face) |
25685 | 4122 (set (make-local-variable 'widget-button-pressed-face) |
4123 'custom-button-pressed-face) | |
4124 (set (make-local-variable 'widget-mouse-face) | |
4125 'custom-button-pressed-face) ; buttons `depress' when moused | |
4126 ;; When possible, use relief for buttons, not bracketing. This test | |
4127 ;; may not be optimal. | |
4128 (when custom-raised-buttons | |
4129 (set (make-local-variable 'widget-push-button-prefix) "") | |
4130 (set (make-local-variable 'widget-push-button-suffix) "") | |
4131 (set (make-local-variable 'widget-link-prefix) "") | |
4132 (set (make-local-variable 'widget-link-suffix) "")) | |
18437
cbaf72286a2e
(custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents:
18436
diff
changeset
|
4133 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t) |
17415 | 4134 (run-hooks 'custom-mode-hook)) |
17334 | 4135 |
32904
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
4136 (put 'custom-mode 'mode-class 'special) |
2109c5fb0c3f
(custom-mode): Add `special' mode-class property.
Dave Love <fx@gnu.org>
parents:
32883
diff
changeset
|
4137 |
28130 | 4138 (add-to-list |
4139 'debug-ignored-errors | |
4140 "^No user options have changed defaults in recent Emacs versions$") | |
4141 | |
17334 | 4142 ;;; The End. |
4143 | |
4144 (provide 'cus-edit) | |
4145 | |
52401 | 4146 ;;; arch-tag: 64533aa4-1b1a-48c3-8812-f9dc718e8a6f |
25685 | 4147 ;;; cus-edit.el ends here |