comparison lispref/symbols.texi @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 23a1cea22d13
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual. 2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002, 2003,
4 @c Free Software Foundation, Inc. 4 @c 2004, 2005 Free Software Foundation, Inc.
5 @c See the file elisp.texi for copying conditions. 5 @c See the file elisp.texi for copying conditions.
6 @setfilename ../info/symbols 6 @setfilename ../info/symbols
7 @node Symbols, Evaluation, Hash Tables, Top 7 @node Symbols, Evaluation, Hash Tables, Top
8 @chapter Symbols 8 @chapter Symbols
9 @cindex symbol 9 @cindex symbol
113 @example 113 @example
114 (symbol-name 'buffer-file-name) 114 (symbol-name 'buffer-file-name)
115 @result{} "buffer-file-name" 115 @result{} "buffer-file-name"
116 (symbol-value 'buffer-file-name) 116 (symbol-value 'buffer-file-name)
117 @result{} "/gnu/elisp/symbols.texi" 117 @result{} "/gnu/elisp/symbols.texi"
118 (symbol-function 'buffer-file-name)
119 @result{} #<subr buffer-file-name>
118 (symbol-plist 'buffer-file-name) 120 (symbol-plist 'buffer-file-name)
119 @result{} (variable-documentation 29529) 121 @result{} (variable-documentation 29529)
120 (symbol-function 'buffer-file-name)
121 @result{} #<subr buffer-file-name>
122 @end example 122 @end example
123 123
124 @noindent 124 @noindent
125 Because this symbol is the variable which holds the name of the file 125 Because this symbol is the variable which holds the name of the file
126 being visited in the current buffer, the value cell contents we see are 126 being visited in the current buffer, the value cell contents we see are
359 This variable is the standard obarray for use by @code{intern} and 359 This variable is the standard obarray for use by @code{intern} and
360 @code{read}. 360 @code{read}.
361 @end defvar 361 @end defvar
362 362
363 @defun mapatoms function &optional obarray 363 @defun mapatoms function &optional obarray
364 @anchor{Definition of mapatoms}
364 This function calls @var{function} once with each symbol in the obarray 365 This function calls @var{function} once with each symbol in the obarray
365 @var{obarray}. Then it returns @code{nil}. If @var{obarray} is 366 @var{obarray}. Then it returns @code{nil}. If @var{obarray} is
366 omitted, it defaults to the value of @code{obarray}, the standard 367 omitted, it defaults to the value of @code{obarray}, the standard
367 obarray for ordinary symbols. 368 obarray for ordinary symbols.
368 369
473 @end defun 474 @end defun
474 475
475 @defun setplist symbol plist 476 @defun setplist symbol plist
476 This function sets @var{symbol}'s property list to @var{plist}. 477 This function sets @var{symbol}'s property list to @var{plist}.
477 Normally, @var{plist} should be a well-formed property list, but this is 478 Normally, @var{plist} should be a well-formed property list, but this is
478 not enforced. 479 not enforced. The return value is @var{plist}.
479 480
480 @smallexample 481 @smallexample
481 (setplist 'foo '(a 1 b (2 3) c nil)) 482 (setplist 'foo '(a 1 b (2 3) c nil))
482 @result{} (a 1 b (2 3) c nil) 483 @result{} (a 1 b (2 3) c nil)
483 (symbol-plist 'foo) 484 (symbol-plist 'foo)
530 stored in the property list @var{plist}. For example, 531 stored in the property list @var{plist}. For example,
531 532
532 @example 533 @example
533 (plist-get '(foo 4) 'foo) 534 (plist-get '(foo 4) 'foo)
534 @result{} 4 535 @result{} 4
536 (plist-get '(foo 4 bad) 'foo)
537 @result{} 4
538 (plist-get '(foo 4 bad) 'bar)
539 @result{} @code{wrong-type-argument} error
540 @end example
541
542 It accepts a malformed @var{plist} argument and always returns @code{nil}
543 if @var{property} is not found in the @var{plist}. For example,
544
545 @example
546 (plist-get '(foo 4 bad) 'bar)
547 @result{} nil
535 @end example 548 @end example
536 @end defun 549 @end defun
537 550
538 @defun plist-put plist property value 551 @defun plist-put plist property value
539 This stores @var{value} as the value of the @var{property} property in 552 This stores @var{value} as the value of the @var{property} property in
557 @example 570 @example
558 (defun put (symbol prop value) 571 (defun put (symbol prop value)
559 (setplist symbol 572 (setplist symbol
560 (plist-put (symbol-plist symbol) prop value))) 573 (plist-put (symbol-plist symbol) prop value)))
561 @end example 574 @end example
575
576 @defun lax-plist-get plist property
577 Like @code{plist-get} except that it compares properties
578 using @code{equal} instead of @code{eq}.
579 @end defun
580
581 @defun lax-plist-put plist property value
582 Like @code{plist-put} except that it compares properties
583 using @code{equal} instead of @code{eq}.
584 @end defun
562 585
563 @defun plist-member plist property 586 @defun plist-member plist property
564 @tindex plist-member 587 @tindex plist-member
565 This returns non-@code{nil} if @var{plist} contains the given 588 This returns non-@code{nil} if @var{plist} contains the given
566 @var{property}. Unlike @code{plist-get}, this allows you to distinguish 589 @var{property}. Unlike @code{plist-get}, this allows you to distinguish
567 between a missing property and a property with the value @code{nil}. 590 between a missing property and a property with the value @code{nil}.
568 The value is actually the tail of @var{plist} whose @code{car} is 591 The value is actually the tail of @var{plist} whose @code{car} is
569 @var{property}. 592 @var{property}.
570 @end defun 593 @end defun
594
595 @ignore
596 arch-tag: 8750b7d2-de4c-4923-809a-d35fc39fd8ce
597 @end ignore