bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58531: 29.0.50; Wrong predicate used by map-elt gv getter


From: Basil L. Contovounesios
Subject: bug#58531: 29.0.50; Wrong predicate used by map-elt gv getter
Date: Sat, 22 Oct 2022 21:04:27 +0300
User-agent: Gnus/5.13 (Gnus v5.13)

Basil L. Contovounesios [2022-10-16 01:41 +0300] wrote:

> Stefan Monnier [2022-10-15 11:52 -0400] wrote:
>
>>> -(defun eudc-plist-member (plist prop)
>>> -  "Return t if PROP has a value specified in PLIST."
>>> -  (if (not (= 0 (% (length plist) 2)))
>>> +(defun eudc--plist-member (plist prop &optional predicate)
>>> +  "Like `plist-member', but signal on invalid PLIST."
>>> +  ;; Could also use `plistp', but that would change the error.
>>> +  (or (zerop (% (length plist) 2))
>>>        (error "Malformed plist"))
>>> -  (catch 'found
>>> -    (while plist
>>> -      (if (eq prop (car plist))
>>> -     (throw 'found t))
>>> -      (setq plist (cdr (cdr plist))))
>>> -    nil))
>>> +  (plist-member plist prop predicate))
>>
>> The current error is poor (it doesn't include the offending plist, for
>> example), so I think changing it (e.g. using the usual
>> `wrong-type-argument` error) would be for the better.
>> I do wonder whether it's worth the trouble keeping the error here, tho,
>> instead of just using `plist-member` directly.
>
> I was just being conservative, because I don't know where EUDC might get
> its data from, or how important it is to catch dubious plists
> red-handed.
>
> I'd be happy to simplify the code, but let's see if Thomas (CCed) has
> any comments.  Thomas, the patch touching eudc.el can be found at:
> https://bugs.gnu.org/58531#8.

I've now moved this subdiscussion to https://bugs.gnu.org/58720.

-- 
Basil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]