comparison lisp/cus-edit.el @ 227:0e522484dd2a r20-5b12

Import from CVS: tag r20-5b12
author cvs
date Mon, 13 Aug 2007 10:12:37 +0200
parents 12579d965149
children 57709be46d1b
comparison
equal deleted inserted replaced
226:eea38c7ad7b4 227:0e522484dd2a
70 ;; Most of these groups are stolen from `finder.el', 70 ;; Most of these groups are stolen from `finder.el',
71 (defgroup editing nil 71 (defgroup editing nil
72 "Basic text editing facilities." 72 "Basic text editing facilities."
73 :group 'emacs) 73 :group 'emacs)
74 74
75 (defgroup abbrev nil
76 "Abbreviation handling, typing shortcuts, macros."
77 :tag "Abbreviations"
78 :group 'editing)
79
80 (defgroup matching nil 75 (defgroup matching nil
81 "Various sorts of searching and matching." 76 "Various sorts of searching and matching."
82 :group 'editing) 77 :group 'editing)
83 78
84 (defgroup emulations nil 79 (defgroup emulations nil
85 "Emulations of other editors." 80 "Emulations of other editors."
86 :group 'editing)
87
88 (defgroup mouse nil
89 "Mouse support."
90 :group 'editing) 81 :group 'editing)
91 82
92 (defgroup outlines nil 83 (defgroup outlines nil
93 "Support for hierarchical outlining." 84 "Support for hierarchical outlining."
94 :group 'editing) 85 :group 'editing)
100 (defgroup bib nil 91 (defgroup bib nil
101 "Code related to the `bib' bibliography processor." 92 "Code related to the `bib' bibliography processor."
102 :tag "Bibliography" 93 :tag "Bibliography"
103 :group 'external) 94 :group 'external)
104 95
105 (defgroup processes nil
106 "Process, subshell, compilation, and job control support."
107 :group 'external
108 :group 'development)
109
110 (defgroup programming nil 96 (defgroup programming nil
111 "Support for programming in other languages." 97 "Support for programming in other languages."
112 :group 'emacs) 98 :group 'emacs)
113 99
114 (defgroup languages nil 100 (defgroup languages nil
115 "Specialized modes for editing programming languages." 101 "Specialized modes for editing programming languages."
116 :group 'programming) 102 :group 'programming)
117 103
118 (defgroup lisp nil 104 ;; #### This should be in cc-vars.el
119 "Lisp support, including Emacs Lisp."
120 :group 'languages
121 :group 'development)
122
123 (defgroup c nil 105 (defgroup c nil
124 "Support for the C language and related languages." 106 "Support for the C language and related languages."
125 :group 'languages) 107 :group 'languages)
126 108
127 (defgroup tools nil 109 (defgroup tools nil
134 116
135 (defgroup applications nil 117 (defgroup applications nil
136 "Applications written in Emacs." 118 "Applications written in Emacs."
137 :group 'emacs) 119 :group 'emacs)
138 120
121 ;; #### This should be in calendar.el
139 (defgroup calendar nil 122 (defgroup calendar nil
140 "Calendar and time management support." 123 "Calendar and time management support."
141 :group 'applications) 124 :group 'applications)
142 125
143 (defgroup mail nil 126 (defgroup mail nil
197 (defgroup i18n nil 180 (defgroup i18n nil
198 "Internationalization and alternate character-set support." 181 "Internationalization and alternate character-set support."
199 :group 'environment 182 :group 'environment
200 :group 'editing) 183 :group 'editing)
201 184
202 (defgroup x nil
203 "The X Window system."
204 :group 'environment)
205
206 (defgroup frames nil
207 "Support for Emacs frames and window systems."
208 :group 'environment)
209
210 (defgroup data nil 185 (defgroup data nil
211 "Support editing files of data." 186 "Support editing files of data."
212 :group 'emacs) 187 :group 'emacs)
213 188
214 (defgroup files nil
215 "Support editing files."
216 :group 'emacs)
217
218 (defgroup wp nil 189 (defgroup wp nil
219 "Word processing." 190 "Word processing."
220 :group 'emacs) 191 :group 'emacs)
221 192
222 (defgroup tex nil 193 (defgroup tex nil
223 "Code related to the TeX formatter." 194 "Code related to the TeX formatter."
224 :group 'wp) 195 :group 'wp)
225 196
226 (defgroup faces nil
227 "Support for multiple fonts."
228 :group 'emacs)
229
230 (defgroup hypermedia nil 197 (defgroup hypermedia nil
231 "Support for links between text or other media types." 198 "Support for links between text or other media types."
232 :group 'emacs)
233
234 (defgroup help nil
235 "Support for on-line help systems."
236 :group 'emacs) 199 :group 'emacs)
237 200
238 (defgroup local nil 201 (defgroup local nil
239 "Code local to your site." 202 "Code local to your site."
240 :group 'emacs) 203 :group 'emacs)
265 (defgroup custom-menu nil 228 (defgroup custom-menu nil
266 "Control customize menus." 229 "Control customize menus."
267 :prefix "custom-" 230 :prefix "custom-"
268 :group 'customize) 231 :group 'customize)
269 232
270 (defgroup abbrev-mode nil
271 "Word abbreviations mode."
272 :group 'abbrev)
273
274 (defgroup alloc nil 233 (defgroup alloc nil
275 "Storage allocation and gc for GNU Emacs Lisp interpreter." 234 "Storage allocation and gc for GNU Emacs Lisp interpreter."
276 :tag "Storage Allocation" 235 :tag "Storage Allocation"
277 :group 'internal) 236 :group 'internal)
278 237
279 (defgroup undo nil 238 (defgroup undo nil
280 "Undoing changes in buffers." 239 "Undoing changes in buffers."
281 :group 'editing) 240 :group 'editing)
282 241
283 (defgroup modeline nil
284 "Content of the modeline."
285 :group 'environment)
286
287 (defgroup fill nil
288 "Indenting and filling text."
289 :group 'editing)
290
291 (defgroup editing-basics nil 242 (defgroup editing-basics nil
292 "Most basic editing facilities." 243 "Most basic editing facilities."
293 :group 'editing) 244 :group 'editing)
294 245
295 (defgroup display nil 246 (defgroup display nil
296 "How characters are displayed in buffers." 247 "How characters are displayed in buffers."
297 :group 'environment) 248 :group 'environment)
298 249
299 (defgroup execute nil
300 "Executing external commands."
301 :group 'processes)
302
303 (defgroup installation nil 250 (defgroup installation nil
304 "The Emacs installation." 251 "The Emacs installation."
305 :group 'environment) 252 :group 'environment)
306 253
307 (defgroup dired nil
308 "Directory editing."
309 :group 'environment)
310
311 (defgroup limits nil 254 (defgroup limits nil
312 "Internal Emacs limits." 255 "Internal Emacs limits."
313 :group 'internal) 256 :group 'internal)
314 257
315 (defgroup debug nil 258 (defgroup debug nil
316 "Debugging Emacs itself." 259 "Debugging Emacs itself."
317 :group 'development) 260 :group 'development)
318 261
319 (defgroup minibuffer nil
320 "Controling the behaviour of the minibuffer."
321 :group 'environment)
322
323 (defgroup keyboard nil
324 "Input from the keyboard."
325 :group 'environment)
326
327 (defgroup mouse nil
328 "Input from the mouse."
329 :group 'environment)
330
331 (defgroup menu nil
332 "Input from the menus."
333 :group 'environment)
334
335 (defgroup auto-save nil
336 "Preventing accidential loss of data."
337 :group 'files)
338
339 (defgroup processes-basics nil
340 "Basic stuff dealing with processes."
341 :group 'processes)
342
343 (defgroup mule nil 262 (defgroup mule nil
344 "Mule XEmacs internationalization." 263 "Mule XEmacs internationalization."
345 :group 'i18n) 264 :group 'i18n)
346
347 (defgroup windows nil
348 "Windows within a frame."
349 :group 'environment)
350 265
351 266
352 ;;; Utilities. 267 ;;; Utilities.
353 268
354 (defun custom-quote (sexp) 269 (defun custom-quote (sexp)
900 (face-list)) 815 (face-list))
901 t nil) 816 t nil)
902 "*Customize Faces*") 817 "*Customize Faces*")
903 (when (stringp symbol) 818 (when (stringp symbol)
904 (setq symbol (intern symbol))) 819 (setq symbol (intern symbol)))
905 (unless (symbolp symbol) 820 (check-argument-type 'symbolp symbol)
906 (error "Should be a symbol %S" symbol))
907 (custom-buffer-create (list (list symbol 'custom-face)) 821 (custom-buffer-create (list (list symbol 'custom-face))
908 (format "*Customize Face: %s*" 822 (format "*Customize Face: %s*"
909 (custom-unlispify-tag-name symbol))))) 823 (custom-unlispify-tag-name symbol)))))
910 824
911 ;;;###autoload 825 ;;;###autoload
915 obarray 'find-face))) 829 obarray 'find-face)))
916 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol)))) 830 (if (or (null symbol) (and (stringp symbol) (zerop (length symbol))))
917 () 831 ()
918 (if (stringp symbol) 832 (if (stringp symbol)
919 (setq symbol (intern symbol))) 833 (setq symbol (intern symbol)))
920 (unless (symbolp symbol) 834 (check-argument-type 'symbolp symbol)
921 (error "Should be a symbol %S" symbol))
922 (custom-buffer-create-other-window 835 (custom-buffer-create-other-window
923 (list (list symbol 'custom-face)) 836 (list (list symbol 'custom-face))
924 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol))))) 837 (format "*Customize Face: %s*" (custom-unlispify-tag-name symbol)))))
925 838
926 ;;;###autoload 839 ;;;###autoload
1928 children))) 1841 children)))
1929 (t 1842 (t
1930 ;; Edit mode. 1843 ;; Edit mode.
1931 (let* ((format (widget-get type :format)) 1844 (let* ((format (widget-get type :format))
1932 tag-format value-format) 1845 tag-format value-format)
1933 (unless (string-match ":" format) 1846 (while (not (string-match ":" format))
1934 (error "Bad format.")) 1847 (setq format (signal 'error (list "Bad format" format))))
1935 (setq tag-format (substring format 0 (match-end 0))) 1848 (setq tag-format (substring format 0 (match-end 0)))
1936 (setq value-format (substring format (match-end 0))) 1849 (setq value-format (substring format (match-end 0)))
1937 (push (widget-create-child-and-convert 1850 (push (widget-create-child-and-convert
1938 widget 'item 1851 widget 'item
1939 :format tag-format 1852 :format tag-format
2092 (child (car (widget-get widget :children))) 2005 (child (car (widget-get widget :children)))
2093 (symbol (widget-value widget)) 2006 (symbol (widget-value widget))
2094 (set (or (get symbol 'custom-set) 'set-default)) 2007 (set (or (get symbol 'custom-set) 'set-default))
2095 val) 2008 val)
2096 (cond ((eq state 'hidden) 2009 (cond ((eq state 'hidden)
2097 (error "Cannot set hidden variable.")) 2010 (error "Cannot set hidden variable"))
2098 ((setq val (widget-apply child :validate)) 2011 ((setq val (widget-apply child :validate))
2099 (goto-char (widget-get val :from)) 2012 (goto-char (widget-get val :from))
2100 (error "%s" (widget-get val :error))) 2013 (error "%s" (widget-get val :error)))
2101 ((memq form '(lisp mismatch)) 2014 ((memq form '(lisp mismatch))
2102 (funcall set symbol (eval (setq val (widget-value child)))) 2015 (funcall set symbol (eval (setq val (widget-value child))))
2114 (child (car (widget-get widget :children))) 2027 (child (car (widget-get widget :children)))
2115 (symbol (widget-value widget)) 2028 (symbol (widget-value widget))
2116 (set (or (get symbol 'custom-set) 'set-default)) 2029 (set (or (get symbol 'custom-set) 'set-default))
2117 val) 2030 val)
2118 (cond ((eq state 'hidden) 2031 (cond ((eq state 'hidden)
2119 (error "Cannot set hidden variable.")) 2032 (error "Cannot set hidden variable"))
2120 ((setq val (widget-apply child :validate)) 2033 ((setq val (widget-apply child :validate))
2121 (goto-char (widget-get val :from)) 2034 (goto-char (widget-get val :from))
2122 (error "%s" (widget-get val :error))) 2035 (error "%s" (widget-get val :error)))
2123 ((memq form '(lisp mismatch)) 2036 ((memq form '(lisp mismatch))
2124 (put symbol 'saved-value (list (widget-value child))) 2037 (put symbol 'saved-value (list (widget-value child)))
2139 (set (or (get symbol 'custom-set) 'set-default))) 2052 (set (or (get symbol 'custom-set) 'set-default)))
2140 (if (get symbol 'saved-value) 2053 (if (get symbol 'saved-value)
2141 (condition-case nil 2054 (condition-case nil
2142 (funcall set symbol (eval (car (get symbol 'saved-value)))) 2055 (funcall set symbol (eval (car (get symbol 'saved-value))))
2143 (error nil)) 2056 (error nil))
2144 (error "No saved value for %s" symbol)) 2057 (signal 'error (list "No saved value for variable" symbol)))
2145 (put symbol 'customized-value nil) 2058 (put symbol 'customized-value nil)
2146 (widget-put widget :custom-state 'unknown) 2059 (widget-put widget :custom-state 'unknown)
2147 (custom-redraw widget))) 2060 (custom-redraw widget)))
2148 2061
2149 (defun custom-variable-reset-standard (widget) 2062 (defun custom-variable-reset-standard (widget)
2150 "Restore the standard setting for the variable being edited by WIDGET." 2063 "Restore the standard setting for the variable being edited by WIDGET."
2151 (let* ((symbol (widget-value widget)) 2064 (let* ((symbol (widget-value widget))
2152 (set (or (get symbol 'custom-set) 'set-default))) 2065 (set (or (get symbol 'custom-set) 'set-default)))
2153 (if (get symbol 'standard-value) 2066 (if (get symbol 'standard-value)
2154 (funcall set symbol (eval (car (get symbol 'standard-value)))) 2067 (funcall set symbol (eval (car (get symbol 'standard-value))))
2155 (error "No standard setting known for %S" symbol)) 2068 (signal 'error (list "No standard setting known for variable" symbol)))
2156 (put symbol 'customized-value nil) 2069 (put symbol 'customized-value nil)
2157 (when (get symbol 'saved-value) 2070 (when (get symbol 'saved-value)
2158 (put symbol 'saved-value nil) 2071 (put symbol 'saved-value nil)
2159 (custom-save-all)) 2072 (custom-save-all))
2160 (widget-put widget :custom-state 'unknown) 2073 (widget-put widget :custom-state 'unknown)
2498 "Restore WIDGET to the face's default attributes." 2411 "Restore WIDGET to the face's default attributes."
2499 (let* ((symbol (widget-value widget)) 2412 (let* ((symbol (widget-value widget))
2500 (child (car (widget-get widget :children))) 2413 (child (car (widget-get widget :children)))
2501 (value (get symbol 'saved-face))) 2414 (value (get symbol 'saved-face)))
2502 (unless value 2415 (unless value
2503 (error "No saved value for this face")) 2416 (signal 'error (list "No saved value for this face" symbol)))
2504 (put symbol 'customized-face nil) 2417 (put symbol 'customized-face nil)
2505 (face-spec-set symbol value) 2418 (face-spec-set symbol value)
2506 (widget-value-set child value) 2419 (widget-value-set child value)
2507 (custom-face-state-set widget) 2420 (custom-face-state-set widget)
2508 (custom-redraw-magic widget))) 2421 (custom-redraw-magic widget)))
2511 "Restore WIDGET to the face's standard settings." 2424 "Restore WIDGET to the face's standard settings."
2512 (let* ((symbol (widget-value widget)) 2425 (let* ((symbol (widget-value widget))
2513 (child (car (widget-get widget :children))) 2426 (child (car (widget-get widget :children)))
2514 (value (get symbol 'face-defface-spec))) 2427 (value (get symbol 'face-defface-spec)))
2515 (unless value 2428 (unless value
2516 (error "No standard setting for this face")) 2429 (signal 'error (list "No standard setting for this face" symbol)))
2517 (put symbol 'customized-face nil) 2430 (put symbol 'customized-face nil)
2518 (when (get symbol 'saved-face) 2431 (when (get symbol 'saved-face)
2519 (put symbol 'saved-face nil) 2432 (put symbol 'saved-face nil)
2520 (custom-save-all)) 2433 (custom-save-all))
2521 (face-spec-set symbol value) 2434 (face-spec-set symbol value)