annotate lisp/cus-edit.el @ 25953:d79615c0b727

(uninstall, install-arch-indep, install-arch-dep): Unset CDPATH to prevent cd from generating output.
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Oct 1999 19:13:48 +0000
parents f54121af02c8
children 91e697e38599
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18606
bd6a9aa88797 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 18598
diff changeset
1 ;;; cus-edit.el --- Tools for customizating Emacs and Lisp packages.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2 ;;
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3 ;; Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
6 ;; Keywords: help, faces
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
7 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ (probably obsolete)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
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
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
26 ;;; Commentary:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
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.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
29 ;;
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
30 ;; See `custom.el'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
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
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
36 ;;; Code:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
37
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
38 (require 'cus-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
39 (require 'wid-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
40 (require 'easymenu)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
41 (eval-when-compile
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
42 (require 'cl)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
43 (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
44
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
45 (condition-case nil
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
46 (require 'cus-load)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
47 (error nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
48
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
49 (condition-case nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
50 (require 'cus-start)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
51 (error nil))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
52
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
53 (put 'custom-define-hook 'custom-type 'hook)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
54 (put 'custom-define-hook 'standard-value '(nil))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
55 (custom-add-to-group 'customize 'custom-define-hook 'custom-variable)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
56
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
57 ;;; Customization Groups.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
58
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
59 (defgroup emacs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
60 "Customization of the One True Editor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
61 :link '(custom-manual "(emacs)Top"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
62
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
63 ;; Most of these groups are stolen from `finder.el',
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
64 (defgroup editing nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
65 "Basic text editing facilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
66 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
67
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
68 (defgroup abbrev nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
69 "Abbreviation handling, typing shortcuts, macros."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
70 :tag "Abbreviations"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
71 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
72
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
73 (defgroup matching nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
74 "Various sorts of searching and matching."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
75 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
76
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
77 (defgroup emulations nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
78 "Emulations of other editors."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
79 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
80
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
81 (defgroup mouse nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
82 "Mouse support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
83 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
84
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
85 (defgroup outlines nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
86 "Support for hierarchical outlining."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
87 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
88
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
89 (defgroup external nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
90 "Interfacing to external utilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
91 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
92
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
93 (defgroup bib nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
94 "Code related to the `bib' bibliography processor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
95 :tag "Bibliography"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
96 :group 'external)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
97
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
98 (defgroup processes nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
99 "Process, subshell, compilation, and job control support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
100 :group 'external
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
101 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
102
22068
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
103 (defgroup convenience nil
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
104 "Convenience features for faster editing."
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
105 :group 'emacs)
82db88d21acd (convenience): New group.
Richard M. Stallman <rms@gnu.org>
parents: 22001
diff changeset
106
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
107 (defgroup programming nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
108 "Support for programming in other languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
109 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
110
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
111 (defgroup languages nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
112 "Specialized modes for editing programming languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
113 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
114
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
115 (defgroup lisp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
116 "Lisp support, including Emacs Lisp."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
117 :group 'languages
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
118 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
119
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
120 (defgroup c nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
121 "Support for the C language and related languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
122 :group 'languages)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
123
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
124 (defgroup tools nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
125 "Programming tools."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
126 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
127
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
128 (defgroup oop nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
129 "Support for object-oriented programming."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
130 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
131
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
132 (defgroup applications nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
133 "Applications written in Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
134 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
135
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
136 (defgroup calendar nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
137 "Calendar and time management support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
138 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
139
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
140 (defgroup mail nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
141 "Modes for electronic-mail handling."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
142 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
143
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
144 (defgroup news nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
145 "Support for netnews reading and posting."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
146 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
147
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
148 (defgroup games nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
149 "Games, jokes and amusements."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
150 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
151
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
152 (defgroup development nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
153 "Support for further development of Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
154 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
155
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
156 (defgroup docs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
157 "Support for Emacs documentation."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
158 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
159
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
160 (defgroup extensions nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
161 "Emacs Lisp language extensions."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
162 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
163
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
164 (defgroup internal nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
165 "Code for Emacs internals, build process, defaults."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
166 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
167
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
168 (defgroup maint nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
169 "Maintenance aids for the Emacs development group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
170 :tag "Maintenance"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
171 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
172
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
173 (defgroup environment nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
174 "Fitting Emacs with its environment."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
175 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
176
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
177 (defgroup comm nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
178 "Communications, networking, remote access to files."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
179 :tag "Communication"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
180 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
181
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
182 (defgroup hardware nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
183 "Support for interfacing with exotic hardware."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
184 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
185
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
186 (defgroup terminals nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
187 "Support for terminal types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
188 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
189
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
190 (defgroup unix nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
191 "Front-ends/assistants for, or emulators of, UNIX features."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
192 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
193
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
194 (defgroup vms nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
195 "Support code for vms."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
196 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
197
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
198 (defgroup i18n nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
199 "Internationalization and alternate character-set support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
200 :group 'environment
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
201 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
202
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
203 (defgroup x nil
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
204 "The X Window system."
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
205 :group 'environment)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
206
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
207 (defgroup frames nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
208 "Support for Emacs frames and window systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
209 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
210
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
211 (defgroup data nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
212 "Support editing files of data."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
213 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
214
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
215 (defgroup files nil
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
216 "Support editing files."
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
217 :group 'emacs)
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
218
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
219 (defgroup wp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
220 "Word processing."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
221 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
222
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
223 (defgroup tex nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
224 "Code related to the TeX formatter."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
225 :group 'wp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
226
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
227 (defgroup faces nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
228 "Support for multiple fonts."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
229 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
230
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
231 (defgroup hypermedia nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
232 "Support for links between text or other media types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
233 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
234
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
235 (defgroup help nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
236 "Support for on-line help systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
237 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
238
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
239 (defgroup multimedia nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
240 "Non-textual support, specifically images and sound."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
241 :group 'emacs)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
242
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
243 (defgroup local nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
244 "Code local to your site."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
245 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
246
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
247 (defgroup customize '((widgets custom-group))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
248 "Customization of the Customization support."
23357
856a82c440fa (Custom-mode-menu): Fix info node name.
Karl Heuer <kwzh@gnu.org>
parents: 23223
diff changeset
249 :link '(custom-manual "(elisp)Customization")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
250 :link '(url-link :tag "(Old?) Development Page"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
251 "http://www.dina.kvl.dk/~abraham/custom/")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
252 :prefix "custom-"
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
253 :group 'help)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
254
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
255 (defgroup custom-faces nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
256 "Faces used by customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
257 :group 'customize
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
258 :group 'faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
259
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
260 (defgroup custom-browse nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
261 "Control customize browser."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
262 :prefix "custom-"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
263 :group 'customize)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
264
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
265 (defgroup custom-buffer nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
266 "Control customize buffers."
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
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
270 (defgroup custom-menu nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
271 "Control customize menus."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
272 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
273 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
274
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
275 (defgroup abbrev-mode nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
276 "Word abbreviations mode."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
277 :group 'abbrev)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
278
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
279 (defgroup alloc nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
280 "Storage allocation and gc for GNU Emacs Lisp interpreter."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
281 :tag "Storage Allocation"
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
282 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
283
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
284 (defgroup undo nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
285 "Undoing changes in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
286 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
287
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
288 (defgroup modeline nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
289 "Content of the modeline."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
290 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
291
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
292 (defgroup fill nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
293 "Indenting and filling text."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
294 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
295
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
296 (defgroup editing-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
297 "Most basic editing facilities."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
298 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
299
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
300 (defgroup display nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
301 "How characters are displayed in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
302 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
303
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
304 (defgroup execute nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
305 "Executing external commands."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
306 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
307
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
308 (defgroup installation nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
309 "The Emacs installation."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
310 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
311
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
312 (defgroup dired nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
313 "Directory editing."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
314 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
315
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
316 (defgroup limits nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
317 "Internal Emacs limits."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
318 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
319
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
320 (defgroup debug nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
321 "Debugging Emacs itself."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
322 :group 'development)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
323
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
324 (defgroup minibuffer nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
325 "Controling the behaviour of the minibuffer."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
326 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
327
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
328 (defgroup keyboard nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
329 "Input from the keyboard."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
330 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
331
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
332 (defgroup mouse nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
333 "Input from the mouse."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
334 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
335
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
336 (defgroup menu nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
337 "Input from the menus."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
338 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
339
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
340 (defgroup auto-save nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
341 "Preventing accidential loss of data."
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
342 :group 'files)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
343
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
344 (defgroup processes-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
345 "Basic stuff dealing with processes."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
346 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
347
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
348 (defgroup mule nil
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
349 "MULE Emacs internationalization."
18053
941f5d1a241e (cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents: 18033
diff changeset
350 :group 'i18n)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
351
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
352 (defgroup windows nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
353 "Windows within a frame."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
354 :group 'environment)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
355
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
356 ;;; Utilities.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
357
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
358 (defun custom-quote (sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
359 "Quote SEXP iff it is not self quoting."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
360 (if (or (memq sexp '(t nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
361 (and (symbolp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
362 (eq (aref (symbol-name sexp) 0) ?:))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
363 (and (listp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
364 (memq (car sexp) '(lambda)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
365 (stringp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
366 (numberp sexp)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
367 (vectorp sexp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
368 ;;; (and (fboundp 'characterp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
369 ;;; (characterp sexp))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
370 )
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
371 sexp
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
372 (list 'quote sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
373
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
374 (defun custom-split-regexp-maybe (regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
375 "If REGEXP is a string, split it to a list at `\\|'.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
376 You can get the original back with from the result with:
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
377 (mapconcat 'identity result \"\\|\")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
378
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
379 IF REGEXP is not a string, return it unchanged."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
380 (if (stringp regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
381 (let ((start 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
382 all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
383 (while (string-match "\\\\|" regexp start)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
384 (setq all (cons (substring regexp start (match-beginning 0)) all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
385 start (match-end 0)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
386 (nreverse (cons (substring regexp start) all)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
387 regexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
388
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
389 (defun custom-variable-prompt ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
390 ;; Code stolen from `help.el'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
391 "Prompt for a variable, defaulting to the variable at point.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
392 Return a list suitable for use in `interactive'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
393 (let ((v (variable-at-point))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
394 (enable-recursive-minibuffers t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
395 val)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
396 (setq val (completing-read
18085
3da4eaba1fe8 (custom-variable-prompt): Handle variable-at-point returning 0.
Richard M. Stallman <rms@gnu.org>
parents: 18067
diff changeset
397 (if (symbolp v)
18131
5711f2e5a643 (custom-variable-prompt): Change prompt.
Richard M. Stallman <rms@gnu.org>
parents: 18090
diff changeset
398 (format "Customize option: (default %s) " v)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
399 "Customize variable: ")
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
400 obarray (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
401 (and (boundp symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
402 (or (get symbol 'custom-type)
24509
3cb266497eb3 (custom-variable-prompt): Allow customization of
Karl Heuer <kwzh@gnu.org>
parents: 24030
diff changeset
403 (get symbol 'custom-loads)
20397
a7bab1d0c5e3 (custom-variable-prompt): Ensure valid variable name
Karl Heuer <kwzh@gnu.org>
parents: 20262
diff changeset
404 (user-variable-p symbol)))) t))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
405 (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
406 (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
407 (intern val)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
408
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
409 (defun custom-menu-filter (menu widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
410 "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
411 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
412 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
413 (let ((result nil)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
414 current name action filter)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
415 (while menu
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
416 (setq current (car menu)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
417 name (nth 0 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
418 action (nth 1 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
419 filter (nth 2 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
420 menu (cdr menu))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
421 (if (or (null filter) (funcall filter widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
422 (push (cons name action) result)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
423 (push name result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
424 (nreverse result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
425
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
426 ;;; Unlispify.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
427
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
428 (defvar custom-prefix-list nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
429 "List of prefixes that should be ignored by `custom-unlispify'")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
430
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
431 (defcustom custom-unlispify-menu-entries t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
432 "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
433 :group 'custom-menu
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
434 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
435
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
436 (defcustom custom-unlispify-remove-prefixes nil
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
437 "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
438 :group 'custom-menu
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
439 :type 'boolean)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
440
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
441 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
442 "Convert symbol into a menu entry."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
443 (cond ((not custom-unlispify-menu-entries)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
444 (symbol-name symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
445 ((get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
446 (if no-suffix
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
447 (get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
448 (concat (get symbol 'custom-tag) "...")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
449 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
450 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
451 (set-buffer (get-buffer-create " *Custom-Work*"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
452 (erase-buffer)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
453 (princ symbol (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
454 (goto-char (point-min))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
455 (when (and (eq (get symbol 'custom-type) 'boolean)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
456 (re-search-forward "-p\\'" nil t))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
457 (replace-match "" t t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
458 (goto-char (point-min)))
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
459 (if custom-unlispify-remove-prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
460 (let ((prefixes custom-prefix-list)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
461 prefix)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
462 (while prefixes
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
463 (setq prefix (car prefixes))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
464 (if (search-forward prefix (+ (point) (length prefix)) t)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
465 (progn
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
466 (setq prefixes nil)
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
467 (delete-region (point-min) (point)))
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
468 (setq prefixes (cdr prefixes))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
469 (subst-char-in-region (point-min) (point-max) ?- ?\ t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
470 (capitalize-region (point-min) (point-max))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
471 (unless no-suffix
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
472 (goto-char (point-max))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
473 (insert "..."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
474 (buffer-string)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
475
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
476 (defcustom custom-unlispify-tag-names t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
477 "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
478 :group 'custom-buffer
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
479 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
480
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
481 (defun custom-unlispify-tag-name (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
482 "Convert symbol into a menu entry."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
483 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
484 (custom-unlispify-menu-entry symbol t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
485
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
486 (defun custom-prefix-add (symbol prefixes)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
487 ;; Addd SYMBOL to list of ignored PREFIXES.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
488 (cons (or (get symbol 'custom-prefix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
489 (concat (symbol-name symbol) "-"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
490 prefixes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
491
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
492 ;;; Guess.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
493
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
494 (defcustom custom-guess-name-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
495 '(("-p\\'" boolean)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
496 ("-hook\\'" hook)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
497 ("-face\\'" face)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
498 ("-file\\'" file)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
499 ("-function\\'" function)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
500 ("-functions\\'" (repeat function))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
501 ("-list\\'" (repeat sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
502 ("-alist\\'" (repeat (cons sexp sexp))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
503 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
504
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
505 MATCH should be a regexp matching the name of a symbol, and TYPE should
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
506 be a widget suitable for editing the value of that symbol. The TYPE
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
507 of the first entry where MATCH matches the name of the symbol will be
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
508 used.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
509
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
510 This is used for guessing the type of variables not declared with
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
511 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
512 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
513 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
514
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
515 (defcustom custom-guess-doc-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
516 '(("\\`\\*?Non-nil " boolean))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
517 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
518
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
519 MATCH should be a regexp matching a documentation string, and TYPE
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
520 should be a widget suitable for editing the value of a variable with
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
521 that documentation string. The TYPE of the first entry where MATCH
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
522 matches the name of the symbol will be used.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
523
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
524 This is used for guessing the type of variables not declared with
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
525 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
526 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
527 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
528
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
529 (defun custom-guess-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
530 "Guess a widget suitable for editing the value of SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
531 This is done by matching SYMBOL with `custom-guess-name-alist' and
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
532 if that fails, the doc string with `custom-guess-doc-alist'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
533 (let ((name (symbol-name symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
534 (names custom-guess-name-alist)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
535 current found)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
536 (while names
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
537 (setq current (car names)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
538 names (cdr names))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
539 (when (string-match (nth 0 current) name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
540 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
541 names nil)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
542 (unless found
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
543 (let ((doc (documentation-property symbol 'variable-documentation))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
544 (docs custom-guess-doc-alist))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
545 (when doc
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
546 (while docs
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
547 (setq current (car docs)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
548 docs (cdr docs))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
549 (when (string-match (nth 0 current) doc)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
550 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
551 docs nil))))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
552 found))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
553
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
554 ;;; Sorting.
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
555
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
556 (defcustom custom-browse-sort-alphabetically nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
557 "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
558 :type 'boolean
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
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
561 (defcustom custom-browse-order-groups nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
562 "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
563 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
564 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
565 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
566 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
567 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
568 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
569
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
570 (defcustom custom-browse-only-groups nil
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
571 "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
572 :type 'boolean
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
573 :group 'custom-browse)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
574
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
575 (defcustom custom-buffer-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
576 "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
577 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
578 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
579
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
580 (defcustom custom-buffer-order-groups 'last
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
581 "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
582 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
583 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
584 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
585 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
586 (const :tag "none" nil))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
587 :group 'custom-buffer)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
588
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
589 (defcustom custom-menu-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
590 "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
591 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
592 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
593
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
594 (defcustom custom-menu-order-groups 'first
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
595 "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
596 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
597 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
598 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
599 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
600 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
601 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
602
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
603 ;;;###autoload (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
604
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
605 (defun custom-sort-items (items sort-alphabetically order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
606 "Return a sorted copy of ITEMS.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
607 ITEMS should be a `custom-group' property.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
608 If SORT-ALPHABETICALLY non-nil, sort alphabetically.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
609 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
610 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
611 (sort (copy-sequence items)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
612 (lambda (a b)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
613 (let ((typea (nth 1 a)) (typeb (nth 1 b))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
614 (namea (symbol-name (nth 0 a))) (nameb (symbol-name (nth 0 b))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
615 (cond ((not order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
616 ;; 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
617 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
618 (string-lessp namea nameb)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
619 ((eq typea 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
620 ;; 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
621 (if (eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
622 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
623 (string-lessp namea nameb))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
624 (eq order-groups 'first)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
625 ((eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
626 ;; 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
627 (eq order-groups 'last))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
628 (sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
629 ;; Since A and B cannot be groups, sort.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
630 (string-lessp namea nameb)))))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
631
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
632 ;;; Custom Mode Commands.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
633
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
634 (defvar custom-options nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
635 "Customization widgets in the current buffer.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
636
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
637 (defun Custom-set ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
638 "Set changes in all modified options."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
639 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
640 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
641 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
642 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
643 (widget-apply child :custom-set)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
644 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
645
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
646 (defun Custom-save ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
647 "Set all modified group members and save them."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
648 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
649 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
650 (mapcar (lambda (child)
23223
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
651 (when (memq (widget-get child :custom-state)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
652 '(modified set changed rogue))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
653 (widget-apply child :custom-save)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
654 children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
655 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
656
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
657 (defvar custom-reset-menu
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
658 '(("Current" . Custom-reset-current)
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
659 ("Saved" . Custom-reset-saved)
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
660 ("Standard Settings" . Custom-reset-standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
661 "Alist of actions for the `Reset' button.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
662 The key is a string containing the name of the action, the value is a
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
663 lisp function taking the widget as an element which will be called
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
664 when the action is chosen.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
665
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
666 (defun custom-reset (event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
667 "Select item from reset menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
668 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
669 (answer (widget-choose "Reset to"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
670 custom-reset-menu
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
671 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
672 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
673 (funcall answer))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
674
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
675 (defun Custom-reset-current (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
676 "Reset all modified group members to their current value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
677 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
678 (let ((children custom-options))
23223
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
679 (mapcar (lambda (widget)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
680 (and (default-boundp (widget-value widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
681 (if (memq (widget-get widget :custom-state)
23223
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
682 '(modified changed))
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
683 (widget-apply widget :custom-reset-current))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
684 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
685
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
686 (defun Custom-reset-saved (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
687 "Reset all modified or set group members to their saved value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
688 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
689 (let ((children custom-options))
23223
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
690 (mapcar (lambda (widget)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
691 (and (get (widget-value widget) 'saved-value)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
692 (if (memq (widget-get widget :custom-state)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
693 '(modified set changed rogue))
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
694 (widget-apply widget :custom-reset-saved))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
695 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
696
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
697 (defun Custom-reset-standard (&rest ignore)
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
698 "Reset all modified, set, or saved group members to their standard settings."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
699 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
700 (let ((children custom-options))
23223
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
701 (mapcar (lambda (widget)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
702 (and (get (widget-value widget) 'standard-value)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
703 (if (memq (widget-get widget :custom-state)
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
704 '(modified set changed saved rogue))
da40016c8767 (Custom-save, Custom-reset-current, Custom-reset-saved)
Karl Heuer <kwzh@gnu.org>
parents: 23190
diff changeset
705 (widget-apply widget :custom-reset-standard))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
706 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
707
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
708 ;;; The Customize Commands
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
709
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
710 (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
711 "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
712 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
713 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
714 the name of the variable.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
715
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
716 If the variable has a `variable-interactive' property, that is used as if
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
717 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
718
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
719 If the variable has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
720 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
721
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
722 If optional COMMENT argument is non nil, also prompt for a comment and return
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
723 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
724 (let* ((var (read-variable prompt-var))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
725 (minibuffer-help-form '(describe-variable var))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
726 (val
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
727 (let ((prop (get var 'variable-interactive))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
728 (type (get var 'custom-type))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
729 (prompt (format prompt-val var)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
730 (unless (listp type)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
731 (setq type (list type)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
732 (cond (prop
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
733 ;; Use VAR's `variable-interactive' property
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
734 ;; as an interactive spec for prompting.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
735 (call-interactively (list 'lambda '(arg)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
736 (list 'interactive prop)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
737 'arg)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
738 (type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
739 (widget-prompt-value type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
740 prompt
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
741 (if (boundp var)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
742 (symbol-value var))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
743 (not (boundp var))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
744 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
745 (eval-minibuffer prompt))))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
746 (if comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
747 (list var val
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
748 (read-string "Comment: " (get var 'variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
749 (list var val))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
750
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
751 ;;;###autoload
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
752 (defun customize-set-value (var val &optional comment)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
753 "Set VARIABLE to VALUE. VALUE is a Lisp object.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
754
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
755 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
756 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
757
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
758 If VARIABLE has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
759 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
760
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
761 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
762 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
763 "Set %s to value: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
764 current-prefix-arg))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
765
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
766 (set var val)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
767 (cond ((string= comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
768 (put var 'variable-comment nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
769 (comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
770 (put var 'variable-comment comment))))
17550
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 ;;;###autoload
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
773 (defun customize-set-variable (var val &optional comment)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
774 "Set the default for VARIABLE to VALUE. VALUE is a Lisp object.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
775
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
776 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
777 VARIABLE, otherwise `set-default' is used.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
778
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
779 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
780 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
781
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
782 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
783 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
784
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
785 If VARIABLE has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
786 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
787
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
788 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
789 (interactive (custom-prompt-variable "Set variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
790 "Set customized value for %s to: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
791 current-prefix-arg))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
792 (funcall (or (get var 'custom-set) 'set-default) var val)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
793 (put var 'customized-value (list (custom-quote val)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
794 (cond ((string= comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
795 (put var 'variable-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
796 (put var 'customized-variable-comment nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
797 (comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
798 (put var 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
799 (put var 'customized-variable-comment comment))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
800
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
801 ;;;###autoload
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
802 (defun customize-save-variable (var val &optional comment)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
803 "Set the default for VARIABLE to VALUE, and save it for future sessions.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
804 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
805 VARIABLE, otherwise `set-default' is used.
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 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
808 with a quoted VALUE as its sole list member.
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 `variable-interactive' property, that is used as if
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
811 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
812
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
813 If VARIABLE has a `custom-type' property, it must be a widget and the
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
814 `:prompt-value' property of that widget will be used for reading the value.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
815
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
816 If given a prefix (or a COMMENT argument), also prompt for a comment."
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
817 (interactive (custom-prompt-variable "Set and ave variable: "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
818 "Set and save value for %s as: "
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
819 current-prefix-arg))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
820 (funcall (or (get var 'custom-set) 'set-default) var val)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
821 (put var 'saved-value (list (custom-quote val)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
822 (cond ((string= comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
823 (put var 'variable-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
824 (put var 'saved-variable-comment nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
825 (comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
826 (put var 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
827 (put var 'saved-variable-comment comment)))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
828 (custom-save-all))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
829
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
830 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
831 (defun customize ()
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
832 "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
833 User options are structured into \"groups\".
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
834 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
835 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
836 (interactive)
17703
cd6ad557fb57 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17702
diff changeset
837 (customize-group 'emacs))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
838
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
839 ;;;###autoload
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
840 (defun customize-group (group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
841 "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
842 (interactive (list (let ((completion-ignore-case t))
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
843 (completing-read "Customize group: (default emacs) "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
844 obarray
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
845 (lambda (symbol)
19886
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
846 (or (get symbol 'custom-loads)
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
847 (get symbol 'custom-group)))
18352
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
848 t))))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
849 (when (stringp group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
850 (if (string-equal "" group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
851 (setq group 'emacs)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
852 (setq group (intern group))))
19886
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
853 (or (get group 'custom-group)
539d06d1f0da (customize-group): Handle groups not yet loaded.
Richard M. Stallman <rms@gnu.org>
parents: 19883
diff changeset
854 (custom-load-symbol group))
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
855 (let ((name (format "*Customize Group: %s*"
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
856 (custom-unlispify-tag-name group))))
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
857 (if (get-buffer name)
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
858 (pop-to-buffer name)
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
859 (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
860 name
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
861 (concat " for group "
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
862 (custom-unlispify-tag-name group))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
863
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
864 ;;;###autoload
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
865 (defun customize-group-other-window (group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
866 "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
867 (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
868 (completing-read "Customize group: (default emacs) "
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
869 obarray
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
870 (lambda (symbol)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
871 (or (get symbol 'custom-loads)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
872 (get symbol 'custom-group)))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
873 t))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
874 (when (stringp group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
875 (if (string-equal "" group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
876 (setq group 'emacs)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
877 (setq group (intern group))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
878 (or (get group 'custom-group)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
879 (custom-load-symbol group))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
880 (let ((name (format "*Customize Group: %s*"
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
881 (custom-unlispify-tag-name group))))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
882 (if (get-buffer name)
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
883 (let ((window (selected-window)))
22348
86cb09249796 (customize-group-other-window): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 22332
diff changeset
884 (pop-to-buffer name)
22001
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
885 (select-window window))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
886 (custom-buffer-create-other-window
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
887 (list (list group 'custom-group))
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
888 name
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
889 (concat " for group "
e35aafba190f (customize-group-other-window): Handle groups not
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
890 (custom-unlispify-tag-name group))))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
891
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
892 ;;;###autoload
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
893 (defalias 'customize-variable 'customize-option)
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
894
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
895 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
896 (defun customize-option (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
897 "Customize SYMBOL, which must be a user option variable."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
898 (interactive (custom-variable-prompt))
23190
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
899 ;; If we don't have SYMBOL's real definition loaded,
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
900 ;; try to load it.
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
901 (unless (get symbol 'custom-type)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
902 (let ((loaddefs-file (locate-library "loaddefs.el" t))
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
903 file)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
904 ;; See if it is autoloaded from some library.
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
905 (when loaddefs-file
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
906 (with-temp-buffer
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
907 (insert-file-contents loaddefs-file)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
908 (when (re-search-forward (concat "^(defvar " (symbol-name symbol))
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
909 nil t)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
910 (search-backward "\n;;; Generated autoloads from ")
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
911 (goto-char (match-end 0))
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
912 (setq file (buffer-substring (point)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
913 (progn (end-of-line) (point)))))))
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
914 ;; If it is, load that library.
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
915 (when file
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
916 (when (string-match "\\.el\\'" file)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
917 (setq file (substring file 0 (match-beginning 0))))
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
918 (load file))))
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
919 (unless (get symbol 'custom-type)
0fe0fe296153 (customize-option): Refuse to customize
Karl Heuer <kwzh@gnu.org>
parents: 23105
diff changeset
920 (error "Variable %s cannot be customized" symbol))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
921 (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
922 (format "*Customize Option: %s*"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
923 (custom-unlispify-tag-name symbol))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
924
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
925 (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
926 "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
927
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
928 ;;;###autoload
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
929 (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
930 "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
931 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
932 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
933 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
934
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
935 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
936 variables that were added (or their meanings were changed) since that
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
937 version."
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
938
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
939 (interactive "sCustomize options changed, since version (default all versions): ")
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
940 (if (equal since-version "")
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
941 (setq since-version nil))
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
942 (unless since-version
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
943 (setq since-version customize-changed-options-previous-release))
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
944 (let ((found nil)
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
945 (versions nil))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
946 (mapatoms (lambda (symbol)
21649
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
947 (and (or (boundp symbol)
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
948 ;; For variables not yet loaded.
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
949 (get symbol 'standard-value)
21649
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
950 ;; For groups the previous test fails, this one
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
951 ;; could be used to determine if symbol is a
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
952 ;; group. Is there a better way for this?
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
953 (get symbol 'group-documentation))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
954 (let ((version (get symbol 'custom-version)))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
955 (and version
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
956 (or (null since-version)
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
957 (customize-version-lessp since-version version))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
958 (if (member version versions)
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
959 t
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
960 ;;; Collect all versions that we use.
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
961 (push version versions))))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
962 (setq found
21649
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
963 ;; We have to set the right thing here,
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
964 ;; depending if we have a group or a
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
965 ;; variable.
21649
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
966 (if (get symbol 'group-documentation)
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
967 (cons (list symbol 'custom-group) found)
840699d18eab *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 20974
diff changeset
968 (cons (list symbol 'custom-variable) found))))))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
969 (if (not found)
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
970 (error "No user option defaults have been changed since Emacs %s"
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
971 since-version)
22667
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
972 (let ((flist nil))
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
973 (while versions
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
974 (push (copy-sequence
22667
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
975 (cdr (assoc (car versions) custom-versions-load-alist)))
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
976 flist)
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
977 (setq versions (cdr versions)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
978 (put 'custom-versions-load-alist 'custom-loads
22667
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
979 ;; Get all the files that correspond to element from the
8e8001567771 (customize-changed-options): Clean up previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22600
diff changeset
980 ;; VERSIONS list. This could use some simplification.
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
981 (apply 'nconc flist)))
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
982 ;; Because we set all the files needed to be loaded as a
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
983 ;; `custom-loads' property to `custom-versions-load-alist' this
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
984 ;; call will actually load them.
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
985 (custom-load-symbol 'custom-versions-load-alist)
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
986 ;; Clean up
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
987 (put 'custom-versions-load-alist 'custom-loads nil)
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
988 (custom-buffer-create (custom-sort-items found t 'first)
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
989 "*Customize Changed Options*"))))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
990
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
991 (defun customize-version-lessp (version1 version2)
23105
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
992 ;; 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
993 ;; in the :version value.
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
994 (if (numberp version2)
a47a69af14c8 (customize-version-lessp): Handle a number as VERSION2.
Karl Heuer <kwzh@gnu.org>
parents: 22667
diff changeset
995 (setq version2 (prin1-to-string version2)))
20444
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
996 (let (major1 major2 minor1 minor2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
997 (string-match "\\([0-9]+\\)[.]\\([0-9]+\\)" version1)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
998 (setq major1 (read (match-string 1 version1)))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
999 (setq minor1 (read (match-string 2 version1)))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1000 (string-match "\\([0-9]+\\)[.]\\([0-9]+\\)" version2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1001 (setq major2 (read (match-string 1 version2)))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1002 (setq minor2 (read (match-string 2 version2)))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1003 (or (< major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1004 (and (= major1 major2)
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1005 (< minor1 minor2)))))
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1006
a9fbb6791eb7 (customize-changed-options): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20411
diff changeset
1007 ;;;###autoload
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1008 (defalias 'customize-variable-other-window 'customize-option-other-window)
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1009
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1010 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1011 (defun customize-option-other-window (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1012 "Customize SYMBOL, which must be a user option variable.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1013 Show the buffer in another window, but don't select it."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1014 (interactive (custom-variable-prompt))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1015 (custom-buffer-create-other-window
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1016 (list (list symbol 'custom-variable))
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1017 (format "*Customize Option: %s*" (custom-unlispify-tag-name symbol))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1018
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1019 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1020 (defun customize-face (&optional symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1021 "Customize SYMBOL, which should be a face name or nil.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1022 If SYMBOL is nil, customize all faces."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1023 (interactive (list (completing-read "Customize face: (default all) "
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1024 obarray 'custom-facep)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1025 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1026 (custom-buffer-create (custom-sort-items
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1027 (mapcar (lambda (symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1028 (list symbol 'custom-face))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1029 (face-list))
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*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1032 (when (stringp symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1033 (setq symbol (intern symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1034 (unless (symbolp symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1035 (error "Should be a symbol %S" symbol))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1036 (custom-buffer-create (list (list symbol 'custom-face))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1037 (format "*Customize Face: %s*"
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1038 (custom-unlispify-tag-name symbol)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1039
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1040 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1041 (defun customize-face-other-window (&optional symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1042 "Show customization buffer for FACE in other window."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1043 (interactive (list (completing-read "Customize face: "
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1044 obarray 'custom-facep)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1045 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1046 ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1047 (if (stringp symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1048 (setq symbol (intern symbol)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1049 (unless (symbolp symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1050 (error "Should be a symbol %S" symbol))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1051 (custom-buffer-create-other-window
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1052 (list (list symbol 'custom-face))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1053 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1054
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1055 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1056 (defun customize-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1057 "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
1058 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1059 (let ((found nil))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1060 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1061 (and (or (get symbol 'customized-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1062 (get symbol 'customized-face-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1063 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1064 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1065 (and (or (get symbol 'customized-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1066 (get symbol 'customized-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1067 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1068 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1069 (if (not found)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1070 (error "No customized user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1071 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1072 "*Customize Customized*"))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1073
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1074 ;;;###autoload
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1075 (defun customize-saved ()
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1076 "Customize all already saved user options."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1077 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1078 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1079 (mapatoms (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1080 (and (or (get symbol 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1081 (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1082 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1083 (push (list symbol 'custom-face) found))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1084 (and (or (get symbol 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1085 (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1086 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1087 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1088 (if (not found )
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1089 (error "No saved user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1090 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1091 "*Customize Saved*"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1092
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1093 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1094 (defun customize-apropos (regexp &optional all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1095 "Customize all user options matching REGEXP.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1096 If ALL is `options', include only options.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1097 If ALL is `faces', include only faces.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1098 If ALL is `groups', include only groups.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1099 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
1100 user-settable, as well as faces and groups."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1101 (interactive "sCustomize regexp: \nP")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1102 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1103 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1104 (when (string-match regexp (symbol-name symbol))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1105 (when (and (not (memq all '(faces options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1106 (get symbol 'custom-group))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1107 (push (list symbol 'custom-group) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1108 (when (and (not (memq all '(options groups)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1109 (custom-facep symbol))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1110 (push (list symbol 'custom-face) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1111 (when (and (not (memq all '(groups faces)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1112 (boundp symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1113 (or (get symbol 'saved-value)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1114 (get symbol 'standard-value)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1115 (if (memq all '(nil options))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1116 (user-variable-p symbol)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1117 (get symbol 'variable-documentation))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1118 (push (list symbol 'custom-variable) found)))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1119 (if (not found)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1120 (error "No matches")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1121 (custom-buffer-create (custom-sort-items found t
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1122 custom-buffer-order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1123 "*Customize Apropos*"))))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1124
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1125 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1126 (defun customize-apropos-options (regexp &optional arg)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1127 "Customize all user options matching REGEXP.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1128 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
1129 (interactive "sCustomize regexp: \nP")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1130 (customize-apropos regexp (or arg 'options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1131
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1132 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1133 (defun customize-apropos-faces (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1134 "Customize all user faces matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1135 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1136 (customize-apropos regexp 'faces))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1137
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1138 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1139 (defun customize-apropos-groups (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1140 "Customize all user groups matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1141 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
1142 (customize-apropos regexp 'groups))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1143
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1144 ;;; Buffer.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1145
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1146 (defcustom custom-buffer-style 'links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1147 "Control the presentation style for customization buffers.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1148 The value should be a symbol, one of:
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1149
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1150 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
1151 links: groups have links to subgroups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1152 :type '(radio (const brackets)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1153 (const links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1154 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1155
25840
6beb132dd31c (custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents: 25824
diff changeset
1156 (defun custom-bury-buffer (buffer)
6beb132dd31c (custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents: 25824
diff changeset
1157 (bury-buffer))
6beb132dd31c (custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents: 25824
diff changeset
1158
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1159 (defcustom custom-buffer-done-function 'bury-buffer
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1160 "*Function called to remove a Custom buffer when the user is done with it.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1161 Called with one argument, the buffer to remove."
25840
6beb132dd31c (custom-bury-buffer): New function.
Dave Love <fx@gnu.org>
parents: 25824
diff changeset
1162 :type '(choice (function-item custom-bury-buffer)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1163 (function-item kill-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1164 (function :tag "Other"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1165 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1166 :group 'custom-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1167
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1168 (defcustom custom-buffer-indent 3
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1169 "Number of spaces to indent nested groups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1170 :type 'integer
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1171 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1172
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1173 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1174 (defun custom-buffer-create (options &optional name description)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1175 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1176 Optional NAME is the name of the buffer.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1177 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1178 SYMBOL is a customization option, and WIDGET is a widget for editing
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1179 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1180 (unless name (setq name "*Customization*"))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1181 (kill-buffer (get-buffer-create name))
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1182 (pop-to-buffer (get-buffer-create name))
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1183 (custom-buffer-create-internal options description))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1184
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1185 ;;;###autoload
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1186 (defun custom-buffer-create-other-window (options &optional name description)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1187 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1188 Optional NAME is the name of the buffer.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1189 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1190 SYMBOL is a customization option, and WIDGET is a widget for editing
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1191 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1192 (unless name (setq name "*Customization*"))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1193 (kill-buffer (get-buffer-create name))
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1194 (let ((window (selected-window))
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1195 (pop-up-windows t)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1196 (special-display-buffer-names nil)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1197 (special-display-regexps nil)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1198 (same-window-buffer-names nil)
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1199 (same-window-regexps nil))
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1200 (pop-to-buffer (get-buffer-create name))
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1201 (custom-buffer-create-internal options description)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1202 (select-window window)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1203
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1204 (defcustom custom-reset-button-menu nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1205 "If non-nil, only show a single reset button in customize buffers.
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1206 This button will have a menu with all three reset operations."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1207 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1208 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1209
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1210 (defun Custom-buffer-done (&rest ignore)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1211 "Remove current buffer by calling `custom-buffer-done-function'."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1212 (interactive)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1213 (funcall custom-buffer-done-function (current-buffer)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1214
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1215 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1216 '(("unspecified" . unspecified))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1217 "If non-nil, indicate active buttons in a `raised-button' style.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1218 Otherwise use brackets."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1219 :type 'boolean
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1220 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1221 :group 'custom-buffer)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1222
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1223 (defun custom-buffer-create-internal (options &optional description)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1224 (message "Creating customization buffer...")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1225 (custom-mode)
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1226 (widget-insert "This is a customization buffer")
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1227 (if description
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
1228 (widget-insert description))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1229 (widget-insert (format ".
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1230 %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
1231 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
1232 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
1233 choose the Set operation to set the option value.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1234 Invoke " (if custom-raised-buttons
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1235 "`Raised' buttons"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1236 "Square brackets")))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1237 (widget-create 'info-link
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1238 :tag "Help"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1239 :help-echo "Read the online help."
18032
fd3f0a7e79b9 (custom-face-display-set): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents: 17800
diff changeset
1240 "(emacs)Easy Customization")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1241 (widget-insert " for more information.\n\n")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1242 (message "Creating customization buttons...")
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1243 (widget-insert "Operate on everything in this buffer:\n ")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1244 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1245 :tag "Set for Current Session"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1246 :help-echo "\
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1247 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
1248 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1249 (Custom-set)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1250 (widget-insert " ")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1251 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1252 :tag "Save for Future Sessions"
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1253 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1254 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
1255 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1256 (Custom-save)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1257 (if custom-reset-button-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1258 (progn
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1259 (widget-insert " ")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1260 (widget-create 'push-button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1261 :tag "Reset"
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1262 :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
1263 :mouse-down-action (lambda (&rest junk) t)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1264 :action (lambda (widget &optional event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1265 (custom-reset event))))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1266 (widget-insert "\n ")
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1267 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1268 :tag "Reset"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1269 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1270 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
1271 :action 'Custom-reset-current)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1272 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1273 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1274 :tag "Reset to Saved"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1275 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1276 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
1277 :action 'Custom-reset-saved)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1278 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1279 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1280 :tag "Reset to Standard"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1281 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1282 Reset all values in this buffer to their standard settings."
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1283 :action 'Custom-reset-standard))
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1284 (widget-insert " ")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1285 (widget-create 'push-button
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1286 :tag "Finish"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1287 :help-echo "Bury or kill the buffer."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1288 :action #'Custom-buffer-done)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1289 (widget-insert "\n\n")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1290 (message "Creating customization items...")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1291 (setq custom-options
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1292 (if (= (length options) 1)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1293 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1294 (widget-create (nth 1 entry)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1295 :documentation-shown t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1296 :custom-state 'unknown
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1297 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1298 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1299 :value (nth 0 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1300 options)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1301 (let ((count 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1302 (length (length options)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1303 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1304 (prog2
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
1305 (message "Creating customization items ...%2d%%"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1306 (/ (* 100.0 count) length))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1307 (widget-create (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1308 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1309 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1310 :value (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1311 (setq count (1+ count))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1312 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1313 (widget-insert "\n"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1314 (widget-insert "\n")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1315 options))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1316 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1317 (widget-insert "\n"))
22538
2649d061d370 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 22348
diff changeset
1318 (message "Creating customization items ...%2d%%done" 100)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1319 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1320 (mapcar 'custom-magic-reset custom-options))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1321 (message "Creating customization setup...")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1322 (widget-setup)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1323 (goto-char (point-min))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1324 (message "Creating customization buffer...done"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1325
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1326 ;;; The Tree Browser.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1327
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1328 ;;;###autoload
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1329 (defun customize-browse (&optional group)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1330 "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
1331 (interactive)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1332 (unless group
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1333 (setq group 'emacs))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1334 (let ((name "*Customize Browser*"))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1335 (kill-buffer (get-buffer-create name))
22332
7ad747c6c5a9 (customize-group, customize-group-other-window)
Karl Heuer <kwzh@gnu.org>
parents: 22068
diff changeset
1336 (pop-to-buffer (get-buffer-create name)))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1337 (custom-mode)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1338 (widget-insert "\
18812
82c80b23fa9d (custom-unlispify-remove-prefixes): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18669
diff changeset
1339 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
1340 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
1341 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
1342 (if custom-browse-only-groups
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1343 (widget-insert "\
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1344 Invoke the [Group] button below to edit that item in another window.\n\n")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1345 (widget-insert "Invoke the ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1346 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1347 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1348 :tag "[Group]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1349 :tag-glyph "folder")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1350 (widget-insert ", ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1351 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1352 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1353 :tag "[Face]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1354 :tag-glyph "face")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1355 (widget-insert ", and ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1356 (widget-create 'item
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1357 :format "%t"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1358 :tag "[Option]"
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1359 :tag-glyph "option")
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1360 (widget-insert " buttons below to edit that
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1361 item in another window.\n\n"))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1362 (let ((custom-buffer-style 'tree))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1363 (widget-create 'custom-group
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1364 :custom-last t
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1365 :custom-state 'unknown
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1366 :tag (custom-unlispify-tag-name group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1367 :value group))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
1368 (goto-char (point-min)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1369
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1370 (define-widget 'custom-browse-visibility 'item
20600
323f33e3e92c (custom-browse-visibility): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 20562
diff changeset
1371 "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
1372 :format "%[[%t]%]"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1373 :action 'custom-browse-visibility-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1374
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1375 (defun custom-browse-visibility-action (widget &rest ignore)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1376 (let ((custom-buffer-style 'tree))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1377 (custom-toggle-parent widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1378
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1379 (define-widget 'custom-browse-group-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1380 "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
1381 :tag "Group"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1382 :tag-glyph "folder"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1383 :action 'custom-browse-group-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1384
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1385 (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
1386 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1387 (customize-group-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1388
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1389 (define-widget 'custom-browse-variable-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1390 "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
1391 :tag "Option"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1392 :tag-glyph "option"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1393 :action 'custom-browse-variable-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1394
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1395 (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
1396 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1397 (customize-variable-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1398
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1399 (define-widget 'custom-browse-face-tag 'push-button
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1400 "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
1401 :tag "Face"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1402 :tag-glyph "face"
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1403 :action 'custom-browse-face-tag-action)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1404
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1405 (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
1406 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1407 (customize-face-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1408
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1409 (defconst custom-browse-alist '((" " "space")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1410 (" | " "vertical")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1411 ("-\\ " "top")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1412 (" |-" "middle")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1413 (" `-" "bottom")))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1414
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1415 (defun custom-browse-insert-prefix (prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1416 "Insert PREFIX. On XEmacs convert it to line graphics."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1417 ;; Fixme: do graphics.
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1418 (if nil ; (string-match "XEmacs" emacs-version)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1419 (progn
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1420 (insert "*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1421 (while (not (string-equal prefix ""))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1422 (let ((entry (substring prefix 0 3)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1423 (setq prefix (substring prefix 3))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1424 (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
1425 (name (nth 1 (assoc entry custom-browse-alist))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1426 (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
1427 (overlay-put overlay 'start-open t)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1428 (overlay-put overlay 'end-open t)))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1429 (insert prefix)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1430
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1431 ;;; Modification of Basic Widgets.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1432 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1433 ;; We add extra properties to the basic widgets needed here. This is
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1434 ;; fine, as long as we are careful to stay within out own namespace.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1435 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1436 ;; We want simple widgets to be displayed by default, but complex
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1437 ;; widgets to be hidden.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1438
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1439 (widget-put (get 'item 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1440 (widget-put (get 'editable-field 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1441 :custom-show (lambda (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1442 (let ((pp (pp-to-string value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1443 (cond ((string-match "\n" pp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1444 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1445 ((> (length pp) 40)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1446 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1447 (t t)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1448 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1449
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1450 ;;; The `custom-manual' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1451
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1452 (define-widget 'custom-manual 'info-link
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1453 "Link to the manual entry for this customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1454 :help-echo "Read the manual entry for this option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1455 :tag "Manual")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1456
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1457 ;;; The `custom-magic' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1458
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1459 (defgroup custom-magic-faces nil
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1460 "Faces used by the magic button."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1461 :group 'custom-faces
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1462 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1463
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1464 (defface custom-invalid-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1465 (:foreground "yellow" :background "red"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1466 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1467 (:bold t :italic t :underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1468 "Face used when the customize item is invalid."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1469 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1470
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1471 (defface custom-rogue-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1472 (:foreground "pink" :background "black"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1473 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1474 (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1475 "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
1476 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1477
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1478 (defface custom-modified-face '((((class color))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1479 (:foreground "white" :background "blue"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1480 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1481 (:italic t :bold)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1482 "Face used when the customize item has been modified."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1483 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1484
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1485 (defface custom-set-face '((((class color))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1486 (:foreground "blue" :background "white"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1487 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1488 (:italic t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1489 "Face used when the customize item has been set."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1490 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1491
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1492 (defface custom-changed-face '((((class color))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1493 (:foreground "white" :background "blue"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1494 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1495 (:italic t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1496 "Face used when the customize item has been changed."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1497 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1498
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1499 (defface custom-saved-face '((t (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1500 "Face used when the customize item has been saved."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1501 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1502
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1503 (defconst custom-magic-alist '((nil "#" underline "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1504 uninitialized, you should not see this.")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1505 (unknown "?" italic "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1506 unknown, you should not see this.")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1507 (hidden "-" default "\
18362
4655515f51cc (custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents: 18360
diff changeset
1508 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
1509 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
1510 (invalid "x" custom-invalid-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1511 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
1512 (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
1513 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
1514 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
1515 (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
1516 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
1517 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
1518 (changed ":" custom-changed-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1519 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
1520 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
1521 (saved "!" custom-saved-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1522 this %c has been set and saved." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1523 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
1524 (rogue "@" custom-rogue-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1525 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
1526 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
1527 (standard " " nil "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1528 this %c is unchanged from its standard setting." "\
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1529 visible group members are all at standard settings."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1530 "Alist of customize option states.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1531 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1532
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1533 STATE is one of the following symbols:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1534
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1535 `nil'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1536 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1537 `unknown'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1538 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1539 `hidden'
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1540 This item is not being displayed.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1541 `invalid'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1542 This item is modified, but has an invalid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1543 `modified'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1544 This item is modified, and has a valid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1545 `set'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1546 This item has been set but not saved.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1547 `changed'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1548 The current value of this item has been changed temporarily.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1549 `saved'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1550 This item is marked for saving.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1551 `rogue'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1552 This item has no customization information.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1553 `standard'
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1554 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
1555
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1556 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
1557
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1558 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
1559
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1560 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
1561
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1562 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
1563 left out, ITEM-DESC will be used.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1564
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1565 The string %c in either description will be replaced with the
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1566 category of the item. These are `group'. `option', and `face'.
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1567
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1568 The list should be sorted most significant first.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1569
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1570 (defcustom custom-magic-show 'long
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1571 "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
1572 If `long', show a full-line description, not just one word."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1573 :type '(choice (const :tag "no" nil)
22600
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1574 (const long)
2f3b4c74e9a1 (custom-magic-show): Use `other' widget type.
Andreas Schwab <schwab@suse.de>
parents: 22538
diff changeset
1575 (other :tag "short" short))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1576 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1577
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1578 (defcustom custom-magic-show-hidden '(option face)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1579 "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
1580 The value should be a list with the custom categories where the State
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1581 button should be visible. Possible categories are `group', `option',
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1582 and `face'."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1583 :type '(set (const group) (const option) (const face))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1584 :group 'custom-buffer)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1585
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1586 (defcustom custom-magic-show-button nil
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1587 "Show a \"magic\" button indicating the state of each customization option."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1588 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1589 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1590
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1591 (define-widget 'custom-magic 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1592 "Show and manipulate state for a customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1593 :format "%v"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1594 :action 'widget-parent-action
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1595 :notify 'ignore
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1596 :value-get 'ignore
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1597 :value-create 'custom-magic-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1598 :value-delete 'widget-children-value-delete)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1599
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1600 (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
1601 ;; Non-nil unless hidden.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1602 (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
1603 :custom-state)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1604 'hidden)))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1605
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1606 (defun custom-magic-value-create (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1607 ;; Create compact status report for WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1608 (let* ((parent (widget-get widget :parent))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1609 (state (widget-get parent :custom-state))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1610 (hidden (eq state 'hidden))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1611 (entry (assq state custom-magic-alist))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1612 (magic (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1613 (face (nth 2 entry))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1614 (category (widget-get parent :custom-category))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1615 (text (or (and (eq category 'group)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1616 (nth 4 entry))
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1617 (nth 3 entry)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1618 (form (widget-get parent :custom-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1619 children)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1620 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1621 (setq text (concat (match-string 1 text)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1622 (symbol-name category)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1623 (match-string 2 text))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1624 (when (and custom-magic-show
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1625 (or (not hidden)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1626 (memq category custom-magic-show-hidden)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1627 (insert " ")
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1628 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1629 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1630 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1631 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1632 (widget-get parent :custom-level))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1633 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1634 widget 'choice-item
18087
05c70aa62552 Synched with 1.9903
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18086
diff changeset
1635 :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
1636 :format (if hidden "%t" "%[%t%]")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1637 :button-prefix 'widget-push-button-prefix
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1638 :button-suffix 'widget-push-button-suffix
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1639 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1640 :tag "State")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1641 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1642 (insert ": ")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1643 (let ((start (point)))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1644 (if (eq custom-magic-show 'long)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1645 (insert text)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1646 (insert (symbol-name state)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1647 (cond ((eq form 'lisp)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1648 (insert " (lisp)"))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1649 ((eq form 'mismatch)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1650 (insert " (mismatch)")))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1651 (put-text-property start (point) 'face 'custom-state-face))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1652 (insert "\n"))
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1653 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1654 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1655 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1656 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1657 (widget-get parent :custom-level))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1658 (when custom-magic-show-button
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1659 (when custom-magic-show
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1660 (let ((indent (widget-get parent :indent)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1661 (when indent
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1662 (insert-char ? indent))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1663 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1664 widget 'choice-item
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1665 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1666 :button-face face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1667 :button-prefix ""
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1668 :button-suffix ""
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1669 :help-echo "Change the state."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1670 :format (if hidden "%t" "%[%t%]")
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1671 :tag (if (memq form '(lisp mismatch))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1672 (concat "(" magic ")")
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1673 (concat "[" magic "]")))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1674 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1675 (insert " "))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1676 (widget-put widget :children children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1677
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1678 (defun custom-magic-reset (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1679 "Redraw the :custom-magic property of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1680 (let ((magic (widget-get widget :custom-magic)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1681 (widget-value-set magic (widget-value magic))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1682
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1683 ;;; The `custom' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1684
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1685 (defface custom-button-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1686 '((((type x) (class color)) ; Like default modeline
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1687 (:box (:line-width 2 :style released-button) :background "lightgrey"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1688 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1689 nil))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1690 "Face used for buttons in customization buffers."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1691 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1692 :group 'custom-faces)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1693
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1694 (defface custom-button-pressed-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1695 '((((type x) (class color))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1696 (:box (:line-width 2 :style pressed-button) :background "lightgrey"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1697 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1698 (:inverse-video t)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1699 "Face used for buttons in customization buffers."
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1700 :version "21.1"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1701 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1702
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1703 (defface custom-documentation-face nil
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1704 "Face used for documentation strings in customization buffers."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1705 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1706
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1707 (defface custom-state-face '((((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1708 (background dark))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1709 (:foreground "lime green"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1710 (((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1711 (background light))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1712 (:foreground "dark green"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1713 (t nil))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1714 "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
1715 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1716
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1717 (define-widget 'custom 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1718 "Customize a user option."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1719 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1720 :convert-widget 'custom-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1721 :notify 'custom-notify
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1722 :custom-prefix ""
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1723 :custom-level 1
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1724 :custom-state 'hidden
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1725 :documentation-property 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1726 :value-create 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1727 :value-delete 'widget-children-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1728 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1729 :validate 'widget-children-validate
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1730 :match (lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1731
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1732 (defun custom-convert-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1733 ;; Initialize :value and :tag from :args in WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1734 (let ((args (widget-get widget :args)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1735 (when args
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1736 (widget-put widget :value (widget-apply widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1737 :value-to-internal (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1738 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1739 (widget-put widget :args nil)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1740 widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1741
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1742 (defun custom-notify (widget &rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1743 "Keep track of changes."
18090
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1744 (let ((state (widget-get widget :custom-state)))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1745 (unless (eq state 'modified)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1746 (unless (memq state '(nil unknown hidden))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1747 (widget-put widget :custom-state 'modified))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1748 (custom-magic-reset widget)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1749 (apply 'widget-default-notify widget args))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1750
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1751 (defun custom-redraw (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1752 "Redraw WIDGET with current settings."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1753 (let ((line (count-lines (point-min) (point)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1754 (column (current-column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1755 (pos (point))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1756 (from (marker-position (widget-get widget :from)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1757 (to (marker-position (widget-get widget :to))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1758 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1759 (widget-value-set widget (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1760 (custom-redraw-magic widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1761 (when (and (>= pos from) (<= pos to))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1762 (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1763 (progn
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1764 (if (> column 0)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1765 (goto-line line)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1766 (goto-line (1+ line)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1767 (move-to-column column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1768 (error nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1769
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1770 (defun custom-redraw-magic (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1771 "Redraw WIDGET state with current settings."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1772 (while widget
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1773 (let ((magic (widget-get widget :custom-magic)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1774 (cond (magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1775 (widget-value-set magic (widget-value magic))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1776 (when (setq widget (widget-get widget :group))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1777 (custom-group-state-update widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1778 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1779 (setq widget nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1780 (widget-setup))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1781
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1782 (defun custom-show (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1783 "Non-nil if WIDGET should be shown with VALUE by default."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1784 (let ((show (widget-get widget :custom-show)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1785 (cond ((null show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1786 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1787 ((eq t show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1788 t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1789 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1790 (funcall show widget value)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1791
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1792 (defvar custom-load-recursion nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1793 "Hack to avoid recursive dependencies.")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1794
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1795 (defun custom-load-symbol (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1796 "Load all dependencies for SYMBOL."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1797 (unless custom-load-recursion
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1798 (let ((custom-load-recursion t)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1799 (loads (get symbol 'custom-loads))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1800 load)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1801 (while loads
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1802 (setq load (car loads)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1803 loads (cdr loads))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1804 (cond ((symbolp load)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1805 (condition-case nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1806 (require load)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1807 (error nil)))
18059
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1808 ;; Don't reload a file already loaded.
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1809 ((and (boundp 'preloaded-file-list)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
1810 (member load preloaded-file-list)))
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1811 ((assoc load load-history))
18059
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1812 ((assoc (locate-library load) load-history))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1813 (t
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1814 (condition-case nil
18059
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1815 ;; Without this, we would load cus-edit recursively.
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1816 ;; We are still loading it when we call this,
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1817 ;; and it is not in load-history yet.
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1818 (or (equal load "cus-edit")
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1819 (load-library load))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1820 (error nil))))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1821
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1822 (defun custom-load-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1823 "Load all dependencies for WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1824 (custom-load-symbol (widget-value widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1825
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1826 (defun custom-unloaded-symbol-p (symbol)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1827 "Return non-nil if the dependencies of SYMBOL has not yet been loaded."
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1828 (let ((found nil)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1829 (loads (get symbol 'custom-loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1830 load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1831 (while loads
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1832 (setq load (car loads)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1833 loads (cdr loads))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1834 (cond ((symbolp load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1835 (unless (featurep load)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1836 (setq found t)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1837 ((assoc load load-history))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1838 ((assoc (locate-library load) load-history)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1839 (message nil))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1840 (t
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1841 (setq found t))))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1842 found))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1843
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1844 (defun custom-unloaded-widget-p (widget)
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1845 "Return non-nil if the dependencies of WIDGET has not yet been loaded."
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1846 (custom-unloaded-symbol-p (widget-value widget)))
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1847
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1848 (defun custom-toggle-hide (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1849 "Toggle visibility of WIDGET."
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
1850 (custom-load-widget widget)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1851 (let ((state (widget-get widget :custom-state)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1852 (cond ((memq state '(invalid modified))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1853 (error "There are unset changes"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1854 ((eq state 'hidden)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1855 (widget-put widget :custom-state 'unknown))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1856 (t
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1857 (widget-put widget :documentation-shown nil)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1858 (widget-put widget :custom-state 'hidden)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1859 (custom-redraw widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1860 (widget-setup)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1861
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1862 (defun custom-toggle-parent (widget &rest ignore)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1863 "Toggle visibility of parent of WIDGET."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1864 (custom-toggle-hide (widget-get widget :parent)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1865
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1866 (defun custom-add-see-also (widget &optional prefix)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1867 "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
1868 Insert PREFIX first if non-nil."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1869 (let* ((symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1870 (links (get symbol 'custom-links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1871 (many (> (length links) 2))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1872 (buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1873 (indent (widget-get widget :indent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1874 (when links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1875 (when indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1876 (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1877 (when prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1878 (insert prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1879 (insert "See also ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1880 (while links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1881 (push (widget-create-child-and-convert widget (car links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1882 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1883 (setq links (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1884 (cond ((null links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1885 (insert ".\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1886 ((null (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1887 (if many
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1888 (insert ", and ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1889 (insert " and ")))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1890 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1891 (insert ", "))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1892 (widget-put widget :buttons buttons))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1893
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1894 (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
1895 "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
1896 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
1897 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
1898 (let ((name (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1899 (type (widget-type widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1900 (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
1901 (start (point))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1902 found)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1903 (insert (or initial-string "Parent groups:"))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1904 (mapatoms (lambda (symbol)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1905 (let ((entry (assq name (get symbol 'custom-group))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1906 (when (eq (nth 1 entry) type)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1907 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1908 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1909 widget 'custom-group-link
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1910 :tag (custom-unlispify-tag-name symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1911 symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1912 buttons)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1913 (setq found t)))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1914 (widget-put widget :buttons buttons)
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1915 (if found
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1916 (insert "\n")
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1917 (delete-region start (point)))
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1918 found))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1919
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1920 ;;; The `custom-comment' Widget.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1921
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1922 ;; like the editable field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1923 (defface custom-comment-face '((((class grayscale color)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1924 (background light))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1925 (:background "gray85"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1926 (((class grayscale color)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1927 (background dark))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1928 (:background "dim gray"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1929 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1930 (:italic t)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1931 "Face used for comments on variables or faces"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1932 :version "21.1"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1933 :group 'custom-faces)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1934
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1935 ;; like font-lock-comment-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1936 (defface custom-comment-tag-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1937 '((((class color) (background dark)) (:foreground "gray80"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1938 (((class color) (background light)) (:foreground "blue4"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1939 (((class grayscale) (background light))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1940 (:foreground "DimGray" :bold t :italic t))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1941 (((class grayscale) (background dark))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1942 (:foreground "LightGray" :bold t :italic t))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1943 (t (:bold t)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1944 "Face used for variables or faces comment tags"
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1945 :group 'custom-faces)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1946
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1947 (define-widget 'custom-comment 'string
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1948 "User comment."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1949 :tag "Comment"
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1950 :help-echo "Edit a comment here."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1951 :sample-face 'custom-comment-tag-face
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1952 :value-face 'custom-comment-face
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1953 :shown nil
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1954 :create 'custom-comment-create)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1955
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1956 (defun custom-comment-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1957 (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
1958 (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
1959 (not null-comment))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
1960 (widget-default-create widget)
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
1961 ;; `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
1962 ;; maybe it shouldn't.
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
1963 (widget-put widget :from (point-marker))
f54121af02c8 (custom-comment-create): Fill :from and :to slots
Dave Love <fx@gnu.org>
parents: 25840
diff changeset
1964 (widget-put widget :to (point-marker)))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1965
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1966 (defun custom-comment-hide (widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1967 (widget-put (widget-get widget :parent) :comment-shown nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1968
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1969 ;; Those functions are for the menu. WIDGET is NOT the comment widget. It's
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1970 ;; the global custom one
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1971 (defun custom-comment-show (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1972 (widget-put widget :comment-shown t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1973 (custom-redraw widget)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1974 (widget-setup))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1975
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1976 (defun custom-comment-invisible-p (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1977 (let ((val (widget-value (widget-get widget :comment-widget))))
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1978 (and (equal "" val)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
1979 (not (widget-get widget :comment-shown)))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
1980
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1981 ;;; The `custom-variable' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1982
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1983 (defface custom-variable-tag-face '((((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1984 (background dark))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1985 (:foreground "light blue" :underline t))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1986 (((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1987 (background light))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1988 (:foreground "blue" :underline t))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1989 (t (:underline t)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1990 "Face used for unpushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1991 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1992
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1993 (defface custom-variable-button-face '((t (:underline t :bold t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1994 "Face used for pushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1995 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1996
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
1997 (defcustom custom-variable-default-form 'edit
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
1998 "Default form of displaying variable values."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
1999 :type '(choice (const edit)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2000 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2001 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2002 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2003
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2004 (define-widget 'custom-variable 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2005 "Customize variable."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2006 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2007 :help-echo "Set or reset this variable."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2008 :documentation-property 'variable-documentation
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2009 :custom-category 'option
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2010 :custom-state nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2011 :custom-menu 'custom-variable-menu-create
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2012 :custom-form nil ; defaults to value of `custom-variable-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2013 :value-create 'custom-variable-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2014 :action 'custom-variable-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2015 :custom-set 'custom-variable-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2016 :custom-save 'custom-variable-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2017 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2018 :custom-reset-saved 'custom-variable-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2019 :custom-reset-standard 'custom-variable-reset-standard)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2020
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2021 (defun custom-variable-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2022 "Return a widget suitable for editing the value of SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2023 If SYMBOL has a `custom-type' property, use that.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2024 Otherwise, look up symbol in `custom-guess-type-alist'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2025 (let* ((type (or (get symbol 'custom-type)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2026 (and (not (get symbol 'standard-value))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2027 (custom-guess-type symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2028 'sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2029 (options (get symbol 'custom-options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2030 (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
2031 (copy-sequence type)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2032 (list type))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2033 (when options
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2034 (widget-put tmp :options options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2035 tmp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2036
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2037 (defun custom-variable-value-create (widget)
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2038 "Here is where you edit the variable's value."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2039 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2040 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2041 (widget-put widget :custom-form custom-variable-default-form))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2042 (let* ((buttons (widget-get widget :buttons))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2043 (children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2044 (form (widget-get widget :custom-form))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2045 (state (widget-get widget :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2046 (symbol (widget-get widget :value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2047 (tag (widget-get widget :tag))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2048 (type (custom-variable-type symbol))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2049 (conv (widget-convert type))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2050 (get (or (get symbol 'custom-get) 'default-value))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2051 (prefix (widget-get widget :custom-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2052 (last (widget-get widget :custom-last))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2053 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2054 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2055 (widget-get conv :value))))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2056 ;; If the widget is new, the child determines whether it is hidden.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2057 (cond (state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2058 ((custom-show type value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2059 (setq state 'unknown))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2060 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2061 (setq state 'hidden)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2062 ;; If we don't know the state, see if we need to edit it in lisp form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2063 (when (eq state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2064 (unless (widget-apply conv :match value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2065 ;; (widget-apply (widget-convert type) :match value)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2066 (setq form 'mismatch)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2067 ;; Now we can create the child widget.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2068 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2069 (insert prefix (if last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2070 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2071 widget 'custom-browse-variable-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2072 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2073 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2074 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2075 ((eq state 'hidden)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2076 ;; Indicate hidden value.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2077 (push (widget-create-child-and-convert
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2078 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2079 :format "%{%t%}: "
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2080 :sample-face 'custom-variable-tag-face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2081 :tag tag
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2082 :parent widget)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2083 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2084 (push (widget-create-child-and-convert
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2085 widget 'visibility
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2086 :help-echo "Show the value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2087 :action 'custom-toggle-parent
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2088 nil)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2089 buttons))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2090 ((memq form '(lisp mismatch))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2091 ;; In lisp mode edit the saved value when possible.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2092 (let* ((value (cond ((get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2093 (car (get symbol 'saved-value)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2094 ((get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2095 (car (get symbol 'standard-value)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2096 ((default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2097 (custom-quote (funcall get symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2098 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2099 (custom-quote (widget-get conv :value))))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2100 (insert (symbol-name symbol) ": ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2101 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2102 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2103 :help-echo "Hide the value of this option."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2104 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2105 t)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2106 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2107 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2108 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2109 widget 'sexp
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2110 :button-face 'custom-variable-button-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2111 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2112 :tag (symbol-name symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2113 :parent widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2114 :value value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2115 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2116 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2117 ;; Edit mode.
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2118 (let* ((format (widget-get type :format))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2119 tag-format value-format)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2120 (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
2121 (error "Bad format"))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2122 (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
2123 (setq value-format (substring format (match-end 0)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2124 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2125 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2126 :format tag-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2127 :action 'custom-tag-action
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2128 :help-echo "Change value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2129 :mouse-down-action 'custom-tag-mouse-down-action
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2130 :button-face 'custom-variable-button-face
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2131 :sample-face 'custom-variable-tag-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2132 tag)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2133 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2134 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2135 (push (widget-create-child-and-convert
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2136 widget 'visibility
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2137 :help-echo "Hide the value of this option."
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2138 :action 'custom-toggle-parent
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2139 t)
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2140 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2141 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2142 widget type
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2143 :format value-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2144 :value value)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2145 children))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2146 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2147 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2148 (widget-insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2149 ;; Create the magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2150 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2151 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2152 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2153 (push magic buttons))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2154 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2155 ;; before the call to `widget-default-format-handler'. Otherwise, I
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2156 ;; loose my current `buttons'. This function shouldn't be called like
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2157 ;; this anyway. The doc string widget should be added like the others.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2158 ;; --dv
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2159 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2160 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2161 (widget-default-format-handler widget ?h)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2162
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2163 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2164 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2165 (let* ((comment (get symbol 'variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2166 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2167 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2168 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2169 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2170 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2171 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2172 ;; Don't push it !!! Custom assumes that the first child is the
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2173 ;; value one.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2174 (setq children (append children (list comment-widget)))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2175 ;; Update the rest of the properties properties.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2176 (widget-put widget :custom-form form)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2177 (widget-put widget :children children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2178 ;; Now update the state.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2179 (if (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2180 (widget-put widget :custom-state state)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2181 (custom-variable-state-set widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2182 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2183 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2184 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2185 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2186 (custom-add-see-also widget)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2187
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2188 (defun custom-tag-action (widget &rest args)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2189 "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
2190 (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
2191 :action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2192
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2193 (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
2194 "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
2195 (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
2196 :mouse-down-action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2197
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2198 (defun custom-variable-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2199 "Set the state of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2200 (let* ((symbol (widget-value widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2201 (get (or (get symbol 'custom-get) 'default-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2202 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2203 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2204 (widget-get widget :value)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2205 (comment (get symbol 'variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2206 tmp
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2207 temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2208 (state (cond ((progn (setq tmp (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2209 (setq temp
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2210 (get symbol 'customized-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2211 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2212 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2213 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2214 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2215 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2216 'set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2217 'changed))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2218 ((progn (setq tmp (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2219 (setq temp (get symbol 'saved-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2220 (or tmp temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2221 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2222 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2223 (equal comment temp))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2224 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2225 'saved
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2226 'changed))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2227 ((setq tmp (get symbol 'standard-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2228 (if (condition-case nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2229 (and (equal value (eval (car tmp)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2230 (equal comment nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2231 (error nil))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2232 'standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2233 'changed))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2234 (t 'rogue))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2235 (widget-put widget :custom-state state)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2236
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2237 (defvar custom-variable-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
2238 '(("Set for Current Session" custom-variable-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2239 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2240 (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
2241 ("Save for Future Sessions" custom-variable-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2242 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2243 (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
2244 ("Reset to Current" custom-redraw
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2245 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2246 (and (default-boundp (widget-value widget))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2247 (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
2248 ("Reset to Saved" custom-variable-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2249 (lambda (widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2250 (and (or (get (widget-value widget) 'saved-value)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2251 (get (widget-value widget) 'saved-variable-comment))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2252 (memq (widget-get widget :custom-state)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2253 '(modified set changed rogue)))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2254 ("Reset to Standard Settings" custom-variable-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2255 (lambda (widget)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2256 (and (get (widget-value widget) 'standard-value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2257 (memq (widget-get widget :custom-state)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2258 '(modified set changed saved rogue)))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2259 ("---" ignore ignore)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2260 ("Add Comment" custom-comment-show custom-comment-invisible-p)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2261 ("---" ignore ignore)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2262 ("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
2263 (lambda (widget)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2264 (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
2265 ("Show initial Lisp expression" custom-variable-edit-lisp
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2266 (lambda (widget)
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2267 (eq (widget-get widget :custom-form) 'edit))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2268 "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
2269 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
2270 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
2271 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
2272 widget as an argument, and returns non-nil if ACTION is valid on that
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2273 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2274
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2275 (defun custom-variable-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2276 "Show the menu for `custom-variable' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2277 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2278 (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
2279 (custom-toggle-hide widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2280 (unless (eq (widget-get widget :custom-state) 'modified)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2281 (custom-variable-state-set widget))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2282 (custom-redraw-magic widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2283 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2284 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2285 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2286 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2287 (custom-menu-filter custom-variable-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2288 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2289 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2290 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2291 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2292
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2293 (defun custom-variable-edit (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2294 "Edit value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2295 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2296 (widget-put widget :custom-form 'edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2297 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2298
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2299 (defun custom-variable-edit-lisp (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2300 "Edit the lisp representation of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2301 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2302 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2303 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2304
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2305 (defun custom-variable-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2306 "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
2307 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2308 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2309 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2310 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2311 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2312 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2313 (comment (widget-value comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2314 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2315 (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
2316 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2317 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2318 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2319 (error "%s" (widget-get val :error)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2320 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2321 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2322 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2323 ;; 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
2324 (custom-comment-hide comment-widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2325 (funcall set symbol (eval (setq val (widget-value child))))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2326 (put symbol 'customized-value (list val))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2327 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2328 (put symbol 'customized-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2329 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2330 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2331 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2332 ;; 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
2333 (custom-comment-hide comment-widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2334 (funcall set symbol (setq val (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2335 (put symbol 'customized-value (list (custom-quote val)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2336 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2337 (put symbol 'customized-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2338 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2339 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2340
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2341 (defun custom-variable-save (widget)
19823
0c1b4a44db76 (custom-variable-save): Fixed doc string.
Richard M. Stallman <rms@gnu.org>
parents: 19822
diff changeset
2342 "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
2343 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2344 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2345 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2346 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2347 (set (or (get symbol 'custom-set) 'set-default))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2348 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2349 (comment (widget-value comment-widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2350 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2351 (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
2352 (error "Cannot set hidden variable"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2353 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2354 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2355 (error "%s" (widget-get val :error)))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2356 ((memq form '(lisp mismatch))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2357 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2358 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2359 ;; 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
2360 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2361 (put symbol 'saved-value (list (widget-value child)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2362 (funcall set symbol (eval (widget-value child)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2363 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2364 (put symbol 'saved-variable-comment comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2365 (t
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2366 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2367 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2368 ;; 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
2369 (custom-comment-hide comment-widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2370 (put symbol 'saved-value
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2371 (list (custom-quote (widget-value child))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2372 (funcall set symbol (widget-value child))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2373 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2374 (put symbol 'saved-variable-comment comment)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2375 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2376 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2377 (custom-save-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2378 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2379 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2380
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2381 (defun custom-variable-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2382 "Restore the saved value for the variable being edited by WIDGET."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2383 (let* ((symbol (widget-value widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2384 (set (or (get symbol 'custom-set) 'set-default))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2385 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2386 (value (get symbol 'saved-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2387 (comment (get symbol 'saved-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2388 (cond ((or value comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2389 (put symbol 'variable-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2390 (condition-case nil
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2391 (funcall set symbol (eval (car value)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2392 (error nil)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2393 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2394 (error "No saved value for %s" symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2395 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2396 (put symbol 'customized-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2397 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2398 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2399 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2400
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2401 (defun custom-variable-reset-standard (widget)
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
2402 "Restore the standard setting for the variable being edited by WIDGET."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2403 (let* ((symbol (widget-value widget))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2404 (set (or (get symbol 'custom-set) 'set-default))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2405 (comment-widget (widget-get widget :comment-widget)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2406 (if (get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2407 (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
2408 (error "No standard setting known for %S" symbol))
25824
0d1ba90ad774 (custom-comment): Change widget definition.
Dave Love <fx@gnu.org>
parents: 25685
diff changeset
2409 (put symbol 'variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2410 (put symbol 'customized-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2411 (put symbol 'customized-variable-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2412 (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2413 (put symbol 'saved-value nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2414 (put symbol 'saved-variable-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2415 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2416 (widget-put widget :custom-state 'unknown)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2417 ;; This call will possibly make the comment invisible
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2418 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2419
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2420 ;;; The `custom-face-edit' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2421
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2422 (define-widget 'custom-face-edit 'checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2423 "Edit face attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2424 :format "%t: %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2425 :tag "Attributes"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2426 :extra-offset 12
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2427 :button-args '(:help-echo "Control whether this attribute has any effect.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2428 :args (mapcar (lambda (att)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2429 (list 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2430 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2431 :sibling-args (widget-get (nth 1 att) :sibling-args)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2432 (list 'const :format "" :value (nth 0 att))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2433 (nth 1 att)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2434 custom-face-attributes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2435
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2436 ;;; The `custom-display' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2437
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2438 (define-widget 'custom-display 'menu-choice
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2439 "Select a display type."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2440 :tag "Display"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2441 :value t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2442 :help-echo "Specify frames where the face attributes should be used."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2443 :args '((const :tag "all" t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2444 (checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2445 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2446 :extra-offset 9
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2447 :args ((group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2448 Only match the specified window systems.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2449 (const :format "Type: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2450 type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2451 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2452 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2453 (const :format "X "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2454 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2455 The X11 Window System.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2456 x)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2457 (const :format "PM "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2458 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2459 OS/2 Presentation Manager.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2460 pm)
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2461 (const :format "W32 "
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2462 :sibling-args (:help-echo "\
19684
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2463 Windows NT/9X.")
d5378da3dd73 (custom-display): Use w32 instead of win32.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19316
diff changeset
2464 w32)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2465 (const :format "DOS "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2466 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2467 Plain MS-DOS.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2468 pc)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2469 (const :format "TTY%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2470 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2471 Plain text terminals.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2472 tty)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2473 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2474 Only match the frames with the specified color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2475 (const :format "Class: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2476 class)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2477 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2478 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2479 (const :format "Color "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2480 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2481 Match color frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2482 color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2483 (const :format "Grayscale "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2484 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2485 Match grayscale frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2486 grayscale)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2487 (const :format "Monochrome%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2488 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2489 Match frames with no color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2490 mono)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2491 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2492 Only match frames with the specified intensity.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2493 (const :format "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2494 Background brightness: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2495 background)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2496 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2497 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2498 (const :format "Light "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2499 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2500 Match frames with light backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2501 light)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2502 (const :format "Dark\n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2503 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2504 Match frames with dark backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2505 dark)))))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2506
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2507 ;;; The `custom-face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2508
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2509 (defface custom-face-tag-face '((t (:underline t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2510 "Face used for face tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2511 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2512
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2513 (defcustom custom-face-default-form 'selected
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2514 "Default form of displaying face definition."
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2515 :type '(choice (const all)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2516 (const selected)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2517 (const lisp))
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2518 :group 'custom-buffer
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21649
diff changeset
2519 :version "20.3")
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2520
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2521 (define-widget 'custom-face 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2522 "Customize face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2523 :sample-face 'custom-face-tag-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2524 :help-echo "Set or reset this face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2525 :documentation-property '(lambda (face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2526 (face-doc-string face))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2527 :value-create 'custom-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2528 :action 'custom-face-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2529 :custom-category 'face
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2530 :custom-form nil ; defaults to value of `custom-face-default-form'
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2531 :custom-set 'custom-face-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2532 :custom-save 'custom-face-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2533 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2534 :custom-reset-saved 'custom-face-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2535 :custom-reset-standard 'custom-face-reset-standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2536 :custom-menu 'custom-face-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2537
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2538 (define-widget 'custom-face-all 'editable-list
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2539 "An editable list of display specifications and attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2540 :entry-format "%i %d %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2541 :insert-button-args '(:help-echo "Insert new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2542 :append-button-args '(:help-echo "Append new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2543 :delete-button-args '(:help-echo "Delete this display specification.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2544 :args '((group :format "%v" custom-display custom-face-edit)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2545
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2546 (defconst custom-face-all (widget-convert 'custom-face-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2547 "Converted version of the `custom-face-all' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2548
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2549 (define-widget 'custom-display-unselected 'item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2550 "A display specification that doesn't match the selected display."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2551 :match 'custom-display-unselected-match)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2552
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2553 (defun custom-display-unselected-match (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2554 "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
2555 (not (face-spec-set-match-display value (selected-frame))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2556
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2557 (define-widget 'custom-face-selected 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2558 "Edit the attributes of the selected display in a face specification."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2559 :args '((repeat :format ""
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2560 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2561 (group custom-display-unselected sexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2562 (group (sexp :format "") custom-face-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2563 (repeat :format ""
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2564 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2565 sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2566
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2567 (defconst custom-face-selected (widget-convert 'custom-face-selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2568 "Converted version of the `custom-face-selected' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2569
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2570 (defun custom-face-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2571 "Create a list of the display specifications for WIDGET."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2572 (let ((buttons (widget-get widget :buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2573 children
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2574 (symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2575 (tag (widget-get widget :tag))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2576 (state (widget-get widget :custom-state))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2577 (begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2578 (is-last (widget-get widget :custom-last))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2579 (prefix (widget-get widget :custom-prefix)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2580 (unless tag
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2581 (setq tag (prin1-to-string symbol)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2582 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2583 (insert prefix (if is-last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2584 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
2585 widget 'custom-browse-face-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2586 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2587 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2588 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2589 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2590 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2591 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2592 (if (eq custom-buffer-style 'face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2593 (insert " ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2594 (widget-specify-sample widget begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2595 (insert ": "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2596 ;; Sample.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2597 (push (widget-create-child-and-convert widget 'item
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2598 :format "(%{%t%})"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2599 :sample-face symbol
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2600 :tag "sample")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2601 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2602 ;; Visibility.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2603 (insert " ")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2604 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2605 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2606 :help-echo "Hide or show this face."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2607 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2608 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2609 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2610 ;; Magic.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2611 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2612 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2613 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2614 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2615 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2616 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2617 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2618 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2619 (widget-default-format-handler widget ?h)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2620 ;; The comment field
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2621 (unless (eq state 'hidden)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2622 (let* ((comment (get symbol 'face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2623 (comment-widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2624 (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2625 widget 'custom-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2626 :parent widget
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2627 :value (or comment ""))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2628 (widget-put widget :comment-widget comment-widget)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2629 (push comment-widget children)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2630 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2631 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2632 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2633 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2634 (custom-add-see-also widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2635 ;; Editor.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2636 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2637 (insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2638 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2639 (message "Creating face editor...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2640 (custom-load-widget widget)
20411
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2641 (unless (widget-get widget :custom-form)
089ca3e66e6d (custom-unlispify-remove-prefixes): Reference to
Karl Heuer <kwzh@gnu.org>
parents: 20398
diff changeset
2642 (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
2643 (let* ((symbol (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2644 (spec (or (get symbol 'saved-face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2645 (get symbol 'face-defface-spec)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2646 ;; Attempt to construct it.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2647 (list (list t (custom-face-attributes-get
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2648 symbol (selected-frame))))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2649 (form (widget-get widget :custom-form))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2650 (indent (widget-get widget :indent))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
2651 edit)
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
2652 ;; 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
2653 ;; 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
2654 (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
2655 (setq spec (list (list t (face-attr-construct symbol (selected-frame))))))
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
2656 (setq edit (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2657 widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2658 (cond ((and (eq form 'selected)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2659 (widget-apply custom-face-selected
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2660 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2661 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2662 'custom-face-selected)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2663 ((and (not (eq form 'lisp))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2664 (widget-apply custom-face-all
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2665 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2666 'custom-face-all)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2667 (t
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2668 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2669 'sexp))
19097
200ff7e7d620 (custom-face-value-create): Take account
Richard M. Stallman <rms@gnu.org>
parents: 19040
diff changeset
2670 :value spec))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2671 (custom-face-state-set widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2672 (push edit children)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2673 (widget-put widget :children children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2674 (message "Creating face editor...done"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2675
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2676 (defvar custom-face-menu
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
2677 '(("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
2678 ("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
2679 ("Reset to Saved" custom-face-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2680 (lambda (widget)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2681 (or (get (widget-value widget) 'saved-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2682 (get (widget-value widget) 'saved-face-comment))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2683 ("Reset to Standard Setting" custom-face-reset-standard
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2684 (lambda (widget)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2685 (get (widget-value widget) 'face-defface-spec)))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2686 ("---" ignore ignore)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2687 ("Add Comment" custom-comment-show custom-comment-invisible-p)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2688 ("---" ignore ignore)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2689 ("Show all display specs" custom-face-edit-all
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2690 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2691 (not (eq (widget-get widget :custom-form) 'all))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2692 ("Just current attributes" custom-face-edit-selected
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2693 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2694 (not (eq (widget-get widget :custom-form) 'selected))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2695 ("Show as Lisp expression" custom-face-edit-lisp
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2696 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2697 (not (eq (widget-get widget :custom-form) 'lisp)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2698 "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
2699 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
2700 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
2701 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
2702 widget as an argument, and returns non-nil if ACTION is valid on that
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2703 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2704
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2705 (defun custom-face-edit-selected (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2706 "Edit selected attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2707 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2708 (widget-put widget :custom-form 'selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2709 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2710
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2711 (defun custom-face-edit-all (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2712 "Edit all attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2713 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2714 (widget-put widget :custom-form 'all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2715 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2716
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2717 (defun custom-face-edit-lisp (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2718 "Edit the lisp representation of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2719 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2720 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2721 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2722
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2723 (defun custom-face-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2724 "Set the state of WIDGET."
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2725 (let* ((symbol (widget-value widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2726 (comment (get symbol 'face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2727 tmp temp)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2728 (widget-put widget :custom-state
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2729 (cond ((progn
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2730 (setq tmp (get symbol 'customized-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2731 (setq temp (get symbol 'customized-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2732 (or tmp temp))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2733 (if (equal temp comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2734 'set
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2735 'changed))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2736 ((progn
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2737 (setq tmp (get symbol 'saved-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2738 (setq temp (get symbol 'saved-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2739 (or tmp temp))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2740 (if (equal temp comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2741 'saved
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2742 'changed))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2743 ((get symbol 'face-defface-spec)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2744 (if (equal comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2745 'standard
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2746 'changed))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2747 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2748 'rogue)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2749
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2750 (defun custom-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2751 "Show the menu for `custom-face' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2752 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2753 (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
2754 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2755 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2756 (symbol (widget-get widget :value))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2757 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2758 (custom-unlispify-tag-name symbol))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2759 (custom-menu-filter custom-face-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2760 widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2761 event)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2762 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2763 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2764
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2765 (defun custom-face-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2766 "Make the face attributes in WIDGET take effect."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2767 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2768 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2769 (value (widget-value child))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2770 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2771 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2772 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2773 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2774 ;; 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
2775 (custom-comment-hide comment-widget))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2776 (put symbol 'customized-face value)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2777 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2778 (put symbol 'customized-face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2779 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2780 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2781 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2782
19883
519eab181c36 (custom-face-menu): Use custom-face-save-command. not custom-face-save.
Richard M. Stallman <rms@gnu.org>
parents: 19823
diff changeset
2783 (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
2784 "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
2785 (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
2786 (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
2787
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2788 (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
2789 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2790 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2791 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2792 (value (widget-value child))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2793 (comment-widget (widget-get widget :comment-widget))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2794 (comment (widget-value comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2795 (when (equal comment "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2796 (setq comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2797 ;; 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
2798 (custom-comment-hide comment-widget))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2799 (face-spec-set symbol value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2800 (put symbol 'saved-face value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2801 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2802 (put symbol 'face-comment comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2803 (put symbol 'customized-face-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2804 (put symbol 'saved-face-comment comment)
20262
c6532008f2a9 (custom-face-save): Save the face.
Karl Heuer <kwzh@gnu.org>
parents: 20174
diff changeset
2805 (custom-save-all)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2806 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2807 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2808
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2809 (defun custom-face-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2810 "Restore WIDGET to the face's default attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2811 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2812 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2813 (value (get symbol 'saved-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2814 (comment (get symbol 'saved-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2815 (comment-widget (widget-get widget :comment-widget)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2816 (unless (or value comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2817 (error "No saved value for this face"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2818 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2819 (put symbol 'customized-face-comment nil)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2820 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2821 (put symbol 'face-comment comment)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2822 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2823 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2824 (widget-value-set comment-widget (or comment ""))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2825 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2826 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2827
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2828 (defun custom-face-reset-standard (widget)
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
2829 "Restore WIDGET to the face's standard settings."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2830 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2831 (child (car (widget-get widget :children)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2832 (value (get symbol 'face-defface-spec))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2833 (comment-widget (widget-get widget :comment-widget)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2834 (unless value
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
2835 (error "No standard setting for this face"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2836 (put symbol 'customized-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2837 (put symbol 'customized-face-comment nil)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2838 (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2839 (put symbol 'saved-face nil)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2840 (put symbol 'saved-face-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2841 (custom-save-all))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2842 (face-spec-set symbol value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2843 (put symbol 'face-comment nil)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2844 (widget-value-set child value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2845 ;; This call manages the comment visibility
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2846 (widget-value-set comment-widget "")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2847 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2848 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2849
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2850 ;;; The `face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2851
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2852 (define-widget 'face 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2853 "Select and customize a face."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2854 :convert-widget 'widget-value-convert-widget
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2855 :button-prefix 'widget-push-button-prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2856 :button-suffix 'widget-push-button-suffix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2857 :format "%t: %[select face%] %v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2858 :tag "Face"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2859 :value 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2860 :value-create 'widget-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2861 :value-delete 'widget-face-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2862 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2863 :validate 'widget-children-validate
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2864 :action 'widget-face-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2865 :match '(lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2866
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2867 (defun widget-face-value-create (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2868 ;; Create a `custom-face' child.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2869 (let* ((symbol (widget-value widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2870 (custom-buffer-style 'face)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2871 (child (widget-create-child-and-convert
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2872 widget 'custom-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2873 :custom-level nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2874 :value symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2875 (custom-magic-reset child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2876 (setq custom-options (cons child custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2877 (widget-put widget :children (list child))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2878
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2879 (defun widget-face-value-delete (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2880 ;; Remove the child from the options.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2881 (let ((child (car (widget-get widget :children))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2882 (setq custom-options (delq child custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2883 (widget-children-value-delete widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2884
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2885 (defvar face-history nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2886 "History of entered face names.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2887
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2888 (defun widget-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2889 "Prompt for a face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2890 (let ((answer (completing-read "Face: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2891 (mapcar (lambda (face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2892 (list (symbol-name face)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2893 (face-list))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2894 nil nil nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2895 'face-history)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2896 (unless (zerop (length answer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2897 (widget-value-set widget (intern answer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2898 (widget-apply widget :notify widget event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2899 (widget-setup))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2900
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2901 ;;; The `hook' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2902
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2903 (define-widget 'hook 'list
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2904 "A emacs lisp hook"
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2905 :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
2906 (if (and value (symbolp value))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2907 (list value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2908 value))
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2909 :match (lambda (widget value)
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
2910 (or (symbolp value)
20174
e1ca1fe89e6e (hook): Use `widget-group-match' instead of
Karl Heuer <kwzh@gnu.org>
parents: 20100
diff changeset
2911 (widget-group-match widget value)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2912 :convert-widget 'custom-hook-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2913 :tag "Hook")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2914
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2915 (defun custom-hook-convert-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2916 ;; Handle `:custom-options'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2917 (let* ((options (widget-get widget :options))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2918 (other `(editable-list :inline t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2919 :entry-format "%i %d%v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2920 (function :format " %v")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2921 (args (if options
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2922 (list `(checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2923 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2924 `(function-item ,entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2925 options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2926 other)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2927 (list other))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2928 (widget-put widget :args args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2929 widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2930
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2931 ;;; The `custom-group-link' Widget.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2932
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2933 (define-widget 'custom-group-link 'link
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2934 "Show parent in other window when activated."
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2935 :help-echo "Create customization buffer for this group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2936 :action 'custom-group-link-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2937
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2938 (defun custom-group-link-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2939 (customize-group (widget-value widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2940
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2941 ;;; The `custom-group' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2942
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2943 (defcustom custom-group-tag-faces nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2944 ;; In XEmacs, this ought to play games with font size.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
2945 ;; Fixme: make it do so in Emacs.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2946 "Face used for group tags.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2947 The first member is used for level 1 groups, the second for level 2,
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2948 and so forth. The remaining group tags are shown with
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2949 `custom-group-tag-face'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2950 :type '(repeat face)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2951 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2952
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2953 (defface custom-group-tag-face-1 '((((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2954 (background dark))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2955 (:foreground "pink" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2956 (((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2957 (background light))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2958 (:foreground "red" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2959 (t (:underline t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2960 "Face used for group tags.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2961
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2962 (defface custom-group-tag-face '((((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2963 (background dark))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2964 (:foreground "light blue" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2965 (((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2966 (background light))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2967 (:foreground "blue" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2968 (t (:underline t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2969 "Face used for low level group tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2970 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2971
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2972 (define-widget 'custom-group 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2973 "Customize group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2974 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2975 :sample-face-get 'custom-group-sample-face-get
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2976 :documentation-property 'group-documentation
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2977 :help-echo "Set or reset all members of this group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2978 :value-create 'custom-group-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2979 :action 'custom-group-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2980 :custom-category 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2981 :custom-set 'custom-group-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2982 :custom-save 'custom-group-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2983 :custom-reset-current 'custom-group-reset-current
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2984 :custom-reset-saved 'custom-group-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2985 :custom-reset-standard 'custom-group-reset-standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2986 :custom-menu 'custom-group-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2987
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2988 (defun custom-group-sample-face-get (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2989 ;; Use :sample-face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2990 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2991 'custom-group-tag-face))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2992
18430
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2993 (define-widget 'custom-group-visibility 'visibility
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2994 "An indicator and manipulator for hidden group contents."
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2995 :create 'custom-group-visibility-create)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2996
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2997 (defun custom-group-visibility-create (widget)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2998 (let ((visible (widget-value widget)))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2999 (if visible
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3000 (insert "--------")))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3001 (widget-default-create widget))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
3002
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3003 (defun custom-group-members (symbol groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3004 "Return SYMBOL's custom group members.
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3005 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
3006 (if (not groups-only)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3007 (get symbol 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3008 (let (members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3009 (dolist (entry (get symbol 'custom-group))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3010 (when (eq (nth 1 entry) 'custom-group)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3011 (push entry members)))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3012 (nreverse members))))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3013
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3014 (defun custom-group-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3015 "Insert a customize group for WIDGET in the current buffer."
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3016 (let* ((state (widget-get widget :custom-state))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3017 (level (widget-get widget :custom-level))
19040
c0dc58ad2d47 Synched with 1.9954.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19022
diff changeset
3018 ;; (indent (widget-get widget :indent))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3019 (prefix (widget-get widget :custom-prefix))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3020 (buttons (widget-get widget :buttons))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3021 (tag (widget-get widget :tag))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3022 (symbol (widget-value widget))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3023 (members (custom-group-members symbol
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3024 (and (eq custom-buffer-style 'tree)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3025 custom-browse-only-groups))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3026 (cond ((and (eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3027 (eq state 'hidden)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3028 (or members (custom-unloaded-widget-p widget)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3029 (custom-browse-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3030 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3031 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3032 ;; :tag-glyph "plus"
18856
03eeb83520d8 (custom-group-value-create) <tree>: Don't distinguish
Richard M. Stallman <rms@gnu.org>
parents: 18812
diff changeset
3033 :tag "+")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3034 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3035 (insert "-- ")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3036 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3037 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3038 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3039 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3040 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3041 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3042 ((and (eq custom-buffer-style 'tree)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3043 (zerop (length members)))
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3044 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3045 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3046 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3047 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3048 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3049 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3050 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3051 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3052 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3053 ((eq custom-buffer-style 'tree)
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3054 (custom-browse-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3055 (custom-load-widget widget)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3056 (if (zerop (length members))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3057 (progn
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3058 (custom-browse-insert-prefix prefix)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3059 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3060 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3061 ;; (widget-glyph-insert nil "-- " "horizontal")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3062 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3063 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3064 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3065 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3066 (widget-put widget :buttons buttons))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3067 (push (widget-create-child-and-convert
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3068 widget 'custom-browse-visibility
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3069 ;; :tag-glyph "minus"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3070 :tag "-")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3071 buttons)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3072 (insert "-\\ ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3073 ;; (widget-glyph-insert nil "-\\ " "top")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3074 (push (widget-create-child-and-convert
18562
e22e2a4e683a Synched with 1.9942.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18462
diff changeset
3075 widget 'custom-browse-group-tag)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3076 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3077 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3078 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3079 (message "Creating group...")
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3080 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3081 custom-browse-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3082 custom-browse-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3083 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3084 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3085 (extra-prefix (if (widget-get widget :custom-last)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3086 " "
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3087 " | "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3088 (prefix (concat prefix extra-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3089 children entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3090 (while members
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3091 (setq entry (car members)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3092 members (cdr members))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3093 (push (widget-create-child-and-convert
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3094 widget (nth 1 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3095 :group widget
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3096 :tag (custom-unlispify-tag-name (nth 0 entry))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3097 :custom-prefixes custom-prefix-list
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3098 :custom-level (1+ level)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3099 :custom-last (null members)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3100 :value (nth 0 entry)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3101 :custom-prefix prefix)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3102 children))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3103 (widget-put widget :children (reverse children)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3104 (message "Creating group...done")))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3105 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3106 ((eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3107 ;; Create level indicator.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3108 (unless (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3109 (insert-char ?\ (* custom-buffer-indent (1- level)))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3110 (insert "-- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3111 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3112 (let ((begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3113 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3114 (widget-specify-sample widget begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3115 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3116 ;; Create link/visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3117 (if (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3118 (push (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3119 widget 'custom-group-link
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3120 :tag "Go to Group"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3121 symbol)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3122 buttons)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3123 (push (widget-create-child-and-convert
20100
0db4553d47cc (custom-group-value-create): Use
Karl Heuer <kwzh@gnu.org>
parents: 19886
diff changeset
3124 widget 'custom-group-visibility
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3125 :help-echo "Show members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3126 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3127 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3128 buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3129 (insert " \n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3130 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3131 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3132 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3133 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3134 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3135 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3136 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3137 ;; Insert documentation.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3138 (if (and (eq custom-buffer-style 'links) (> level 1))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
3139 (widget-put widget :documentation-indent 0))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3140 (widget-default-format-handler widget ?h))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3141 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3142 (t ;Visible.
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3143 ;; 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
3144 (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
3145 ;;; 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
3146 (when (eq level 1)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
3147 (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
3148 "Go to parent group:")
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3149 (insert "\n"))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3150 ;; Create level indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3151 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3152 (insert "/- ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3153 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3154 (let ((start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3155 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3156 (widget-specify-sample widget start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3157 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3158 ;; Create visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3159 (unless (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3160 (insert "--------")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3161 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3162 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3163 :help-echo "Hide members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3164 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3165 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3166 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3167 (insert " "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3168 ;; Create more dashes.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3169 ;; Use 76 instead of 75 to compensate for the temporary "<"
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3170 ;; added by `widget-insert'.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3171 (insert-char ?- (- 76 (current-column)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3172 (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3173 (insert "\\\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3174 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3175 (let ((magic (widget-create-child-and-convert
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3176 widget 'custom-magic
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3177 :indent 0
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3178 nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3179 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3180 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3181 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3182 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3183 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3184 (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
3185 ;; Parent groups.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3186 (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
3187 ;;; 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
3188 (when (eq level 1)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3189 (insert-char ?\ custom-buffer-indent)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
3190 (custom-add-parent-links widget)))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3191 (custom-add-see-also widget
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3192 (make-string (* custom-buffer-indent level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3193 ?\ ))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3194 ;; Members.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3195 (message "Creating group...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3196 (custom-load-widget widget)
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3197 (let* ((members (custom-sort-items members
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3198 custom-buffer-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3199 custom-buffer-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3200 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3201 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3202 (length (length members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3203 (count 0)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3204 (children (mapcar (lambda (entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3205 (widget-insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3206 (message "\
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3207 Creating group members... %2d%%"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3208 (/ (* 100.0 count) length))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3209 (setq count (1+ count))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3210 (prog1
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3211 (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3212 widget (nth 1 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3213 :group widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3214 :tag (custom-unlispify-tag-name
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3215 (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3216 :custom-prefixes custom-prefix-list
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3217 :custom-level (1+ level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3218 :value (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3219 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3220 (widget-insert "\n"))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3221 members)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3222 (message "Creating group magic...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3223 (mapcar 'custom-magic-reset children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3224 (message "Creating group state...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3225 (widget-put widget :children children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3226 (custom-group-state-update widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3227 (message "Creating group... done"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3228 ;; End line
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3229 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3230 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3231 (insert "\\- " (widget-get widget :tag) " group end ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3232 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3233 (insert "/\n")))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3234
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3235 (defvar custom-group-menu
18571
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3236 '(("Set for Current Session" custom-group-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3237 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3238 (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
3239 ("Save for Future Sessions" custom-group-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3240 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3241 (memq (widget-get widget :custom-state) '(modified set))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3242 ("Reset to Current" custom-group-reset-current
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3243 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3244 (memq (widget-get widget :custom-state) '(modified))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3245 ("Reset to Saved" custom-group-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3246 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3247 (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
3248 ("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
3249 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3250 (memq (widget-get widget :custom-state) '(modified set saved)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3251 "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
3252 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
3253 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
3254 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
3255 widget as an argument, and returns non-nil if ACTION is valid on that
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3256 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3257
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3258 (defun custom-group-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3259 "Show the menu for `custom-group' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3260 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3261 (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
3262 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3263 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3264 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3265 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3266 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3267 (custom-menu-filter custom-group-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3268 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3269 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3270 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3271 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3272
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3273 (defun custom-group-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3274 "Set changes in all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3275 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3276 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3277 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3278 (widget-apply child :custom-set)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3279 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3280
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3281 (defun custom-group-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3282 "Save all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3283 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3284 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3285 (when (memq (widget-get child :custom-state) '(modified set))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3286 (widget-apply child :custom-save)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3287 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3288
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3289 (defun custom-group-reset-current (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3290 "Reset all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3291 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3292 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3293 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3294 (widget-apply child :custom-reset-current)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3295 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3296
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3297 (defun custom-group-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3298 "Reset all modified or set group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3299 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3300 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3301 (when (memq (widget-get child :custom-state) '(modified set))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3302 (widget-apply child :custom-reset-saved)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3303 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3304
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3305 (defun custom-group-reset-standard (widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3306 "Reset all modified, set, or saved group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3307 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3308 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3309 (when (memq (widget-get child :custom-state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3310 '(modified set saved))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3311 (widget-apply child :custom-reset-standard)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3312 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3313
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3314 (defun custom-group-state-update (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3315 "Update magic."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3316 (unless (eq (widget-get widget :custom-state) 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3317 (let* ((children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3318 (states (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3319 (widget-get child :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3320 children))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3321 (magics custom-magic-alist)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3322 (found 'standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3323 (while magics
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3324 (let ((magic (car (car magics))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3325 (if (and (not (eq magic 'hidden))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3326 (memq magic states))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3327 (setq found magic
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3328 magics nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3329 (setq magics (cdr magics)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3330 (widget-put widget :custom-state found)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3331 (custom-magic-reset widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3332
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3333 ;;; The `custom-save-all' Function.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
3334 ;;;###autoload
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3335 (defcustom custom-file nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3336 "File used for storing customization information.
19822
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3337 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
3338 as specified by `user-init-file'. If you specify some other file,
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3339 you need to explicitly load that file for the settings to take effect."
b5c12a2d1c26 *** empty log message ***
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 19684
diff changeset
3340 :type '(choice (const :tag "Your Emacs init file" nil) file)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3341 :group 'customize)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3342
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3343 (defun custom-file ()
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3344 "Return the file name for saving customizations."
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3345 (setq custom-file
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3346 (or custom-file
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3347 user-init-file
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3348 (read-file-name "File for customizations: "
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3349 "~/" nil nil ".emacs"))))
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3350
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3351 (defun custom-save-delete (symbol)
20398
47f326ffb7ba (custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents: 20397
diff changeset
3352 "Delete the call to SYMBOL from `custom-file'.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3353 Leave point at the location of the call, or after the last expression."
20398
47f326ffb7ba (custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents: 20397
diff changeset
3354 (let ((default-major-mode))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3355 (set-buffer (find-file-noselect (custom-file))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3356 (goto-char (point-min))
25058
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3357 ;; Skip all whitespace and comments.
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3358 (while (forward-comment 1))
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3359 (or (eobp)
af119d40c92d (custom-save-delete): Avoid error for empty .emacs.
Karl Heuer <kwzh@gnu.org>
parents: 24509
diff changeset
3360 (save-excursion (forward-sexp (buffer-size)))) ; Test for scan errors.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3361 (catch 'found
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3362 (while t
23999
8c46e3a0623e (custom-save-delete): Don't delete whitespace
Richard M. Stallman <rms@gnu.org>
parents: 23795
diff changeset
3363 ;; Skip all whitespace and comments.
8c46e3a0623e (custom-save-delete): Don't delete whitespace
Richard M. Stallman <rms@gnu.org>
parents: 23795
diff changeset
3364 (while (forward-comment 1))
23795
a4dd6e536bc1 (custom-save-delete): Save point before
Karl Heuer <kwzh@gnu.org>
parents: 23357
diff changeset
3365 (let ((start (point))
a4dd6e536bc1 (custom-save-delete): Save point before
Karl Heuer <kwzh@gnu.org>
parents: 23357
diff changeset
3366 (sexp (condition-case nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3367 (read (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3368 (end-of-file (throw 'found nil)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3369 (when (and (listp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3370 (eq (car sexp) symbol))
23795
a4dd6e536bc1 (custom-save-delete): Save point before
Karl Heuer <kwzh@gnu.org>
parents: 23357
diff changeset
3371 (delete-region start (point))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3372 (throw 'found nil))))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3373
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3374 (defun custom-save-variables ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3375 "Save all customized variables in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3376 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3377 (custom-save-delete 'custom-set-variables)
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3378 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3379 (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
3380 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3381 ;; 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
3382 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3383 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3384 (if (get symbol 'saved-value)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3385 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3386 (setq saved-list (sort (cdr saved-list) 'string<))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3387 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3388 (princ "\n"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3389 (princ "(custom-set-variables")
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3390 (mapcar
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3391 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3392 (let ((value (get symbol 'saved-value))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3393 (requests (get symbol 'custom-requests))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3394 (now (not (or (get symbol 'standard-value)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3395 (and (not (boundp symbol))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3396 (not (get symbol 'force-value))))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3397 (comment (get symbol 'saved-variable-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3398 sep)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3399 (when (or value comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3400 (princ "\n '(")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3401 (prin1 symbol)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3402 (princ " ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3403 (prin1 (car value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3404 (cond ((or now requests comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3405 (princ " ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3406 (if now
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3407 (princ "t")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3408 (princ "nil"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3409 (cond ((or requests comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3410 (princ " ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3411 (if requests
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3412 (prin1 requests)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3413 (princ "nil"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3414 (cond (comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3415 (princ " ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3416 (prin1 comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3417 (princ ")"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3418 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3419 (princ ")"))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3420 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3421 (princ ")"))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3422 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3423 (princ ")"))))))
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3424 saved-list)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3425 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3426 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3427 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3428
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3429 (defun custom-save-faces ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3430 "Save all customized faces in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3431 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3432 (custom-save-delete 'custom-set-faces)
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3433 (let ((standard-output (current-buffer))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3434 (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
3435 sort-fold-case)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3436 ;; 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
3437 (mapatoms
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3438 (lambda (symbol)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3439 (if (get symbol 'saved-face)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3440 (nconc saved-list (list symbol)))))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3441 (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
3442 ;; 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
3443 (if (memq 'default saved-list)
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3444 (setq saved-list (cons 'default (delq 'default saved-list))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3445 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3446 (princ "\n"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3447 (princ "(custom-set-faces")
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3448 (mapcar
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3449 (lambda (symbol)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3450 (let ((value (get symbol 'saved-face))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3451 (now (not (or (get 'default 'face-defface-spec)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3452 (and (not (custom-facep 'default))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3453 (not (get 'default 'force-face))))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3454 (comment (get 'default 'saved-face-comment)))
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3455 (unless (eq symbol 'default))
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3456 ;; Don't print default face here.
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3457 (princ "\n '(")
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3458 (prin1 symbol)
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3459 (princ " ")
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3460 (prin1 value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3461 (cond ((or now comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3462 (princ " ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3463 (if now
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3464 (princ "t")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3465 (princ "nil"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3466 (cond (comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3467 (princ " ")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3468 (prin1 comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3469 (princ ")"))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3470 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3471 (princ ")"))))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3472 (t
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3473 (princ ")")))))
25059
d6081fb56cda (custom-save-variables, custom-save-faces): Sort
Markus Rost <rost@math.uni-bielefeld.de>
parents: 25058
diff changeset
3474 saved-list)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3475 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3476 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3477 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3478
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3479 ;;;###autoload
18436
2163f03bb88f (customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents: 18435
diff changeset
3480 (defun customize-save-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3481 "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
3482 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3483 (mapatoms (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3484 (let ((face (get symbol 'customized-face))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3485 (value (get symbol 'customized-value))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3486 (face-comment (get symbol 'customized-face-comment))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3487 (variable-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3488 (get symbol 'customized-variable-comment)))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3489 (when face
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3490 (put symbol 'saved-face face)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3491 (put symbol 'customized-face nil))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3492 (when value
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3493 (put symbol 'saved-value value)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3494 (put symbol 'customized-value nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3495 (when variable-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3496 (put symbol 'saved-variable-comment variable-comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3497 (put symbol 'customized-variable-comment nil))
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3498 (when face-comment
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3499 (put symbol 'saved-face-comment face-comment)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3500 (put symbol 'customized-face-comment nil)))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3501 ;; We really should update all custom buffers here.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3502 (custom-save-all))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3503
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
3504 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3505 (defun custom-save-all ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3506 "Save all customizations in `custom-file'."
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3507 (let ((inhibit-read-only t))
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3508 (custom-save-variables)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3509 (custom-save-faces)
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3510 (save-excursion
20398
47f326ffb7ba (custom-save-delete, custom-save-all):
Karl Heuer <kwzh@gnu.org>
parents: 20397
diff changeset
3511 (let ((default-major-mode nil))
20974
a49aafe4e242 (custom-file): New function.
Karl Heuer <kwzh@gnu.org>
parents: 20600
diff changeset
3512 (set-buffer (find-file-noselect (custom-file))))
19022
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3513 (save-buffer))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3514
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3515 ;;; The Customize Menu.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3516
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3517 ;;; Menu support
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3518
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3519 (defcustom custom-menu-nesting 2
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3520 "Maximum nesting in custom menus."
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3521 :type 'integer
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
3522 :group 'custom-menu)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3523
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3524 (defun custom-face-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3525 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3526 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3527 `(customize-face ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3528 t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3529
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3530 (defun custom-variable-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3531 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3532 (let ((type (get symbol 'custom-type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3533 (unless (listp type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3534 (setq type (list type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3535 (if (and type (widget-get type :custom-menu))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3536 (widget-apply type :custom-menu symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3537 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3538 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3539 t))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3540
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3541 ;; Add checkboxes to boolean variable entries.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3542 (widget-put (get 'boolean 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3543 :custom-menu (lambda (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3544 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3545 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3546 ':style 'toggle
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3547 ':selected symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3548
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3549 ;; Fixme: sort out use of :filter in Emacs
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3550 (if nil ; (string-match "XEmacs" emacs-version)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3551 ;; XEmacs can create menus dynamically.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3552 (defun custom-group-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3553 "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3554 `( ,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3555 :filter (lambda (&rest junk)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3556 (cdr (custom-menu-create ',symbol)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3557 ;; But emacs can't.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3558 (defun custom-group-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3559 "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3560 ;; Limit the nesting.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3561 (let ((custom-menu-nesting (1- custom-menu-nesting)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3562 (custom-menu-create symbol))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3563
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3564 ;;;###autoload
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3565 (defun custom-menu-create (symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3566 "Create menu for customization group SYMBOL.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3567 The menu is in a format applicable to `easy-menu-define'."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3568 (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
3569 `(customize-group ',symbol)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3570 t)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3571 (if (and (or (not (boundp 'custom-menu-nesting))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3572 (>= custom-menu-nesting 0))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3573 (< (length (get symbol 'custom-group)) widget-menu-max-size))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3574 (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
3575 custom-prefix-list))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3576 (members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3577 custom-menu-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3578 custom-menu-order-groups)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3579 (custom-load-symbol symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3580 `(,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3581 ,item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3582 "--"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3583 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3584 (widget-apply (if (listp (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3585 (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3586 (list (nth 1 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3587 :custom-menu (nth 0 entry)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3588 members)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3589 item)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3590
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3591 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3592 (defun customize-menu-create (symbol &optional name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3593 "Return a customize menu for customization group SYMBOL.
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3594 If optional NAME is given, use that as the name of the menu.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3595 Otherwise the menu will be named `Customize'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3596 The format is suitable for use with `easy-menu-define'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3597 (unless name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3598 (setq name "Customize"))
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3599 ;; Fixme: sort out use of :filter in Emacs
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3600 (if nil ;(string-match "XEmacs" emacs-version)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3601 ;; We can delay it under XEmacs.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3602 `(,name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3603 :filter (lambda (&rest junk)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3604 (cdr (custom-menu-create ',symbol))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3605 ;; But we must create it now under Emacs.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3606 (cons name (cdr (custom-menu-create symbol)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3607
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3608 ;;; The Custom Mode.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3609
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3610 (defvar custom-mode-map nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3611 "Keymap for `custom-mode'.")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3612
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3613 (unless custom-mode-map
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3614 (setq custom-mode-map (make-sparse-keymap))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3615 (set-keymap-parent custom-mode-map widget-keymap)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
3616 (suppress-keymap custom-mode-map)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3617 (define-key custom-mode-map " " 'scroll-up)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3618 (define-key custom-mode-map "\177" 'scroll-down)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3619 (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
3620 (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
3621 (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
3622 (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
3623 (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
3624
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3625 (defun Custom-move-and-invoke (event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3626 "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
3627 (interactive "e")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3628 (mouse-set-point event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3629 (if (widget-event-point event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3630 (let* ((pos (widget-event-point event))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3631 (button (get-char-property pos 'button)))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3632 (if button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3633 (widget-button-click event)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3634
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3635 (easy-menu-define Custom-mode-menu
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3636 custom-mode-map
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3637 "Menu used in customization buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3638 `("Custom"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3639 ,(customize-menu-create 'customize)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3640 ["Set" Custom-set t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3641 ["Save" Custom-save t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3642 ["Reset to Current" Custom-reset-current t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3643 ["Reset to Saved" Custom-reset-saved t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3644 ["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
3645 ["Info" (Info-goto-node "(emacs)Easy Customization") t]))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3646
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3647 (defun Custom-goto-parent ()
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3648 "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
3649 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
3650 (interactive)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3651 (save-excursion
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3652 (goto-char (point-min))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3653 (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
3654 (let* ((button (get-char-property (point) 'button))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3655 (parent (downcase (widget-get button :tag))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3656 (customize-group parent)))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3657
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3658 (defcustom custom-mode-hook nil
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3659 "Hook called when entering Custom mode."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3660 :type 'hook
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
3661 :group 'custom-buffer )
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3662
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3663 (defun custom-state-buffer-message (widget)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3664 (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
3665 (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
3666
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3667 (defun custom-mode ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3668 "Major mode for editing customization buffers.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3669
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3670 The following commands are available:
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3671
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3672 Move to next button or editable field. \\[widget-forward]
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3673 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
3674 \\<widget-field-keymap>\
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3675 Complete content of editable text field. \\[widget-complete]
904dcdbb8576 Synched with 1.9951.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18856
diff changeset
3676 \\<custom-mode-map>\
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3677 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
3678 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
3679 Set all modifications. \\[Custom-set]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3680 Make all modifications default. \\[Custom-save]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3681 Reset all modified options. \\[Custom-reset-current]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3682 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
3683 Reset all options. \\[Custom-reset-standard]
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3684
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3685 Entry to this mode calls the value of `custom-mode-hook'
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3686 if that value is non-nil."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3687 (kill-all-local-variables)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3688 (setq major-mode 'custom-mode
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3689 mode-name "Custom")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3690 (use-local-map custom-mode-map)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3691 (easy-menu-add Custom-mode-menu)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3692 (make-local-variable 'custom-options)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3693 (make-local-variable 'widget-documentation-face)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3694 (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
3695 (make-local-variable 'widget-button-face)
1beba85e8c62 (custom-buffer-create-internal): New arg DESCRIPTION
Richard M. Stallman <rms@gnu.org>
parents: 18562
diff changeset
3696 (setq widget-button-face 'custom-button-face)
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3697 (set (make-local-variable 'widget-button-pressed-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3698 'custom-button-pressed-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3699 (set (make-local-variable 'widget-mouse-face)
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3700 'custom-button-pressed-face) ; buttons `depress' when moused
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3701 ;; When possible, use relief for buttons, not bracketing. This test
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3702 ;; may not be optimal.
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3703 (when custom-raised-buttons
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3704 (set (make-local-variable 'widget-push-button-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3705 (set (make-local-variable 'widget-push-button-suffix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3706 (set (make-local-variable 'widget-link-prefix) "")
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3707 (set (make-local-variable 'widget-link-suffix) ""))
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3708 (make-local-hook 'widget-edit-functions)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3709 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3710 (run-hooks 'custom-mode-hook))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3711
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3712 ;;; The End.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3713
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3714 (provide 'cus-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3715
25685
fc2bfab28ed7 Don't define-widget-keywords.
Dave Love <fx@gnu.org>
parents: 25059
diff changeset
3716 ;;; cus-edit.el ends here