diff options
| author | Philipp Stephani | 2017-09-02 21:08:04 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-09-02 21:08:04 +0200 |
| commit | 71766a45f1edb02ec5107803a7f7a8e17809b093 (patch) | |
| tree | a2b5f8d72f6a6213646814fa0c6c8556617b23ea /src | |
| parent | dbe1e55dc4064e82813f6b84ee4297d8fc45b2fc (diff) | |
| download | emacs-71766a45f1edb02ec5107803a7f7a8e17809b093.tar.gz emacs-71766a45f1edb02ec5107803a7f7a8e17809b093.zip | |
Improve error messages for improper plists (Bug#27726)
* src/fns.c (Fplist_put, Flax_plist_get, Flax_plist_put)
(Fplist_member, syms_of_fns): Use ‘plistp’ as pseudo-predicate for
improper plists instead of ‘listp.’
* test/src/fns-tests.el (plist-get/odd-number-of-elements)
(lax-plist-get/odd-number-of-elements)
(plist-put/odd-number-of-elements)
(lax-plist-put/odd-number-of-elements)
(plist-member/improper-list): Add unit tests.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -2021,7 +2021,7 @@ The PLIST is modified by side effects. */) | |||
| 2021 | if (EQ (tail, li.tortoise)) | 2021 | if (EQ (tail, li.tortoise)) |
| 2022 | circular_list (plist); | 2022 | circular_list (plist); |
| 2023 | } | 2023 | } |
| 2024 | CHECK_LIST_END (tail, plist); | 2024 | CHECK_TYPE (NILP (tail), Qplistp, plist); |
| 2025 | Lisp_Object newcell | 2025 | Lisp_Object newcell |
| 2026 | = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev)))); | 2026 | = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev)))); |
| 2027 | if (NILP (prev)) | 2027 | if (NILP (prev)) |
| @@ -2061,7 +2061,7 @@ one of the properties on the list. */) | |||
| 2061 | circular_list (plist); | 2061 | circular_list (plist); |
| 2062 | } | 2062 | } |
| 2063 | 2063 | ||
| 2064 | CHECK_LIST_END (tail, plist); | 2064 | CHECK_TYPE (NILP (tail), Qplistp, plist); |
| 2065 | 2065 | ||
| 2066 | return Qnil; | 2066 | return Qnil; |
| 2067 | } | 2067 | } |
| @@ -2093,7 +2093,7 @@ The PLIST is modified by side effects. */) | |||
| 2093 | if (EQ (tail, li.tortoise)) | 2093 | if (EQ (tail, li.tortoise)) |
| 2094 | circular_list (plist); | 2094 | circular_list (plist); |
| 2095 | } | 2095 | } |
| 2096 | CHECK_LIST_END (tail, plist); | 2096 | CHECK_TYPE (NILP (tail), Qplistp, plist); |
| 2097 | Lisp_Object newcell = list2 (prop, val); | 2097 | Lisp_Object newcell = list2 (prop, val); |
| 2098 | if (NILP (prev)) | 2098 | if (NILP (prev)) |
| 2099 | return newcell; | 2099 | return newcell; |
| @@ -2858,7 +2858,7 @@ The value is actually the tail of PLIST whose car is PROP. */) | |||
| 2858 | if (EQ (tail, li.tortoise)) | 2858 | if (EQ (tail, li.tortoise)) |
| 2859 | circular_list (tail); | 2859 | circular_list (tail); |
| 2860 | } | 2860 | } |
| 2861 | CHECK_LIST_END (tail, plist); | 2861 | CHECK_TYPE (NILP (tail), Qplistp, plist); |
| 2862 | return Qnil; | 2862 | return Qnil; |
| 2863 | } | 2863 | } |
| 2864 | 2864 | ||
| @@ -5191,6 +5191,7 @@ Used by `featurep' and `require', and altered by `provide'. */); | |||
| 5191 | Fmake_var_non_special (Qfeatures); | 5191 | Fmake_var_non_special (Qfeatures); |
| 5192 | DEFSYM (Qsubfeatures, "subfeatures"); | 5192 | DEFSYM (Qsubfeatures, "subfeatures"); |
| 5193 | DEFSYM (Qfuncall, "funcall"); | 5193 | DEFSYM (Qfuncall, "funcall"); |
| 5194 | DEFSYM (Qplistp, "plistp"); | ||
| 5194 | 5195 | ||
| 5195 | #ifdef HAVE_LANGINFO_CODESET | 5196 | #ifdef HAVE_LANGINFO_CODESET |
| 5196 | DEFSYM (Qcodeset, "codeset"); | 5197 | DEFSYM (Qcodeset, "codeset"); |