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

Import from CVS: tag r20-5b12
author cvs
date Mon, 13 Aug 2007 10:12:37 +0200
parents 2c611d1463a6
children a4f53d9b3154
comparison
equal deleted inserted replaced
226:eea38c7ad7b4 227:0e522484dd2a
112 (let ((initialize 'custom-initialize-reset) 112 (let ((initialize 'custom-initialize-reset)
113 (requests nil)) 113 (requests nil))
114 (while args 114 (while args
115 (let ((arg (car args))) 115 (let ((arg (car args)))
116 (setq args (cdr args)) 116 (setq args (cdr args))
117 (unless (symbolp arg) 117 (check-argument-type 'keywordp arg)
118 (error "Junk in args %S" args))
119 (let ((keyword arg) 118 (let ((keyword arg)
120 (value (car args))) 119 (value (car args)))
121 (unless args 120 (unless args
122 (error "Keyword %s is missing an argument" keyword)) 121 (signal 'error (list "Keyword is missing an argument" keyword)))
123 (setq args (cdr args)) 122 (setq args (cdr args))
124 (cond ((eq keyword :initialize) 123 (cond ((eq keyword :initialize)
125 (setq initialize value)) 124 (setq initialize value))
126 ((eq keyword :set) 125 ((eq keyword :set)
127 (put symbol 'custom-set value)) 126 (put symbol 'custom-set value))
245 (when doc 244 (when doc
246 (put symbol 'group-documentation doc)) 245 (put symbol 'group-documentation doc))
247 (while args 246 (while args
248 (let ((arg (car args))) 247 (let ((arg (car args)))
249 (setq args (cdr args)) 248 (setq args (cdr args))
250 (unless (symbolp arg) 249 (check-argument-type 'keywordp arg)
251 (error "Junk in args %S" args))
252 (let ((keyword arg) 250 (let ((keyword arg)
253 (value (car args))) 251 (value (car args)))
254 (unless args 252 (unless args
255 (error "Keyword %s is missing an argument" keyword)) 253 (signal 'error (list "Keyword is missing an argument" keyword)))
256 (setq args (cdr args)) 254 (setq args (cdr args))
257 (cond ((eq keyword :prefix) 255 (cond ((eq keyword :prefix)
258 (put symbol 'custom-prefix value)) 256 (put symbol 'custom-prefix value))
259 (t 257 (t
260 (custom-handle-keyword symbol keyword value 258 (custom-handle-keyword symbol keyword value
306 "For customization option SYMBOL, handle keyword arguments ARGS. 304 "For customization option SYMBOL, handle keyword arguments ARGS.
307 Third argument TYPE is the custom option type." 305 Third argument TYPE is the custom option type."
308 (while args 306 (while args
309 (let ((arg (car args))) 307 (let ((arg (car args)))
310 (setq args (cdr args)) 308 (setq args (cdr args))
311 (unless (symbolp arg) 309 (check-argument-type 'keywordp arg)
312 (error "Junk in args %S" args))
313 (let ((keyword arg) 310 (let ((keyword arg)
314 (value (car args))) 311 (value (car args)))
315 (unless args 312 (unless args
316 (error "Keyword %s is missing an argument" keyword)) 313 (signal 'error (list "Keyword is missing an argument" keyword)))
317 (setq args (cdr args)) 314 (setq args (cdr args))
318 (custom-handle-keyword symbol keyword value type))))) 315 (custom-handle-keyword symbol keyword value type)))))
319 316
320 (defun custom-handle-keyword (symbol keyword value type) 317 (defun custom-handle-keyword (symbol keyword value type)
321 "For customization option SYMBOL, handle KEYWORD with VALUE. 318 "For customization option SYMBOL, handle KEYWORD with VALUE.
329 ((eq keyword :load) 326 ((eq keyword :load)
330 (custom-add-load symbol value)) 327 (custom-add-load symbol value))
331 ((eq keyword :tag) 328 ((eq keyword :tag)
332 (put symbol 'custom-tag value)) 329 (put symbol 'custom-tag value))
333 (t 330 (t
334 (error "Unknown keyword %s" symbol)))) 331 (signal 'error (list "Unknown keyword" keyword)))))
335 332
336 (defun custom-add-option (symbol option) 333 (defun custom-add-option (symbol option)
337 "To the variable SYMBOL add OPTION. 334 "To the variable SYMBOL add OPTION.
338 335
339 If SYMBOL is a hook variable, OPTION should be a hook member. 336 If SYMBOL is a hook variable, OPTION should be a hook member.