aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-11-15 15:21:14 +0000
committerKim F. Storm2004-11-15 15:21:14 +0000
commit27f604dddf41aa1e79f1a6b70e95a66c31efcc26 (patch)
tree39bdb8a25a4c926e8b705f97aee2c9003d604da3 /src
parent479440d29ce6b6ada79074a6791a6f315762ed71 (diff)
downloademacs-27f604dddf41aa1e79f1a6b70e95a66c31efcc26.tar.gz
emacs-27f604dddf41aa1e79f1a6b70e95a66c31efcc26.zip
(Fsafe_plist_get): New defun.
(syms_of_fns): Defsubr it.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/fns.c b/src/fns.c
index e0167ebf990..2d9131846a9 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1997,6 +1997,35 @@ one of the properties on the list. */)
1997 return Qnil; 1997 return Qnil;
1998} 1998}
1999 1999
2000DEFUN ("safe-plist-get", Fsafe_plist_get, Ssafe_plist_get, 2, 2, 0,
2001 doc: /* Extract a value from a property list.
2002PLIST is a property list, which is a list of the form
2003\(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
2004corresponding to the given PROP, or nil if PROP is not
2005one of the properties on the list.
2006This 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
2000DEFUN ("get", Fget, Sget, 2, 2, 0, 2029DEFUN ("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.
2002This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */) 2031This 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);