unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: 49407@debbugs.gnu.org
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
	Nicolas Petton <nicolas@petton.fr>, Okam <okamsn@protonmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	49407-done@debbugs.gnu.org
Subject: bug#49407: Request: Specify default values in `map-let` in Map.el
Date: Mon, 31 Jul 2023 06:02:15 +0200	[thread overview]
Message-ID: <87cz08wwxk.fsf@web.de> (raw)
In-Reply-To: <87fs55h5f3.fsf@epfl.ch> (Basil L. Contovounesios's message of "Sun, 30 Jul 2023 15:53:20 +0200")

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

"Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army
knife of text editors" <bug-gnu-emacs@gnu.org> writes:

> WFM, thank you!  Installed and closing as done:
>
> Allow default values in 'map-let' and the pcase 'map' form
> 19777b7c864 2023-07-30 15:20:27 +0200
> https://git.sv.gnu.org/cgit/emacs.git/commit/?id=19777b7c864

Does this addition look appropriate?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Docstring-tweaks-in-map.el.patch --]
[-- Type: text/x-diff, Size: 2159 bytes --]

From b2b6f34c08c17a9411c4264ea500b434c833ec04 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Tue, 25 Jul 2023 20:38:46 +0200
Subject: [PATCH] ; Docstring tweaks in map.el

* lisp/emacs-lisp/map.el (pcase-defmacro) <map>:
(map-let): Mention 'map-elt' where equality predicates are explained.
Improve wording.
---
 lisp/emacs-lisp/map.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index b55eb431668..04c00a2e908 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -57,9 +57,10 @@ map
 defaults to nil.  Both KEY and DEFAULT are evaluated.

 Each element can also be a SYMBOL, which is an abbreviation of
-a (KEY PAT) tuple of the form (\\='SYMBOL SYMBOL).  When SYMBOL
-is a keyword, it is an abbreviation of the form (:SYMBOL SYMBOL),
-useful for binding plist values.
+a (KEY PAT) tuple of the form (\\='SYMBOL SYMBOL).  A keyword :FOO
+is an abbreviation of the form (:FOO FOO), useful for binding plist values.
+
+See `map-elt' for an explanation of the used equality tests.

 An element of ARGS fails to match if PAT does not match the
 associated value or the default value.  The overall pattern fails
@@ -70,13 +71,13 @@ map
 (defmacro map-let (keys map &rest body)
   "Bind the variables in KEYS to the elements of MAP then evaluate BODY.

-KEYS can be a list of symbols, in which case each element will be
-bound to the looked up value in MAP.
-
-KEYS can also be a list of (KEY VARNAME [DEFAULT]) sublists, in
-which case KEY and DEFAULT are unquoted forms.
+Elements of the list KEYS can be symbols, in which case each
+will be bound to the looked up value in MAP, or
+(KEY VARNAME [DEFAULT]) sublists where KEY and DEFAULT are
+unquoted forms.

-MAP can be an alist, plist, hash-table, or array."
+MAP can be an alist, plist, hash-table, or array.  See `map-elt'
+for an explanation of the used equality tests."
   (declare (indent 2)
            (debug ((&rest &or symbolp ([form symbolp &optional form]))
                    form body)))
--
2.30.2


[-- Attachment #3: Type: text/plain, Size: 295 bytes --]



If it's not clear: I changed :SYMBOL to :FOO because the original text
called SYMBOL a keyword and then used SYMBOL and :SYMBOL (although then
only :SYMBOL would be the keyword) - I found that confusing.  :KEYWORD
would also be confusing, so I went with the placeholder "FOO".

TIA,

Michael.

  reply	other threads:[~2023-07-31  4:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 23:08 bug#49407: Request: Specify default values in `map-let` in Map.el Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-15  8:51 ` Lars Ingebrigtsen
2021-07-16  1:45   ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-21  2:56   ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22  1:48     ` Michael Heerdegen
2023-07-22 15:45       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22 18:46       ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-26  3:41         ` Michael Heerdegen
2023-07-27  1:39           ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-28 18:02             ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-28 19:19               ` Eli Zaretskii
2023-07-29  0:37               ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-30 13:53                 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-31  4:02                   ` Michael Heerdegen [this message]
2023-08-08 12:41                     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-06 13:31                   ` Okam via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-08 12:46                     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-27  1:37 ` Earl Hyatt via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz08wwxk.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=49407-done@debbugs.gnu.org \
    --cc=49407@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nicolas@petton.fr \
    --cc=okamsn@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).