comparison lisp/specifier.el @ 408:501cfd01ee6d r21-2-34

Import from CVS: tag r21-2-34
author cvs
date Mon, 13 Aug 2007 11:18:11 +0200
parents 2f8bb876ab1d
children 697ef44129c6
comparison
equal deleted inserted replaced
407:ed6218a7d4d3 408:501cfd01ee6d
1 ;;; specifier.el --- Lisp interface to specifiers 1 ;;; specifier.el --- Lisp interface to specifiers
2 2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996 Ben Wing. 4 ;; Copyright (C) 1995, 1996, 2000 Ben Wing.
5 5
6 ;; Author: Ben Wing <ben@xemacs.org> 6 ;; Author: Ben Wing <ben@xemacs.org>
7 ;; Keywords: internal, dumped 7 ;; Keywords: internal, dumped
8 8
9 ;;; Synched up with: Not in FSF. 9 ;;; Synched up with: Not in FSF.
273 indicate that it applies everywhere. LOCALE usually defaults to 273 indicate that it applies everywhere. LOCALE usually defaults to
274 `global' if omitted. 274 `global' if omitted.
275 275
276 VALUE is usually what is called an \"instantiator\" (which, roughly 276 VALUE is usually what is called an \"instantiator\" (which, roughly
277 speaking, corresponds to the \"value\" of the property governed by 277 speaking, corresponds to the \"value\" of the property governed by
278 SPECIFIER). The valid instantiators for SPECIFIER depend on the 278 SPECIFIER). The valid instantiators for SPECIFIER depend on the type
279 type of SPECIFIER (which you can determine using `specifier-type'). 279 of SPECIFIER (which you can determine using `specifier-type'). The
280 The specifier `scrollbar-width', for example, is of type `integer', 280 specifier `scrollbar-width', for example, is of type `integer',
281 meaning its valid instantiators are integers. The specifier 281 meaning its valid instantiators are integers. The specifier governing
282 governing the background color of the `default' face (you can 282 the background color of the `default' face (you can retrieve this
283 retrieve this specifier using `(face-background 'default)') is 283 specifier using `(face-background 'default)') is of type `color',
284 of type `color', meaning its valid instantiators are strings naming 284 meaning its valid instantiators are strings naming colors and
285 colors and color-instance objects. For some types of specifiers, 285 color-instance objects. For some types of specifiers, such as `image'
286 such as `image' and `toolbar', the instantiators can be very 286 and `toolbar', the instantiators can be very complex. Generally this
287 complex. Generally this is documented in the appropriate predicate 287 is documented in the appropriate creation function --
288 function -- `color-specifier-p', `image-specifier-p', 288 e.g. `make-color-specifier', `make-font-specifier',
289 `toolbar-specifier-p', etc. 289 `make-image-specifier' -- or in the global variable holding the most
290 common specifier for that type (`default-toolbar', `default-gutter',
291 `current-display-table').
290 292
291 NOTE: It does *not* work to give a VALUE of nil as a way of 293 NOTE: It does *not* work to give a VALUE of nil as a way of
292 removing the specifications for a locale. Use `remove-specifier' 294 removing the specifications for a locale. Use `remove-specifier'
293 instead. (And keep in mind that, if you omit the LOCALE argument 295 instead. (And keep in mind that, if you omit the LOCALE argument
294 to `remove-specifier', it removes *all* specifications! If you 296 to `remove-specifier', it removes *all* specifications! If you
524 (add-spec-list-to-specifier 526 (add-spec-list-to-specifier
525 ,(car (nth 0 varel)) 527 ,(car (nth 0 varel))
526 ,(car oldval)))) 528 ,(car oldval))))
527 oldvallist varlist)))))))) 529 oldvallist varlist))))))))
528 530
531 (defun make-integer-specifier (spec-list)
532 "Return a new `integer' specifier object with the given specification list.
533 SPEC-LIST can be a list of specifications (each of which is a cons of a
534 locale and a list of instantiators), a single instantiator, or a list
535 of instantiators. See `make-specifier' for more information about
536 specifiers.
537
538 Valid instantiators for integer specifiers are integers."
539 (make-specifier-and-init 'integer spec-list))
540
541 (defun make-boolean-specifier (spec-list)
542 "Return a new `boolean' specifier object with the given specification list.
543 SPEC-LIST can be a list of specifications (each of which is a cons of a
544 locale and a list of instantiators), a single instantiator, or a list
545 of instantiators. See `make-specifier' for more information about
546 specifiers.
547
548 Valid instantiators for boolean specifiers are t and nil."
549 (make-specifier-and-init 'boolean spec-list))
550
551 (defun make-natnum-specifier (spec-list)
552 "Return a new `natnum' specifier object with the given specification list.
553 SPEC-LIST can be a list of specifications (each of which is a cons of a
554 locale and a list of instantiators), a single instantiator, or a list
555 of instantiators. See `make-specifier' for more information about
556 specifiers.
557
558 Valid instantiators for natnum specifiers are non-negative integers."
559 (make-specifier-and-init 'natnum spec-list))
560
561 (defun make-generic-specifier (spec-list)
562 "Return a new `generic' specifier object with the given specification list.
563 SPEC-LIST can be a list of specifications (each of which is a cons of a
564 locale and a list of instantiators), a single instantiator, or a list
565 of instantiators. See `make-specifier' for more information about
566 specifiers.
567
568 Valid instantiators for generic specifiers are all Lisp values.
569 They are returned back unchanged when a specifier is instantiated."
570 (make-specifier-and-init 'generic spec-list))
571
572 (defun make-display-table-specifier (spec-list)
573 "Return a new `display-table' specifier object with the given spec list.
574 SPEC-LIST can be a list of specifications (each of which is a cons of a
575 locale and a list of instantiators), a single instantiator, or a list
576 of instantiators. See `make-specifier' for more information about
577 specifiers.
578
579 Valid instantiators for display-table specifiers are described in
580 detail in the doc string for `current-display-table'."
581 (make-specifier-and-init 'display-table spec-list))
582
529 ;; Evaluate this for testing: 583 ;; Evaluate this for testing:
530 ; (cl-prettyexpand '(let-specifier ((modeline-shadow-thickness 0 (selected-window) 'x) (fubar (value) baz)) (sit-for 1))) 584 ; (cl-prettyexpand '(let-specifier ((modeline-shadow-thickness 0 (selected-window) 'x) (fubar (value) baz)) (sit-for 1)))
531 585
532 (define-specifier-tag 'win 'device-on-window-system-p) 586 (define-specifier-tag 'win 'device-on-window-system-p)
533 587