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

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

bug#27584: 26.0.50; alist-get: Add optional arg TESTFN


From: Eli Zaretskii
Subject: bug#27584: 26.0.50; alist-get: Add optional arg TESTFN
Date: Sat, 08 Jul 2017 09:30:00 +0300

> From: Nicolas Petton <nicolas@petton.fr>
> Date: Fri, 07 Jul 2017 21:47:03 +0200
> Cc: 27584@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>
> 
> +      if (NILP (testfn))
> +     {
> +       if (CONSP (car)
> +           && (EQ (XCAR (car), key) || !NILP (Fequal (XCAR (car), key))))
> +         return car;
> +     }
> +      else if (CONSP (car) && (!NILP (call2 (testfn, (XCAR (car)), key))))
> +     {
> +       return car;
> +     }

No need for braces when there's only one line to enclose.
Also, no need for parentheses around "!NILP (...)".

Bonus points for simplifying the code by determining TESTFN up front,
then having only one of the above two clauses.

Thanks.





reply via email to

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