[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: map.el: pcase plist keyword-only binding improvement
From: |
Adam Porter |
Subject: |
Re: map.el: pcase plist keyword-only binding improvement |
Date: |
Sun, 02 Feb 2020 10:38:56 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> (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).
Hi Stefan,
Ok, I've attached a patch. I tried to follow the appropriate
guidelines, but please let me know if any changes are required.
Thanks,
Adam
0001-lisp-emacs-lisp-map.el-Add-keyword-only-pattern-abbr.patch
Description: map.el keyword-only pattern abbreviation