diff options
| author | Kim F. Storm | 2004-11-15 15:21:14 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-11-15 15:21:14 +0000 |
| commit | 27f604dddf41aa1e79f1a6b70e95a66c31efcc26 (patch) | |
| tree | 39bdb8a25a4c926e8b705f97aee2c9003d604da3 /src/fns.c | |
| parent | 479440d29ce6b6ada79074a6791a6f315762ed71 (diff) | |
| download | emacs-27f604dddf41aa1e79f1a6b70e95a66c31efcc26.tar.gz emacs-27f604dddf41aa1e79f1a6b70e95a66c31efcc26.zip | |
(Fsafe_plist_get): New defun.
(syms_of_fns): Defsubr it.
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 30 |
1 files changed, 30 insertions, 0 deletions
| @@ -1997,6 +1997,35 @@ one of the properties on the list. */) | |||
| 1997 | return Qnil; | 1997 | return Qnil; |
| 1998 | } | 1998 | } |
| 1999 | 1999 | ||
| 2000 | DEFUN ("safe-plist-get", Fsafe_plist_get, Ssafe_plist_get, 2, 2, 0, | ||
| 2001 | doc: /* Extract a value from a property list. | ||
| 2002 | PLIST is a property list, which is a list of the form | ||
| 2003 | \(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value | ||
| 2004 | corresponding to the given PROP, or nil if PROP is not | ||
| 2005 | one of the properties on the list. | ||
| 2006 | This function never signals an error. */) | ||
| 2007 | (plist, prop) | ||
| 2008 | Lisp_Object plist; | ||
| 2009 | Lisp_Object prop; | ||
| 2010 | { | ||
| 2011 | Lisp_Object tail, halftail; | ||
| 2012 | |||
| 2013 | /* halftail is used to detect circular lists. */ | ||
| 2014 | tail = halftail = plist; | ||
| 2015 | while (CONSP (tail) && CONSP (XCDR (tail))) | ||
| 2016 | { | ||
| 2017 | if (EQ (prop, XCAR (tail))) | ||
| 2018 | return XCAR (XCDR (tail)); | ||
| 2019 | |||
| 2020 | tail = XCDR (XCDR (tail)); | ||
| 2021 | halftail = XCDR (halftail); | ||
| 2022 | if (EQ (tail, halftail)) | ||
| 2023 | break; | ||
| 2024 | } | ||
| 2025 | |||
| 2026 | return Qnil; | ||
| 2027 | } | ||
| 2028 | |||
| 2000 | DEFUN ("get", Fget, Sget, 2, 2, 0, | 2029 | DEFUN ("get", Fget, Sget, 2, 2, 0, |
| 2001 | doc: /* Return the value of SYMBOL's PROPNAME property. | 2030 | doc: /* Return the value of SYMBOL's PROPNAME property. |
| 2002 | This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */) | 2031 | This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */) |
| @@ -5734,6 +5763,7 @@ used if both `use-dialog-box' and this variable are non-nil. */); | |||
| 5734 | defsubr (&Sreverse); | 5763 | defsubr (&Sreverse); |
| 5735 | defsubr (&Ssort); | 5764 | defsubr (&Ssort); |
| 5736 | defsubr (&Splist_get); | 5765 | defsubr (&Splist_get); |
| 5766 | defsubr (&Ssafe_plist_get); | ||
| 5737 | defsubr (&Sget); | 5767 | defsubr (&Sget); |
| 5738 | defsubr (&Splist_put); | 5768 | defsubr (&Splist_put); |
| 5739 | defsubr (&Sput); | 5769 | defsubr (&Sput); |