annotate lisp/cus-edit.el @ 18462:0e65e5074881

(custom-magic-alist): Update messages for `modified' and `set' states.
author Richard M. Stallman <rms@gnu.org>
date Fri, 27 Jun 1997 06:09:07 +0000
parents a2be4f4ac8ed
children e22e2a4e683a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1 ;;; cus-edit.el --- Tools for customization Emacs.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
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
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
7 ;; Version: 1.9936
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
9
17521
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
10 ;; 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
11
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
12 ;; 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
13 ;; 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
14 ;; 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
15 ;; any later version.
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
16
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
17 ;; 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
18 ;; 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
19 ;; 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
20 ;; 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
21
ddce9ecc6f6a (custom-face-set): Don't copy an empty face,
Richard M. Stallman <rms@gnu.org>
parents: 17415
diff changeset
22 ;; 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
23 ;; 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
24 ;; 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
25 ;; 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
26
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
27 ;;; Commentary:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
28 ;;
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
29 ;; 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
30 ;;
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
31 ;; See `custom.el'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
32
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
33 ;; 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
34 ;; 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
35 ;; 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
36
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
37 ;;; Code:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
38
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
39 (require 'cus-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
40 (require 'wid-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
41 (require 'easymenu)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
42 (eval-when-compile (require 'cl))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
43
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
44 (condition-case nil
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
45 (require 'cus-load)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
46 (error nil))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
47
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
48 (condition-case nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
49 (require 'cus-start)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
50 (error nil))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
51
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
52 (define-widget-keywords :custom-last :custom-prefix :custom-category
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
53 :custom-prefixes :custom-menu
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
54 :custom-show
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
55 :custom-magic :custom-state :custom-level :custom-form
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
56 :custom-set :custom-save :custom-reset-current :custom-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
57 :custom-reset-standard)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
58
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
59 (put 'custom-define-hook 'custom-type 'hook)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
60 (put 'custom-define-hook 'standard-value '(nil))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
61 (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
62
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
63 ;;; Customization Groups.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
64
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
65 (defgroup emacs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
66 "Customization of the One True Editor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
67 :link '(custom-manual "(emacs)Top"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
68
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
69 ;; Most of these groups are stolen from `finder.el',
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
70 (defgroup editing nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
71 "Basic text editing facilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
72 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
73
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
74 (defgroup abbrev nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
75 "Abbreviation handling, typing shortcuts, macros."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
76 :tag "Abbreviations"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
77 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
78
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
79 (defgroup matching nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
80 "Various sorts of searching and matching."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
81 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
82
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
83 (defgroup emulations nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
84 "Emulations of other editors."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
85 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
86
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
87 (defgroup mouse nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
88 "Mouse support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
89 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
90
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
91 (defgroup outlines nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
92 "Support for hierarchical outlining."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
93 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
94
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
95 (defgroup external nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
96 "Interfacing to external utilities."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
97 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
98
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
99 (defgroup bib nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
100 "Code related to the `bib' bibliography processor."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
101 :tag "Bibliography"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
102 :group 'external)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
103
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
104 (defgroup processes nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
105 "Process, subshell, compilation, and job control support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
106 :group 'external
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
107 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
108
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
109 (defgroup programming nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
110 "Support for programming in other languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
111 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
112
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
113 (defgroup languages nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
114 "Specialized modes for editing programming languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
115 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
116
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
117 (defgroup lisp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
118 "Lisp support, including Emacs Lisp."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
119 :group 'languages
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
120 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
121
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
122 (defgroup c nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
123 "Support for the C language and related languages."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
124 :group 'languages)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
125
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
126 (defgroup tools nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
127 "Programming tools."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
128 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
129
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
130 (defgroup oop nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
131 "Support for object-oriented programming."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
132 :group 'programming)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
133
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
134 (defgroup applications nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
135 "Applications written in Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
136 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
137
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
138 (defgroup calendar nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
139 "Calendar and time management support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
140 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
141
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
142 (defgroup mail nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
143 "Modes for electronic-mail handling."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
144 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
145
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
146 (defgroup news nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
147 "Support for netnews reading and posting."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
148 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
149
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
150 (defgroup games nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
151 "Games, jokes and amusements."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
152 :group 'applications)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
153
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
154 (defgroup development nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
155 "Support for further development of Emacs."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
156 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
157
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
158 (defgroup docs nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
159 "Support for Emacs documentation."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
160 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
161
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
162 (defgroup extensions nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
163 "Emacs Lisp language extensions."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
164 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
165
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
166 (defgroup internal nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
167 "Code for Emacs internals, build process, defaults."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
168 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
169
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
170 (defgroup maint nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
171 "Maintenance aids for the Emacs development group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
172 :tag "Maintenance"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
173 :group 'development)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
174
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
175 (defgroup environment nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
176 "Fitting Emacs with its environment."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
177 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
178
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
179 (defgroup comm nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
180 "Communications, networking, remote access to files."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
181 :tag "Communication"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
182 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
183
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
184 (defgroup hardware nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
185 "Support for interfacing with exotic hardware."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
186 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
187
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
188 (defgroup terminals nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
189 "Support for terminal types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
190 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
191
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
192 (defgroup unix nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
193 "Front-ends/assistants for, or emulators of, UNIX features."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
194 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
195
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
196 (defgroup vms nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
197 "Support code for vms."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
198 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
199
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
200 (defgroup i18n nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
201 "Internationalization and alternate character-set support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
202 :group 'environment
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
203 :group 'editing)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
204
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
205 (defgroup x nil
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
206 "The X Window system."
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
207 :group 'environment)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
208
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
209 (defgroup frames nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
210 "Support for Emacs frames and window systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
211 :group 'environment)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
212
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
213 (defgroup data nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
214 "Support editing files of data."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
215 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
216
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
217 (defgroup files nil
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
218 "Support editing files."
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
219 :group 'emacs)
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
220
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
221 (defgroup wp nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
222 "Word processing."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
223 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
224
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
225 (defgroup tex nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
226 "Code related to the TeX formatter."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
227 :group 'wp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
228
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
229 (defgroup faces nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
230 "Support for multiple fonts."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
231 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
232
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
233 (defgroup hypermedia nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
234 "Support for links between text or other media types."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
235 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
236
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
237 (defgroup help nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
238 "Support for on-line help systems."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
239 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
240
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
241 (defgroup local nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
242 "Code local to your site."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
243 :group 'emacs)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
244
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
245 (defgroup customize '((widgets custom-group))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
246 "Customization of the Customization support."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
247 :link '(custom-manual "(custom)Top")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
248 :link '(url-link :tag "Development Page"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
249 "http://www.dina.kvl.dk/~abraham/custom/")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
250 :prefix "custom-"
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
251 :group 'help)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
252
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
253 (defgroup custom-faces nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
254 "Faces used by customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
255 :group 'customize
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
256 :group 'faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
257
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
258 (defgroup custom-browse nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
259 "Control customize browser."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
260 :prefix "custom-"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
261 :group 'customize)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
262
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
263 (defgroup custom-buffer nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
264 "Control customize buffers."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
265 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
266 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
267
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
268 (defgroup custom-menu nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
269 "Control customize menus."
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
270 :prefix "custom-"
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
271 :group 'customize)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
272
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
273 (defgroup abbrev-mode nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
274 "Word abbreviations mode."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
275 :group 'abbrev)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
276
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
277 (defgroup alloc nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
278 "Storage allocation and gc for GNU Emacs Lisp interpreter."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
279 :tag "Storage Allocation"
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
280 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
281
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
282 (defgroup undo nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
283 "Undoing changes in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
284 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
285
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
286 (defgroup modeline nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
287 "Content of the modeline."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
288 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
289
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
290 (defgroup fill nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
291 "Indenting and filling text."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
292 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
293
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
294 (defgroup editing-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
295 "Most basic editing facilities."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
296 :group 'editing)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
297
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
298 (defgroup display nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
299 "How characters are displayed in buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
300 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
301
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
302 (defgroup execute nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
303 "Executing external commands."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
304 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
305
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
306 (defgroup installation nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
307 "The Emacs installation."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
308 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
309
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
310 (defgroup dired nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
311 "Directory editing."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
312 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
313
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
314 (defgroup limits nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
315 "Internal Emacs limits."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
316 :group 'internal)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
317
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
318 (defgroup debug nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
319 "Debugging Emacs itself."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
320 :group 'development)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
321
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
322 (defgroup minibuffer nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
323 "Controling the behaviour of the minibuffer."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
324 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
325
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
326 (defgroup keyboard nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
327 "Input from the keyboard."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
328 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
329
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
330 (defgroup mouse nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
331 "Input from the mouse."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
332 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
333
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
334 (defgroup menu nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
335 "Input from the menus."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
336 :group 'environment)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
337
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
338 (defgroup auto-save nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
339 "Preventing accidential loss of data."
18320
bb83860447d0 (files): New group `files'.
Richard M. Stallman <rms@gnu.org>
parents: 18258
diff changeset
340 :group 'files)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
341
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
342 (defgroup processes-basics nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
343 "Basic stuff dealing with processes."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
344 :group 'processes)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
345
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
346 (defgroup mule nil
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
347 "MULE Emacs internationalization."
18053
941f5d1a241e (cus-start): Require cus-start.
Richard M. Stallman <rms@gnu.org>
parents: 18033
diff changeset
348 :group 'i18n)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
349
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
350 (defgroup windows nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
351 "Windows within a frame."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
352 :group 'environment)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
353
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
354 ;;; Utilities.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
355
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
356 (defun custom-last (x &optional n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
357 ;; Stolen from `cl.el'.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
358 "Returns the last link in the list LIST.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
359 With optional argument N, returns Nth-to-last link (default 1)."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
360 (if n
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
361 (let ((m 0) (p x))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
362 (while (consp p) (incf m) (pop p))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
363 (if (<= n 0) p
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
364 (if (< n m) (nthcdr (- m n) x) x)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
365 (while (consp (cdr x)) (pop x))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
366 x))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
367
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
368 (defun custom-quote (sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
369 "Quote SEXP iff it is not self quoting."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
370 (if (or (memq sexp '(t nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
371 (and (symbolp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
372 (eq (aref (symbol-name sexp) 0) ?:))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
373 (and (listp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
374 (memq (car sexp) '(lambda)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
375 (stringp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
376 (numberp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
377 (and (fboundp 'characterp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
378 (characterp sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
379 sexp
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
380 (list 'quote sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
381
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
382 (defun custom-split-regexp-maybe (regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
383 "If REGEXP is a string, split it to a list at `\\|'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
384 You can get the original back with from the result with:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
385 (mapconcat 'identity result \"\\|\")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
386
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
387 IF REGEXP is not a string, return it unchanged."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
388 (if (stringp regexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
389 (let ((start 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
390 all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
391 (while (string-match "\\\\|" regexp start)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
392 (setq all (cons (substring regexp start (match-beginning 0)) all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
393 start (match-end 0)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
394 (nreverse (cons (substring regexp start) all)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
395 regexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
396
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
397 (defun custom-variable-prompt ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
398 ;; Code stolen from `help.el'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
399 "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
400 Return a list suitable for use in `interactive'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
401 (let ((v (variable-at-point))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
402 (enable-recursive-minibuffers t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
403 val)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
404 (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
405 (if (symbolp v)
18131
5711f2e5a643 (custom-variable-prompt): Change prompt.
Richard M. Stallman <rms@gnu.org>
parents: 18090
diff changeset
406 (format "Customize option: (default %s) " v)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
407 "Customize variable: ")
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
408 obarray (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
409 (and (boundp symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
410 (or (get symbol 'custom-type)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
411 (user-variable-p symbol))))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
412 (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
413 (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
414 (intern val)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
415
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
416 (defun custom-menu-filter (menu widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
417 "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
418 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
419 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
420 (let ((result nil)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
421 current name action filter)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
422 (while menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
423 (setq current (car menu)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
424 name (nth 0 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
425 action (nth 1 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
426 filter (nth 2 current)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
427 menu (cdr menu))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
428 (if (or (null filter) (funcall filter widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
429 (push (cons name action) result)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
430 (push name result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
431 (nreverse result)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
432
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
433 ;;; Unlispify.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
434
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
435 (defvar custom-prefix-list nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
436 "List of prefixes that should be ignored by `custom-unlispify'")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
437
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
438 (defcustom custom-unlispify-menu-entries t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
439 "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
440 :group 'custom-menu
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
441 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
442
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
443 (defun custom-unlispify-menu-entry (symbol &optional no-suffix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
444 "Convert symbol into a menu entry."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
445 (cond ((not custom-unlispify-menu-entries)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
446 (symbol-name symbol))
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 (if no-suffix
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
449 (get symbol 'custom-tag)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
450 (concat (get symbol 'custom-tag) "...")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
451 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
452 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
453 (set-buffer (get-buffer-create " *Custom-Work*"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
454 (erase-buffer)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
455 (princ symbol (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
456 (goto-char (point-min))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
457 (when (and (eq (get symbol 'custom-type) 'boolean)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
458 (re-search-forward "-p\\'" nil t))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
459 (replace-match "" t t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
460 (goto-char (point-min)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
461 (let ((prefixes custom-prefix-list)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
462 prefix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
463 (while prefixes
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
464 (setq prefix (car prefixes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
465 (if (search-forward prefix (+ (point) (length prefix)) t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
466 (progn
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
467 (setq prefixes nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
468 (delete-region (point-min) (point)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
469 (setq prefixes (cdr prefixes)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
470 (subst-char-in-region (point-min) (point-max) ?- ?\ t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
471 (capitalize-region (point-min) (point-max))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
472 (unless no-suffix
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
473 (goto-char (point-max))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
474 (insert "..."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
475 (buffer-string)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
476
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
477 (defcustom custom-unlispify-tag-names t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
478 "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
479 :group 'custom-buffer
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
480 :type 'boolean)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
481
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
482 (defun custom-unlispify-tag-name (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
483 "Convert symbol into a menu entry."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
484 (let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
485 (custom-unlispify-menu-entry symbol t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
486
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
487 (defun custom-prefix-add (symbol prefixes)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
488 ;; Addd SYMBOL to list of ignored PREFIXES.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
489 (cons (or (get symbol 'custom-prefix)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
490 (concat (symbol-name symbol) "-"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
491 prefixes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
492
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
493 ;;; Guess.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
494
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
495 (defcustom custom-guess-name-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
496 '(("-p\\'" boolean)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
497 ("-hook\\'" hook)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
498 ("-face\\'" face)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
499 ("-file\\'" file)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
500 ("-function\\'" function)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
501 ("-functions\\'" (repeat function))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
502 ("-list\\'" (repeat sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
503 ("-alist\\'" (repeat (cons sexp sexp))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
504 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
505
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
506 MATCH should be a regexp matching the name of a symbol, and TYPE should
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
507 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
508 of the first entry where MATCH matches the name of the symbol will be
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
509 used.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
510
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
511 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
512 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
513 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
514 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
515
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
516 (defcustom custom-guess-doc-alist
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
517 '(("\\`\\*?Non-nil " boolean))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
518 "Alist of (MATCH TYPE).
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
519
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
520 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
521 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
522 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
523 matches the name of the symbol will be used.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
524
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
525 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
526 customize."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
527 :type '(repeat (group (regexp :tag "Match") (sexp :tag "Type")))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
528 :group 'customize)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
529
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
530 (defun custom-guess-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
531 "Guess a widget suitable for editing the value of SYMBOL.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
532 This is done by matching SYMBOL with `custom-guess-name-alist' and
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
533 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
534 (let ((name (symbol-name symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
535 (names custom-guess-name-alist)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
536 current found)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
537 (while names
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
538 (setq current (car names)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
539 names (cdr names))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
540 (when (string-match (nth 0 current) name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
541 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
542 names nil)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
543 (unless found
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
544 (let ((doc (documentation-property symbol 'variable-documentation))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
545 (docs custom-guess-doc-alist))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
546 (when doc
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
547 (while docs
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
548 (setq current (car docs)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
549 docs (cdr docs))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
550 (when (string-match (nth 0 current) doc)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
551 (setq found (nth 1 current)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
552 docs nil))))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
553 found))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
554
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
555 ;;; Sorting.
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
556
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
557 (defcustom custom-browse-sort-alphabetically nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
558 "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
559 :type 'boolean
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
560 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
561
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
562 (defcustom custom-browse-order-groups nil
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
563 "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
564 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
565 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
566 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
567 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
568 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
569 :group 'custom-browse)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
570
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
571 (defcustom custom-buffer-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
572 "If non-nil, sort members of each customization group alphabetically."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
573 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
574 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
575
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
576 (defcustom custom-buffer-order-groups 'last
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
577 "If non-nil, order group members within each customization group.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
578 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
579 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
580 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
581 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
582 (const :tag "none" nil))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
583 :group 'custom-buffer)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
584
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
585 (defcustom custom-menu-sort-alphabetically nil
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
586 "If non-nil, sort members of each customization group alphabetically."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
587 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
588 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
589
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
590 (defcustom custom-menu-order-groups 'first
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
591 "If non-nil, order group members within each customization group.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
592 If `first', order groups before non-groups.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
593 If `last', order groups after non-groups."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
594 :type '(choice (const first)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
595 (const last)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
596 (const :tag "none" nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
597 :group 'custom-menu)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
598
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
599 (defun custom-sort-items (items sort-alphabetically order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
600 "Return a sorted copy of ITEMS.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
601 ITEMS should be a `custom-group' property.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
602 If SORT-ALPHABETICALLY non-nil, sort alphabetically.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
603 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
604 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
605 (sort (copy-sequence items)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
606 (lambda (a b)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
607 (let ((typea (nth 1 a)) (typeb (nth 1 b))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
608 (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
609 (cond ((not order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
610 ;; 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
611 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
612 (string-lessp namea nameb)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
613 ((eq typea 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
614 ;; 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
615 (if (eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
616 (when sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
617 (string-lessp namea nameb))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
618 (eq order-groups 'first)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
619 ((eq typeb 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
620 ;; 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
621 (eq order-groups 'last))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
622 (sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
623 ;; Since A and B cannot be groups, sort.
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
624 (string-lessp namea nameb)))))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
625
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
626 ;;; Custom Mode Commands.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
627
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
628 (defvar custom-options nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
629 "Customization widgets in the current buffer.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
630
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
631 (defun Custom-set ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
632 "Set changes in all modified options."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
633 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
634 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
635 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
636 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
637 (widget-apply child :custom-set)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
638 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
639
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
640 (defun Custom-save ()
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
641 "Set all modified group members and save them."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
642 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
643 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
644 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
645 (when (memq (widget-get child :custom-state) '(modified set))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
646 (widget-apply child :custom-save)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
647 children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
648 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
649
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
650 (defvar custom-reset-menu
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
651 '(("Current" . Custom-reset-current)
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
652 ("Saved" . Custom-reset-saved)
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
653 ("Standard Settings" . Custom-reset-standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
654 "Alist of actions for the `Reset' button.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
655 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
656 lisp function taking the widget as an element which will be called
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
657 when the action is chosen.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
658
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
659 (defun custom-reset (event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
660 "Select item from reset menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
661 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
662 (answer (widget-choose "Reset to"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
663 custom-reset-menu
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
664 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
665 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
666 (funcall answer))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
667
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
668 (defun Custom-reset-current (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
669 "Reset all modified group members to their current value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
670 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
671 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
672 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
673 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
674 (widget-apply child :custom-reset-current)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
675 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
676
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
677 (defun Custom-reset-saved (&rest ignore)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
678 "Reset all modified or set group members to their saved value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
679 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
680 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
681 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
682 (when (eq (widget-get child :custom-state) 'modified)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
683 (widget-apply child :custom-reset-saved)))
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-standard (&rest ignore)
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
687 "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
688 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
689 (let ((children custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
690 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
691 (when (eq (widget-get child :custom-state) 'modified)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
692 (widget-apply child :custom-reset-standard)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
693 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
694
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
695 ;;; The Customize Commands
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
696
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
697 (defun custom-prompt-variable (prompt-var prompt-val)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
698 "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
699 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
700 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
701 the name of the variable.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
702
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
703 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
704 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
705
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
706 If the variable has a `custom-type' property, it must be a widget and the
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
707 `:prompt-value' property of that widget will be used for reading the value."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
708 (let* ((var (read-variable prompt-var))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
709 (minibuffer-help-form '(describe-variable var)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
710 (list var
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
711 (let ((prop (get var 'variable-interactive))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
712 (type (get var 'custom-type))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
713 (prompt (format prompt-val var)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
714 (unless (listp type)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
715 (setq type (list type)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
716 (cond (prop
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
717 ;; Use VAR's `variable-interactive' property
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
718 ;; as an interactive spec for prompting.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
719 (call-interactively (list 'lambda '(arg)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
720 (list 'interactive prop)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
721 'arg)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
722 (type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
723 (widget-prompt-value type
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
724 prompt
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
725 (if (boundp var)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
726 (symbol-value var))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
727 (not (boundp var))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
728 (t
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
729 (eval-minibuffer prompt)))))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
730
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
731 ;;;###autoload
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
732 (defun customize-set-value (var val)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
733 "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
734
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
735 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
736 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
737
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
738 If VARIABLE has a `custom-type' property, it must be a widget and the
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
739 `:prompt-value' property of that widget will be used for reading the value."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
740 (interactive (custom-prompt-variable "Set variable: "
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
741 "Set %s to value: "))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
742
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
743 (set var val))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
744
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
745 ;;;###autoload
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
746 (defun customize-set-variable (var val)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
747 "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
748
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
749 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
750 VARIABLE, otherwise `set-default' is used.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
751
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
752 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
753 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
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
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
759 `:prompt-value' property of that widget will be used for reading the value. "
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
760 (interactive (custom-prompt-variable "Set variable: "
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
761 "Set customized value for %s to: "))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
762 (funcall (or (get var 'custom-set) 'set-default) var val)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
763 (put var 'customized-value (list (custom-quote val))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
764
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
765 ;;;###autoload
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
766 (defun customize ()
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
767 "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
768 User options are structured into \"groups\".
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
769 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
770 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
771 (interactive)
17703
cd6ad557fb57 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17702
diff changeset
772 (customize-group 'emacs))
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
773
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
774 ;;;###autoload
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
775 (defun customize-group (group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
776 "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
777 (interactive (list (let ((completion-ignore-case t))
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
778 (completing-read "Customize group: (default emacs) "
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
779 obarray
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
780 (lambda (symbol)
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
781 (get symbol 'custom-group))
4951826c2ed2 (customize-group): Ignore case in completion.
Richard M. Stallman <rms@gnu.org>
parents: 18336
diff changeset
782 t))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
783
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
784 (when (stringp group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
785 (if (string-equal "" group)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
786 (setq group 'emacs)
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
787 (setq group (intern group))))
18359
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
788 (let ((name (format "*Customize Group: %s*"
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
789 (custom-unlispify-tag-name group))))
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
790 (if (get-buffer name)
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
791 (switch-to-buffer name)
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
792 (custom-buffer-create (list (list group 'custom-group))
057bb638549c (custom-nest-groups): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 18352
diff changeset
793 name))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
794
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
795 ;;;###autoload
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
796 (defun customize-group-other-window (symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
797 "Customize SYMBOL, which must be a customization group."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
798 (interactive (list (completing-read "Customize group: (default emacs) "
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
799 obarray
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
800 (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
801 (get symbol 'custom-group))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
802 t)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
803
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
804 (when (stringp symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
805 (if (string-equal "" symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
806 (setq symbol 'emacs)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
807 (setq symbol (intern symbol))))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
808 (custom-buffer-create-other-window
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
809 (list (list symbol 'custom-group))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
810 (format "*Customize Group: %s*" (custom-unlispify-tag-name symbol))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
811
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
812 ;;;###autoload
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
813 (defalias 'customize-variable 'customize-option)
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
814
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
815 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
816 (defun customize-option (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
817 "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
818 (interactive (custom-variable-prompt))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
819 (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
820 (format "*Customize Option: %s*"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
821 (custom-unlispify-tag-name symbol))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
822
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
823 ;;;###autoload
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
824 (defalias 'customize-variable-other-window 'customize-option-other-window)
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
825
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
826 ;;;###autoload
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
827 (defun customize-option-other-window (symbol)
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
828 "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
829 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
830 (interactive (custom-variable-prompt))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
831 (custom-buffer-create-other-window
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
832 (list (list symbol 'custom-variable))
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
833 (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
834
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
835 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
836 (defun customize-face (&optional symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
837 "Customize SYMBOL, which should be a face name or nil.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
838 If SYMBOL is nil, customize all faces."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
839 (interactive (list (completing-read "Customize face: (default all) "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
840 obarray 'custom-facep)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
841 (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
842 (custom-buffer-create (custom-sort-items
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
843 (mapcar (lambda (symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
844 (list symbol 'custom-face))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
845 (face-list))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
846 t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
847 "*Customize Faces*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
848 (when (stringp symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
849 (setq symbol (intern symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
850 (unless (symbolp symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
851 (error "Should be a symbol %S" symbol))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
852 (custom-buffer-create (list (list symbol 'custom-face))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
853 (format "*Customize Face: %s*"
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
854 (custom-unlispify-tag-name symbol)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
855
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
856 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
857 (defun customize-face-other-window (&optional symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
858 "Show customization buffer for FACE in other window."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
859 (interactive (list (completing-read "Customize face: "
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
860 obarray 'custom-facep)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
861 (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
862 ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
863 (if (stringp symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
864 (setq symbol (intern symbol)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
865 (unless (symbolp symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
866 (error "Should be a symbol %S" symbol))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
867 (custom-buffer-create-other-window
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
868 (list (list symbol 'custom-face))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
869 (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
870
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
871 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
872 (defun customize-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
873 "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
874 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
875 (let ((found nil))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
876 (mapatoms (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
877 (and (get symbol 'customized-face)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
878 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
879 (push (list symbol 'custom-face) found))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
880 (and (get symbol 'customized-value)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
881 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
882 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
883 (if (not found)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
884 (error "No customized user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
885 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
886 "*Customize Customized*"))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
887
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
888 ;;;###autoload
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
889 (defun customize-saved ()
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
890 "Customize all already saved user options."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
891 (interactive)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
892 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
893 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
894 (and (get symbol 'saved-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
895 (custom-facep symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
896 (push (list symbol 'custom-face) found))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
897 (and (get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
898 (boundp symbol)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
899 (push (list symbol 'custom-variable) found))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
900 (if (not found )
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
901 (error "No saved user options")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
902 (custom-buffer-create (custom-sort-items found t nil)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
903 "*Customize Saved*"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
904
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
905 ;;;###autoload
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
906 (defun customize-apropos (regexp &optional all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
907 "Customize all user options matching REGEXP.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
908 If ALL is `options', include only options.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
909 If ALL is `faces', include only faces.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
910 If ALL is `groups', include only groups.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
911 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
912 user-settable, as well as faces and groups."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
913 (interactive "sCustomize regexp: \nP")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
914 (let ((found nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
915 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
916 (when (string-match regexp (symbol-name symbol))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
917 (when (and (not (memq all '(faces options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
918 (get symbol 'custom-group))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
919 (push (list symbol 'custom-group) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
920 (when (and (not (memq all '(options groups)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
921 (custom-facep symbol))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
922 (push (list symbol 'custom-face) found))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
923 (when (and (not (memq all '(groups faces)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
924 (boundp symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
925 (or (get symbol 'saved-value)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
926 (get symbol 'standard-value)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
927 (if (memq all '(nil options))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
928 (user-variable-p symbol)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
929 (get symbol 'variable-documentation))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
930 (push (list symbol 'custom-variable) found)))))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
931 (if (not found)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
932 (error "No matches")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
933 (custom-buffer-create (custom-sort-items found t
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
934 custom-buffer-order-groups)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
935 "*Customize Apropos*"))))
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
936
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
937 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
938 (defun customize-apropos-options (regexp &optional arg)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
939 "Customize all user options matching REGEXP.
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
940 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
941 (interactive "sCustomize regexp: \nP")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
942 (customize-apropos regexp (or arg 'options)))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
943
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
944 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
945 (defun customize-apropos-faces (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
946 "Customize all user faces matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
947 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
948 (customize-apropos regexp 'faces))
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
949
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
950 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
951 (defun customize-apropos-groups (regexp)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
952 "Customize all user groups matching REGEXP."
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
953 (interactive "sCustomize regexp: \n")
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
954 (customize-apropos regexp 'groups))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
955
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
956 ;;; Buffer.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
957
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
958 (defcustom custom-buffer-style 'links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
959 "Control the presentation style for customization buffers.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
960 The value should be a symbol, one of:
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
961
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
962 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
963 links: groups have links to subgroups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
964 :type '(radio (const brackets)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
965 (const links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
966 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
967
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
968 (defcustom custom-buffer-indent 3
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
969 "Number of spaces to indent nested groups."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
970 :type 'integer
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
971 :group 'custom-buffer)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
972
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
973 ;;;###autoload
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
974 (defun custom-buffer-create (options &optional name)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
975 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
976 Optional NAME is the name of the buffer.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
977 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
978 SYMBOL is a customization option, and WIDGET is a widget for editing
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
979 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
980 (unless name (setq name "*Customization*"))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
981 (kill-buffer (get-buffer-create name))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
982 (switch-to-buffer (get-buffer-create name))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
983 (custom-buffer-create-internal options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
984
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
985 ;;;###autoload
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
986 (defun custom-buffer-create-other-window (options &optional name)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
987 "Create a buffer containing OPTIONS.
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
988 Optional NAME is the name of the buffer.
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
989 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
990 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
991 that option."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
992 (unless name (setq name "*Customization*"))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
993 (kill-buffer (get-buffer-create name))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
994 (let ((window (selected-window)))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
995 (switch-to-buffer-other-window (get-buffer-create name))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
996 (custom-buffer-create-internal options)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
997 (select-window window)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
998
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
999 (defcustom custom-reset-button-menu nil
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1000 "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
1001 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
1002 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1003 :group 'custom-buffer)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1004
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1005 (defun custom-buffer-create-internal (options)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1006 (message "Creating customization buffer...")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1007 (custom-mode)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1008 (widget-insert "This is a customization buffer.
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1009 Square brackets show active fields; type RET or click mouse-1
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1010 on an active field to invoke its action. Invoke ")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1011 (widget-create 'info-link
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1012 :tag "Help"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1013 :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
1014 "(emacs)Easy Customization")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1015 (widget-insert " for more information.\n\n")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1016 (message "Creating customization buttons...")
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1017 (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
1018 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1019 :tag "Set for Current Session"
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1020 :help-echo "\
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1021 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
1022 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1023 (Custom-set)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1024 (widget-insert " ")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1025 (widget-create 'push-button
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1026 :tag "Save for Future Sessions"
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1027 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1028 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
1029 :action (lambda (widget &optional event)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
1030 (Custom-save)))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1031 (if custom-reset-button-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1032 (progn
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1033 (widget-insert " ")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1034 (widget-create 'push-button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1035 :tag "Reset"
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1036 :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
1037 :mouse-down-action (lambda (&rest junk) t)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1038 :action (lambda (widget &optional event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1039 (custom-reset event))))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1040 (widget-insert "\n ")
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1041 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1042 :tag "Reset"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1043 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1044 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
1045 :action 'Custom-reset-current)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1046 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1047 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1048 :tag "Reset to Saved"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1049 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1050 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
1051 :action 'Custom-reset-saved)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1052 (widget-insert " ")
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1053 (widget-create 'push-button
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1054 :tag "Reset to Standard"
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1055 :help-echo "\
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1056 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
1057 :action 'Custom-reset-standard))
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1058 (widget-insert " ")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1059 (widget-create 'push-button
18373
45ef45c34aa4 (custom-buffer-create-internal):
Richard M. Stallman <rms@gnu.org>
parents: 18371
diff changeset
1060 :tag "Bury Buffer"
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1061 :help-echo "Bury the buffer."
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1062 :action (lambda (widget &optional event)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1063 (bury-buffer)))
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1064 (widget-insert "\n\n")
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1065 (message "Creating customization items...")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1066 (setq custom-options
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1067 (if (= (length options) 1)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1068 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1069 (widget-create (nth 1 entry)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1070 :documentation-shown t
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1071 :custom-state 'unknown
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1072 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1073 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1074 :value (nth 0 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1075 options)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1076 (let ((count 0)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1077 (length (length options)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1078 (mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1079 (prog2
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1080 (message "Creating customization items %2d%%..."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1081 (/ (* 100.0 count) length))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1082 (widget-create (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1083 :tag (custom-unlispify-tag-name
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1084 (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1085 :value (nth 0 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1086 (setq count (1+ count))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1087 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1088 (widget-insert "\n"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1089 (widget-insert "\n")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1090 options))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1091 (unless (eq (preceding-char) ?\n)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1092 (widget-insert "\n"))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1093 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1094 (mapcar 'custom-magic-reset custom-options))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1095 (message "Creating customization setup...")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1096 (widget-setup)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1097 (goto-char (point-min))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1098 (message "Creating customization buffer...done"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1099
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1100 ;;; The Tree Browser.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1101
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1102 ;;;###autoload
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1103 (defun customize-browse (group)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1104 "Create a tree browser for the customize hierarchy."
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1105 (interactive (list (let ((completion-ignore-case t))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1106 (completing-read "Customize group: (default emacs) "
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1107 obarray
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1108 (lambda (symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1109 (get symbol 'custom-group))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1110 t))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1111
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1112 (when (stringp group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1113 (if (string-equal "" group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1114 (setq group 'emacs)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1115 (setq group (intern group))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1116 (let ((name "*Customize Browser*"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1117 (kill-buffer (get-buffer-create name))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1118 (switch-to-buffer (get-buffer-create name)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1119 (custom-mode)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1120 (widget-insert "\
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1121 Invoke [+] below to expand items, and [-] to collapse items.
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1122 Invoke the [Group], [Face], and [Option] buttons below to edit that
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1123 item in another window.\n\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1124 (let ((custom-buffer-style 'tree))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1125 (widget-create 'custom-group
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1126 :custom-last t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1127 :custom-state 'unknown
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1128 :tag (custom-unlispify-tag-name group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1129 :value group))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1130 (goto-char (point-min)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1131
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1132 (define-widget 'custom-tree-visibility 'item
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1133 "Control visibility of of items in the customize tree browser."
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1134 :format "%[[%t]%]"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1135 :action 'custom-tree-visibility-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1136
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1137 (defun custom-tree-visibility-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1138 (let ((custom-buffer-style 'tree))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1139 (custom-toggle-parent widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1140
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1141 (define-widget 'custom-tree-group-tag 'push-button
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1142 "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
1143 :tag "Group"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1144 :tag-glyph "folder"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1145 :action 'custom-tree-group-tag-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1146
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1147 (defun custom-tree-group-tag-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1148 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1149 (customize-group-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1150
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1151 (define-widget 'custom-tree-variable-tag 'push-button
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1152 "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
1153 :tag "Option"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1154 :tag-glyph "option"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1155 :action 'custom-tree-variable-tag-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1156
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1157 (defun custom-tree-variable-tag-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1158 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1159 (customize-variable-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1160
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1161 (define-widget 'custom-tree-face-tag 'push-button
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1162 "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
1163 :tag "Face"
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1164 :tag-glyph "face"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1165 :action 'custom-tree-face-tag-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1166
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1167 (defun custom-tree-face-tag-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1168 (let ((parent (widget-get widget :parent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1169 (customize-face-other-window (widget-value parent))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1170
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1171 (defconst custom-tree-alist '((" " "space")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1172 (" | " "vertical")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1173 ("-\\ " "top")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1174 (" |-" "middle")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1175 (" `-" "bottom")))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1176
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1177 (defun custom-tree-insert-prefix (prefix)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1178 "Insert PREFIX. On XEmacs convert it to line graphics."
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1179 (if nil ; (string-match "XEmacs" emacs-version)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1180 (progn
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1181 (insert "*")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1182 (while (not (string-equal prefix ""))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1183 (let ((entry (substring prefix 0 3)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1184 (setq prefix (substring prefix 3))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1185 (let ((overlay (make-overlay (1- (point)) (point) nil t nil))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1186 (name (nth 1 (assoc entry custom-tree-alist))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1187 (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
1188 (overlay-put overlay 'start-open t)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1189 (overlay-put overlay 'end-open t)))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1190 (insert prefix)))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1191
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1192 ;;; Modification of Basic Widgets.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1193 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1194 ;; We add extra properties to the basic widgets needed here. This is
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1195 ;; 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
1196 ;;
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1197 ;; We want simple widgets to be displayed by default, but complex
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1198 ;; widgets to be hidden.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1199
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1200 (widget-put (get 'item 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1201 (widget-put (get 'editable-field 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1202 :custom-show (lambda (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1203 (let ((pp (pp-to-string value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1204 (cond ((string-match "\n" pp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1205 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1206 ((> (length pp) 40)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1207 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1208 (t t)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1209 (widget-put (get 'menu-choice 'widget-type) :custom-show t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1210
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1211 ;;; The `custom-manual' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1212
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1213 (define-widget 'custom-manual 'info-link
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1214 "Link to the manual entry for this customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1215 :help-echo "Read the manual entry for this option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1216 :tag "Manual")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1217
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1218 ;;; The `custom-magic' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1219
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1220 (defgroup custom-magic-faces nil
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1221 "Faces used by the magic button."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1222 :group 'custom-faces
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1223 :group 'custom-buffer)
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1224
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1225 (defface custom-invalid-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1226 (:foreground "yellow" :background "red"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1227 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1228 (:bold t :italic t :underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1229 "Face used when the customize item is invalid."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1230 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1231
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1232 (defface custom-rogue-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1233 (:foreground "pink" :background "black"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1234 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1235 (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1236 "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
1237 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1238
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1239 (defface custom-modified-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1240 (:foreground "white" :background "blue"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1241 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1242 (:italic t :bold)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1243 "Face used when the customize item has been modified."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1244 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1245
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1246 (defface custom-set-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1247 (:foreground "blue" :background "white"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1248 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1249 (:italic t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1250 "Face used when the customize item has been set."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1251 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1252
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1253 (defface custom-changed-face '((((class color))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1254 (:foreground "white" :background "blue"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1255 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1256 (:italic t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1257 "Face used when the customize item has been changed."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1258 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1259
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1260 (defface custom-saved-face '((t (:underline t)))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1261 "Face used when the customize item has been saved."
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1262 :group 'custom-magic-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1263
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1264 (defconst custom-magic-alist '((nil "#" underline "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1265 uninitialized, you should not see this.")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1266 (unknown "?" italic "\
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1267 unknown, you should not see this.")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1268 (hidden "-" default "\
18362
4655515f51cc (custom-magic-alist) <hidden>: Don't refer to "dots".
Richard M. Stallman <rms@gnu.org>
parents: 18360
diff changeset
1269 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
1270 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
1271 (invalid "x" custom-invalid-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1272 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
1273 (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
1274 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
1275 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
1276 (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
1277 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
1278 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
1279 (changed ":" custom-changed-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1280 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
1281 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
1282 (saved "!" custom-saved-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1283 this %c has been set and saved." "\
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1284 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
1285 (rogue "@" custom-rogue-face "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1286 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
1287 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
1288 (standard " " nil "\
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1289 this %c is unchanged from its standard setting." "\
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
1290 visible group members are all at standard settings."))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1291 "Alist of customize option states.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1292 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
1293
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1294 STATE is one of the following symbols:
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1295
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1296 `nil'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1297 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1298 `unknown'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1299 For internal use, should never occur.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1300 `hidden'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1301 This item is not being displayed.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1302 `invalid'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1303 This item is modified, but has an invalid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1304 `modified'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1305 This item is modified, and has a valid form.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1306 `set'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1307 This item has been set but not saved.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1308 `changed'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1309 The current value of this item has been changed temporarily.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1310 `saved'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1311 This item is marked for saving.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1312 `rogue'
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1313 This item has no customization information.
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1314 `standard'
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1315 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
1316
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1317 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
1318
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
1319 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
1320
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1321 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
1322
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1323 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
1324 left out, ITEM-DESC will be used.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1325
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1326 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
1327 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
1328
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1329 The list should be sorted most significant first.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1330
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1331 (defcustom custom-magic-show 'long
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1332 "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
1333 If `long', show a full-line description, not just one word."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1334 :type '(choice (const :tag "no" nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1335 (const short)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1336 (const long))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1337 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1338
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1339 (defcustom custom-magic-show-hidden '(option face)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1340 "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
1341 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
1342 button should be visible. Possible categories are `group', `option',
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1343 and `face'."
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1344 :type '(set (const group) (const option) (const face))
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1345 :group 'custom-buffer)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1346
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1347 (defcustom custom-magic-show-button nil
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1348 "Show a \"magic\" button indicating the state of each customization option."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1349 :type 'boolean
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
1350 :group 'custom-buffer)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1351
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1352 (define-widget 'custom-magic 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1353 "Show and manipulate state for a customization option."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1354 :format "%v"
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1355 :action 'widget-parent-action
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1356 :notify 'ignore
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1357 :value-get 'ignore
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1358 :value-create 'custom-magic-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1359 :value-delete 'widget-children-value-delete)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1360
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1361 (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
1362 ;; Non-nil unless hidden.
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1363 (not (eq (widget-get (widget-get (widget-get widget :parent) :parent)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1364 :custom-state)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1365 'hidden)))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1366
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1367 (defun custom-magic-value-create (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1368 ;; Create compact status report for WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1369 (let* ((parent (widget-get widget :parent))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1370 (state (widget-get parent :custom-state))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1371 (hidden (eq state 'hidden))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1372 (entry (assq state custom-magic-alist))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1373 (magic (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1374 (face (nth 2 entry))
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1375 (category (widget-get parent :custom-category))
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1376 (text (or (and (eq category 'group)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1377 (nth 4 entry))
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1378 (nth 3 entry)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1379 (lisp (eq (widget-get parent :custom-form) 'lisp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1380 children)
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1381 (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1382 (setq text (concat (match-string 1 text)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1383 (symbol-name category)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1384 (match-string 2 text))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1385 (when (and custom-magic-show
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1386 (or (not hidden)
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1387 (memq category custom-magic-show-hidden)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1388 (insert " ")
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1389 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1390 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1391 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1392 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1393 (widget-get parent :custom-level))))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1394 (push (widget-create-child-and-convert
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1395 widget 'choice-item
18087
05c70aa62552 Synched with 1.9903
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18086
diff changeset
1396 :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
1397 :format (if hidden "%t" "%[%t%]")
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1398 :button-prefix 'widget-push-button-prefix
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1399 :button-suffix 'widget-push-button-suffix
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1400 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1401 :tag "State")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1402 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1403 (insert ": ")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1404 (let ((start (point)))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1405 (if (eq custom-magic-show 'long)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1406 (insert text)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1407 (insert (symbol-name state)))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1408 (when lisp
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1409 (insert " (lisp)"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1410 (put-text-property start (point) 'face 'custom-state-face))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1411 (insert "\n"))
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1412 (when (and (eq category 'group)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1413 (not (and (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
1414 (> (widget-get parent :custom-level) 1))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1415 (insert-char ?\ (* custom-buffer-indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1416 (widget-get parent :custom-level))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1417 (when custom-magic-show-button
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1418 (when custom-magic-show
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1419 (let ((indent (widget-get parent :indent)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1420 (when indent
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1421 (insert-char ? indent))))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1422 (push (widget-create-child-and-convert
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1423 widget 'choice-item
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1424 :mouse-down-action 'widget-magic-mouse-down-action
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1425 :button-face face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1426 :button-prefix ""
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1427 :button-suffix ""
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1428 :help-echo "Change the state."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1429 :format (if hidden "%t" "%[%t%]")
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1430 :tag (if lisp
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1431 (concat "(" magic ")")
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1432 (concat "[" magic "]")))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1433 children)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1434 (insert " "))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1435 (widget-put widget :children children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1436
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1437 (defun custom-magic-reset (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1438 "Redraw the :custom-magic property of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1439 (let ((magic (widget-get widget :custom-magic)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1440 (widget-value-set magic (widget-value magic))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1441
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1442 ;;; The `custom' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1443
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1444 (defface custom-button-face nil
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1445 "Face used for buttons in customization buffers."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1446 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1447
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1448 (defface custom-documentation-face nil
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1449 "Face used for documentation strings in customization buffers."
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1450 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1451
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1452 (defface custom-state-face '((((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1453 (background dark))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1454 (:foreground "lime green"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1455 (((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1456 (background light))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1457 (:foreground "dark green"))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1458 (t nil))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1459 "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
1460 :group 'custom-faces)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1461
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1462 (define-widget 'custom 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1463 "Customize a user option."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1464 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1465 :convert-widget 'custom-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1466 :notify 'custom-notify
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1467 :custom-prefix ""
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1468 :custom-level 1
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1469 :custom-state 'hidden
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1470 :documentation-property 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1471 :value-create 'widget-subclass-responsibility
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1472 :value-delete 'widget-children-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1473 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1474 :validate 'widget-children-validate
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1475 :button-face 'custom-button-face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1476 :match (lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1477
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1478 (defun custom-convert-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1479 ;; Initialize :value and :tag from :args in WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1480 (let ((args (widget-get widget :args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1481 (when args
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1482 (widget-put widget :value (widget-apply widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1483 :value-to-internal (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1484 (widget-put widget :tag (custom-unlispify-tag-name (car args)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1485 (widget-put widget :args nil)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1486 widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1487
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1488 (defun custom-notify (widget &rest args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1489 "Keep track of changes."
18090
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1490 (let ((state (widget-get widget :custom-state)))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1491 (unless (eq state 'modified)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1492 (unless (memq state '(nil unknown hidden))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1493 (widget-put widget :custom-state 'modified))
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1494 (custom-magic-reset widget)
2983683a278b Synched with 1.9905
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18089
diff changeset
1495 (apply 'widget-default-notify widget args))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1496
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1497 (defun custom-redraw (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1498 "Redraw WIDGET with current settings."
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1499 (let ((line (count-lines (point-min) (point)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1500 (column (current-column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1501 (pos (point))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1502 (from (marker-position (widget-get widget :from)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1503 (to (marker-position (widget-get widget :to))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1504 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1505 (widget-value-set widget (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1506 (custom-redraw-magic widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1507 (when (and (>= pos from) (<= pos to))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1508 (condition-case nil
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1509 (progn
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1510 (if (> column 0)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1511 (goto-line line)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1512 (goto-line (1+ line)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1513 (move-to-column column))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1514 (error nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1515
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1516 (defun custom-redraw-magic (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1517 "Redraw WIDGET state with current settings."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1518 (while widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1519 (let ((magic (widget-get widget :custom-magic)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1520 (cond (magic
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1521 (widget-value-set magic (widget-value magic))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1522 (when (setq widget (widget-get widget :group))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1523 (custom-group-state-update widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1524 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1525 (setq widget nil)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1526 (widget-setup))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1527
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1528 (defun custom-show (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1529 "Non-nil if WIDGET should be shown with VALUE by default."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1530 (let ((show (widget-get widget :custom-show)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1531 (cond ((null show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1532 nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1533 ((eq t show)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1534 t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1535 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1536 (funcall show widget value)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1537
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1538 (defvar custom-load-recursion nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1539 "Hack to avoid recursive dependencies.")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1540
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1541 (defun custom-load-symbol (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1542 "Load all dependencies for SYMBOL."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1543 (unless custom-load-recursion
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1544 (let ((custom-load-recursion t)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1545 (loads (get symbol 'custom-loads))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1546 load)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1547 (while loads
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1548 (setq load (car loads)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1549 loads (cdr loads))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1550 (cond ((symbolp load)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1551 (condition-case nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1552 (require load)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1553 (error nil)))
18059
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1554 ;; Don't reload a file already loaded.
18086
dbae3eb8b351 (customize-option): Renamed from custom-variable.
Richard M. Stallman <rms@gnu.org>
parents: 18085
diff changeset
1555 ((assoc load load-history))
18059
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1556 ((assoc (locate-library load) load-history))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1557 (t
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1558 (condition-case nil
18059
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1559 ;; 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
1560 ;; 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
1561 ;; 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
1562 (or (equal load "cus-edit")
fef9a6fc0655 (custom-load-symbol): Simplify previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18053
diff changeset
1563 (load-library load))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1564 (error nil))))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1565
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1566 (defun custom-load-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1567 "Load all dependencies for WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1568 (custom-load-symbol (widget-value widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1569
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1570 (defun custom-toggle-hide (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1571 "Toggle visibility of WIDGET."
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1572 (let ((state (widget-get widget :custom-state)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1573 (cond ((memq state '(invalid modified))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1574 (error "There are unset changes"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1575 ((eq state 'hidden)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1576 (widget-put widget :custom-state 'unknown))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1577 (t
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1578 (widget-put widget :documentation-shown nil)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1579 (widget-put widget :custom-state 'hidden)))
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1580 (custom-redraw widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1581 (widget-setup)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1582
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1583 (defun custom-toggle-parent (widget &rest ignore)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1584 "Toggle visibility of parent of WIDGET."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1585 (custom-toggle-hide (widget-get widget :parent)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1586
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1587 (defun custom-add-see-also (widget &optional prefix)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1588 "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
1589 Insert PREFIX first if non-nil."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1590 (let* ((symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1591 (links (get symbol 'custom-links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1592 (many (> (length links) 2))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1593 (buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1594 (indent (widget-get widget :indent)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1595 (when links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1596 (when indent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1597 (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1598 (when prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1599 (insert prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1600 (insert "See also ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1601 (while links
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1602 (push (widget-create-child-and-convert widget (car links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1603 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1604 (setq links (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1605 (cond ((null links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1606 (insert ".\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1607 ((null (cdr links))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1608 (if many
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1609 (insert ", and ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1610 (insert " and ")))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1611 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1612 (insert ", "))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1613 (widget-put widget :buttons buttons))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1614
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1615 (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
1616 "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
1617 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
1618 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
1619 (let ((name (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1620 (type (widget-type widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1621 (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
1622 (start (point))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1623 found)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
1624 (insert (or initial-string "Parent groups:"))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1625 (mapatoms (lambda (symbol)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1626 (let ((entry (assq name (get symbol 'custom-group))))
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1627 (when (eq (nth 1 entry) type)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1628 (insert " ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1629 (push (widget-create-child-and-convert
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1630 widget 'custom-group-link
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1631 :tag (custom-unlispify-tag-name symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1632 symbol)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1633 buttons)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1634 (setq found t)))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1635 (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
1636 (if found
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1637 (insert "\n")
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1638 (delete-region start (point)))
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
1639 found))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1640
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1641 ;;; The `custom-variable' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1642
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1643 (defface custom-variable-tag-face '((((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1644 (background dark))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1645 (:foreground "light blue" :underline t))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1646 (((class color)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1647 (background light))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1648 (:foreground "blue" :underline t))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1649 (t (:underline t)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1650 "Face used for unpushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1651 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1652
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1653 (defface custom-variable-button-face '((t (:underline t :bold t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1654 "Face used for pushable variable tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1655 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1656
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1657 (define-widget 'custom-variable 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1658 "Customize variable."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1659 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1660 :help-echo "Set or reset this variable."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1661 :documentation-property 'variable-documentation
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
1662 :custom-category 'option
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1663 :custom-state nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1664 :custom-menu 'custom-variable-menu-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1665 :custom-form 'edit
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1666 :value-create 'custom-variable-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1667 :action 'custom-variable-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1668 :custom-set 'custom-variable-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1669 :custom-save 'custom-variable-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1670 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1671 :custom-reset-saved 'custom-variable-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1672 :custom-reset-standard 'custom-variable-reset-standard)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1673
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1674 (defun custom-variable-type (symbol)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1675 "Return a widget suitable for editing the value of SYMBOL.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1676 If SYMBOL has a `custom-type' property, use that.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1677 Otherwise, look up symbol in `custom-guess-type-alist'."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1678 (let* ((type (or (get symbol 'custom-type)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1679 (and (not (get symbol 'standard-value))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1680 (custom-guess-type symbol))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1681 'sexp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1682 (options (get symbol 'custom-options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1683 (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
1684 (copy-sequence type)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1685 (list type))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1686 (when options
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1687 (widget-put tmp :options options))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1688 tmp))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1689
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1690 (defun custom-variable-value-create (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1691 "Here is where you edit the variables value."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1692 (custom-load-widget widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1693 (let* ((buttons (widget-get widget :buttons))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1694 (children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1695 (form (widget-get widget :custom-form))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1696 (state (widget-get widget :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1697 (symbol (widget-get widget :value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1698 (tag (widget-get widget :tag))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
1699 (type (custom-variable-type symbol))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1700 (conv (widget-convert type))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1701 (get (or (get symbol 'custom-get) 'default-value))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1702 (prefix (widget-get widget :custom-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1703 (last (widget-get widget :custom-last))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1704 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1705 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1706 (widget-get conv :value))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1707 ;; If the widget is new, the child determine whether it is hidden.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1708 (cond (state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1709 ((custom-show type value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1710 (setq state 'unknown))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1711 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1712 (setq state 'hidden)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1713 ;; 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
1714 (when (eq state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1715 (unless (widget-apply conv :match value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1716 ;; (widget-apply (widget-convert type) :match value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1717 (setq form 'lisp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1718 ;; Now we can create the child widget.
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1719 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
1720 (insert prefix (if last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1721 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1722 widget 'custom-tree-variable-tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1723 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1724 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1725 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1726 ((eq state 'hidden)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1727 ;; Indicate hidden value.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1728 (push (widget-create-child-and-convert
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1729 widget 'item
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1730 :format "%{%t%}: "
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1731 :sample-face 'custom-variable-tag-face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1732 :tag tag
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1733 :parent widget)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1734 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1735 (push (widget-create-child-and-convert
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1736 widget 'visibility
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1737 :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
1738 :action 'custom-toggle-parent
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1739 nil)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1740 buttons))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1741 ((eq form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1742 ;; In lisp mode edit the saved value when possible.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1743 (let* ((value (cond ((get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1744 (car (get symbol 'saved-value)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1745 ((get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1746 (car (get symbol 'standard-value)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1747 ((default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1748 (custom-quote (funcall get symbol)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1749 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1750 (custom-quote (widget-get conv :value))))))
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1751 (insert (symbol-name symbol) ": ")
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1752 (push (widget-create-child-and-convert
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1753 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1754 :help-echo "Hide the value of this option."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1755 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1756 t)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1757 buttons)
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1758 (insert " ")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1759 (push (widget-create-child-and-convert
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1760 widget 'sexp
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1761 :button-face 'custom-variable-button-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1762 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1763 :tag (symbol-name symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1764 :parent widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1765 :value value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1766 children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1767 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1768 ;; Edit mode.
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1769 (let* ((format (widget-get type :format))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1770 tag-format value-format)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1771 (unless (string-match ":" format)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1772 (error "Bad format."))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1773 (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
1774 (setq value-format (substring format (match-end 0)))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1775 (push (widget-create-child-and-convert
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1776 widget 'item
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1777 :format tag-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1778 :action 'custom-tag-action
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1779 :help-echo "Change value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1780 :mouse-down-action 'custom-tag-mouse-down-action
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1781 :button-face 'custom-variable-button-face
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
1782 :sample-face 'custom-variable-tag-face
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1783 tag)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1784 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1785 (insert " ")
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1786 (push (widget-create-child-and-convert
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1787 widget 'visibility
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1788 :help-echo "Hide the value of this option."
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1789 :action 'custom-toggle-parent
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1790 t)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1791 buttons)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1792 (push (widget-create-child-and-convert
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1793 widget type
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1794 :format value-format
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1795 :value value)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1796 children))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1797 (unless (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1798 ;; Now update the state.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1799 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1800 (widget-insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1801 (if (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1802 (widget-put widget :custom-state state)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1803 (custom-variable-state-set widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1804 ;; Create the magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1805 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1806 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1807 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1808 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1809 ;; Update properties.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1810 (widget-put widget :custom-form form)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1811 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1812 (widget-put widget :children children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1813 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1814 (widget-default-format-handler widget ?h)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1815 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1816 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1817 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1818 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
1819 (custom-add-see-also widget)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1820
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1821 (defun custom-tag-action (widget &rest args)
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1822 "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
1823 (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
1824 :action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1825
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1826 (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
1827 "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
1828 (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
1829 :mouse-down-action args))
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
1830
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1831 (defun custom-variable-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1832 "Set the state of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1833 (let* ((symbol (widget-value widget))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1834 (get (or (get symbol 'custom-get) 'default-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1835 (value (if (default-boundp symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1836 (funcall get symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1837 (widget-get widget :value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1838 tmp
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1839 (state (cond ((setq tmp (get symbol 'customized-value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1840 (if (condition-case nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1841 (equal value (eval (car tmp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1842 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1843 'set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1844 'changed))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1845 ((setq tmp (get symbol 'saved-value))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1846 (if (condition-case nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1847 (equal value (eval (car tmp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1848 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1849 'saved
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1850 'changed))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1851 ((setq tmp (get symbol 'standard-value))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1852 (if (condition-case nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1853 (equal value (eval (car tmp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1854 (error nil))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1855 'standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1856 'changed))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1857 (t 'rogue))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1858 (widget-put widget :custom-state state)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1859
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1860 (defvar custom-variable-menu
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
1861 '(("Set for Current Session" custom-variable-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1862 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1863 (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
1864 ("Save for Future Sessions" custom-variable-save
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1865 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1866 (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
1867 ("Reset to Current" custom-redraw
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1868 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1869 (and (default-boundp (widget-value widget))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1870 (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
1871 ("Reset to Saved" custom-variable-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1872 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1873 (and (get (widget-value widget) 'saved-value)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1874 (memq (widget-get widget :custom-state)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1875 '(modified set changed rogue)))))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1876 ("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
1877 (lambda (widget)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1878 (and (get (widget-value widget) 'standard-value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1879 (memq (widget-get widget :custom-state)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1880 '(modified set changed saved rogue)))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1881 ("---" ignore ignore)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1882 ("Don't show as Lisp expression" custom-variable-edit
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1883 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1884 (not (eq (widget-get widget :custom-form) 'edit))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1885 ("Show as Lisp expression" custom-variable-edit-lisp
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1886 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
1887 (not (eq (widget-get widget :custom-form) 'lisp)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1888 "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
1889 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
1890 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
1891 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
1892 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
1893 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1894
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1895 (defun custom-variable-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1896 "Show the menu for `custom-variable' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1897 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1898 (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
1899 (custom-toggle-hide widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1900 (unless (eq (widget-get widget :custom-state) 'modified)
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1901 (custom-variable-state-set widget))
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
1902 (custom-redraw-magic widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1903 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1904 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1905 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1906 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1907 (custom-menu-filter custom-variable-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1908 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1909 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1910 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1911 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1912
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1913 (defun custom-variable-edit (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1914 "Edit value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1915 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1916 (widget-put widget :custom-form 'edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1917 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1918
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1919 (defun custom-variable-edit-lisp (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1920 "Edit the lisp representation of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1921 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1922 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1923 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1924
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1925 (defun custom-variable-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1926 "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
1927 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1928 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1929 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1930 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1931 (set (or (get symbol 'custom-set) 'set-default))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1932 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1933 (cond ((eq state 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1934 (error "Cannot set hidden variable."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1935 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1936 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1937 (error "%s" (widget-get val :error)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1938 ((eq form 'lisp)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1939 (funcall set symbol (eval (setq val (widget-value child))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1940 (put symbol 'customized-value (list val)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1941 (t
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1942 (funcall set symbol (setq val (widget-value child)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1943 (put symbol 'customized-value (list (custom-quote val)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1944 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1945 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1946
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1947 (defun custom-variable-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1948 "Set the default 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
1949 (let* ((form (widget-get widget :custom-form))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1950 (state (widget-get widget :custom-state))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1951 (child (car (widget-get widget :children)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1952 (symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1953 (set (or (get symbol 'custom-set) 'set-default))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1954 val)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1955 (cond ((eq state 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1956 (error "Cannot set hidden variable."))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1957 ((setq val (widget-apply child :validate))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1958 (goto-char (widget-get val :from))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1959 (error "%s" (widget-get val :error)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1960 ((eq form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1961 (put symbol 'saved-value (list (widget-value child)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1962 (funcall set symbol (eval (widget-value child))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1963 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1964 (put symbol
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1965 'saved-value (list (custom-quote (widget-value
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1966 child))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1967 (funcall set symbol (widget-value child))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1968 (put symbol 'customized-value nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1969 (custom-save-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1970 (custom-variable-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1971 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1972
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1973 (defun custom-variable-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1974 "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
1975 (let* ((symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1976 (set (or (get symbol 'custom-set) 'set-default)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1977 (if (get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1978 (condition-case nil
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1979 (funcall set symbol (eval (car (get symbol 'saved-value))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1980 (error nil))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1981 (error "No saved value for %s" symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1982 (put symbol 'customized-value nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1983 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1984 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1985
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1986 (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
1987 "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
1988 (let* ((symbol (widget-value widget))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
1989 (set (or (get symbol 'custom-set) 'set-default)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1990 (if (get symbol 'standard-value)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
1991 (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
1992 (error "No standard setting known for %S" symbol))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1993 (put symbol 'customized-value nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1994 (when (get symbol 'saved-value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1995 (put symbol 'saved-value nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1996 (custom-save-all))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1997 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1998 (custom-redraw widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1999
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2000 ;;; The `custom-face-edit' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2001
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2002 (define-widget 'custom-face-edit 'checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2003 "Edit face attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2004 :format "%t: %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2005 :tag "Attributes"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2006 :extra-offset 12
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2007 :button-args '(:help-echo "Control whether this attribute have any effect.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2008 :args (mapcar (lambda (att)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2009 (list 'group
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2010 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2011 :sibling-args (widget-get (nth 1 att) :sibling-args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2012 (list 'const :format "" :value (nth 0 att))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2013 (nth 1 att)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2014 custom-face-attributes))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2015
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2016 ;;; The `custom-display' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2017
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2018 (define-widget 'custom-display 'menu-choice
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2019 "Select a display type."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2020 :tag "Display"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2021 :value t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2022 :help-echo "Specify frames where the face attributes should be used."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2023 :args '((const :tag "all" t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2024 (checklist
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2025 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2026 :extra-offset 9
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2027 :args ((group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2028 Only match the specified window systems.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2029 (const :format "Type: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2030 type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2031 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2032 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2033 (const :format "X "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2034 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2035 The X11 Window System.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2036 x)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2037 (const :format "PM "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2038 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2039 OS/2 Presentation Manager.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2040 pm)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2041 (const :format "Win32 "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2042 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2043 Windows NT/95/97.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2044 win32)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2045 (const :format "DOS "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2046 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2047 Plain MS-DOS.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2048 pc)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2049 (const :format "TTY%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2050 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2051 Plain text terminals.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2052 tty)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2053 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2054 Only match the frames with the specified color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2055 (const :format "Class: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2056 class)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2057 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2058 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2059 (const :format "Color "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2060 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2061 Match color frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2062 color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2063 (const :format "Grayscale "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2064 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2065 Match grayscale frames.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2066 grayscale)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2067 (const :format "Monochrome%n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2068 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2069 Match frames with no color support.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2070 mono)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2071 (group :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2072 Only match frames with the specified intensity.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2073 (const :format "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2074 Background brightness: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2075 background)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2076 (checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2077 :offset 0
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2078 (const :format "Light "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2079 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2080 Match frames with light backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2081 light)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2082 (const :format "Dark\n"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2083 :sibling-args (:help-echo "\
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2084 Match frames with dark backgrounds.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2085 dark)))))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2086
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2087 ;;; The `custom-face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2088
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2089 (defface custom-face-tag-face '((t (:underline t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2090 "Face used for face tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2091 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2092
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2093 (define-widget 'custom-face 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2094 "Customize face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2095 :sample-face 'custom-face-tag-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2096 :help-echo "Set or reset this face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2097 :documentation-property '(lambda (face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2098 (face-doc-string face))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2099 :value-create 'custom-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2100 :action 'custom-face-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2101 :custom-category 'face
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2102 :custom-form 'selected
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2103 :custom-set 'custom-face-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2104 :custom-save 'custom-face-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2105 :custom-reset-current 'custom-redraw
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2106 :custom-reset-saved 'custom-face-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2107 :custom-reset-standard 'custom-face-reset-standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2108 :custom-menu 'custom-face-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2109
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2110 (define-widget 'custom-face-all 'editable-list
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2111 "An editable list of display specifications and attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2112 :entry-format "%i %d %v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2113 :insert-button-args '(:help-echo "Insert new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2114 :append-button-args '(:help-echo "Append new display specification here.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2115 :delete-button-args '(:help-echo "Delete this display specification.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2116 :args '((group :format "%v" custom-display custom-face-edit)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2117
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2118 (defconst custom-face-all (widget-convert 'custom-face-all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2119 "Converted version of the `custom-face-all' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2120
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2121 (define-widget 'custom-display-unselected 'item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2122 "A display specification that doesn't match the selected display."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2123 :match 'custom-display-unselected-match)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2124
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2125 (defun custom-display-unselected-match (widget value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2126 "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
2127 (not (face-spec-set-match-display value (selected-frame))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2128
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2129 (define-widget 'custom-face-selected 'group
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2130 "Edit the attributes of the selected display in a face specification."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2131 :args '((repeat :format ""
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2132 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2133 (group custom-display-unselected sexp))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2134 (group (sexp :format "") custom-face-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2135 (repeat :format ""
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2136 :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2137 sexp)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2138
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2139 (defconst custom-face-selected (widget-convert 'custom-face-selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2140 "Converted version of the `custom-face-selected' widget.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2141
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2142 (defun custom-face-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2143 "Create a list of the display specifications for WIDGET."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2144 (let ((buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2145 (symbol (widget-get widget :value))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2146 (tag (widget-get widget :tag))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2147 (state (widget-get widget :custom-state))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2148 (begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2149 (is-last (widget-get widget :custom-last))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2150 (prefix (widget-get widget :custom-prefix)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2151 (unless tag
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2152 (setq tag (prin1-to-string symbol)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2153 (cond ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2154 (insert prefix (if is-last " `--- " " |--- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2155 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2156 widget 'custom-tree-face-tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2157 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2158 (insert " " tag "\n")
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 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2161 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2162 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2163 (if (eq custom-buffer-style 'face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2164 (insert " ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2165 (widget-specify-sample widget begin (point))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2166 (insert ": "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2167 ;; Sample.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2168 (and (string-match "XEmacs" emacs-version)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2169 ;; XEmacs cannot display uninitialized faces.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2170 (not (custom-facep symbol))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2171 (copy-face 'custom-face-empty symbol))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2172 (push (widget-create-child-and-convert widget 'item
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2173 :format "(%{%t%})"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2174 :sample-face symbol
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2175 :tag "sample")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2176 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2177 ;; Visibility.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2178 (insert " ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2179 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2180 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2181 :help-echo "Hide or show this face."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2182 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2183 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2184 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2185 ;; Magic.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2186 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2187 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2188 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2189 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2190 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2191 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2192 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2193 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2194 (widget-default-format-handler widget ?h)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2195 ;; See also.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2196 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2197 (when (eq (widget-get widget :custom-level) 1)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2198 (custom-add-parent-links widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2199 (custom-add-see-also widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2200 ;; Editor.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2201 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2202 (insert "\n"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2203 (unless (eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2204 (message "Creating face editor...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2205 (custom-load-widget widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2206 (let* ((symbol (widget-value widget))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2207 (spec (or (get symbol 'saved-face)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2208 (get symbol 'face-defface-spec)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2209 ;; Attempt to construct it.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2210 (list (list t (custom-face-attributes-get
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2211 symbol (selected-frame))))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2212 (form (widget-get widget :custom-form))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2213 (indent (widget-get widget :indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2214 (edit (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2215 widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2216 (cond ((and (eq form 'selected)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2217 (widget-apply custom-face-selected
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2218 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2219 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2220 'custom-face-selected)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2221 ((and (not (eq form 'lisp))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2222 (widget-apply custom-face-all
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2223 :match spec))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2224 'custom-face-all)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2225 (t
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2226 (when indent (insert-char ?\ indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2227 'sexp))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2228 :value spec)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2229 (custom-face-state-set widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2230 (widget-put widget :children (list edit)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2231 (message "Creating face editor...done"))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2232
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2233 (defvar custom-face-menu
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2234 '(("Set" custom-face-set)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2235 ("Save" custom-face-save)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2236 ("Reset to Saved" custom-face-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2237 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2238 (get (widget-value widget) 'saved-face)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2239 ("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
2240 (lambda (widget)
18258
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2241 (get (widget-value widget) 'face-defface-spec)))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2242 ("---" ignore ignore)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2243 ("Show all display specs" custom-face-edit-all
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2244 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2245 (not (eq (widget-get widget :custom-form) 'all))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2246 ("Just current attributes" custom-face-edit-selected
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2247 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2248 (not (eq (widget-get widget :custom-form) 'selected))))
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2249 ("Show as Lisp expression" custom-face-edit-lisp
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2250 (lambda (widget)
e83bc8150072 Synched with 1.9920.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18244
diff changeset
2251 (not (eq (widget-get widget :custom-form) 'lisp)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2252 "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
2253 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
2254 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
2255 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
2256 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
2257 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2258
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2259 (defun custom-face-edit-selected (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2260 "Edit selected attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2261 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2262 (widget-put widget :custom-form 'selected)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2263 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2264
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2265 (defun custom-face-edit-all (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2266 "Edit all attributes of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2267 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2268 (widget-put widget :custom-form 'all)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2269 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2270
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2271 (defun custom-face-edit-lisp (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2272 "Edit the lisp representation of the value of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2273 (widget-put widget :custom-state 'unknown)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2274 (widget-put widget :custom-form 'lisp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2275 (custom-redraw widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2276
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2277 (defun custom-face-state-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2278 "Set the state of WIDGET."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2279 (let ((symbol (widget-value widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2280 (widget-put widget :custom-state (cond ((get symbol 'customized-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2281 'set)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2282 ((get symbol 'saved-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2283 'saved)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2284 ((get symbol 'face-defface-spec)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2285 'standard)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2286 (t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2287 'rogue)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2288
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2289 (defun custom-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2290 "Show the menu for `custom-face' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2291 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2292 (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
2293 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2294 (let* ((completion-ignore-case t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2295 (symbol (widget-get widget :value))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2296 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2297 (custom-unlispify-tag-name symbol))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2298 (custom-menu-filter custom-face-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2299 widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2300 event)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2301 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2302 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2303
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2304 (defun custom-face-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2305 "Make the face attributes in WIDGET take effect."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2306 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2307 (child (car (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2308 (value (widget-value child)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2309 (put symbol 'customized-face value)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2310 (face-spec-set symbol value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2311 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2312 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2313
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2314 (defun custom-face-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2315 "Make the face attributes in WIDGET default."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2316 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2317 (child (car (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2318 (value (widget-value child)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2319 (face-spec-set symbol value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2320 (put symbol 'saved-face value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2321 (put symbol 'customized-face nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2322 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2323 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2324
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2325 (defun custom-face-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2326 "Restore WIDGET to the face's default attributes."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2327 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2328 (child (car (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2329 (value (get symbol 'saved-face)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2330 (unless value
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2331 (error "No saved value for this face"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2332 (put symbol 'customized-face nil)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2333 (face-spec-set symbol value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2334 (widget-value-set child value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2335 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2336 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2337
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2338 (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
2339 "Restore WIDGET to the face's standard settings."
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2340 (let* ((symbol (widget-value widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2341 (child (car (widget-get widget :children)))
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2342 (value (get symbol 'face-defface-spec)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2343 (unless value
17641
4650d25e48f6 Say "standard settings" instead of "factory settings".
Richard M. Stallman <rms@gnu.org>
parents: 17550
diff changeset
2344 (error "No standard setting for this face"))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2345 (put symbol 'customized-face nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2346 (when (get symbol 'saved-face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2347 (put symbol 'saved-face nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2348 (custom-save-all))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2349 (face-spec-set symbol value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2350 (widget-value-set child value)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2351 (custom-face-state-set widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2352 (custom-redraw-magic widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2353
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2354 ;;; The `face' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2355
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2356 (define-widget 'face 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2357 "Select and customize a face."
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2358 :convert-widget 'widget-value-convert-widget
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2359 :button-prefix 'widget-push-button-prefix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2360 :button-suffix 'widget-push-button-suffix
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2361 :format "%t: %[select face%] %v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2362 :tag "Face"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2363 :value 'default
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2364 :value-create 'widget-face-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2365 :value-delete 'widget-face-value-delete
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2366 :value-get 'widget-value-value-get
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2367 :validate 'widget-children-validate
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2368 :action 'widget-face-action
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2369 :match '(lambda (widget value) (symbolp value)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2370
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2371 (defun widget-face-value-create (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2372 ;; Create a `custom-face' child.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2373 (let* ((symbol (widget-value widget))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2374 (custom-buffer-style 'face)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2375 (child (widget-create-child-and-convert
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2376 widget 'custom-face
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2377 :custom-level nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2378 :value symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2379 (custom-magic-reset child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2380 (setq custom-options (cons child custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2381 (widget-put widget :children (list child))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2382
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2383 (defun widget-face-value-delete (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2384 ;; Remove the child from the options.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2385 (let ((child (car (widget-get widget :children))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2386 (setq custom-options (delq child custom-options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2387 (widget-children-value-delete widget)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2388
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2389 (defvar face-history nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2390 "History of entered face names.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2391
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2392 (defun widget-face-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2393 "Prompt for a face."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2394 (let ((answer (completing-read "Face: "
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2395 (mapcar (lambda (face)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2396 (list (symbol-name face)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2397 (face-list))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2398 nil nil nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2399 'face-history)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2400 (unless (zerop (length answer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2401 (widget-value-set widget (intern answer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2402 (widget-apply widget :notify widget event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2403 (widget-setup))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2404
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2405 ;;; The `hook' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2406
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2407 (define-widget 'hook 'list
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2408 "A emacs lisp hook"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2409 :convert-widget 'custom-hook-convert-widget
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2410 :tag "Hook")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2411
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2412 (defun custom-hook-convert-widget (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2413 ;; Handle `:custom-options'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2414 (let* ((options (widget-get widget :options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2415 (other `(editable-list :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2416 :entry-format "%i %d%v"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2417 (function :format " %v")))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2418 (args (if options
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2419 (list `(checklist :inline t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2420 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2421 `(function-item ,entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2422 options))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2423 other)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2424 (list other))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2425 (widget-put widget :args args)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2426 widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2427
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2428 ;;; The `custom-group-link' Widget.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2429
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2430 (define-widget 'custom-group-link 'link
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2431 "Show parent in other window when activated."
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2432 :help-echo "Create customization buffer for this group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2433 :action 'custom-group-link-action)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2434
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2435 (defun custom-group-link-action (widget &rest ignore)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2436 (customize-group (widget-value widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2437
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2438 ;;; The `custom-group' Widget.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2439
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2440 (defcustom custom-group-tag-faces nil
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2441 ;; In XEmacs, this ought to play games with font size.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2442 "Face used for group tags.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2443 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
2444 and so forth. The remaining group tags are shown with
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2445 `custom-group-tag-face'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2446 :type '(repeat face)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2447 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2448
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2449 (defface custom-group-tag-face-1 '((((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2450 (background dark))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2451 (:foreground "pink" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2452 (((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2453 (background light))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2454 (:foreground "red" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2455 (t (:underline t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2456 "Face used for group tags.")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2457
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2458 (defface custom-group-tag-face '((((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2459 (background dark))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2460 (:foreground "light blue" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2461 (((class color)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2462 (background light))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2463 (:foreground "blue" :underline t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2464 (t (:underline t)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2465 "Face used for low level group tags."
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2466 :group 'custom-faces)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2467
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2468 (define-widget 'custom-group 'custom
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2469 "Customize group."
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2470 :format "%v"
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2471 :sample-face-get 'custom-group-sample-face-get
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2472 :documentation-property 'group-documentation
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2473 :help-echo "Set or reset all members of this group."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2474 :value-create 'custom-group-value-create
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2475 :action 'custom-group-action
18089
bb0e09c8ada3 Synched with 1.9904
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18087
diff changeset
2476 :custom-category 'group
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2477 :custom-set 'custom-group-set
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2478 :custom-save 'custom-group-save
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2479 :custom-reset-current 'custom-group-reset-current
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2480 :custom-reset-saved 'custom-group-reset-saved
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2481 :custom-reset-standard 'custom-group-reset-standard
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2482 :custom-menu 'custom-group-menu-create)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2483
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2484 (defun custom-group-sample-face-get (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2485 ;; Use :sample-face.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2486 (or (nth (1- (widget-get widget :custom-level)) custom-group-tag-faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2487 'custom-group-tag-face))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2488
18430
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2489 (define-widget 'custom-group-visibility 'visibility
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2490 "An indicator and manipulator for hidden group contents."
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2491 :create 'custom-group-visibility-create)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2492
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2493 (defun custom-group-visibility-create (widget)
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2494 (let ((visible (widget-value widget)))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2495 (if visible
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2496 (insert "--------")))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2497 (widget-default-create widget))
a8ae9c653696 (custom-group-visibility): Widget type
Richard M. Stallman <rms@gnu.org>
parents: 18373
diff changeset
2498
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2499 (defun custom-group-value-create (widget)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2500 "Insert a customize group for WIDGET in the current buffer."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2501 (let ((state (widget-get widget :custom-state))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2502 (level (widget-get widget :custom-level))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2503 (indent (widget-get widget :indent))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2504 (prefix (widget-get widget :custom-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2505 (buttons (widget-get widget :buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2506 (tag (widget-get widget :tag))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2507 (symbol (widget-value widget)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2508 (cond ((and (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2509 (eq state 'hidden))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2510 (custom-tree-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2511 (push (widget-create-child-and-convert
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2512 widget 'custom-tree-visibility
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2513 ;; :tag-glyph "plus"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2514 :tag "+")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2515 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2516 (insert "-- ")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2517 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2518 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2519 widget 'custom-tree-group-tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2520 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2521 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2522 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2523 ((and (eq custom-buffer-style 'tree)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2524 (zerop (length (get symbol 'custom-group))))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2525 (custom-tree-insert-prefix prefix)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2526 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2527 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2528 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2529 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2530 widget 'custom-tree-group-tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2531 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2532 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2533 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2534 ((eq custom-buffer-style 'tree)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2535 (custom-tree-insert-prefix prefix)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2536 (custom-load-widget widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2537 (if (zerop (length (get symbol 'custom-group)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2538 (progn
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2539 (custom-tree-insert-prefix prefix)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2540 (insert "[ ]-- ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2541 ;; (widget-glyph-insert nil "[ ]" "empty")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2542 ;; (widget-glyph-insert nil "-- " "horizontal")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2543 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2544 widget 'custom-tree-group-tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2545 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2546 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2547 (widget-put widget :buttons buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2548 (push (widget-create-child-and-convert
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2549 widget 'custom-tree-visibility
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2550 ;; :tag-glyph "minus"
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2551 :tag "-")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2552 buttons)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2553 (insert "-\\ ")
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2554 ;; (widget-glyph-insert nil "-\\ " "top")
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2555 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2556 widget 'custom-tree-group-tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2557 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2558 (insert " " tag "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2559 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2560 (message "Creating group...")
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2561 (let* ((members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2562 custom-browse-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2563 custom-browse-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2564 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2565 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2566 (length (length members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2567 (extra-prefix (if (widget-get widget :custom-last)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2568 " "
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2569 " | "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2570 (prefix (concat prefix extra-prefix))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2571 children entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2572 (while members
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2573 (setq entry (car members)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2574 members (cdr members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2575 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2576 widget (nth 1 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2577 :group widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2578 :tag (custom-unlispify-tag-name
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2579 (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2580 :custom-prefixes custom-prefix-list
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2581 :custom-level (1+ level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2582 :custom-last (null members)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2583 :value (nth 0 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2584 :custom-prefix prefix)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2585 children))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2586 (widget-put widget :children (reverse children)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2587 (message "Creating group...done")))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2588 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2589 ((eq state 'hidden)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2590 ;; Create level indicator.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2591 (unless (eq custom-buffer-style 'links)
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2592 (insert-char ?\ (* custom-buffer-indent (1- level)))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2593 (insert "-- "))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2594 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2595 (let ((begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2596 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2597 (widget-specify-sample widget begin (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2598 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2599 ;; Create link/visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2600 (if (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2601 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2602 widget 'custom-group-link
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
2603 :tag "Go to Group"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2604 symbol)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2605 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2606 (push (widget-create-child-and-convert
18368
14b3e7eb6a17 (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18367
diff changeset
2607 widget 'group-visibility
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2608 :help-echo "Show members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2609 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2610 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2611 buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2612 (insert " \n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2613 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2614 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2615 widget 'custom-magic nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2616 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2617 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2618 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2619 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2620 ;; Insert documentation.
18367
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2621 (if (and (eq custom-buffer-style 'links) (> level 1))
f4682a047be1 (custom-magic-value-create):
Richard M. Stallman <rms@gnu.org>
parents: 18364
diff changeset
2622 (widget-put widget :documentation-indent 0))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2623 (widget-default-format-handler widget ?h))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2624 ;; Nested style.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2625 (t ;Visible.
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
2626 ;; 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
2627 (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
2628 ;;; 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
2629 (when (eq level 1)
18371
a32f9b2c2e0c (custom-add-parent-links): New arg INITIAL-STRING.
Richard M. Stallman <rms@gnu.org>
parents: 18370
diff changeset
2630 (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
2631 "Go to parent group:")
18370
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
2632 (insert "\n"))))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2633 ;; Create level indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2634 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2635 (insert "/- ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2636 ;; Create tag.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2637 (let ((start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2638 (insert tag)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2639 (widget-specify-sample widget start (point)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2640 (insert " group: ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2641 ;; Create visibility indicator.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2642 (unless (eq custom-buffer-style 'links)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2643 (insert "--------")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2644 (push (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2645 widget 'visibility
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2646 :help-echo "Hide members of this group."
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2647 :action 'custom-toggle-parent
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2648 (not (eq state 'hidden)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2649 buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2650 (insert " "))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2651 ;; Create more dashes.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2652 ;; Use 76 instead of 75 to compensate for the temporary "<"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2653 ;; added by `widget-insert'.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2654 (insert-char ?- (- 76 (current-column)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2655 (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2656 (insert "\\\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2657 ;; Create magic button.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2658 (let ((magic (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2659 widget 'custom-magic
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2660 :indent 0
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2661 nil)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2662 (widget-put widget :custom-magic magic)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2663 (push magic buttons))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2664 ;; Update buttons.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2665 (widget-put widget :buttons buttons)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2666 ;; Insert documentation.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2667 (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
2668 ;; Parent groups.
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
2669 (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
2670 ;;; 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
2671 (when (eq level 1)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
2672 (insert-char ?\ custom-buffer-indent)
74558272517b (custom-group-value-create): Use group-visibility widget.
Richard M. Stallman <rms@gnu.org>
parents: 18368
diff changeset
2673 (custom-add-parent-links widget)))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2674 (custom-add-see-also widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2675 (make-string (* custom-buffer-indent level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2676 ?\ ))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2677 ;; Members.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2678 (message "Creating group...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2679 (custom-load-widget widget)
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2680 (let* ((members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2681 custom-buffer-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2682 custom-buffer-order-groups))
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2683 (prefixes (widget-get widget :custom-prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2684 (custom-prefix-list (custom-prefix-add symbol prefixes))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2685 (length (length members))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2686 (count 0)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2687 (children (mapcar (lambda (entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2688 (widget-insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2689 (message "\
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2690 Creating group members... %2d%%"
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2691 (/ (* 100.0 count) length))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2692 (setq count (1+ count))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2693 (prog1
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2694 (widget-create-child-and-convert
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2695 widget (nth 1 entry)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2696 :group widget
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2697 :tag (custom-unlispify-tag-name
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2698 (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2699 :custom-prefixes custom-prefix-list
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2700 :custom-level (1+ level)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2701 :value (nth 0 entry))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2702 (unless (eq (preceding-char) ?\n)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2703 (widget-insert "\n"))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2704 members)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2705 (message "Creating group magic...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2706 (mapcar 'custom-magic-reset children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2707 (message "Creating group state...")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2708 (widget-put widget :children children)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2709 (custom-group-state-update widget)
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2710 (message "Creating group... done"))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2711 ;; End line
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2712 (insert "\n")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2713 (insert-char ?\ (* custom-buffer-indent (1- level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2714 (insert "\\- " (widget-get widget :tag) " group end ")
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2715 (insert-char ?- (- 75 (current-column) (* custom-buffer-indent level)))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
2716 (insert "/\n")))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2717
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2718 (defvar custom-group-menu
18067
0e2aa3b58e16 Synched with version 1.9901.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18059
diff changeset
2719 '(("Set" custom-group-set
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2720 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2721 (eq (widget-get widget :custom-state) 'modified)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2722 ("Save" custom-group-save
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2723 (lambda (widget)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2724 (memq (widget-get widget :custom-state) '(modified set))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2725 ("Reset to Current" custom-group-reset-current
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2726 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2727 (memq (widget-get widget :custom-state) '(modified))))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2728 ("Reset to Saved" custom-group-reset-saved
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2729 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2730 (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
2731 ("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
2732 (lambda (widget)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2733 (memq (widget-get widget :custom-state) '(modified set saved)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2734 "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
2735 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
2736 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
2737 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
2738 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
2739 widget. If FILTER is nil, ACTION is always valid.")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2740
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2741 (defun custom-group-action (widget &optional event)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2742 "Show the menu for `custom-group' WIDGET.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2743 Optional EVENT is the location for the menu."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2744 (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
2745 (custom-toggle-hide widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2746 (let* ((completion-ignore-case t)
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2747 (answer (widget-choose (concat "Operation on "
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2748 (custom-unlispify-tag-name
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2749 (widget-get widget :value)))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2750 (custom-menu-filter custom-group-menu
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2751 widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2752 event)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2753 (if answer
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2754 (funcall answer widget)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2755
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2756 (defun custom-group-set (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2757 "Set changes in all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2758 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2759 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2760 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2761 (widget-apply child :custom-set)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2762 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2763
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2764 (defun custom-group-save (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2765 "Save all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2766 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2767 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2768 (when (memq (widget-get child :custom-state) '(modified set))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2769 (widget-apply child :custom-save)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2770 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2771
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2772 (defun custom-group-reset-current (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2773 "Reset all modified group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2774 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2775 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2776 (when (eq (widget-get child :custom-state) 'modified)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2777 (widget-apply child :custom-reset-current)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2778 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2779
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2780 (defun custom-group-reset-saved (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2781 "Reset all modified or set group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2782 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2783 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2784 (when (memq (widget-get child :custom-state) '(modified set))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2785 (widget-apply child :custom-reset-saved)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2786 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2787
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2788 (defun custom-group-reset-standard (widget)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2789 "Reset all modified, set, or saved group members."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2790 (let ((children (widget-get widget :children)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2791 (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2792 (when (memq (widget-get child :custom-state)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2793 '(modified set saved))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2794 (widget-apply child :custom-reset-standard)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2795 children )))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2796
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2797 (defun custom-group-state-update (widget)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2798 "Update magic."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2799 (unless (eq (widget-get widget :custom-state) 'hidden)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2800 (let* ((children (widget-get widget :children))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2801 (states (mapcar (lambda (child)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2802 (widget-get child :custom-state))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2803 children))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2804 (magics custom-magic-alist)
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2805 (found 'standard))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2806 (while magics
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2807 (let ((magic (car (car magics))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2808 (if (and (not (eq magic 'hidden))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2809 (memq magic states))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2810 (setq found magic
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2811 magics nil)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2812 (setq magics (cdr magics)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2813 (widget-put widget :custom-state found)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2814 (custom-magic-reset widget))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2815
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2816 ;;; The `custom-save-all' Function.
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2817 ;;;###autoload
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2818 (defcustom custom-file (if (featurep 'xemacs)
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2819 "~/.xemacs-custom"
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2820 "~/.emacs")
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2821 "File used for storing customization information.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2822 If you change this from the default \"~/.emacs\" you need to
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2823 explicitly load that file for the settings to take effect."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2824 :type 'file
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2825 :group 'customize)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2826
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2827 (defun custom-save-delete (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2828 "Delete the call to SYMBOL form `custom-file'.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2829 Leave point at the location of the call, or after the last expression."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2830 (set-buffer (find-file-noselect custom-file))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2831 (goto-char (point-min))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2832 (catch 'found
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2833 (while t
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2834 (let ((sexp (condition-case nil
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2835 (read (current-buffer))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2836 (end-of-file (throw 'found nil)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2837 (when (and (listp sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2838 (eq (car sexp) symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2839 (delete-region (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2840 (backward-sexp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2841 (point))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2842 (point))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2843 (throw 'found nil))))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2844
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2845 (defun custom-save-variables ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2846 "Save all customized variables in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2847 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2848 (custom-save-delete 'custom-set-variables)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2849 (let ((standard-output (current-buffer)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2850 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2851 (princ "\n"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2852 (princ "(custom-set-variables")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2853 (mapatoms (lambda (symbol)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2854 (let ((value (get symbol 'saved-value))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2855 (requests (get symbol 'custom-requests))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2856 (now (not (or (get symbol 'standard-value)
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2857 (and (not (boundp symbol))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2858 (not (get symbol 'force-value)))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2859 (when value
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2860 (princ "\n '(")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2861 (princ symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2862 (princ " ")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2863 (prin1 (car value))
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2864 (cond (requests
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2865 (if now
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2866 (princ " t ")
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2867 (princ " nil "))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2868 (prin1 requests)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2869 (princ ")"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2870 (now
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2871 (princ " t)"))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2872 (t
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2873 (princ ")")))))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2874 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2875 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2876 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2877
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2878 (defun custom-save-faces ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2879 "Save all customized faces in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2880 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2881 (custom-save-delete 'custom-set-faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2882 (let ((standard-output (current-buffer)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2883 (unless (bolp)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2884 (princ "\n"))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2885 (princ "(custom-set-faces")
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2886 (let ((value (get 'default 'saved-face)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2887 ;; The default face must be first, since it affects the others.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2888 (when value
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2889 (princ "\n '(default ")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2890 (prin1 value)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2891 (if (or (get 'default 'face-defface-spec)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2892 (and (not (custom-facep 'default))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2893 (not (get 'default 'force-face))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2894 (princ ")")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2895 (princ " t)"))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2896 (mapatoms (lambda (symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2897 (let ((value (get symbol 'saved-face)))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2898 (when (and (not (eq symbol 'default))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2899 ;; Don't print default face here.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2900 value)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2901 (princ "\n '(")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2902 (princ symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2903 (princ " ")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2904 (prin1 value)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2905 (if (or (get symbol 'face-defface-spec)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2906 (and (not (custom-facep symbol))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2907 (not (get symbol 'force-face))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2908 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2909 (princ " t)"))))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2910 (princ ")")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2911 (unless (looking-at "\n")
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2912 (princ "\n")))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2913
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2914 ;;;###autoload
18436
2163f03bb88f (customize-save-customized): Renamed from custom-save-customized.
Richard M. Stallman <rms@gnu.org>
parents: 18435
diff changeset
2915 (defun customize-save-customized ()
17550
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2916 "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
2917 (interactive)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2918 (mapatoms (lambda (symbol)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2919 (let ((face (get symbol 'customized-face))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2920 (value (get symbol 'customized-value)))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2921 (when face
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2922 (put symbol 'saved-face face)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2923 (put symbol 'customized-face nil))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2924 (when value
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2925 (put symbol 'saved-value value)
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2926 (put symbol 'customized-value nil)))))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2927 ;; We really should update all custom buffers here.
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2928 (custom-save-all))
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2929
d6545cfb6c5a Synched with custom 1.90.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17534
diff changeset
2930 ;;;###autoload
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2931 (defun custom-save-all ()
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2932 "Save all customizations in `custom-file'."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2933 (custom-save-variables)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2934 (custom-save-faces)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2935 (save-excursion
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2936 (set-buffer (find-file-noselect custom-file))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2937 (save-buffer)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2938
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2939 ;;; The Customize Menu.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2940
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2941 ;;; Menu support
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2942
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2943 (unless (string-match "XEmacs" emacs-version)
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2944 (defconst custom-help-menu
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2945 '("Customize"
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
2946 ["Update menu..." Custom-menu-update t]
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
2947 ["Browse..." (customize-browse 'emacs) t]
18336
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2948 ["Group..." customize-group t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2949 ["Variable..." customize-variable t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2950 ["Face..." customize-face t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2951 ["Saved..." customize-saved t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2952 ["Set..." customize-customized t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2953 ["--" custom-menu-sep t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2954 ["Apropos..." customize-apropos t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2955 ["Group apropos..." customize-apropos-groups t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2956 ["Variable apropos..." customize-apropos-options t]
325190603227 Synched with 1.9924.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18320
diff changeset
2957 ["Face apropos..." customize-apropos-faces t])
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2958 ;; This menu should be identical to the one defined in `menu-bar.el'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2959 "Customize menu")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2960
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2961 (defun custom-menu-reset ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2962 "Reset customize menu."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2963 (remove-hook 'custom-define-hook 'custom-menu-reset)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2964 (define-key global-map [menu-bar help-menu customize-menu]
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2965 (cons (car custom-help-menu)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2966 (easy-menu-create-keymaps (car custom-help-menu)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2967 (cdr custom-help-menu)))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2968
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
2969 (defun Custom-menu-update (event)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2970 "Update customize menu."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2971 (interactive "e")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2972 (add-hook 'custom-define-hook 'custom-menu-reset)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2973 (let* ((emacs (widget-apply '(custom-group) :custom-menu 'emacs))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2974 (menu `(,(car custom-help-menu)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2975 ,emacs
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2976 ,@(cdr (cdr custom-help-menu)))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2977 (let ((map (easy-menu-create-keymaps (car menu) (cdr menu))))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2978 (define-key global-map [menu-bar help-menu customize-menu]
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2979 (cons (car menu) map))))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
2980
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2981 (defcustom custom-menu-nesting 2
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2982 "Maximum nesting in custom menus."
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
2983 :type 'integer
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
2984 :group 'custom-menu)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2985
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2986 (defun custom-face-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2987 "Ignoring WIDGET, create a menu entry for customization face SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2988 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
2989 `(customize-face ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2990 t))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2991
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2992 (defun custom-variable-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2993 "Ignoring WIDGET, create a menu entry for customization variable SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2994 (let ((type (get symbol 'custom-type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2995 (unless (listp type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2996 (setq type (list type)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2997 (if (and type (widget-get type :custom-menu))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2998 (widget-apply type :custom-menu symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2999 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3000 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3001 t))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3002
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3003 ;; Add checkboxes to boolean variable entries.
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3004 (widget-put (get 'boolean 'widget-type)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3005 :custom-menu (lambda (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3006 (vector (custom-unlispify-menu-entry symbol)
17798
f59c9a63514b Synched with version 1.97.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17703
diff changeset
3007 `(customize-variable ',symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3008 ':style 'toggle
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3009 ':selected symbol)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3010
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3011 (if (string-match "XEmacs" emacs-version)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3012 ;; XEmacs can create menus dynamically.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3013 (defun custom-group-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3014 "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3015 `( ,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3016 :filter (lambda (&rest junk)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3017 (cdr (custom-menu-create ',symbol)))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3018 ;; But emacs can't.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3019 (defun custom-group-menu-create (widget symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3020 "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3021 ;; Limit the nesting.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3022 (let ((custom-menu-nesting (1- custom-menu-nesting)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3023 (custom-menu-create symbol))))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3024
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3025 ;;;###autoload
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3026 (defun custom-menu-create (symbol)
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3027 "Create menu for customization group SYMBOL.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3028 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
3029 (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
3030 `(customize-group ',symbol)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3031 t)))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3032 (if (and (or (not (boundp 'custom-menu-nesting))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3033 (>= custom-menu-nesting 0))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3034 (< (length (get symbol 'custom-group)) widget-menu-max-size))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3035 (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
3036 custom-prefix-list))
18451
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3037 (members (custom-sort-items (get symbol 'custom-group)
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3038 custom-menu-sort-alphabetically
8eb08560287b Synched with 1.9936.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18437
diff changeset
3039 custom-menu-order-groups)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3040 (custom-load-symbol symbol)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3041 `(,(custom-unlispify-menu-entry symbol t)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3042 ,item
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3043 "--"
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3044 ,@(mapcar (lambda (entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3045 (widget-apply (if (listp (nth 1 entry))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3046 (nth 1 entry)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3047 (list (nth 1 entry)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3048 :custom-menu (nth 0 entry)))
18033
bccd356a3b7c Synched with version 1.9900.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18032
diff changeset
3049 members)))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3050 item)))
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3051
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3052 ;;;###autoload
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3053 (defun customize-menu-create (symbol &optional name)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3054 "Return a customize menu for customization group SYMBOL.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3055 If optional NAME is given, use that as the name of the menu.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3056 Otherwise the menu will be named `Customize'.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3057 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
3058 (unless name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3059 (setq name "Customize"))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3060 (if (string-match "XEmacs" emacs-version)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3061 ;; We can delay it under XEmacs.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3062 `(,name
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3063 :filter (lambda (&rest junk)
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3064 (cdr (custom-menu-create ',symbol))))
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3065 ;; But we must create it now under Emacs.
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3066 (cons name (cdr (custom-menu-create symbol)))))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3067
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3068 ;;; The Custom Mode.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3069
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3070 (defvar custom-mode-map nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3071 "Keymap for `custom-mode'.")
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3072
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3073 (unless custom-mode-map
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3074 (setq custom-mode-map (make-sparse-keymap))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3075 (set-keymap-parent custom-mode-map widget-keymap)
18139
ee3c0d09dcd3 Synched with 1.9908.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18131
diff changeset
3076 (suppress-keymap custom-mode-map)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3077 (define-key custom-mode-map " " 'scroll-up)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3078 (define-key custom-mode-map "\177" 'scroll-down)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3079 (define-key custom-mode-map "q" 'bury-buffer)
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3080 (define-key custom-mode-map "u" 'Custom-goto-parent)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3081 (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
3082
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3083 (defun Custom-move-and-invoke (event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3084 "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
3085 (interactive "e")
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3086 (mouse-set-point event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3087 (if (widget-event-point event)
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3088 (let* ((pos (widget-event-point event))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3089 (button (get-char-property pos 'button)))
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3090 (if button
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3091 (widget-button-click event)))))
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3092
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3093 (easy-menu-define Custom-mode-menu
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3094 custom-mode-map
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3095 "Menu used in customization buffers."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3096 `("Custom"
18364
01666331d10f Synched with 1.9930.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18362
diff changeset
3097 ,(customize-menu-create 'customize)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3098 ["Set" Custom-set t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3099 ["Save" Custom-save t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3100 ["Reset to Current" Custom-reset-current t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3101 ["Reset to Saved" Custom-reset-saved t]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3102 ["Reset to Standard Settings" Custom-reset-standard t]
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3103 ["Info" (Info-goto-node "(custom)The Customization Buffer") t]))
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3104
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3105 (defun Custom-goto-parent ()
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3106 "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
3107 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
3108 (interactive)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3109 (save-excursion
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3110 (goto-char (point-min))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3111 (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
3112 (let* ((button (get-char-property (point) 'button))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3113 (parent (downcase (widget-get button :tag))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3114 (customize-group parent)))))
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3115
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3116 (defcustom custom-mode-hook nil
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3117 "Hook called when entering custom-mode."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3118 :type 'hook
18244
909a0f9169b8 Synched with 1.9914.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18139
diff changeset
3119 :group 'custom-buffer )
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3120
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3121 (defun custom-state-buffer-message (widget)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3122 (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
3123 (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
3124
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3125 (defun custom-mode ()
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3126 "Major mode for editing customization buffers.
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3127
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3128 The following commands are available:
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3129
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3130 Move to next button or editable field. \\[widget-forward]
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3131 Move to previous button or editable field. \\[widget-backward]
18460
a2be4f4ac8ed (Custom-move-and-invoke): New command.
Richard M. Stallman <rms@gnu.org>
parents: 18451
diff changeset
3132 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
3133 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
3134 Set all modifications. \\[Custom-set]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3135 Make all modifications default. \\[Custom-save]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3136 Reset all modified options. \\[Custom-reset-current]
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3137 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
3138 Reset all options. \\[Custom-reset-standard]
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3139
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3140 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
3141 if that value is non-nil."
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3142 (kill-all-local-variables)
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3143 (setq major-mode 'custom-mode
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3144 mode-name "Custom")
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3145 (use-local-map custom-mode-map)
18435
2f906938425b (Custom-set): Renamed from custom-set.
Richard M. Stallman <rms@gnu.org>
parents: 18430
diff changeset
3146 (easy-menu-add Custom-mode-menu)
17415
30a567b89fb6 Sync with 1.84.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17334
diff changeset
3147 (make-local-variable 'custom-options)
18437
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3148 (make-local-variable 'widget-documentation-face)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3149 (setq widget-documentation-face 'custom-documentation-face)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3150 (make-local-hook 'widget-edit-functions)
cbaf72286a2e (custom-documentation-face): New face.
Richard M. Stallman <rms@gnu.org>
parents: 18436
diff changeset
3151 (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
3152 (run-hooks 'custom-mode-hook))
17334
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3153
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3154 ;;; The End.
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3155
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3156 (provide 'cus-edit)
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3157
1effe507ea85 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3158 ;; cus-edit.el ends here