[Top][All Lists]

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

Re: map.el: pcase plist keyword-only binding improvement

From: Stefan Monnier
Subject: Re: map.el: pcase plist keyword-only binding improvement
Date: Sun, 02 Feb 2020 08:46:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>     (seq-map (lambda (elt)
>                (cond ((consp elt)
>                       `(app (pcase--flip map-elt ,(car elt)) ,(cadr elt)))
>                      ((keywordp elt)
>                       ;; New clause for keyword-only elements.
>                       (let ((var (intern (substring (symbol-name elt) 1))))
>                         `(app (pcase--flip map-elt ,elt) ,var)))
>                      (t
>                       `(app (pcase--flip map-elt ',elt) ,elt))))
>              args))

Since binding the result of the match to a keyword can't work anyway,
this seems like a very good idea.

> Assuming that this change is acceptable, I would like to prepare a
> patch, which would probably need to include NEWS and documentation
> changes.

AFAICT we don't yet have actual documentation for the map.el package, so
only NEWS needs to be changed.

> However, since the change is to map.el rather than pcase.el,
> and since map.el is also available on ELPA,

It's also distributed via GNU ELPA indeed, but taken straight from the
emacs.git repository, so you don't need to worry about that (just
increment the `Version:` entry at the top).


reply via email to

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